Epimenides, Gödel, Turing: an Eternal Gölden Tangle [0]

Size: px
Start display at page:

Download "Epimenides, Gödel, Turing: an Eternal Gölden Tangle [0]"

Transcription

1 Epimenides, Gödel, Turing: an Eternal Gölden Tangle [0] Eric C.R. Hehner Department of Computer Science, University of Toronto hehner@cs.utoronto.ca Abstract: The Halting Problem is a version of the Liar's Paradox. Epimenides An ancient Cretan named Epimenides is reported to have said All Cretans are liars. [1]. This is supposed to be self-contradictory, but it misses the mark. If there is any other Cretan, and that Cretan is a truth-teller, then Epimenides' sentence is simply false: Epimenides is a liar, but not all Cretans are liars. Saint Paul missed the point completely, taking Epimenides' statement at face value, and elaborating: It was one of themselves, one of their own prophets, who said, Cretans were never anything but liars, dangerous animals, and lazy : and that is a true statement. [5]. I will refer to the simpler sentence This sentence is false. as the Liar's Paradox. If that sentence is true, then, according to the sentence, it is false. If it is false, then it is true. That simple sentence is self-contradictory. I give the sentence a name, say L for Liar. L: L is false. As a mathematical formula, it becomes L = (L=false) As an equation in unknown L, it has no solution, because the equation is false regardless of whether L is true or false. As a definition or specification of L it is called inconsistent. (I am using italic true and false for the binary constants representing truth and falsity.) A slightly more complicated version presents the inconsistency as two sentences. The next sentence is true. The previous sentence is false. Naming the first sentence B and the second G, as mathematical formulas, they become B = (G=true) G = (B=false) These two equations in the two unknowns B and G have no solution: there is no assignment of binary values to B and G that satisfies the two equations. They are inconsistent. If you look at either one of the sentences alone, there is no inconsistency. It may make sense to say that the next sentence is true, and it may make sense to say that the previous sentence is false. But together they are inconsistent. Let me complicate this inconsistency by adding a parameter, so B can say whether any sentence is true, not just sentence G. To reduce contention over truth and falsity, I will stick with mathematical sentences, otherwise known as binary expressions (allowing subexpressions of any type, including functions). To pass sentences as data, we need to encode them in some way. The easiest encoding is as a character string. Now B becomes a function from strings to binary values, and the pair of sentences become B (s) = true if string s represents a binary expression with value true ; false otherwise G = B (G) = false

2 1 Eric Hehner I have made two definitions: B and G. Since G is just a character string, there cannot be anything wrong with its definition; it represents the binary expression B (G) = false. But the definition of B, no matter how carefully worded, no matter how clear it sounds, conceals an inconsistency. I am not concerned with computing B ; I just want to define a mathematical function. The parameter allows us to show a large number of examples, like B ( 0=0 ) = true and B ( 0=1 ) = false, which are not problematic. They may fool us into believing that the definition of B makes sense. But they are irrelevant. The inconsistency is revealed by applying B to G. If B (G) = true, then G represents a false expression, so B (G) should be false. If B (G) = false, then G represents a true expression, so B (G) should be true. The inconsistency is the same as in the unparameterized, unencoded version of the Liar's Paradox. Gödel The Liar's Paradox is about truth. Gödel used the same self-contradictory construction to talk about provability [2]. He used a numeric, rather than string, encoding of sentences, and he used the name Bew (short for Beweisbar, which is German for provable) for a function similar to B. The sentence encoded by G is popularly called the Gödel sentence. With our notations and encoding, B and G become B (s) = true if string s represents a provable binary expression; false otherwise G = B (G) = false Now we ask: Is B (G) = true? If we suppose B (G) = true, then G represents a false sentence, and in a consistent logic, no false sentence is provable, so B (G) should be false. If we suppose B (G) = false, then G represents a true sentence, and in a complete logic, all true sentences are provable, so B (G) should be true. Gödel concluded that if a logic is expressive enough to define B, then the logic is either inconsistent or incomplete. Turing Epimenides talked about truth; Gödel talked about provability; Turing talked about computability using the same sort of arguments [4]. For my examples, I will use the Pascal programming language, but the choice of language is irrelevant; any other general-purpose programming language would do just as well. I'll start with a procedure named liar that is closely analogous to the Liar's Paradox. procedure liar; if (execution of liar terminates) then liar I have not finished writing procedure liar ; what remains is to replace the informal binary expression (execution of liar terminates) with either true or false, whichever one is appropriate. The problem in doing so is that the informal binary expression refers to itself in a self-contradictory manner: if the execution of procedure liar terminates, it should be replaced with true, creating a procedure whose execution does not terminate; if the execution of liar does not terminate, it should be replaced with false, creating a procedure whose execution does terminate. This is not a programming problem, not a computability problem, not a lack of expressiveness of Pascal. The problem is that the informal binary expression is an inconsistent specification. One might protest: Either execution of liar terminates, or it doesn't. If it terminates, use true ; if it doesn't, use false. How can there possibly be an inconsistency? But I hope the inconsistency is clear enough that no-one will protest.

