# computation. binary numbers decimal numbers binary numbers

Post on 16-Jan-2016

239 views

Category:

## Documents

Embed Size (px)

TRANSCRIPT

• Computation

• Binary Numbershttp://schoolscience.rice.edu/duker/robots/binarynumber.html Decimal numbers Binary numbers

• Representing TextDecide how many characters we need to represent.

Determine the required number of bits.

Ascii: 7 bits. Can encode 27 = 128 different symbols.

• Asciihttp://www.neurophys.wisc.edu/comp/docs/ascii.html

• Representing TextFour

01000110 01101111 01110101 01110010

• When We Need More Characters What about things like:

• When We Need More CharactersAnswer: Unicode: 32 bits. Over 4 million characters.

• Digital Images

• RGBThe red channel

• RGBThe green channel

• RGBRed GreenBlue

• Representing Pictures

• Representing Sounds

• Representing Programspublic static TreeMap create() throws IOException public static TreeMap create() throws IOException{ Integer freq; String word; TreeMap result = new TreeMap(); JFileChooser c = new JFileChooser(); int retval = c.showOpenDialog(null); if (retval == JFileChooser.APPROVE_OPTION) { Scanner s = new Scanner( c.getSelectedFile());while( s.hasNext() ){ word = s.next().toLowerCase(); freq = result.get(word); result.put(word, (freq == null ? 1 : freq + 1));} } return result;}}

• The Roots of Modern Technology5thc B.C. Aristotelian logic invented1642 Pascal built an adding machine1694 Leibnitz reckoning machine

• The Roots, continued1834 Charles Babbages Analytical Engine

Ada writes of the engine, The Analytical Engine has no pretensions whatever to originate anything. It can do whatever we know how to order it to perform.

The picture is of a model built in the late 1800s by Babbages son from Babbages drawings.

• The Roots: Logic1848 George Boole The Calculus of Logicchocolate nuts

mintchocolate and nuts and mint

• Boolean Logic

• Using Boolean Logic

• How Big Are the Truth Tables?

• 2n

Chart1

1

2

4

8

16

32

64

128

256

512

1024

2048

4096

8192

16384

32768

65536

131072

262144

524288

1048576

Sheet1

01

12

24

38

416

532

664

7128

8256

9512

101024

112048

124096

138192

1416384

1532768

1665536

17131072

18262144

19524288

201048576

Sheet1

Sheet2

Sheet3

• Increased Power of Quantified LogicBear(Smoky).

x (Bear(x) Animal(x)).

x (Animal(x) Bear(x)).

x (Animal(x) y (Mother-of(y, x))).

• Using Quantified Logic (FOL)We can represent what we know as a set of logical formulas and then manipulate them.

• Facts in English(1) Marcus was a man.(2) Marcus was a Pompeian.(3) All Pompeians were Romans.(4) Caesar was a ruler.(5) All Romans were either loyal to Caesar or hated him.(6) Everyone is loyal to someone.(7) People only try to assassinate rulers they are not loyal to. (8) Marcus tried to assassinate Caesar.

• Facts in First Order Logic (FOL)(1) Marcus was a man.man(Marcus)(2) Marcus was a Pompeian.Pompeian(Marcus)(3) All Pompeians were Romans.x Pompeian(x) Roman(x)(4) Caesar was a ruler.ruler(Caesar)(5) All Romans were either loyal to Caesar or hated him. x Roman(x) loyalto(x, Caesar) hate(x, Caesar)(6) Everyone is loyal to someone. x y loyalto(x, y)(7) People only try to assassinate rulers they are not loyal to. x y person(x) ruler(y) tryassassinate(x, y) loyalto(x, y)(8) Marcus tried to assassinate Caesar.tryassassinate(Marcus, Caesar)

• Search

• Breadth-First SearchIs this a good idea?

• Depth-First Search

• ScalabilitySolving hard problems requires search in a large space.To play master-level chess requires searching about 8 ply deep. So about 358 or 21012 nodes must be examined.

• Growth Rates of Functions

• The Advent of the Computer1945 ENIAC The first electronic digital computer

• 1949 EDVACThe first stored program computer

• Moores Lawhttp://www.intel.com/technology/mooreslaw/

• How Much Computer Power Might It Take?http://www.frc.ri.cmu.edu/~hpm/book97/ch3/index.html

• How Much Compute Power is There?From Hans Moravec, Robot Mere Machine to Transcendent Mind 1998.

