The Undecidable and the Unprovable

Size: px
Start display at page:

Download "The Undecidable and the Unprovable"

Transcription

1 The Undecidable and the Unprovable Jeff Sanford Russell Spring 2017 The main purpose of these notes is to help you understand some beautiful and important facts about the limits of computation and logic. There are problems that cannot be solved with any general systematic method and these include the problem of deciding which systematic methods will eventually succeed. There are facts that can be formally stated, but cannot be formally proved and these include important facts like the fact that our theory of mathematics (and in particular our theory of formal logic and consistency!) is consistent. These results are philosophically deep, and they give us tools for doing other deep philosophical work. These tools help us use clear language and careful reasoning to talk about clear language and careful reasoning. The results also give us an understanding of this project s pitfalls. Before we get started, here s a puzzle: a certain barber shaves just those people who do not shave themselves. Does the barber shave himself? If so, then he shaves someone who does shave himself, contradicting the assumption. If not, then he fails to shave someone who does not shave himself, again contradicting the assumption. So the premise of the puzzle is impossible: nobody shaves just those people who do not shave themselves. Here s another closely related puzzle, called the Liar Paradox. Consider the sentence This sentence is not true. Call this sentence L. Since apparently what L says is just that L is not true, it seems that (1) L is true iff L is not true Is L true? If so, then 1 says that L is not true, which is a contradiction. Alternatively, if L is not true, then 1 says that L is true, so again we have a contradiction. Since we have a contradiction either way, we have a paradox. The main idea we will use to show that there are undecidable questions and unprovable statements comes from a variant of the Liar Paradox, called Grelling s paradox. Unlike the original Liar, this variant does not depend on a self-referential sentence. Adjectives, like short, interesting, or simple, are words that can be truly applied to some things but not others. (Let s ignore the problems of vagueness for now, and pretend that all of these adjectives are perfectly precise.) 1

2 Words are themselves among the things that adjectives can apply to: for instance, red is a short word, so the adjective short applies to red. Furthermore, short is a short word, so short applies to itself; long is not a long word, so long does not apply to itself. Some adjectives self-apply, and others don t. Now consider the set of all adjectives which do not self-apply. Is there any adjective which has this set as its extension? Suppose there were such an adjective: in particular, suppose that the adjective non-self-applying applies just to those adjectives which do not self-apply. For all adjectives a: (2) non-self-applying applies to a iff a does not apply to a Does non-self-applying self-apply? If so, then it applies to some adjective which self-applies namely non-self-applying itself contradicting the assumption 2. If not, then it fails to apply to some adjective which does not self-apply again, non-self-applying itself again contradicting the assumption 2. Like the barber puzzle, principle 2 is paradoxical. But what we ll see is that this self-applying idea doesn t just raise puzzles. The same idea plays a central role in some great discoveries. 1 The Undecidable For some questions, there is a systematic procedure you can follow that will eventually bring you to an answer. For instance, which numbers are prime? This question can be answered, for any particular number n, by checking each number k less than n, one by one, for whether n is divisible by k. This is an algorithm for answering the question. A question like this, which can be systematically answered somehow or other, is called effectively decidable. We can also think about questions which have different sorts of answers. For instance, the question What is the remainder when m is divided by n? has a number as its answer. Many of us learned the long-division algorithm in elementary school, which provides a systematic way of answering any question of this form. A family of questions like this, the answers to which can be arrived at systematically, is called effectively computable. We can describe these families of questions as functions, whose values are answers to the question. The remainder function takes a pair of numbers (m, n) to the number which is the remainder when m is divided by n. Similarly, the question Which numbers are prime? can be represented by the function that takes each number n to either True or False. 2

3 The main thing we ll be working up to in this chapter is a central result about undecidable questions. 1.1 Programs An algorithm is a general systematic recipe for answering a question. (This is also called an effective procedure.) For example, given a string like "ABC", what is the string of the same symbols in reverse order? For this example, the answer is "CBA". How can we work out the answer in general, for an arbitrary sequence? One approach is to follow these steps. 1. Set the result to "", the empty string. 2. Go through the symbols in the string one by one, from left to right. For each symbol x, append x to the beginning of the current result. We can describe algorithms using formal languages: these are called programming languages, and a formal description written in such a language is called a program. Programs are everywhere now. There are millions of lines of programming code that make your phone work, and about a hundred million for a new car. Hundreds of different programming languages have been developed for different purposes: Javascript, C++, Python, Lisp, Haskell, and so on. Here is an example of a program written in Python that describes (or implements ) the counting algorithm we just described: def reverse(s): result = "" for symbol in s: result = symbol + result return result The most important thing about these basic programs we ll describe is that they only do things that can be worked out mechanically and systematically. given enough time and space to write things down. So if we can write a program that answers a certain question, this shows that the question is effectively computable. Here we ll explore a very simple subset of the Python language. We ll call it Py. Because it s a subset of real Python, that means you can enter our programs into any Python interpreter and they should run (for example, this one: it/languages/python3). This is a useful way to check your work. 3

4 Py-programs work with strings. A string is a sequence of symbols. Each symbol can be a letter, a number, a punctuation mark, or whitespace (including indentation or linebreaks). Symbols can also be fancier things like technical symbols or emoji. Strings can be used to represent all sorts of things: English sentences, or technical formulas, or numbers, or programs. These notes are represented by one long string of symbols. When we want to talk about particular strings, we use quotation marks: for example, "ABC" is the three-symbol string that starts with the letter A, followed by the letter B, followed by the letter C. Each Py-program takes a string as input, does some work, and spits out another string as its output. The reverse program above starts with the line def reverse(s): Here def is short for define, and it indicates that we re beginning a new program. We specify what the name of the program is (reverse), and what the name of its input is (s). The last line of the program is return result This tells us what the program s output is. A program can represent different strings using variables. In this program, s, symbol, and result are three different variables. At any stage in computation, each variable can stand for some string, which is called its value. As we go through the steps of the program, the value of a variable can change. For example, consider this line: result = symbol + result Here the equals sign means to change the value of the variable result. The result of this step is to make the value of result longer: whatever string result happens to represent, this statement says to add the string represented by symbol onto the front of that. (In general, we can stick two strings together using the plus sign.) This is called a let statement. In general, a statement of the form x = a means to change the value of x to be whatever string is described on the right-hand side of the equals sign. In general, a statement is an instruction, which says to do something. A statement doesn t describe how things are; rather, it gives an instruction for how to change the way things are. 4

5 You can think of the program as a list of instructions for someone who has a sheet of paper that lists all of the variables and their values for example: s result symbol "ABC" "A" "B" The person follows the instructions one by one. When they reach a let statement, they erase one of the values in the right-hand column and write in some new value. For instance, when they see the instruction result = symbol + result they will change the table to look like this: s result symbol "ABC" "BA" "B" When they reach the end of the instructions, they ll tell you what is written in the result row of the table. We can chain together statements by putting them in lines one after another, like this: firstvalue = "" secondvalue = "A" secondvalue = secondvalue + secondvalue This means to do what each statement says in order. In this example, first they set the variable firstvalue to the empty string (a string with zero symbols). Second, they set the variable secondvalue to the string "A". Finally, they change the value of secondvalue so it s "AA" instead. We can also chain together statements in more complex ways. 5

6 1.2 Branching One important thing to do is branching. We can write programs that can go in two different alternative directions, depending on whether two strings are the same. if a == b: flag = "True" else: flag = "False" What it means is to first check whether a and b denote the same string. (Note the double equals sign this is because the single equals sign was already taken for let statements. Here we definitely don t want to change the value of a to be the same as b that would defeat the purpose!) Ifa and b do have the same value, then we do the statements in the first block in this case, we set flag to True. If a and b denote different strings, then instead we do the statements after the else in this case, we set flag to "False". Here s another example: if s == "": result = "Error: the string is empty!" else: result = s[0] If s is not empty, then we set the value of result to its first symbol. (In general, we can pick out specific symbols from a string using this square-bracket notation. In Py, we start counting the symbols from 0 rather than 1.) Otherwise, we set result to be an error message. Example 1. This program returns "True" for an empty sequence, and "False" for a non-empty sequence. def empty(seq): if seq == "": result = "True" else: result = "False" return result 6

7 Exercise 2. Show the following functions are computable writing programs using if and else. 1. Are s and t both equal to "True"? 2. Are either of s or t equal to "True"? 1.3 Looping Another common pattern in programs is to go through each of the elements of a string one by one, and do something with each one. This is called a for loop. For example, this program decides whether every symbol in a string is "A". def allas(s): result = "True" for symbol in s: if not (symbol == "A"): result = "False" return result The for loop goes through the elements of the string s one by one, and stores each symbol in the variable symbol. Example 3. This program takes a string and repeats each symbol an extra time. For instance, it takes "ABC" to "AABBCC". def repeatsymbols(s): result = "" for x in s: result = result + x + x return result The second basic kind of statement is a loop. This lets us write programs that do the same steps over and over again as long as the world is a certain way. For any terms a and b, and any block of statements block, we can build this kind of statement: while a == b: block 7