3 Epimenides, Gödel, Turing: an Eternal Gölden Tangle 2 As we did with the Liar's Paradox, let's present the same inconsistency as two declarations. function halts: boolean; { return true if execution of diag terminates; } { return false otherwise } procedure diag; if halts then diag The header of function halts appears but its body is missing. In place of the body there is a comment to specify what the body should be. If execution of procedure diag terminates, then the body should be halts:= true. If execution of procedure diag does not terminate, then the body should be halts:= false. So there is no problem in programming the body. The problem is to decide whether execution of diag terminates. If we suppose it does, then halts should return true, and so we see that execution of diag does not terminate. If we suppose it does not, then halts should return false, and so we see that execution of diag does terminate. Procedure diag has been written in its entirety. Syntactically, it is a procedure; to determine that halts is being used correctly within diag, we need only the header for halts, not the body, and we have the header. Semantically, it is a procedure; to determine the meaning of the call to halts within diag, we need only the specification of halts, not its implementation, and we have the specification. (That important programming principle enables a programmer to call procedures written by other people, knowing only the specification, not the implementation. It also enables a programmer to change the implementation of a procedure, but still satisfying the specification, without knowing where and why the procedure is being called.) So there is nothing wrong with the definition of diag. The problem is that we cannot write the body of halts to satisfy its specification. This is not a programming problem, not a computability problem, not a lack of expressiveness of Pascal. The problem is that the specification of the body of halts is inconsistent. One might protest: Either execution of diag terminates, or it doesn't. If it terminates, use halts:= true ; if it doesn't, use halts:= false. How can there possibly be an inconsistency? The inconsistency cannot be seen by looking only at halts or only at diag. Each refers to the other, and together they are inconsistent. Let me complicate this inconsistency by adding a parameter, so halts can say whether execution of any parameterless Pascal procedure terminates, not just diag. To pass procedures as data, we need to encode them in some way, and the easiest encoding is as a character string. (Whenever programs are presented as input data to a compiler or interpreter, they are presented as character strings.) We assume there is a dictionary of function and procedure definitions that is accessible to halts, so that the call halts ('diag') allows halts to look up 'diag' and 'halts' in the dictionary, and retrieve their texts for analysis. function halts (p: string): boolean; { return true if p represents a parameterless Pascal procedure whose execution terminates; } { return false otherwise } procedure diag; if halts ('diag') then diag

4 3 Eric Hehner To determine that diag is syntactically a Pascal procedure, we need only the header for halts, not the body, and we have the header. To determine the semantics of diag, we need only the specification of halts, not its implementation, and we have the specification. As before, we cannot write the body of halts to satisfy the specification. No matter how carefully worded it is, no matter how clear it sounds, the specification conceals an inconsistency. The inconsistency is revealed by applying halts to 'diag'. If halts ('diag') = true, then execution of diag is nonterminating, so halts ('diag') should be false. If halts ('diag') = false, then execution of diag is terminating, so halts ('diag') should be true. This is still not a programming problem, not a computability problem, not a lack of expressiveness of Pascal. It is still the same inconsistency that was present in the unparameterized, unencoded version, and the same inconsistency that was present in the liar procedure. One might protest: Either execution of a procedure represented by p terminates, or it doesn't. If it terminates, halts (p) should return true ; if it doesn't, halts (p) should return false. How can there possibly be an inconsistency? Now the protest starts to sound more plausible because the parameter allows us to show a large number of examples which are not problematic. For example, if we define stop and go as procedure stop; procedure go; go then halts ('stop') = true halts ('go') = false These nonproblematic examples may fool us into believing that the specification of halts makes sense. But they are irrelevant. Procedure diag shows us the inconsistency. There is one last complication: a second parameter so halts can say whether execution of any Pascal procedure with an input parameter terminates. function halts (p, i: string): boolean; { return true if p represents a Pascal procedure with one string input parameter } { whose execution terminates when given input i ; return false otherwise } procedure diag (s: string); if halts (s, s) then diag (s) This is now a modern version of Turing's Halting Problem. Turing's argument is as follows. Assume that halts is computable, and that it has been programmed according to its specification. Does execution of diag ('diag') terminate? If it terminates, then halts ('diag', 'diag') returns true, and so we see from the body of diag that execution of diag ('diag') does not terminate. If it does not terminate, then halts ('diag', 'diag') returns false, and so we see from the body of diag that execution of diag ('diag') terminates. This is inconsistent. Therefore function halts cannot have been programmed according to its specification; halts is incomputable. The two parameters (p, i) make a two-dimensional space, and point ('diag', 'diag') is on its diagonal, which is why the argument is called a diagonal argument, and why I named the procedure diag. But any string would do equally well as a value for the second parameter, and the second parameter adds nothing to Turing's argument. The surprise, and the main point of this paper, is that the computability assumption is