• Kurweils Visionhttp://www.pocket-lint.co.uk/news/news.phtml/12920/13944/Computers-match-humans-by-2030.phtml

• Limits to What We Can ComputeAre there fundamentally uncomputable things?

Does God exist?

Whats the best way to run a country?

Does this puzzle have a solution?

• Mathematics in the Early 20th Century1900 Hilberts program and the effort to formalize mathematics

1931 Kurt Gdels paper, On Formally Undecidable Propositions

1936 Alan Turings paper, On Computable Numbers with an application to the Entscheidungs problem

• What Can Algorithms Do?Can we make all true statements theorems?

Can we decide whether a statement is a theorem?

• Gdels Incompleteness TheoremKurt Gdel showed, in the proof of his Incompleteness Theorem [Gdel 1931], that the answer to question 1 is no. In particular, he showed that there exists no decidable axiomatization of Peano arithmetic that is both consistent and complete.

• The Entscheidungsproblem Does there exist an algorithm to decide, given an arbitrary sentence w in first order logic, whether w is valid?

Given a set of axioms A and a sentence w, does there exist an algorithm to decide whether w is entailed by A?

Given a set of axioms, A, and a sentence, w, does there exist an algorithm to decide whether w can be proved from A?

• Turing MachinesAt each step, the machine must:

choose its next state, write on the current square, and move left or right.

• An Example

• The Church-Turing ThesisTuring machines

Lambda calculus

Standard programming languages like Java

Conways game of life

DNA computingAll formalisms powerful enough to describe everything we think of as a computational algorithm are equivalent.

• The Game of Life Playing the gameThe rules: A dead cell with exactly three live neighbors becomes a live cell (birth). A live cell with two or three live neighbors stays alive (survival). In all other cases, a cell dies or remains dead (overcrowding or loneliness).

A game halts iff it reaches some stable configuration.

• Back to the Entscheidungsproblem Given a Turing machine M, we can construct a logical formula F that is true iff M ever halts.If there were a solution to the Entscheidungsproblem, then we could determine the truth of F and thus be able to decide whether M ever halts.But there is no procedure for determining (in the general case) whether M halts.So there is no solution to the Entscheidungsproblem.

Theorem: The Entscheidungsproblem is unsolvable.

Proof: (A variant of Turings proof)

• The Halting ProblemTuring machine, Minput string, w

Does M halt on w?Accept

Reject

• An Example of a Similar QuestionDoes this program halt on all inputs? times3(x: positive integer) = While x 1 do: If x is even then x = x/2. Else x = 3x + 1.Lets try it.

• The Halting Problem Is UndecidableProof: If it were decidable, then some TM MH would decide it. MH would implement the specification:

halts() = If is a Turing machine description and M halts on input w then accept. Else reject.

• Trouble Trouble(x: string) = if halts(x, x) then loop forever, else halt.

What is Trouble()?

What is halts()?

If halts reports that Trouble() halts, Trouble ________.

If halts reports that Trouble() does not halt, Trouble __________.

• Another Undecidable ProblemThe Post Correspondence Problem

• A PCP Instance With a Simple Solution

iXY1baab2abbb3abaa4baaababa

• A PCP Instance With a Simple Solution Solution: 3, 4, 1

iXY1baab2abbb3abaa4baaababa

• Another PCP Instance

iXY11101120103001110

• A PCP Instance With No Simple Solution

iXY111011201101131110

• A PCP Instance With No Simple Solution Shortest solution has length 252.

iXY111011201101131110

• A Tiling Problem Given a finite set T of tiles of the form:

Is it possible to tile an arbitrary surface in the plane?

• A Set of TilesThat Cannot Tile the Plane

• Is the Tiling Problem Decidable?

Wangs conjecture: If a given set of tiles can be used to tile anarbitrary surface, then it can always do so periodically. In otherwords, there must exist a finite area that can be tiled and thenrepeated infinitely often to cover any desired surface.

But Wangs conjecture is false.

• The ImplicationsThe Entscheidungs problem is undecidable.

Theres no black box reasoning engine for FOL.

Would quantum computing change the picture?

Does undecidability doom our attempt to make artificial copies of ourselves?

• Is Decidability Enough?

• Boolean Logic, AgainHow many steps would it take a deterministic Turing machine to examine this table?

• Nondeterminism

• Nondeterministically Deciding