8 This means to repeatedly do what block says as long as the values of a and b are the same. One important difference between for loops and while loops is that for loops are guaranteed to eventually stop, when the program gets to the end of the string. In contrast, a while loop might go on running forever: there is no guarantee that the values of a and b will ever be differennt, so the condition a == b might hold forever. Definition 4. A program A halts for input s iff running A with the input s eventually returns some output. In other words, a program halts for a certain input iff it does not end up in an infinite loop. Exercise 5. Write a program loop that never halts for any input. Exercise 6. Write a program flip that halts for the input False, and does not halt for the input True. Definition 7. (a) A set of strings X is Py-decidable iff there is some Py-program that, when given any string s as its input, eventually returns "True" as its output if s is in X, and eventually returns "False" as its output if s is not in X. (b) A function f is Py-computable iff there is some Py-program that, when given any input s, returns f(s) as its output. 1.4 The Church-Turing Thesis If we want to show that a question is decidable, we can write a program to answer it. But how would we show that a question is undecidable? To do this, we wouldn t just need to show that no program in our little language Py answers the question we d need to show that no program in any reasonable programming language can answer it. If a question is undecidable, then there isn t any systematic algorithm for solving it at all. Alonzo Church and Alan Turing both hypothesized that there are universal programming languages: languages which are expressive enough to describe every systematic algorithm. In fact, they didn t just hypothesize that such languages exist: they proposed some specific candidates. (In Church s case, these consisted of a small family 8

9 of operations on functions of natural numbers. In Turing s case, the language consisted of Turing Machines hypothetical devices for reading and printing on a long piece of tape.) These proposals amounted to giving a formal analysis of the intuitive concept of a decidable question. You might doubt whether such an analysis could succeed. (Surely any analysis like this would have counterexamples!) But in fact, we have very strong evidence that Church and Turing s proposal is true. The key philosophical claim is called the Church-Turing Thesis. The first bit of evidence for it is packed right into its name: for Church s and Turing s apparently different theses apparently different analyses of the concept of a decidable question turned out to be equivalent. That is, any question which is decidable using a Turing Machine is also decidable using Church s functions, and vice versa. Today we have hundreds more examples formal languages like C++ or Python or Haskell and so on: these also turn out to be equivalent to Turing and Church s languages. This means that we get a little bit more inductive evidence for the truth of the Church-Turing Thesis every time a programmer takes a precisely described algorithm and implements it in their favorite programming language. The Church- Turing Thesis is thus a hypothesis which is extraordinarily well-confirmed by the practice of modern programming. Even so, it s worth remembering that it is a philosophical thesis an extraordinarily successful philosphical thesis, but not a theorem. We can prove lots of theorems about various kinds of formal languages. But the Church-Turing Thesis is about the relationship between these formal languages and the intuitive notion of a decidable question. In particular, our little language Py is equivalent to each of these other programming languages: a set is Py-decidable if and only if it is decidable using a Turing Machine, if and only if it is decidable using Church s functions, if and only if it can be decided by a program in C++ or any other standard programming language. So if any of these languages is a universal programming language, so is Py. So according to the Church-Turing Thesis, whatever can be done in any systematic way by any algorithm at all can also be done using humble Py. The Church-Turing Thesis. (a) A set of strings is effectively decidable if and only if it is Py-decidable. (b) A function is effectively computable if and only if it is Py-computable. In what follows, we will freely appeal to the Church-Turing Thesis (though it s generally a good idea to be clear about when exactly we re relying on it). This is extremely 9

10 useful in two ways. First, this lets us deduce the existence of programs, even without formally writing them out. In order to show that a question is decidable, it s enough to informally give some reasonably careful description of a systematic procedure for answering it. But transforming an informal algorithm into a formal program can still be pretty tricky. (That s what professional programmers are for.) Given the Church-Turing Thesis, we can deduce the existence of a program from the existence of an algorithm, even when we re not sure exactly how to write that program. We ll do this in what follows: rather than writing out fully detailed programs in our little language, we can just outline how a program ought to work, and posit that some program does in fact work that way, appealing to the Church-Turing Thesis. Second, this lets us prove results about undecidability. We can mathematically prove that every Py-program has certain properties. From this we can deduce properties that all Py-decidable sets have in common. Then any set that doesn t have these properties must be undecidable. 1.5 The Universal Program We ve been writing programs by typing sequences of symbols. That is, we are representing programs themselves using strings. That means that programs themselves can be inputs and outputs of programs. We can write programs to answer questions about programs. Programs that manipulate programs might sound recherché, but it s actually very common and practical. When we write a program in Python and then want to run it, what we do is type a sequence of symbols that represent that program, and we give this string as an argument to a Python interpreter which is some other program. Someody wrote that program, too, in some programming language. In fact, the interpreter might be written in Python itself! Even our little language Py can do this. We can write a Py-interpreter in Py. This is a program that takes as its input the string representation for another Pyprogram A, together with an input value, and returns the resulting value that results from running A with this input value. At least, it does this if A has any output value. It could be that A crashes or goes into an infinite loop. In that case, the interpreter will also just crash or run forever. Theorem 8. The Py-interpretation function is the function that takes each Pyprogram A and string s to the output of running A with input s, if A halts for the input 10

11 s, and is undefined otherwise. The Py-interpretation function is Py-computable. Proof Sketch. We won t write out a full program for this, but we will informally describe an algorithm for doing this. By the Church-Turing Thesis, this algorithm can be implemented by some program. The first part of this project is called parsing. We need to take a string representing a program, and split it up into its meaningful parts. We can write a bunch of small programs to handle basic parsing tasks. Here s our to-do list. (We won t actually do all of this: the goal here is just to make it apparent that the interpretation function is computable, not to actually write a complete parser and interpreter. But if you have the time and interest, it s fun to work out some of these details in front of a computer.) 1. (a) Write a program that takes a program as input and returns its first statement. (b) Write a program that takes a program as input and returns all of it except its first statement. (Remember that a statement can be a complete while loop. One tricky part here is figuring out where the loop ends. In Python, this depends on the indentation.) 2. Write a program that takes a statement as input and identifies what kind of statement it is a let-assignment, a for loop, an if statement, or a while loop and returns "let" "for", "if", or "while" accordingly. 3. Write two programs that take a let -statement x = s and return (a) the variable on the left of the equals sign, (b) the term on the right of the equals sign. 4. Write three programs that take a while -statement while a == b: and return (a) the first term a, (b) the second term b, and (c) the inner block. Similarly for for, and if statements. 5. Write a program that takes a term and identifies what kind of term it is: whether it is of the form head(a), tail(a), a + b, the empty string "", or represents a single character like "A", or a variable. In the first three cases, we should also write programs that return the terms a and b. So far we have just been handling the syntax of programs. To make them work, we ll also need to come up with a way of representing assignment functions with strings. An assignment function is a table that represents the values for each variable at some stage along the way. (We only need to worry about assignment functions that are defined for finitely many values which is a good thing, because there is no way to represent arbitrary infinite assignment functions using finite strings. There 11

12 are too many of them.) There are many ways to do this, but here s one. Say we have the assignment function that assigns the variable x the value "hello" and assigns the variable result the empty string "". We can represent this with this string: { x : "hello", result : "" } We ll also need to write a couple basic programs for manipulating assignment functions. 6. Write a program that takes an assignment and the name of a variable, and which returns the value that the assignment has for that variable (if there is one). For instance, given the assignment above and "x", this should return the string "hello". 7. Write a program that takes an assignment a, the name of a variable v, and another string s, and which returns the assignment that results from changing the value of v to s in a. Finally, we can build our interpreter by putting all these components together. There will be two parts: a term-interpreter, and a block-of-statements-interpreter. The term-interpreter takes an assignment and a term and returns the string that the term denotes (with respect to that assignment). We start by figuring out which form the term has. If it s a variable, then we look up the value of the variable in our assignment (using function 6 above). If, for example, the term is head(a) for some other term a, then we apply our term-interpretation method to a, and then get its first symbol using our actual head function. Things go similarly for the other kinds of term. To interpret a block of statements, first we look at the first statement in the program. If it s a let-assignment, x = a, then first we use our term-interpreter to evaluate the term a, and we use our update an assignment program (program 7 in the to-do list) to set the value of x to whatever value a denotes. If it s a while-statement, of the form while a == b: block, then we will interpret it using a while loop. Here it is in pseudo-code : done = "False" while done == "False": avalue = interpret-term(a) bvalue = interpret-term(b) 12