5 Epimenides, Gödel, Turing: an Eternal Gölden Tangle 4 unnecessary to the argument. Without assuming that halts is computable, I ask what the specification of halts says the result of halts ('diag', 'diag') should be. If the specification says the result should be true, then the semantics of diag ('diag') is nontermination, so halts ('diag', 'diag') should be false. If the specification says the result should be false, then the semantics of diag ('diag') is termination, so halts ('diag', 'diag') should be true. This is inconsistent. Therefore halts cannot be programmed according to its specification. But the problem is not incomputability; it is inconsistency of specification. It is the same inconsistency that was present in all previous versions, before I added the complications of parameters and encodings. It is just the Liar's Paradox in fancy clothing. In fact, Turing's argument could have been applied to procedure liar with equal (in)validity. procedure liar; if (execution of liar terminates) then liar Assume that the expression (execution of liar terminates) is computable, and that it has been programmed according to its specification. Does execution of liar terminate? If it terminates, then (execution of liar terminates) is true, and so we see from the body of liar that its execution does not terminate. If it does not terminate, then (execution of liar terminates) is false, and so we see from the body of liar that its execution terminates. This is inconsistent. Therefore the expression (execution of liar terminates) cannot have been programmed according to its specification; it is incomputable. Turing's argument can be applied to any property of program execution. For example, procedure liar1; if (execution of liar1 prints 'A' ) then print ('B') else print ('A') Termination of execution of liar1 is not in question: when (execution of liar1 prints 'A' ) is replaced with either true or false, whichever is appropriate, execution of liar1 terminates. The question is whether 'A' or 'B' is printed. Turing's argument says that the property prints 'A' is incomputable, and so is every property of program execution (except for the trivial always true and always false properties) [3]. But the problem is not incomputability; the problem is inconsistency of specification. Underdetermination The Liar's Paradox, the Gödel sentence, and Halting Problem are all examples of inconsistency, which is also known as overdetermination. Here, determination means ruling out possible solutions: if we rule out all possible solutions, we have overdetermination; if we are left with more than one possible solution, we have underdetermination. An example is the sentence This sentence is true. Whereas the Liar's Paradox can be neither true nor false, the sentence just written can be either true or false. Giving the sentence the name U for underdetermined, it becomes the formula U = (U=true) As an equation in unknown U, it has two solutions: both true and false. Here is another example. B (s) = true if string s represents a provable binary expression; false otherwise H = B (H) = true

6 5 Eric Hehner Now we ask: Is B (H) = true? If we suppose B (H) = true, then H represents a true sentence, and in a complete logic, all true sentences are provable, so B (H) should be true, as supposed. If we suppose B (H) = false, then H represents a false sentence, and in a consistent logic, no false sentence is provable, so B (H) should be false, as supposed. The specification of B is both overdetermined (for G ) and underdetermined (for H ). Here is the final example. function halts (p, i: string): boolean; { return true if p represents a Pascal procedure with one string input parameter } { whose execution terminates when given input i ; return false otherwise } procedure what (s: string); if not halts (s, s) then what (s) That is the same halts specification as before; it says that the halts function will tell us whether the execution of a procedure terminates. What does it say about what? If we suppose that halts ('what', 'what') = true, we see from the body of what that its execution terminates, so that was the right supposition. If we suppose that halts ('what', 'what') = false, we see from the body of what that its execution does not terminate, so again that was the right supposition. We have come to another inadequacy of the halts specification. The specification sounds just right: neither overdetermined nor underdetermined. But we are forced by the examples to admit that the specification is not as it sounds. In at least one instance ( diag ), the halts specification is overdetermined, and in at least one instance ( what ), the halts specification is underdetermined. Conclusion Epimenides' conclusion was: It is inconsistent to ask for a function whose result is true for all and only those strings representing true sentences in a sufficiently expressive language. Gödel's conclusion was: It is inconsistent to ask for a function whose result is true for all and only those strings representing provable sentences in a sufficiently expressive language. Turing's conclusion should have been: It is inconsistent to ask for a function, written in a programming language, whose result is true for all and only those strings representing procedures, written in that same language, whose execution terminates. If incomputable meant having an inconsistent specification, then halts would be incomputable. But incomputable does not mean inconsistent. It means that a well-defined mathematical function, one with a consistent specification, cannot be computed using a Turing- Machine-equivalent programming language. That question has not been addressed. Conjecture I conjecture that every consistent first-order specification is satisfied by a computable function. This conjecture is a bit like the Löwenheim-Skolem theorem that every consistent first-order theory has a countable model.

7 Epimenides, Gödel, Turing: an Eternal Gölden Tangle 6 References [0] The title of this paper pays homage to the wonderful book by Douglas R. Hofstadter: Gödel, Escher, Bach: an Eternal Golden Braid. Basic Books, 1979 [1] Epimenides Paradox, Wikipedia, [2] K.Gödel: über Formal Unentscheidbare Sätze de Principia Mathematica und Verwandter Systeme I, Monatshefte für Mathematik und Physik v.38 p , Leipzig, 1931 [3] H.G.Rice: Classes of Recursively Enumerable Sets and their Decision Problems, Transactions of the American Mathematical Society v.74 p , 1953 [4] A.M.Turing: on Computable Numbers with an Application to the Entscheidungsproblem, Proceedings of the London Mathematical Society s.2 v.42 p , 1936; correction s.2 v.43 p , 1937 [5] The Jerusalem Bible, Reader's Edition, Titus, chapter 1 verse 12 other papers on halting

How to Compute Halting

How to Compute Halting 2015-1-2 0 How to Compute Halting Eric C.R. Hehner Department of Computer Science, University of Toronto hehner@cs.utoronto.ca Abstract: A consistently specified halting function may be computed. Halting

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

What is a Procedure?

What is a Procedure? 2015-12-10 0 Question and Answers What is a Procedure? Eric C.R. Hehner Department of Computer Science, University of Toronto hehner@cs.utoronto.ca What is the meaning of a procedure? This question is

More information

Objective and Subjective Specifications

Objective and Subjective Specifications 2017-7-10 0 Objective and Subjective Specifications Eric C.R. Hehner Department of Computer Science, University of Toronto hehner@cs.utoronto.ca Abstract: We examine specifications for dependence on the

More information

Java s Precedence. Extended Grammar for Boolean Expressions: Implication. Parse tree. Highest precedence. Lowest precedence

Java s Precedence. Extended Grammar for Boolean Expressions: Implication. Parse tree. Highest precedence. Lowest precedence The Tiling Problem The Halting Problem Highest precedence Java s Precedence G!del, Escher, Bach Natural, yet unsolvable problems Adding variables Adding operators Lecture 19 Lab 4: A Matter of Expression

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

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

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

Formal Methods of Software Design, Eric Hehner, segment 24 page 1 out of 5 Formal Methods of Software Design, Eric Hehner, segment 24 page 1 out of 5 [talking head] This lecture we study theory design and implementation. Programmers have two roles to play here. In one role, they

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

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

This book is licensed under a Creative Commons Attribution 3.0 License

This book is licensed under a Creative Commons Attribution 3.0 License 6. Syntax Learning objectives: syntax and semantics syntax diagrams and EBNF describe context-free grammars terminal and nonterminal symbols productions definition of EBNF by itself parse tree grammars

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

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

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

Kurt Gödel and Computability Theory

Kurt Gödel and Computability Theory University of Calgary, Canada www.ucalgary.ca/ rzach/ CiE 2006 July 5, 2006 Importance of Logical Pioneers to CiE Wilhelm Ackermann Paul Bernays Alonzo Church Gerhard Gentzen Kurt Gödel Stephen Kleene

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

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

THEORY OF COMPUTATION

THEORY OF COMPUTATION Chapter Eleven THEORY OF COMPUTATION Chapter Summary This chapter introduces the subjects of computability as well as problem classification according to (time) complexity. It begins by presenting the

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

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

axiomatic semantics involving logical rules for deriving relations between preconditions and postconditions.

axiomatic semantics involving logical rules for deriving relations between preconditions and postconditions. CS 6110 S18 Lecture 18 Denotational Semantics 1 What is Denotational Semantics? So far we have looked at operational semantics involving rules for state transitions, definitional semantics involving translations

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

arxiv: v2 [cs.lo] 29 Sep 2015

arxiv: v2 [cs.lo] 29 Sep 2015 Avoiding Contradictions in the Paradoxes, the Halting Problem, and Diagonalization arxiv:1509.08003v2 [cs.lo] 29 Sep 2015 Abstract The fundamental proposal in this article is that logical formulas of the