13 if avalue == bvalue: g = the result of interpreting block with respect to assignment g else: done = "True" And that about finishes it up. We haven t written a whole program, but we have described an algorithm for interpreting programs, a bit roughly. (For a really rigorous proof, we would need to fill in more of the details.) By the Church-Turing thesis, there is some program that implements this algorithm. So the interpretation function is computable. 1.6 An Undecidable Problem Recall that a program halts iff it has some well-defined value. A program that halts is one that neither crashes with an error nor goes into an infinite loop. Here is perfectly sensible question: which programs halt? For any particular program A, either A has some final value, or it doesn t. The halting problem is the perfectly precise question of which programs return some value, and which don t. This is a practically important question. It would be extremely useful to have a program-checking program: a program that determines whether your program is going to crash, or whether it will go into a never-ending while loop, or not. Unfortunately, there is no such program. The question of which programs halt, while a perfectly precise question with a correct answer, is effectively undecidable. There is no systematic method for determining, in general, which programs are going to eventually return a value. This is what we ll show in this section. For every string, there s an expression in Py that labels it, using quotation marks. For example, the string ABC is labeled by the string "ABC" which adds quotation marks around the original string. Let s call this Py-expression 13

14 the canonical label for a string (in Py). 1 If s is a string, let s use the notation s for the canonical label for s. We can use canonical labels as a way of plugging data into programs. If s is a string and A(x) is a program, then A s is a program that, before running A(x), begins with a let assignment x = s which has the result of setting the value of x to s (since s is a term that denotes s). So the result of running the program A s is the same as the result of running A(x) with the input s. In particular, we can use canonical labels for the string-representations of programs in order to write programs that do basic manipulations of the syntax of other programs. Each program A has a canonical label A, which is a term in our programming language that stands for the program A. Essentially, it just puts the whole program in quotation marks. Lemma 9. The function that takes each string to its canonical label is computable. We ll call a program that does this label. So for any string s, the result of running label s is the string s. (The basic idea is that we just need to add quotation marks to s. But there are a few tricky details to handle when s is a string that contains quotation marks itself.) Lemma 10. The substitution function that takes a program A(x) and a term t to the program A(t) is computable. Proof. def subst(prog, term): result = "x = " + term + "\n" + prog return result 1 There are some slightly tricky details about how to give canonical labels for strings that involve quotation marks themselves. For example, what is the canonical label for the string consisting of a single quotation mark? It isn t """, because if we allowed quotation marks to appear within quotation marks like this we d end up with lots of annoying ambiguities. One solution is to use '"', with single quotes around the double-quote mark. Then we can label a string like A"BC"" as "A" + '"' + "BC" + '"' + '"' But let s not worry too much about these technicalities. 14

15 We can put these two things together. Exercise 11. There is a program apply(x, y) such that, given any programs A(x) and B as input, returns the program A B that plugs the program B in as input to A(x). Proof. We get apply(x, y) by sticking together subst and label: in particular, apply(x, y) is the same as subst(x, label(y)). We now have a way of applying programs to programs. But remember our paradox of self-applying adjectives? We can do exactly the same trick with programs. Turing s Theorem. The set of programs that halt is undecidable. Proof. We will suppose that the set of programs that halt is decidable and derive a contradiction from this assumption. Suppose that there is some program halt(x) such that, given any program A as input, halt(x) returns "True" if A halts, and halt(x) returns "False" if A does not halt. Remember that we defined a function flip that halts for the input "False", but not for the input "True". So we can put flip and halt together to get a program flip(halt(x)). Call this combined program opposite(x). So if you give opposite(x) the program A as input, then opposite(x) halts if and only if A does not halt. Now, remember the paradoxical adjective non-self-applying? Since we have a way of applying programs to other programs, we can use the same trick here. In place of the adjective non-self-applying, we ll consider the program opposite(apply(x, x)). Call this program A. The question that got us into trouble earlier was Does non-self-applying self-apply? We can ask a similar question: does the program A halt when it is given itself as input? That is, does the program A A halt? What it means for A A to halt is that opposite(apply( A, A )) halts. But we know that this is true if and only if the program given by apply( A, A ) does not halt. And we know that this is true if and only if A A does not halt. So A A halts if and only if A A does not halt. If it halts, it doesn t; and if it doesn t, it does. This is a contradiction! 15

16 This whole line of reasoning got started when we assumed that there was a program halt(x). So the conclusion we have to draw is that really there is no such program: the question of which programs halt is undecidable. 1.7 Semi-Decidable and Effectively Enumerable Sets It might be a little confusing how it could be that the interpretation function for programs is computable, and yet the question of whether a program halts is undecidable. We can clarify the relationship between these two facts by introducing another notion, which is less demanding than decidability, but still goes a long way toward it. A semi-decidable set is a set X that can be decided in one direction. What that means is that there is an algorithm such that, for any given d, if d is in X, then the algorithm will eventually tell you so and the algorithm won t ever tell you something is in it which isn t. But if d is not in X, then there is no guarantee that the algorithm will tell you anything. It will tell you the good things are good, and it won t say any bad things are good, but the bad things might just end up sending your program into an infinite loop instead. Definition 12. A set X is semi-decidable iff there is a program that returns "True" for each input that is in X, and does not return "True" for anything that is not in X. (But for inputs that are not in X, the program isn t guaranteed to return anything at all.) Theorem 13. The set of programs that halt is semi-decidable. Thus there is a set which is semi-decidable, but not decidable. Proof. For any program A, we can use the Universal Program to interpret it. If A halts, then the Universal Program will also eventually halt. Once we are done, we simply return "True". If the program crashes or enters an infinite loop, we will never reach this last step, and so in this case we will not return any value. Semi-decidability is closely linked to another idea. Some sets can be systematically listed. The idea is that we can write a program that spits out each element of X one by one. Definition 14. A set X is effectively enumerable iff there is some program that when run repeatedly eventually returns every value that is in X, and no values that are not in X. 16

17 Listing a set is easier than deciding which things are in it. If a set is decidable, then one way to list its elements is to go through every string one by one in alphabetical order, and for each string check whether it s in your set. If it is, then spit it out, and if it isn t, then don t spit anything out, and go on to the next string. But just because you can list a set doesn t guarantee that you can determine whether any particular thing is in it. You might try to through the list looking for the thing you want but just because you haven t found it yet doesn t guarantee you never will find it. Not every effectively enumerable set is decidable, but every effectively enumerable set is semi-decidable. In fact, the converse is also true: every semi-decidable set is effectively enumerable. But this takes significantly more work to prove. Theorem 15. For any set X, X is effectively enumerable iff X is semi-decidable. Proof Sketch. Here s the basic idea. Say we have a program that returns "True" if and only if its input is in X. Then we can go through strings one by one in alphabetical order. The obvious thing to try is to check each string, and print it out if we get "True". The problem with this approach is that the semi-decision program might go into an infinite loop. The first time this happens, the whole program will stop working. So we need to make sure we never allow the semi-decision program to go on forever. Here s how we can do this. We can run a modified program, which replaces each while loop with a for loop that only runs n times, for some number n, and returns "Fail if the loop-ending condition still hasn t been met at that point. Call this the n-bounded variant of a program. If a program halts, then each of its while loops only goes through finitely many steps, which means there is some number n such that its n-bounded variant program succeeds. So here s what we can do. We can go through the pairs (s, n) of a string and a number, one by one. For each pair, we ll feed the input s to the n-bounded variant of the semi-decision program. If we get "True", then we print out s. If we get "False" or "Fail" then we don t print out s (yet) and we go on to the next pair. Because we are using bounded programs, the computation we do for each pair can only take finitely many steps. So we ll eventually check every pair, and so eventually every string that the semi-decision program returns "True" for will get printed out. 17

18 2 The Unprovable So far we ve been discussing the limits of our ability to answer questions using programs. In this section we ll be considering limits on our ability to describe the world. It turns out that any feasible way of trying to make true statements about the world and deducing their consequences is going to end up leaving out some facts. In short, there are true statements that cannot be proved. 2.1 Statements and Proofs So far we have been talking about a programming language, where the statements are instructions for how to carry out a task. Now we ll turn out attention to descriptive language. Instead of imperative sentences (like Make it so ) we ll be using declarative sentences (like It is so ). In this kind of language, the point of statements is to say something about the way the world is. For instance, we might make statements like Snow is white, or = 4, or The halting problem is undecidable. These aren t instructions for how to change the world; they are claims that can be true or false. One distinctive feature of declarative sentences is that they have negations. For every true sentence, like Snow is white, there is a corresponding false sentence, like Snow is not white. Similarly, for every false sentence, like equals 5, there is a corresponding true sentence, like is not equal to 5. If A is a sentence, we ll represent the negation of A as not-a. (Sometimes people use the notation A or A or A instead.) Here are two important logical facts, for any sentence A. (1) A and not-a cannot both be true. A theory of the world that says both A and not-a is logically inconsistent: it conflicts with itself, and so it cannot be correct. (2) Either A is true or not-a is true. A theory of the world that does not say A, and does not say not-a is logically incomplete: it leaves out some of the facts. What we ll be showing, a bit roughly, is that any reasonable theory is either inconsistent or incomplete. But one of the main tricky details is to say exactly what we mean by a reasonable theory. In particular, we ll be looking at theories that consist of everything that can be deduced from some basic principles. We won t say what the basic principles are just that there have to be some. The basic principles are called axioms, and the way that sentences are deduced from axioms is called a proof. A proof looks like this: 18

19 1. Snow is white. 2. If snow is white then grass is green. 3. So grass is green. 4. If grass is green, then all ravens are black. 5. So all ravens are black. A proof consists of a list of statements, where for each statement A in the list, either A is an axiom (one of our basic premises), or else A logically follows in a simple way from some of the earlier statements. The way in which a sentence can follow from earlier statements is called an inference rule. To keep it simple, we ll look at proofs that only have one kind of inference rule, which has this form: 1. If A then B. 2. A 3. So B. This rule is called modus ponens. Definition 16. Suppose that X is a set of sentences the axioms. A proof from X is a sequence of sentences such that each sentence is either in X, or else follows from two earlier sentences by modus ponens. A sentence A is provable from X if and only if there is some proof from X whose last sentence is A. There can be many different axioms even infinitely many. But in order for a theory to be understandable and useful, the set of axioms should be decidable. There should be some general systematic method for determining which statements are axioms and which are not. If we didn t have this, then there would be no way in principle to tell whether or not an arbitrary sequence of sentences was supposed to count as a proof. Definition 17. (a) An axiomatizable theory is a set of sentences T such that, for some decidable set of axioms X, T contains all and only the sentences that are provable from X. If A is one of the sentences in T, then we say that T proves A, or that A is provable-in-t, or for short A is provable. (b) A theory is inconsistent iff for some sentence A, T proves A and T also proves not-a. Otherwise T is consistent. 19

20 (c) A theory is incomplete iff for some sentence A, T does not prove A, and T does not prove not-a. Otherwise T is complete. Remember, the main result we are going to show that any reasonable way of making statements about the world is either inconsistent or incomplete. The first part of what we mean by reasonable is that it is axiomatizable. Here is a fact about axiomatizable theories that will take us part of the way to the main result. Lemma 18. If T is a consistent and complete axiomatizable theory, then T is decidable. Proof. Suppose that X is some decidable set of axioms. For any sequence of statements, we can systematically check whether or not it counts as a proof from those axioms: we just have to go through and check each line one by one. For each line, first we decide whether it is an axiom (which we are assuming is possible: the set of axioms is decidable). If it is not an axiom, we check whether it follows from some previous lines by modus ponens. If any line fails both tests, then we don t have a proof; if every line passes one of the two tests, we do have a proof. Say we have a sentence A, and we want to decide whether A is provable in T. We can go through the sequences of statements one by one say in alphabetical order. For each sequence, if it is a proof whose last line is A, return "True" this sentence is provable in T. If it is a proof whose last line is not-a, return "False" this sentence is not provable in T, because T is consistent. Since T is complete, eventually either we will find a proof of A or we will find a proof of not-a, so this method is guaranteed to eventually return "True" if A is provable, or "False" if A is not provable. 2.2 Representing Language We can make statements about many things in the world. One of the things we can talk about is language itself. We can talk about symbols and how they can be put together to make sentences, proofs, and programs. We ve been doing this all along. A description (also known as a formula) is a sentence with a hole in it. We represent the hole with the letter x. For example: x is a prime number, or Jeff is taller than x and x is taller than Maggie. The idea is that you can plug a name for something into the hole in order to get a sentence that describes that thing. For instance, we can plug the name two into the first description to get the sentence 20

21 Two is a prime number. We can plug the name Bea into the second description to get the sentence Jeff is taller than Bea and Bea is taller than Maggie. Suppose we have a set of things D, and we have picked out a name for each one of them. Let s use the notation d for the name for d. Then if A(x) is some description, we ll use the notation A d for the sentence you get by plugging in the name for d, to get a sentence that describes d. (This is the same notation we used for plugging inputs into programs. That s on purpose.) In particular, as I said, we will be looking at theories that can describe language. For instance, in English we can say things like this: Snow is white is a sentence. Obama is a name of a president. The result of plugging the name Obama into the description x is a president is the sentence Obama is a president. In order to talk about bits of language, we use quotation marks. If we put a string of symbols between quotation marks, the result is a name for that string of symbols. We ll be looking at theories that have the resources to talk about strings of symbols. So we ll suppose that for each string of symbols s, there is a certain name s. This might use quotation marks, but it also might work some other way. (Again, this is very similar to what we did with programs.) We are interested in theories that are powerful enough to say some things about strings of symbols and how they can be put together. But first, we need to say what we mean for a theory to say something about strings. The first part, which we have already discussed, is that we need names for strings. The second part, though, is that we need some descriptions that we can plug those names into. For example, we might want a theory to be able to say which strings represent programs. In that case we should have some description x is a program. For this description to represent the programs in a theory T, T should be able to prove s is a program for any string s which is a program, and T should prove s is not a program for any string s which is not a program. Here s the general idea: Definition 19. Suppose that X is some set of strings and T is a theory. We say that T represents X iff there is some description A(x) such that, for every string s which is in X, T proves A s, and for every string s which is not in X, T proves not-a s. 21

22 (Representability is similar to decidability. The key difference is that representability has to do with what statements you can prove in a descriptive language, while decidability has to do with what questions you can answer with a programming language.) One simple thing we can describe is how programs work. For example, if we have axioms that describe how each basic programming statement works, we could use this to prove that a certain program has a certain result. The basic operations of programs are pretty simple, so if a theory isn t even strong enough to describe them, then it really can t describe very much. Remember again what our main goal is: to prove any reasonable way of making statements about the world is either inconsistent or incomplete. As we noted, the first part of what we mean by reasonable is that it is an axiomatizable theory. The second part of what we mean by reasonable is that the theory is strong enough to describe programs. Definition 20. A theory is T sufficiently strong iff T represents every decidable set of strings. You might think that being sufficiently strong is a big hurdle to clear. But in fact it isn t very difficult at all. One of the things that Gödel and others showed is that even very simple theories whose axioms are just a few basic principles of logic and arithmetic can count as sufficiently strong. (But we won t go into the details of this.) Certainly any theory that we would treat as a serious attempt to describe our world will include that much. One important thing to notice is that if T is sufficiently strong, then it can represent some basic operations for putting together strings. In particular, suppose you have a description A(x) and a string s. Then one of the things you can do is replace each x in the description with the name for s, in order to get the sentence A s. This is a simple, mechanical thing to do, so it can be done by a program. That means that if T is a sufficiently strong theory, then there is some description x is the result of applying y to z, such that for any formula A(x) and string s, T proves A s is the result of applying A(x) to s. 2.3 An Unprovable Fact Now we have everything we need to prove the main fact about unprovability. 22

23 Gödel s First Incompleteness Theorem. No sufficiently strong axiomatizable theory is both consistent and complete. Proof. Let T be a sufficiently strong axiomatizable theory, and suppose that T is complete. We ll show that T is inconsistent. By Lemma 18, we know that T is decidable. Since T is sufficiently strong, this means that T represents the set of sentences that are provable in T. There is some description x is provable such that for any sentence A, if T proves A, then T proves A is provable, and if T does not prove A, then T proves A is not provable. We can now use the Liar paradox trick again: in place of the adjectives that do not self-apply, this time we ll look at the descriptions that cannot be proved to apply to themselves. Since T is sufficiently strong, we know T contains a description x is the result of applying y to z, as we discussed above. We can now put this together with the description x is provable to form this more complicated description: the result of applying x to x is not provable Call this description A(x). What we know is that for any description B(x), if the result of applying B(x) to B(x) is not provable, then T proves A B(x). Likewise, if the result of applying B(x) to B(x) is provable, then T proves not-a B(x). In short, since B B(x) is the result of applying B(x) to B(x), we can summarize this: (3) If T does not prove B B(x), then T proves A B(x) If T proves B B(x), then T proves not-a B(x) For the Liar paradox, we considered applying non-self-applying to itself. We can do the same trick here: we ll now let G be the sentence you get from plugging A(x) into itself. That is, G = A A(x) This is called the Gödel sentence. Since G is the result of applying A(x) to A(x), we can apply property 3, by specifically plugging in A(x) for B(x): (4) If T does not prove G, then T proves G If T proves G, then T proves not-g But (similar to the reasoning in the Liar paradox), this shows that T is inconsistent. Suppose first that T does not prove G. By the first part of 4, it follows that T proves G. But this is a contradiction; so T must prove G after all. But now, if T proves G, 23

24 by the second part of 4 it follows that T also proves not-g. So T proves both G and not-g. So T is inconsistent. What we have shown is that if T is axiomatizable, sufficiently strong, and complete, then T is inconsistent. We can put that the other way around: if T is axiomatizable, sufficiently strong, and consistent, then T is incomplete. Gödel s Theorem tells us something about any attempt to describe the world. If our theory is tractable, in the sense that it is possible in principle to determine what its basic principles say, and it includes some basic logic and arithmetic, and it does not contradict itself, then our theory is guaranteed to leave out some of the facts. In this sense, it is impossible to give a theory of everything. 2.4 Consistency is Unprovable What we ve shown is that for any sufficiently strong, consistent axiomatizable theory, there is some true statement that it cannot prove. But Gödel showed something more: he gave a specific example of an unprovable statement which is of particularly deep importance. Any sufficiently strong axiomatizable theory has the resources to talk about what is provable in that very theory. So one of the things it can talk about is whether it can prove any contradictions. That is, if T is a sufficiently strong axiomatizable theory, then it includes a sentence that says T is consistent that is, one which says no contradiction is provable in T. The second important thing Gödel showed is that if T really is consistent, then this true statement is unprovable. No reasonable theory can prove its own consistency. This is called Gödel s Second Incompleteness Theorem. The basic idea of the proof is that in a reasonable theory T, the reasoning behind Gödel s First Incompleteness Theorem can be formalized. The steps we went through to justify First Incompleteness Theorem can also be carried out in an official proof in T. We won t go through this in detail, but we ll look at the main ideas. The first step is to come up with a description x is provable. (This doesn t work quite the same way as in the First Incompleteness Theorem, because this time we are not assuming that T is consistent and complete. But the idea is similar. We won t worry too much here about the exact details about how this description works.) Note that T is inconsistent if and only if T proves, for example, that 0 1 and 0 = 1. So let T is consistent be a shorthand for 0 1 and 0 = 1 is not provable. What we are going to show is that if T proves this sentence, then T is inconsistent. The second step is to use the idea of the First Incompleteness Theorem to come up with a Gödel sentence. In particular, we can define a sentence G in the same way as 24

p x i 1 i n x, y, z = 2 x 3 y 5 z

p x i 1 i n x, y, z = 2 x 3 y 5 z 3 Pairing and encoding functions Our aim in this part of the course is to show that register machines can compute everything that can be computed, and to show that there are things that can t be computed.

More information

Chapter 3. Set Theory. 3.1 What is a Set?

Chapter 3. Set Theory. 3.1 What is a Set? Chapter 3 Set Theory 3.1 What is a Set? A set is a well-defined collection of objects called elements or members of the set. Here, well-defined means accurately and unambiguously stated or described. Any

More information

Recursively Enumerable Languages, Turing Machines, and Decidability

Recursively Enumerable Languages, Turing Machines, and Decidability Recursively Enumerable Languages, Turing Machines, and Decidability 1 Problem Reduction: Basic Concepts and Analogies The concept of problem reduction is simple at a high level. You simply take an algorithm

More information

Chapter 12. Computability Mechanizing Reasoning

Chapter 12. Computability Mechanizing Reasoning Chapter 12 Computability Gödel s paper has reached me at last. I am very suspicious of it now but will have to swot up the Zermelo-van Neumann system a bit before I can put objections down in black & white.

More information

Notes on Turing s Theorem and Computability

Notes on Turing s Theorem and Computability Notes on Turing s Theorem and Computability Walter Neumann About 60 years ago there was a revolution in mathematics and philosophy. First Gödel and then Turing showed that there are impossible problems

More information

Discrete Mathematics Lecture 4. Harper Langston New York University

Discrete Mathematics Lecture 4. Harper Langston New York University Discrete Mathematics Lecture 4 Harper Langston New York University Sequences Sequence is a set of (usually infinite number of) ordered elements: a 1, a 2,, a n, Each individual element a k is called a

More information

14.1 Encoding for different models of computation

14.1 Encoding for different models of computation Lecture 14 Decidable languages In the previous lecture we discussed some examples of encoding schemes, through which various objects can be represented by strings over a given alphabet. We will begin this

More information

Diagonalization. The cardinality of a finite set is easy to grasp: {1,3,4} = 3. But what about infinite sets?

Diagonalization. The cardinality of a finite set is easy to grasp: {1,3,4} = 3. But what about infinite sets? Diagonalization Cardinalities The cardinality of a finite set is easy to grasp: {1,3,4} = 3. But what about infinite sets? We say that a set S has at least as great cardinality as set T, written S T, if

More information

Part II Composition of Functions

Part II Composition of Functions Part II Composition of Functions The big idea in this part of the book is deceptively simple. It s that we can take the value returned by one function and use it as an argument to another function. By

More information

Intro. Scheme Basics. scm> 5 5. scm>

Intro. Scheme Basics. scm> 5 5. scm> Intro Let s take some time to talk about LISP. It stands for LISt Processing a way of coding using only lists! It sounds pretty radical, and it is. There are lots of cool things to know about LISP; if

More information

Lecture 1: Overview

Lecture 1: Overview 15-150 Lecture 1: Overview Lecture by Stefan Muller May 21, 2018 Welcome to 15-150! Today s lecture was an overview that showed the highlights of everything you re learning this semester, which also meant

More information

Turing Machine Languages

Turing Machine Languages Turing Machine Languages Based on Chapters 23-24-25 of (Cohen 1997) Introduction A language L over alphabet is called recursively enumerable (r.e.) if there is a Turing Machine T that accepts every word

More information

Computability, Cantor s diagonalization, Russell s Paradox, Gödel s s Incompleteness, Turing Halting Problem.

Computability, Cantor s diagonalization, Russell s Paradox, Gödel s s Incompleteness, Turing Halting Problem. Computability, Cantor s diagonalization, Russell s Paradox, Gödel s s Incompleteness, Turing Halting Problem. Advanced Algorithms By Me Dr. Mustafa Sakalli March, 06, 2012. Incompleteness. Lecture notes

More information

Material from Recitation 1

Material from Recitation 1 Material from Recitation 1 Darcey Riley Frank Ferraro January 18, 2011 1 Introduction In CSC 280 we will be formalizing computation, i.e. we will be creating precise mathematical models for describing

More information

(Refer Slide Time 3:31)

(Refer Slide Time 3:31) Digital Circuits and Systems Prof. S. Srinivasan Department of Electrical Engineering Indian Institute of Technology Madras Lecture - 5 Logic Simplification In the last lecture we talked about logic functions

More information

The Diagonal Lemma: An Informal Exposition

The Diagonal Lemma: An Informal Exposition The Diagonal Lemma: An Informal Exposition Richard G Heck, Jr At the heart of Gödel s incompleteness theorem is the so-called diagonal lemma whose purpose is to allow us to construct self-referential sentences,

More information

Propositional Logic. Part I

Propositional Logic. Part I Part I Propositional Logic 1 Classical Logic and the Material Conditional 1.1 Introduction 1.1.1 The first purpose of this chapter is to review classical propositional logic, including semantic tableaux.

More information

Lecture 4: examples of topological spaces, coarser and finer topologies, bases and closed sets

Lecture 4: examples of topological spaces, coarser and finer topologies, bases and closed sets Lecture 4: examples of topological spaces, coarser and finer topologies, bases and closed sets Saul Glasman 14 September 2016 Let s give the definition of an open subset of R. Definition 1. Let U R. We

More information

Computation Club: Gödel s theorem

Computation Club: Gödel s theorem Computation Club: Gödel s theorem The big picture mathematicians do a lot of reasoning and write a lot of proofs formal systems try to capture the ideas of reasoning and proof in a purely mechanical set

More information

CSCI 270: Introduction to Algorithms and Theory of Computing Fall 2017 Prof: Leonard Adleman Scribe: Joseph Bebel

CSCI 270: Introduction to Algorithms and Theory of Computing Fall 2017 Prof: Leonard Adleman Scribe: Joseph Bebel CSCI 270: Introduction to Algorithms and Theory of Computing Fall 2017 Prof: Leonard Adleman Scribe: Joseph Bebel We will now discuss computer programs, a concrete manifestation of what we ve been calling

More information

Functional Programming in Haskell Prof. Madhavan Mukund and S. P. Suresh Chennai Mathematical Institute

Functional Programming in Haskell Prof. Madhavan Mukund and S. P. Suresh Chennai Mathematical Institute Functional Programming in Haskell Prof. Madhavan Mukund and S. P. Suresh Chennai Mathematical Institute Module # 02 Lecture - 03 Characters and Strings So, let us turn our attention to a data type we have

More information

CS103 Spring 2018 Mathematical Vocabulary

CS103 Spring 2018 Mathematical Vocabulary CS103 Spring 2018 Mathematical Vocabulary You keep using that word. I do not think it means what you think it means. - Inigo Montoya, from The Princess Bride Consider the humble while loop in most programming

More information

Induction and Semantics in Dafny

Induction and Semantics in Dafny 15-414 Lecture 11 1 Instructor: Matt Fredrikson Induction and Semantics in Dafny TA: Ryan Wagner Encoding the syntax of Imp Recall the abstract syntax of Imp: a AExp ::= n Z x Var a 1 + a 2 b BExp ::=

More information

Lecture 5: The Halting Problem. Michael Beeson

Lecture 5: The Halting Problem. Michael Beeson Lecture 5: The Halting Problem Michael Beeson Historical situation in 1930 The diagonal method appears to offer a way to extend just about any definition of computable. It appeared in the 1920s that it

More information

AXIOMS FOR THE INTEGERS

AXIOMS FOR THE INTEGERS AXIOMS FOR THE INTEGERS BRIAN OSSERMAN We describe the set of axioms for the integers which we will use in the class. The axioms are almost the same as what is presented in Appendix A of the textbook,

More information

CS 275 Automata and Formal Language Theory. First Problem of URMs. (a) Definition of the Turing Machine. III.3 (a) Definition of the Turing Machine

CS 275 Automata and Formal Language Theory. First Problem of URMs. (a) Definition of the Turing Machine. III.3 (a) Definition of the Turing Machine CS 275 Automata and Formal Language Theory Course Notes Part III: Limits of Computation Chapt. III.3: Turing Machines Anton Setzer http://www.cs.swan.ac.uk/ csetzer/lectures/ automataformallanguage/13/index.html

More information

STABILITY AND PARADOX IN ALGORITHMIC LOGIC

STABILITY AND PARADOX IN ALGORITHMIC LOGIC STABILITY AND PARADOX IN ALGORITHMIC LOGIC WAYNE AITKEN, JEFFREY A. BARRETT Abstract. Algorithmic logic is the logic of basic statements concerning algorithms and the algorithmic rules of deduction between

More information

Animations involving numbers

Animations involving numbers 136 Chapter 8 Animations involving numbers 8.1 Model and view The examples of Chapter 6 all compute the next picture in the animation from the previous picture. This turns out to be a rather restrictive

More information

6.080 / Great Ideas in Theoretical Computer Science Spring 2008

6.080 / Great Ideas in Theoretical Computer Science Spring 2008 MIT OpenCourseWare http://ocw.mit.edu 6.8 / 6.89 Great Ideas in Theoretical Computer Science Spring 28 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.

More information

6.001 Notes: Section 8.1

6.001 Notes: Section 8.1 6.001 Notes: Section 8.1 Slide 8.1.1 In this lecture we are going to introduce a new data type, specifically to deal with symbols. This may sound a bit odd, but if you step back, you may realize that everything

More information

CS61A Lecture 38. Robert Huang UC Berkeley April 17, 2013

CS61A Lecture 38. Robert Huang UC Berkeley April 17, 2013 CS61A Lecture 38 Robert Huang UC Berkeley April 17, 2013 Announcements HW12 due Wednesday Scheme project, contest out Review: Program Generator A computer program is just a sequence of bits It is possible

More information

Course notes for Data Compression - 2 Kolmogorov complexity Fall 2005

Course notes for Data Compression - 2 Kolmogorov complexity Fall 2005 Course notes for Data Compression - 2 Kolmogorov complexity Fall 2005 Peter Bro Miltersen September 29, 2005 Version 2.0 1 Kolmogorov Complexity In this section, we present the concept of Kolmogorov Complexity

More information

Divisibility Rules and Their Explanations

Divisibility Rules and Their Explanations Divisibility Rules and Their Explanations Increase Your Number Sense These divisibility rules apply to determining the divisibility of a positive integer (1, 2, 3, ) by another positive integer or 0 (although

More information

Understanding Recursion

Understanding Recursion Understanding Recursion sk, rob and dbtucker (modified for CS 536 by kfisler) 2002-09-20 Writing a Recursive Function Can we write the factorial function in AFunExp? Well, we currently don t have multiplication,

More information

Grade 6 Math Circles November 6 & Relations, Functions, and Morphisms

Grade 6 Math Circles November 6 & Relations, Functions, and Morphisms Faculty of Mathematics Waterloo, Ontario N2L 3G1 Centre for Education in Mathematics and Computing Relations Let s talk about relations! Grade 6 Math Circles November 6 & 7 2018 Relations, Functions, and

More information

Lecture 3: Recursion; Structural Induction

Lecture 3: Recursion; Structural Induction 15-150 Lecture 3: Recursion; Structural Induction Lecture by Dan Licata January 24, 2012 Today, we are going to talk about one of the most important ideas in functional programming, structural recursion

More information

An Interesting Way to Combine Numbers

An Interesting Way to Combine Numbers An Interesting Way to Combine Numbers Joshua Zucker and Tom Davis October 12, 2016 Abstract This exercise can be used for middle school students and older. The original problem seems almost impossibly

More information

Statistics Case Study 2000 M. J. Clancy and M. C. Linn

Statistics Case Study 2000 M. J. Clancy and M. C. Linn Statistics Case Study 2000 M. J. Clancy and M. C. Linn Problem Write and test functions to compute the following statistics for a nonempty list of numeric values: The mean, or average value, is computed

More information

Starting Boolean Algebra

Starting Boolean Algebra Boolean Algebra March 2, 27 Diagram for FunChip2 Here is a picture of FunChip2 that we created more or less randomly in class on /25 (used in various Activities): Starting Boolean Algebra Boolean algebra

More information

Typing Control. Chapter Conditionals

Typing Control. Chapter Conditionals Chapter 26 Typing Control 26.1 Conditionals Let s expand our language with a conditional construct. We can use if0 like before, but for generality it s going to be more convenient to have a proper conditional

More information

SOFTWARE ENGINEERING DESIGN I

SOFTWARE ENGINEERING DESIGN I 2 SOFTWARE ENGINEERING DESIGN I 3. Schemas and Theories The aim of this course is to learn how to write formal specifications of computer systems, using classical logic. The key descriptional technique

More information

Lecture 2: SML Basics

Lecture 2: SML Basics 15-150 Lecture 2: SML Basics Lecture by Dan Licata January 19, 2012 I d like to start off by talking about someone named Alfred North Whitehead. With someone named Bertrand Russell, Whitehead wrote Principia

More information

Lecture 3: Constructing the Natural Numbers

Lecture 3: Constructing the Natural Numbers Math/CS 120: Intro. to Math Professor: Padraic Bartlett Lecture 3: Constructing the Natural Numbers Weeks 3-4 UCSB 2014 When we defined what a proof was in our first set of lectures, we mentioned that

More information

4.1 Review - the DPLL procedure

4.1 Review - the DPLL procedure Applied Logic Lecture 4: Efficient SAT solving CS 4860 Spring 2009 Thursday, January 29, 2009 The main purpose of these notes is to help me organize the material that I used to teach today s lecture. They

More information

3.1 Constructions with sets

3.1 Constructions with sets 3 Interlude on sets Sets and functions are ubiquitous in mathematics. You might have the impression that they are most strongly connected with the pure end of the subject, but this is an illusion: think

More information

To prove something about all Boolean expressions, we will need the following induction principle: Axiom 7.1 (Induction over Boolean expressions):

To prove something about all Boolean expressions, we will need the following induction principle: Axiom 7.1 (Induction over Boolean expressions): CS 70 Discrete Mathematics for CS Fall 2003 Wagner Lecture 7 This lecture returns to the topic of propositional logic. Whereas in Lecture 1 we studied this topic as a way of understanding proper reasoning

More information

the Computability Hierarchy

the Computability Hierarchy 2013 0 the Computability Hierarchy Eric Hehner Department of Computer Science, University of Toronto hehner@cs.utoronto.ca Abstract A computability hierarchy cannot be constructed by halting oracles. Introduction

More information

Limitations of Algorithmic Solvability In this Chapter we investigate the power of algorithms to solve problems Some can be solved algorithmically and

Limitations of Algorithmic Solvability In this Chapter we investigate the power of algorithms to solve problems Some can be solved algorithmically and Computer Language Theory Chapter 4: Decidability 1 Limitations of Algorithmic Solvability In this Chapter we investigate the power of algorithms to solve problems Some can be solved algorithmically and

More information

What if current foundations of mathematics are inconsistent? Vladimir Voevodsky September 25, 2010

What if current foundations of mathematics are inconsistent? Vladimir Voevodsky September 25, 2010 What if current foundations of mathematics are inconsistent? Vladimir Voevodsky September 25, 2010 1 Goedel s second incompleteness theorem Theorem (Goedel) It is impossible to prove the consistency of

More information

Week - 01 Lecture - 03 Euclid's Algorithm for gcd. Let us continue with our running example of gcd to explore more issues involved with program.

Week - 01 Lecture - 03 Euclid's Algorithm for gcd. Let us continue with our running example of gcd to explore more issues involved with program. Programming, Data Structures and Algorithms in Python Prof. Madhavan Mukund Department of Computer Science and Engineering Indian Institute of Technology, Madras Week - 01 Lecture - 03 Euclid's Algorithm

More information

Denotational semantics

Denotational semantics 1 Denotational semantics 2 What we're doing today We're looking at how to reason about the effect of a program by mapping it into mathematical objects Specifically, answering the question which function

More information

MergeSort, Recurrences, Asymptotic Analysis Scribe: Michael P. Kim Date: April 1, 2015

MergeSort, Recurrences, Asymptotic Analysis Scribe: Michael P. Kim Date: April 1, 2015 CS161, Lecture 2 MergeSort, Recurrences, Asymptotic Analysis Scribe: Michael P. Kim Date: April 1, 2015 1 Introduction Today, we will introduce a fundamental algorithm design paradigm, Divide-And-Conquer,

More information

Interpretations and Models. Chapter Axiomatic Systems and Incidence Geometry

Interpretations and Models. Chapter Axiomatic Systems and Incidence Geometry Interpretations and Models Chapter 2.1-2.4 - Axiomatic Systems and Incidence Geometry Axiomatic Systems in Mathematics The gold standard for rigor in an area of mathematics Not fully achieved in most areas

More information

Text Input and Conditionals

Text Input and Conditionals Text Input and Conditionals Text Input Many programs allow the user to enter information, like a username and password. Python makes taking input from the user seamless with a single line of code: input()

More information

Recitation 4: Elimination algorithm, reconstituted graph, triangulation

Recitation 4: Elimination algorithm, reconstituted graph, triangulation Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science 6.438 Algorithms For Inference Fall 2014 Recitation 4: Elimination algorithm, reconstituted graph, triangulation

More information

ISA 562: Information Security, Theory and Practice. Lecture 1

ISA 562: Information Security, Theory and Practice. Lecture 1 ISA 562: Information Security, Theory and Practice Lecture 1 1 Encryption schemes 1.1 The semantics of an encryption scheme. A symmetric key encryption scheme allows two parties that share a secret key

More information

CS 4349 Lecture October 18th, 2017

CS 4349 Lecture October 18th, 2017 CS 4349 Lecture October 18th, 2017 Main topics for #lecture include #minimum_spanning_trees. Prelude Homework 6 due today. Homework 7 due Wednesday, October 25th. Homework 7 has one normal homework problem.

More information

MITOCW watch?v=4dj1oguwtem

MITOCW watch?v=4dj1oguwtem MITOCW watch?v=4dj1oguwtem PROFESSOR: So it's time to examine uncountable sets. And that's what we're going to do in this segment. So Cantor's question was, are all sets the same size? And he gives a definitive

More information

Chapter 11 :: Functional Languages

Chapter 11 :: Functional Languages Chapter 11 :: Functional Languages Programming Language Pragmatics Michael L. Scott Copyright 2016 Elsevier 1 Chapter11_Functional_Languages_4e - Tue November 21, 2017 Historical Origins The imperative

More information

To prove something about all Boolean expressions, we will need the following induction principle: Axiom 7.1 (Induction over Boolean expressions):

To prove something about all Boolean expressions, we will need the following induction principle: Axiom 7.1 (Induction over Boolean expressions): CS 70 Discrete Mathematics for CS Spring 2005 Clancy/Wagner Notes 7 This lecture returns to the topic of propositional logic. Whereas in Lecture Notes 1 we studied this topic as a way of understanding

More information

Notes on Non-Chronologic Backtracking, Implication Graphs, and Learning

Notes on Non-Chronologic Backtracking, Implication Graphs, and Learning Notes on Non-Chronologic Backtracking, Implication Graphs, and Learning Alan J. Hu for CpSc 5 Univ. of British Columbia 00 February 9 These are supplementary notes on these aspects of a modern DPLL-style

More information

9. MATHEMATICIANS ARE FOND OF COLLECTIONS

9. MATHEMATICIANS ARE FOND OF COLLECTIONS get the complete book: http://wwwonemathematicalcatorg/getfulltextfullbookhtm 9 MATHEMATICIANS ARE FOND OF COLLECTIONS collections Collections are extremely important in life: when we group together objects

More information

CMSC 330: Organization of Programming Languages. Operational Semantics

CMSC 330: Organization of Programming Languages. Operational Semantics CMSC 330: Organization of Programming Languages Operational Semantics Notes about Project 4, Parts 1 & 2 Still due today (7/2) Will not be graded until 7/11 (along with Part 3) You are strongly encouraged

More information

Topology and Topological Spaces

Topology and Topological Spaces Topology and Topological Spaces Mathematical spaces such as vector spaces, normed vector spaces (Banach spaces), and metric spaces are generalizations of ideas that are familiar in R or in R n. For example,

More information

UNIT 14C The Limits of Computing: Non computable Functions. Problem Classifications

UNIT 14C The Limits of Computing: Non computable Functions. Problem Classifications UNIT 14C The Limits of Computing: Non computable Functions 1 Problem Classifications Tractable Problems Problems that have reasonable, polynomialtime solutions Intractable Problems Problems that may have

More information

Week - 04 Lecture - 01 Merge Sort. (Refer Slide Time: 00:02)

Week - 04 Lecture - 01 Merge Sort. (Refer Slide Time: 00:02) Programming, Data Structures and Algorithms in Python Prof. Madhavan Mukund Department of Computer Science and Engineering Indian Institute of Technology, Madras Week - 04 Lecture - 01 Merge Sort (Refer

More information

Shorthand for values: variables

Shorthand for values: variables Chapter 2 Shorthand for values: variables 2.1 Defining a variable You ve typed a lot of expressions into the computer involving pictures, but every time you need a different picture, you ve needed to find

More information

Lecture 5. Logic I. Statement Logic

Lecture 5. Logic I. Statement Logic Ling 726: Mathematical Linguistics, Logic. Statement Logic V. Borschev and B. Partee, September 27, 2 p. Lecture 5. Logic I. Statement Logic. Statement Logic...... Goals..... Syntax of Statement Logic....2.

More information

Reflection in the Chomsky Hierarchy

Reflection in the Chomsky Hierarchy Reflection in the Chomsky Hierarchy Henk Barendregt Venanzio Capretta Dexter Kozen 1 Introduction We investigate which classes of formal languages in the Chomsky hierarchy are reflexive, that is, contain

More information

05. Turing Machines and Spacetime. I. Turing Machines and Classical Computability.

05. Turing Machines and Spacetime. I. Turing Machines and Classical Computability. 05. Turing Machines and Spacetime. I. Turing Machines and Classical Computability. 1. Turing Machines A Turing machine (TM) consists of (Turing 1936): Alan Turing 1. An unbounded tape. Divided into squares,

More information

Proofwriting Checklist

Proofwriting Checklist CS103 Winter 2019 Proofwriting Checklist Cynthia Lee Keith Schwarz Over the years, we ve found many common proofwriting errors that can easily be spotted once you know how to look for them. In this handout,

More information

From the λ-calculus to Functional Programming Drew McDermott Posted

From the λ-calculus to Functional Programming Drew McDermott Posted From the λ-calculus to Functional Programming Drew McDermott drew.mcdermott@yale.edu 2015-09-28 Posted 2015-10-24 The λ-calculus was intended from its inception as a model of computation. It was used by

More information

Fundamental Concepts. Chapter 1

Fundamental Concepts. Chapter 1 Chapter 1 Fundamental Concepts This book is about the mathematical foundations of programming, with a special attention on computing with infinite objects. How can mathematics help in programming? There

More information

Semantics via Syntax. f (4) = if define f (x) =2 x + 55.

Semantics via Syntax. f (4) = if define f (x) =2 x + 55. 1 Semantics via Syntax The specification of a programming language starts with its syntax. As every programmer knows, the syntax of a language comes in the shape of a variant of a BNF (Backus-Naur Form)

More information

CPS122 Lecture: From Python to Java last revised January 4, Objectives:

CPS122 Lecture: From Python to Java last revised January 4, Objectives: Objectives: CPS122 Lecture: From Python to Java last revised January 4, 2017 1. To introduce the notion of a compiled language 2. To introduce the notions of data type and a statically typed language 3.

More information

COMPUTABILITY THEORY AND RECURSIVELY ENUMERABLE SETS

COMPUTABILITY THEORY AND RECURSIVELY ENUMERABLE SETS COMPUTABILITY THEORY AND RECURSIVELY ENUMERABLE SETS JOSHUA LENERS Abstract. An algorithm is function from ω to ω defined by a finite set of instructions to transform a given input x to the desired output

More information

This is already grossly inconvenient in present formalisms. Why do we want to make this convenient? GENERAL GOALS

This is already grossly inconvenient in present formalisms. Why do we want to make this convenient? GENERAL GOALS 1 THE FORMALIZATION OF MATHEMATICS by Harvey M. Friedman Ohio State University Department of Mathematics friedman@math.ohio-state.edu www.math.ohio-state.edu/~friedman/ May 21, 1997 Can mathematics be

More information

1 Achieving IND-CPA security

1 Achieving IND-CPA security ISA 562: Information Security, Theory and Practice Lecture 2 1 Achieving IND-CPA security 1.1 Pseudorandom numbers, and stateful encryption As we saw last time, the OTP is perfectly secure, but it forces

More information

(Refer Slide Time: 4:00)

(Refer Slide Time: 4:00) Principles of Programming Languages Dr. S. Arun Kumar Department of Computer Science & Engineering Indian Institute of Technology, Delhi Lecture - 38 Meanings Let us look at abstracts namely functional

More information

THE HALTING PROBLEM. Joshua Eckroth Chautauqua Nov

THE HALTING PROBLEM. Joshua Eckroth Chautauqua Nov THE HALTING PROBLEM Joshua Eckroth Chautauqua Nov 10 2015 The year is 1928 Sliced bread is invented. Calvin Coolidge is President. David Hilbert challenged mathematicians to solve the Entscheidungsproblem:

More information

This Lecture. We will first introduce some basic set theory before we do counting. Basic Definitions. Operations on Sets.

This Lecture. We will first introduce some basic set theory before we do counting. Basic Definitions. Operations on Sets. Sets A B C This Lecture We will first introduce some basic set theory before we do counting. Basic Definitions Operations on Sets Set Identities Defining Sets Definition: A set is an unordered collection

More information

Programming Languages Third Edition

Programming Languages Third Edition Programming Languages Third Edition Chapter 12 Formal Semantics Objectives Become familiar with a sample small language for the purpose of semantic specification Understand operational semantics Understand

More information

Consider a description of arithmetic. It includes two equations that define the structural types of digit and operator:

Consider a description of arithmetic. It includes two equations that define the structural types of digit and operator: Syntax A programming language consists of syntax, semantics, and pragmatics. We formalize syntax first, because only syntactically correct programs have semantics. A syntax definition of a language lists

More information

1.7 Limit of a Function

1.7 Limit of a Function 1.7 Limit of a Function We will discuss the following in this section: 1. Limit Notation 2. Finding a it numerically 3. Right and Left Hand Limits 4. Infinite Limits Consider the following graph Notation:

More information

2SKILL. Variables Lesson 6. Remembering numbers (and other stuff)...

2SKILL. Variables Lesson 6. Remembering numbers (and other stuff)... Remembering numbers (and other stuff)... Let s talk about one of the most important things in any programming language. It s called a variable. Don t let the name scare you. What it does is really simple.

More information

These are notes for the third lecture; if statements and loops.

These are notes for the third lecture; if statements and loops. These are notes for the third lecture; if statements and loops. 1 Yeah, this is going to be the second slide in a lot of lectures. 2 - Dominant language for desktop application development - Most modern

More information

We show that the composite function h, h(x) = g(f(x)) is a reduction h: A m C.

We show that the composite function h, h(x) = g(f(x)) is a reduction h: A m C. 219 Lemma J For all languages A, B, C the following hold i. A m A, (reflexive) ii. if A m B and B m C, then A m C, (transitive) iii. if A m B and B is Turing-recognizable, then so is A, and iv. if A m

More information

Excerpt from "Art of Problem Solving Volume 1: the Basics" 2014 AoPS Inc.

Excerpt from Art of Problem Solving Volume 1: the Basics 2014 AoPS Inc. Chapter 5 Using the Integers In spite of their being a rather restricted class of numbers, the integers have a lot of interesting properties and uses. Math which involves the properties of integers is

More information

(Refer Slide Time: 01.26)

(Refer Slide Time: 01.26) Data Structures and Algorithms Dr. Naveen Garg Department of Computer Science and Engineering Indian Institute of Technology, Delhi Lecture # 22 Why Sorting? Today we are going to be looking at sorting.

More information

Introduction to Homotopy Type Theory

Introduction to Homotopy Type Theory Introduction to Homotopy Type Theory Lecture notes for a course at EWSCS 2017 Thorsten Altenkirch March 5, 2017 1 What is this course about? To explain what Homotopy Type Theory is, I will first talk about

More information

Logic: The Big Picture. Axiomatizing Arithmetic. Tautologies and Valid Arguments. Graphs and Trees

Logic: The Big Picture. Axiomatizing Arithmetic. Tautologies and Valid Arguments. Graphs and Trees Axiomatizing Arithmetic Logic: The Big Picture Suppose we restrict the domain to the natural numbers, and allow only the standard symbols of arithmetic (+,, =, >, 0, 1). Typical true formulas include:

More information

Grade 7/8 Math Circles Graph Theory - Solutions October 13/14, 2015

Grade 7/8 Math Circles Graph Theory - Solutions October 13/14, 2015 Faculty of Mathematics Waterloo, Ontario N2L 3G1 Centre for Education in Mathematics and Computing Grade 7/8 Math Circles Graph Theory - Solutions October 13/14, 2015 The Seven Bridges of Königsberg In

More information

Introduction to Computer Science

Introduction to Computer Science Introduction to Computer Science A Quick Puzzle Well-Formed Formula any formula that is structurally correct may be meaningless Axiom A statement that is defined to be true Production Rule A rule that

More information

Algorithms and Data Structures

Algorithms and Data Structures Algorithms and Data Structures Spring 2019 Alexis Maciel Department of Computer Science Clarkson University Copyright c 2019 Alexis Maciel ii Contents 1 Analysis of Algorithms 1 1.1 Introduction.................................

More information

Formal Methods of Software Design, Eric Hehner, segment 1 page 1 out of 5

Formal Methods of Software Design, Eric Hehner, segment 1 page 1 out of 5 Formal Methods of Software Design, Eric Hehner, segment 1 page 1 out of 5 [talking head] Formal Methods of Software Engineering means the use of mathematics as an aid to writing programs. Before we can

More information

The Beauty and Joy of Computing 1 Lab Exercise 4: Starting a simple math tutor program and more interaction

The Beauty and Joy of Computing 1 Lab Exercise 4: Starting a simple math tutor program and more interaction The Beauty and Joy of Computing 1 Lab Exercise 4: Starting a simple math tutor program and more interaction Objectives By completing this lab exercise, you should learn to Create your own reporter and

More information

Trombone players produce different pitches partly by varying the length of a tube.

Trombone players produce different pitches partly by varying the length of a tube. Trombone players produce different pitches partly by varying the length of a tube. 7 Variables A variable is a connection between a name and a value.* That sounds simple enough, but some complexities arise

More information

Graph Theory. 1 Introduction to Graphs. Martin Stynes Department of Mathematics, UCC January 26, 2011

Graph Theory. 1 Introduction to Graphs. Martin Stynes Department of Mathematics, UCC   January 26, 2011 Graph Theory Martin Stynes Department of Mathematics, UCC email: m.stynes@ucc.ie January 26, 2011 1 Introduction to Graphs 1 A graph G = (V, E) is a non-empty set of nodes or vertices V and a (possibly

More information

6.001 Notes: Section 1.1

6.001 Notes: Section 1.1 6.001 Notes: Section 1.1 Slide 1.1.1 This first thing we need to do is discuss the focus of 6.001. What is this course all about? This seems quite obvious -- this is a course about computer science. But

More information

(Refer Slide Time 6:48)

(Refer Slide Time 6:48) Digital Circuits and Systems Prof. S. Srinivasan Department of Electrical Engineering Indian Institute of Technology Madras Lecture - 8 Karnaugh Map Minimization using Maxterms We have been taking about

More information