More information

Chapter Summary. Mathematical Induction Recursive Definitions Structural Induction Recursive Algorithms

Chapter Summary. Mathematical Induction Recursive Definitions Structural Induction Recursive Algorithms Chapter Summary Mathematical Induction Recursive Definitions Structural Induction Recursive Algorithms Section 5.1 Sec.on Summary Mathematical Induction Examples of Proof by Mathematical Induction Mistaken

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

Computability Mechanizing Reasoning

Computability Mechanizing Reasoning 12 Computability However unapproachable these problems may seem to us and however helpless we stand before them, we have, nevertheless, the firm conviction that their solution must follow by a finite number

More information

Logic and Computation

Logic and Computation Logic and Computation From Conceptualization to Formalization Here's what we do when we build a formal model (or do a computation): 0. Identify a collection of objects/events in the real world. This is

More information

Computability Mechanizing Reasoning

Computability Mechanizing Reasoning 12 Computability However unapproachable these problems may seem to us and however helpless we stand before them, we have, nevertheless, the firm conviction that their solution must follow by a finite number

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

System Correctness. EEC 421/521: Software Engineering. System Correctness. The Problem at Hand. A system is correct when it meets its requirements

System Correctness. EEC 421/521: Software Engineering. System Correctness. The Problem at Hand. A system is correct when it meets its requirements System Correctness EEC 421/521: Software Engineering A Whirlwind Intro to Software Model Checking A system is correct when it meets its requirements a design without requirements cannot be right or wrong,

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

We ve studied the main models and concepts of the theory of computation:

We ve studied the main models and concepts of the theory of computation: CMPSCI 601: Summary & Conclusions Lecture 27 We ve studied the main models and concepts of the theory of computation: Computability: what can be computed in principle Logic: how can we express our requirements

More information

Chapter 3. Describing Syntax and Semantics

Chapter 3. Describing Syntax and Semantics Chapter 3 Describing Syntax and Semantics Chapter 3 Topics Introduction The General Problem of Describing Syntax Formal Methods of Describing Syntax Attribute Grammars Describing the Meanings of Programs:

More information

In order to solve the puzzle, you try to form the string MU starting with the string MI and using the following rules for forming new strings from old

In order to solve the puzzle, you try to form the string MU starting with the string MI and using the following rules for forming new strings from old Formal Systems Nathan Albin October 26, 2005 Godel vs. Principia Mathematica. In the early 1900s, Alfred North Whitehead and Bertrand Russell published three volumes of a work they called Principia Mathematica.

More information

Suppose I have two C programs: M1.c and M2.c

Suppose I have two C programs: M1.c and M2.c Suppose I have two C programs: M1.c and M2.c I remember from a few years ago that one of them halts when I use the Keller 7 graph (which has 16,384 vertices) as input and gives me a Hamilton cycle and

More information

CSC 501 Semantics of Programming Languages

CSC 501 Semantics of Programming Languages CSC 501 Semantics of Programming Languages Subtitle: An Introduction to Formal Methods. Instructor: Dr. Lutz Hamel Email: hamel@cs.uri.edu Office: Tyler, Rm 251 Books There are no required books in this

More information

Type Checking. Outline. General properties of type systems. Types in programming languages. Notation for type rules.

Type Checking. Outline. General properties of type systems. Types in programming languages. Notation for type rules. Outline Type Checking General properties of type systems Types in programming languages Notation for type rules Logical rules of inference Common type rules 2 Static Checking Refers to the compile-time

More information

Outline. General properties of type systems. Types in programming languages. Notation for type rules. Common type rules. Logical rules of inference

Outline. General properties of type systems. Types in programming languages. Notation for type rules. Common type rules. Logical rules of inference Type Checking Outline General properties of type systems Types in programming languages Notation for type rules Logical rules of inference Common type rules 2 Static Checking Refers to the compile-time

More information

Halting misconceived?

Halting misconceived? Halting misconceived? Bill Stoddart August 25, 2017 Abstract The halting problem is considered to be an essential part of the theoretical background to computing. That halting is not in general computable

More information

On Considerations of Language in the Diagonal Proof

On Considerations of Language in the Diagonal Proof On Considerations of Language in the Diagonal Proof James R Meyer 31 January 2019 Abstract This paper analyzes the diagonal proof while taking careful account of considerations of language. The analysis

More information

CS 531: Notes II. January 31, 2014

CS 531: Notes II. January 31, 2014 CS 531: Notes II January 31, 2014 1 Acceptable and Decidable Languages Let P be a program and x be a string. What happens when we run P on on input x. There are there possibilities. i) The program runs

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

6.001 Notes: Section 6.1

6.001 Notes: Section 6.1 6.001 Notes: Section 6.1 Slide 6.1.1 When we first starting talking about Scheme expressions, you may recall we said that (almost) every Scheme expression had three components, a syntax (legal ways of

More information

Elementary Recursive Function Theory

Elementary Recursive Function Theory Chapter 6 Elementary Recursive Function Theory 6.1 Acceptable Indexings In a previous Section, we have exhibited a specific indexing of the partial recursive functions by encoding the RAM programs. Using

More information

Introduction to the Lambda Calculus. Chris Lomont

Introduction to the Lambda Calculus. Chris Lomont Introduction to the Lambda Calculus Chris Lomont 2010 2011 2012 www.lomont.org Leibniz (1646-1716) Create a universal language in which all possible problems can be stated Find a decision method to solve

More information

Operational Semantics. One-Slide Summary. Lecture Outline

Operational Semantics. One-Slide Summary. Lecture Outline Operational Semantics #1 One-Slide Summary Operational semantics are a precise way of specifying how to evaluate a program. A formal semantics tells you what each expression means. Meaning depends on context:

More information

1 Introduction CHAPTER ONE: SETS

1 Introduction CHAPTER ONE: SETS 1 Introduction CHAPTER ONE: SETS Scientific theories usually do not directly describe the natural phenomena under investigation, but rather a mathematical idealization of them that abstracts away from

More information

Introduction to Programming in C Department of Computer Science and Engineering. Lecture No. #43. Multidimensional Arrays

Introduction to Programming in C Department of Computer Science and Engineering. Lecture No. #43. Multidimensional Arrays Introduction to Programming in C Department of Computer Science and Engineering Lecture No. #43 Multidimensional Arrays In this video will look at multi-dimensional arrays. (Refer Slide Time: 00:03) In

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

(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 FOUNDATIONS OF MATHEMATICS

THE FOUNDATIONS OF MATHEMATICS THE FOUNDATIONS OF MATHEMATICS By: Sterling McKay APRIL 21, 2014 LONE STAR - MONTGOMERY Mentor: William R. Brown, MBA Mckay 1 In mathematics, truth is arguably the most essential of its components. Suppose

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

Expressions that talk about themselves. Maarten Fokkinga, University of Twente, dept. INF, Version of May 6, 1994

Expressions that talk about themselves. Maarten Fokkinga, University of Twente, dept. INF, Version of May 6, 1994 Expressions that talk about themselves Maarten Fokkinga, University of Twente, dept. INF, fokkinga@cs.utwente.nl Version of May 6, 1994 Introduction Self-reference occurs frequently in theoretical investigations

More information

false, import, new 1 class Lecture2 { 2 3 "Data types, Variables, and Operators" 4

false, import, new 1 class Lecture2 { 2 3 Data types, Variables, and Operators 4 1 class Lecture2 { 2 3 "Data types, Variables, and Operators" 4 5 } 6 7 // Keywords: 8 byte, short, int, long, char, float, double, boolean, true, false, import, new Zheng-Liang Lu Java Programming 44

More information

Propositional Logic Formal Syntax and Semantics. Computability and Logic

Propositional Logic Formal Syntax and Semantics. Computability and Logic Propositional Logic Formal Syntax and Semantics Computability and Logic Syntax and Semantics Syntax: The study of how expressions are structured (think: grammar) Semantics: The study of the relationship

More information

Software Paradigms (Lesson 4) Functional Programming Paradigm

Software Paradigms (Lesson 4) Functional Programming Paradigm Software Paradigms (Lesson 4) Functional Programming Paradigm Table of Contents 1 Introduction... 2 2 Evaluation of Functions... 3 3 Compositional (Construct) Operators... 4 4 Some Implementation Issues...

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

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

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

"Relations for Relationships"

Relations for Relationships M359 An explanation from Hugh Darwen "Relations for Relationships" This note might help those who have struggled with M359's so-called "relation for relationship" method of representing, in a relational

More information

Software Testing Prof. Meenakshi D Souza Department of Computer Science and Engineering International Institute of Information Technology, Bangalore

Software Testing Prof. Meenakshi D Souza Department of Computer Science and Engineering International Institute of Information Technology, Bangalore Software Testing Prof. Meenakshi D Souza Department of Computer Science and Engineering International Institute of Information Technology, Bangalore Lecture 04 Software Test Automation: JUnit as an example

More information

Operational Semantics

Operational Semantics Operational Semantics #1 One-Slide Summary Operational semantics is a precise way of specifying how to evaluate a program. A formal semantics tells you what each expression means. Meaning depends on context:

More information

The Eval/Apply Cycle Eval. Evaluation and universal machines. Examining the role of Eval. Eval from perspective of language designer

The Eval/Apply Cycle Eval. Evaluation and universal machines. Examining the role of Eval. Eval from perspective of language designer Evaluation and universal machines What is the role of evaluation in defining a language? How can we use evaluation to design a language? The Eval/Apply Cycle Eval Exp & env Apply Proc & args Eval and Apply

More information

What s in an Instance?

What s in an Instance? RPI Computer Science Technical Report #94-18, 1994. What s in an Instance? Christopher A. Welty and David A. Ferrucci RPI Computer Science Dept. Troy, NY 12180 {weltyc,ferrucci}@cs.rpi.edu The notion of

More information

Chapter 2 & 3: Representations & Reasoning Systems (2.2)

Chapter 2 & 3: Representations & Reasoning Systems (2.2) Chapter 2 & 3: A Representation & Reasoning System & Using Definite Knowledge Representations & Reasoning Systems (RRS) (2.2) Simplifying Assumptions of the Initial RRS (2.3) Datalog (2.4) Semantics (2.5)

More information

false, import, new 1 class Lecture2 { 2 3 "Data types, Variables, and Operators" 4

false, import, new 1 class Lecture2 { 2 3 Data types, Variables, and Operators 4 1 class Lecture2 { 2 3 "Data types, Variables, and Operators" 4 5 } 6 7 // Keywords: 8 byte, short, int, long, char, float, double, boolean, true, false, import, new Zheng-Liang Lu Java Programming 44

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

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

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

5. Introduction to the Lambda Calculus. Oscar Nierstrasz

5. Introduction to the Lambda Calculus. Oscar Nierstrasz 5. Introduction to the Lambda Calculus Oscar Nierstrasz Roadmap > What is Computability? Church s Thesis > Lambda Calculus operational semantics > The Church-Rosser Property > Modelling basic programming

More information

CS 106 Winter 2016 Craig S. Kaplan. Module 07 Recursion and fractals Topics. Recursion as an extension of hierarchical modelling Simple fractals

CS 106 Winter 2016 Craig S. Kaplan. Module 07 Recursion and fractals Topics. Recursion as an extension of hierarchical modelling Simple fractals CS 106 Winter 2016 Craig S. Kaplan Module 07 Recursion and fractals Topics Recursion as an extension of hierarchical modelling Simple fractals Readings Learning Processing, Section 13.11 Nature of Code,

More information

Wednesday. Wednesday, September 17, CS 1251 Page 1

Wednesday. Wednesday, September 17, CS 1251 Page 1 CS 1251 Page 1 Wednesday Wednesday, September 17, 2014 8:20 AM Here's another good JavaScript practice site This site approaches things from yet another point of view it will be awhile before we cover

More information

Handout 9: Imperative Programs and State

Handout 9: Imperative Programs and State 06-02552 Princ. of Progr. Languages (and Extended ) The University of Birmingham Spring Semester 2016-17 School of Computer Science c Uday Reddy2016-17 Handout 9: Imperative Programs and State Imperative

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

Menu. Lecture 25: Gödel and Computability. Computability. Proof General Idea. Gödel s Statement

Menu. Lecture 25: Gödel and Computability. Computability. Proof General Idea. Gödel s Statement Lecture 25: Gödel and Computability Menu Review and finish Gödel s Proof from Monday Discuss Quiz Computability Halting Problems Hockey Team CS150: Computer Science University of Virginia Computer Science

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

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

Programming Languages and Techniques (CIS120)

Programming Languages and Techniques (CIS120) Programming Languages and Techniques (CIS120) Bonus Lecture April 13, 2012 Consequences of Code is Data Code is Data Note: most images have been removed from this version of the presentahon. Code is Data

More information

1 Introduction. 3 Syntax

1 Introduction. 3 Syntax CS 6110 S18 Lecture 19 Typed λ-calculus 1 Introduction Type checking is a lightweight technique for proving simple properties of programs. Unlike theorem-proving techniques based on axiomatic semantics,

More information

Programming Proofs and Proving Programs. Nick Benton Microsoft Research, Cambridge

Programming Proofs and Proving Programs. Nick Benton Microsoft Research, Cambridge Programming Proofs and Proving Programs Nick Benton Microsoft Research, Cambridge Coffee is does Greek 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously

More information

Chapter 6 Control Flow. June 9, 2015

Chapter 6 Control Flow. June 9, 2015 Chapter 6 Control Flow June 9, 2015 Expression evaluation It s common in programming languages to use the idea of an expression, which might be a simple object function invocation over some number of arguments

More information

Recursive Definitions, Fixed Points and the Combinator

Recursive Definitions, Fixed Points and the Combinator Recursive Definitions, Fixed Points and the Combinator Dr. Greg Lavender Department of Computer Sciences University of Texas at Austin Recursive Self-Reference Recursive self-reference occurs regularly

More information

Lambda Calculus and Computation

Lambda Calculus and Computation 6.037 Structure and Interpretation of Computer Programs Chelsea Voss csvoss@mit.edu Massachusetts Institute of Technology With material from Mike Phillips and Nelson Elhage February 1, 2018 Limits to Computation

More information

Programming in C++ Prof. Partha Pratim Das Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur

Programming in C++ Prof. Partha Pratim Das Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Programming in C++ Prof. Partha Pratim Das Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Lecture - 08 Constants and Inline Functions Welcome to module 6 of Programming

More information

Simply-Typed Lambda Calculus

Simply-Typed Lambda Calculus #1 Simply-Typed Lambda Calculus #2 Back to School What is operational semantics? When would you use contextual (small-step) semantics? What is denotational semantics? What is axiomatic semantics? What

More information

CS2 Algorithms and Data Structures Note 10. Depth-First Search and Topological Sorting

CS2 Algorithms and Data Structures Note 10. Depth-First Search and Topological Sorting CS2 Algorithms and Data Structures Note 10 Depth-First Search and Topological Sorting In this lecture, we will analyse the running time of DFS and discuss a few applications. 10.1 A recursive implementation

More information

EXTENSIONS OF FIRST ORDER LOGIC

EXTENSIONS OF FIRST ORDER LOGIC EXTENSIONS OF FIRST ORDER LOGIC Maria Manzano University of Barcelona CAMBRIDGE UNIVERSITY PRESS Table of contents PREFACE xv CHAPTER I: STANDARD SECOND ORDER LOGIC. 1 1.- Introduction. 1 1.1. General

More information

3.4 Deduction and Evaluation: Tools Conditional-Equational Logic

3.4 Deduction and Evaluation: Tools Conditional-Equational Logic 3.4 Deduction and Evaluation: Tools 3.4.1 Conditional-Equational Logic The general definition of a formal specification from above was based on the existence of a precisely defined semantics for the syntax

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

To figure this out we need a more precise understanding of how ML works

To figure this out we need a more precise understanding of how ML works Announcements: What are the following numbers: 74/2/70/17 (2:30,2:30,3:35,7:30) PS2 due Thursday 9/20 11:59PM Guest lecture on Tuesday 9/25 o No RDZ office hours next Friday, I am on travel A brief comment

More information

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

6.001 Notes: Section 15.1

6.001 Notes: Section 15.1 6.001 Notes: Section 15.1 Slide 15.1.1 Our goal over the next few lectures is to build an interpreter, which in a very basic sense is the ultimate in programming, since doing so will allow us to define

More information

Introduction to the Lambda Calculus

Introduction to the Lambda Calculus Introduction to the Lambda Calculus Overview: What is Computability? Church s Thesis The Lambda Calculus Scope and lexical address The Church-Rosser Property Recursion References: Daniel P. Friedman et

More information

Problem Solving through Programming In C Prof. Anupam Basu Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur

Problem Solving through Programming In C Prof. Anupam Basu Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur Problem Solving through Programming In C Prof. Anupam Basu Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur Lecture 18 Switch Statement (Contd.) And Introduction to

More information

Recursion Theorems and Self-Replication Via Text Register Machine Programs

Recursion Theorems and Self-Replication Via Text Register Machine Programs Recursion Theorems and Self-Replication Via Text Register Machine Programs Lawrence S. Moss Abstract Register machine programs provide explicit proofs of the s m n -Theorem, Kleene s Second Recursion Theorem,

More information

Sets. {1, 2, 3, Calvin}.

Sets. {1, 2, 3, Calvin}. ets 2-24-2007 Roughly speaking, a set is a collection of objects. he objects are called the members or the elements of the set. et theory is the basis for mathematics, and there are a number of axiom systems

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

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

6.001 Notes: Section 4.1

6.001 Notes: Section 4.1 6.001 Notes: Section 4.1 Slide 4.1.1 In this lecture, we are going to take a careful look at the kinds of procedures we can build. We will first go back to look very carefully at the substitution model,

More information

Duke University. Information Searching Models. Xianjue Huang. Math of the Universe. Hubert Bray

Duke University. Information Searching Models. Xianjue Huang. Math of the Universe. Hubert Bray Duke University Information Searching Models Xianjue Huang Math of the Universe Hubert Bray 24 July 2017 Introduction Information searching happens in our daily life, and even before the computers were

More information