Type Systems. Today. 1. What is the Lambda Calculus. 1. What is the Lambda Calculus. Lecture 2 Oct. 27th, 2004 Sebastian Maneth
|
|
- Ethelbert Sydney Booth
- 5 years ago
- Views:
Transcription
1 Today 1. What is the Lambda Calculus? Type Systems 2. Its Syntax and Semantics 3. Church Booleans and Church Numerals 4. Lazy vs. Eager Evaluation (call-by-name vs. call-by-value) Lecture 2 Oct. 27th, 2004 Sebastian Maneth 1. What is the Lambda Calculus introduced in late 1930 s by Alonzo Church and Stephen Kleene 1. What is the Lambda Calculus introduced in late 1930 s by Alonzo Church and Stephen Kleene used in 1936 by Church to prove the undecidability of the Entscheidungsproblem can compute the same as Turing Machines, which is everything we can (intuitively) compute (Church-Turing Thesis). is a formal system designed to investigate function definition function plication recursion is a formal system designed to investigate function definition function plication recursion
2 1. What is the Lambda Calculus 2. Syntax of the Lambda Calculus what do we want? a small core language, into which other language constructs can be translated. There are many such languages: why do we pick out the Lambda Calulus? Turing Machines µ Recursive Functions Chomsky s Type-0 Grammars Cellular Automata etc. Let V be a countable set of variable names. The set of lambda terms (over V) is the smallest set T such that 1. if x V, then x T variable 2. if x V and t 1 T, then x. t 1 T abstraction 3. if t 1, t 2 T, then t 1 t 2 T plication Function abstraction: instead of f(x) = x + 5 write f = x.x + 5 because types are about values of program variables. a lambda term (i.e., T) representing a nameless function, which adds 5 to its parameter 2. Syntax of the Lambda Calculus 2. Syntax of the Lambda Calculus x Function plication: instead of f(x) write f x Example: (x. x + 5) a ply x x + 5 surface syntax Conventions (to save parenthesis) Abstract Syntax Tree a (AST) abstract syntax Example: x.y.z. x z (y z) = x.(y.z. x z (y z)) = x.(y.(z. (x z (y z)) y z ply = x. (y. (z. ((x z) (y z)))) ply ply x z y z surface syntax abstract syntax Conventions (to save parenthesis) plication is left associative: x y z = (x y) z x (y z) scope of abstraction extends as far to the right as possible: plication is left associative: x y z = (x y) z x (y z) scope of abstraction extends as far to the right as possible: x. x y = x. (x y) ( x. x) y x. x y = x. (x y) ( x. x) y
3 2. Semantics of the Lambda Calculus (x.x + 5) a SUBSTITUTE a for x in x Semantics of the Lambda Calculus Example: ( x.y. f (y x) ) 5 ( x. x ) ply redex (REDucible EXpression): ( x. t ) t 1 x x + 5 a can be reduced to (evaluates to): β reduction [ x a ] x + 5 = a + 5 To compute in Lambda Calculus, ALL you do is SUBSTITUTE!! 2. Semantics of the Lambda Calculus Example: ( x.y. f (y x) ) 5 ( x. x ) 2. Semantics of the Lambda Calculus Example: ( x.y. f (y x) ) 5 ( x. x ) = (( x.y. f (y x) ) 5) ( x. x ) because App binds to the left! = (( x.y. f (y x) ) 5) ( x. x ) [ x 5 ]( y. f (y x) ) ( x. x ) because App binds to the left! = ( y. f (y 5) ) ( x. x )
4 2. Semantics of the Lambda Calculus Example: ( x.y. f (y x) ) 5 ( x. x ) 2. Semantics of the Lambda Calculus Example: ( x.y. f (y x) ) 5 ( x. x ) = (( x.y. f (y x) ) 5) ( x. x ) [ x 5 ]( y. f (y x) ) ( x. x ) because App binds to the left! = (( x.y. f (y x) ) 5) ( x. x ) [ x 5 ]( y. f (y x) ) ( x. x ) because App binds to the left! = ( y. f (y 5) ) ( x. x ) = ( y. f (y 5) ) ( x. x ) [ y x. x ]( f (y 5) ) [ y x. x ]( f (y 5) ) = f (x. x 5) = f (x. x 5) f 5 (normal form = cannot be reduced further) 2. Semantics of the Lambda Calculus 2. Semantics of the Lambda Calculus Example: Does every -term have a normal form? Example: Does every -term have a normal form? NO!!! NO!!! ( x. x x ) ( x. x x ) ( x. x x ) ( x. x x ) [ x ( x. x x ) ] ( x x ) [ x ( x. x x ) ] ( x x ) = ( x. x x ) ( x. x x )
5 2. Semantics of the Lambda Calculus 2. Semantics of the Lambda Calculus Example: Does every -term have a normal form? Example: Does every -term have a normal form? NO!!! NO!!! ( x. x x ) ( x. x x ) [ x ( x. x x ) ] ( x x ) ( x. x x ) ( x. x x ) is called the omega combinator =: omega = ( x. x x ) ( x. x x ) ( x. x x ) ( x. x x ) ( x. x x ) ( x. x x ) combinator = closed lambda term = lambda term with no free variables The simplest combinator, identity: id := x. x 2. Semantics of the Lambda Calculus Free vs. Bound Variables: bound x. x y = x. (x y) free scope of x x is bound in its scope Define the set of free variables of a term t, FV(t), as if t = x V, then FV(t) = { x } if t = x. t 1, then FV(t) = FV(t 1 ) \ { x } 3. Church Booleans and Numerals How to encode BOOLEANS into the lambda calculus? tru takes two arguments, selects the FIRST fls takes two arguments, selects the SECOND THEN: if-then-else can be defined as: test x u w = ply x to u w = (k. m. n. k m n) x u w tru := m. n. m fls := m. n. n =: test if t = t 1 t 2, then FV(t) = FV(t 1 ) FV(t 2 ) test tru u w u
6 3. Church Booleans and Numerals How to encode BOOLEANS into the lambda calculus? tru takes two arguments, selects the FIRST fls takes two arguments, selects the SECOND tru := m. n. m fls := m. n. n test := k. m. n. k m n How to do and on these BOOLEANS? and u w = ply u to w fls := (m. n. m n fls) u w =: and 3. Church Booleans and Numerals How to encode BOOLEANS into the lambda calculus? tru takes two arguments, selects the FIRST fls takes two arguments, selects the SECOND tru := m. n. m fls := m. n. n test := k. m. n. k m n How to do and on these BOOLEANS? and u w = ply u to w fls := (m. n. m n fls) u w =: and Define the or and not functions! 3. Church Booleans and Numerals How to encode NUMBERS into the lambda calculus? c0 := s. z. z c1 := s. z. s z c2 := s. z. s (s z) c3 := s. z. s (s (s z)) etc. THEN, the successor function can be defined as scc := n. s. z. s (n s z) 3. Church Booleans and Numerals How to encode NUMBERS into the lambda calculus? c0 := s. z. z c1 := s. z. s z scc := n. s. z. s (n s z) c2 := s. z. s (s z) c3 := s. z. s (s (s z)) How to do plus and times on these Church Numerals? plus := m. n. s. z. m s (n s z) scc c0 s. z. s (c0 s z) s. z. s z = c1 ply m times the successor to n just like fls! Select the second argument.
7 3. Church Booleans and Numerals How to encode NUMBERS into the lambda calculus? 3. Church Booleans and Numerals How to encode NUMBERS into the lambda calculus? c0 := s. z. z c1 := s. z. s z c2 := s. z. s (s z) c3 := s. z. s (s (s z)) scc := n. s. z. s (n s z) c0 := s. z. z c1 := s. z. s z c2 := s. z. s (s z) c3 := s. z. s (s (s z)) scc := n. s. z. s (n s z) plus := m. n. s. z. m s (n s z) How to do plus and times on these Church Numerals? plus := m. n. s. z. m s (n s z) ply m times the successor to n times := m. n. m (plus n) c0 Questions: 1. Write a function subt for subtraction on Church Numerals. 2. How can other datatypes be encoded into the lambda calculus, like, e.g., lists, trees, arrays, and variant records? ply m times (plus n) to c0 4. Lazy vs. Eager Evaluation What does this lambda term evaluate to?? tru id omega 4. Lazy vs. Eager Evaluation What does this lambda term evaluate to?? tru id omega (m. n. m) (x. x) ((x. x x) (x. x x)) where to start evaluating? which redex?? ply ply ply m id x x n ply ply m x x x x
8 4. Lazy vs. Eager Evaluation What does this lambda term evaluate to?? tru id omega (m. n. m) (x. x) ((x. x x) (x. x x)) where to start evaluating? which redex?? 4. Lazy vs. Eager Evaluation What does this lambda term evaluate to?? tru id omega (m. n. m) (x. x) ((x. x x) (x. x x)) where to start evaluating? which redex?? redex1 ply redex2 ply ply m id x x n ply ply m x x x x redex1 ply redex2 ply ply m n id x ply x ply m x x x x if we always reduce redex2 then this lambda term has NO semantics. 4. Lazy vs. Eager Evaluation A redex if outermost, if in the AST it has no ancestor that is a redex. 4. Lazy vs. Eager Evaluation A redex if outermost, if in the AST it has no ancestor that is a redex. outermost redexes outermost redexes A redex if leftmost, if in the AST it has no redex to the left of it.
9 4. Lazy vs. Eager Evaluation A redex if outermost, if in the AST it has no ancestor that is a redex. outermost redexes A redex if leftmost, if in the AST it has no redex to the left of it. 4. Lazy vs. Eager Evaluation A redex if outermost, if in the AST it has no ancestor that is a redex. outermost redexes A redex if leftmost, if in the AST it has no redex to the left of it. 4. Lazy vs. Eager Evaluation A redex if outermost, if in the AST it has no ancestor that is a redex. leftmost outermost redexes A redex if leftmost, if in the AST it has no redex to the left of it. 4. Lazy vs. Eager Evaluation leftmost Evaluation Strategies: normal order outermost redexes always reduce leftmost outermost redex first lazy eager call-by-name call-by-need call-by-value like normal order, but NOT inside abstractions like call-by-name but with sharing reduce only value-redexes (= argument is a value) and do this leftmost right branch of
10 4. Lazy vs. Eager Evaluation Lazy seems better than eager, because more terms can be evaluated! can you define an infinite list consisting of all prime numbers? (with lazy evaluation you can fetch the first n numbers of this list!) > fetch c3 primelist should compute the list [ 2, 3, 5 ] 4. Lazy vs. Eager Evaluation Lazy seems better than eager, because more terms can be evaluated! can you define an infinite list consisting of all prime numbers? (with lazy evaluation you can fetch the first n numbers of this list!) > fetch c3 primelist should compute the list [ 2, 3, 5 ] If a term evaluates to a normal form n using eager evaluation, then it also evaluates to n using lazy evaluation. can you prove this?!? what about the number of eval. steps needed by eager vs. lazy? If a term evaluates to a normal form n using eager evaluation, then it also evaluates to n using lazy evaluation. can you prove this?!? what about the number of eval. steps needed by eager vs. lazy? Lazy is hard to implement efficiently because copies of unevaluated lambda terms must be shared in order not to have duplicate reductions Lazy is hard to implement it efficiently because lots of duplicate reductions might be done. Most FL s use call-by-value. Also the TaPL book! fct = n.if eq n c0 then c1 else (times n (fct (prd n))) e.g. fct c3 needs to unroll 4 times the definition (expand) recursion fct c3 = if eq c3 c0 then c1 else (times c3 ( if eq c2 c0 then c1 else (times c2 ( if eq c1 c0 then c1 else (times c1 ( if eq c0 c0 then c1 else (..)..) ( evaluates to c6 ) fct = n.if eq n c0 then c1 else (times n (fct (prd n))) e.g. fct c3 needs to unroll 4 times the definition (expand) recursion fct c3 = if eq c3 c0 then c1 else (times c3 ( if eq c2 c0 then c1 else (times c2 ( if eq c1 c0 then c1 else (times c1 ( if eq c0 c0 then c1 else (..)..) ( evaluates to c6 ) Is there a combinator doing the unrolling, when plied to fct?
11 fct = n.if eq n c0 then c1 else (times n (fct (prd n))) recursion such a combinator is similar to omega! (x. x x) (x. x x) First, under call-by-name (lazy) evaluation. (cbn) fixed-point combinator Y := f. (x. f (x x)) (x. f (x x)) g := fct. n.if eq n c0 then c1 else (times n (fct (prd n))) Y g c3 additionally to copying itself it should each time split of one plication of the definition of fct Is there a combinator doing the unrolling, when plied to fct? First, under call-by-name (lazy) evaluation. (cbn) fixed-point combinator Y := f. (x. f (x x)) (x. f (x x)) g := fct. n.if eq n c0 then c1 else (times n (fct (prd n))) Y g c3 (x. g (x x)) (x. g (x x)) c3 g (h h) c3 First, under call-by-name (lazy) evaluation. (cbn) fixed-point combinator Y := f. (x. f (x x)) (x. f (x x)) g := fct. n.if eq n c0 then c1 else (times n (fct (prd n))) Y g c3 (x. g (x x)) (x. g (x x)) c3 g (h h) c3 lazy! n.if eq n c0 then c1 else (times n (h h (prd n))) c3
12 First, under call-by-name (lazy) evaluation. (cbn) fixed-point combinator Y := f. (x. f (x x)) (x. f (x x)) g := fct. n.if eq n c0 then c1 else (times n (fct (prd n))) Y g c3 (x. g (x x)) (x. g (x x)) c3 g (h h) c3 eager! g (g (h h)) c3 g(g(g(h h) c3 lazy! n.if eq n c0 then c1 else (times n (h h (prd n))) c3 First, under call-by-name (lazy) evaluation. (cbn) fixed-point combinator Y := f. (x. f (x x)) (x. f (x x)) g := fct. n.if eq n c0 then c1 else (times n (fct (prd n))) Y g c3 (x. g (x x)) (x. g (x x)) c3 g (h h) c3 lazy! n.if eq n c0 then c1 else (times n (h h (prd n))) c3 if eq c3 c0 then c1 else (times c3 (h h (prd c3))) First, under call-by-name (lazy) evaluation. (cbn) fixed-point combinator Y := f. (x. f (x x)) (x. f (x x)) g := fct. n.if eq n c0 then c1 else (times n (fct (prd n))) Y g c3 (x. g (x x)) (x. g (x x)) c3 g (h h) c3 lazy! n.if eq n c0 then c1 else (times n (h h (prd n))) c3 if eq c3 c0 then c1 else (times c3 (h h (prd c3))) times c3 (h h (prd c3)) First, under call-by-name (lazy) evaluation. (cbn) fixed-point combinator Y := f. (x. f (x x)) (x. f (x x)) g := fct. n.if eq n c0 then c1 else (times n (fct (prd n))) Y g c3 (x. g (x x)) (x. g (x x)) c3 g (h h) c3 lazy! n.if eq n c0 then c1 else (times n (h h (prd n))) c3 if eq c3 c0 then c1 else (times c3 (h h (prd c3))) times c3 (h h (prd c3)) times c3 (g (h h) (prd c3))
13 First, under call-by-name (lazy) evaluation. (cbn) fixed-point combinator Y := f. (x. f (x x)) (x. f (x x)) g := fct. n.if eq n c0 then c1 else (times n (fct (prd n))) Now, under eager (call-by-value) evaluation. (cbv) fixed-point combinator fix := f. (x. f (y. x x y)) (x. f (y. x x y)) fix g c3 Y g c3 (x. g (x x)) (x. g (x x)) c3 g (h h) c3 lazy! n.if eq n c0 then c1 else (times n (h h (prd n))) c3 if eq c3 c0 then c1 else (times c3 (h h (prd c3))) times c3 (h h (prd c3)) times c3 (g (h h) (prd c3)) times c3 c2 c1 c1 Now, under eager (call-by-value) evaluation. (cbv) fixed-point combinator fix := f. (x. f (y. x x y)) (x. f (y. x x y)) fix g c3 (x. g (y. x x y)) (x. g (y. x x y)) c3 Now, under eager (call-by-value) evaluation. (cbv) fixed-point combinator fix := f. (x. f (y. x x y)) (x. f (y. x x y)) fix g c3 (x. g (y. x x y)) (x. g (y. x x y)) c3 g (y. h h y) c3 -guard
14 Now, under eager (call-by-value) evaluation. (cbv) fixed-point combinator fix := f. (x. f (y. x x y)) (x. f (y. x x y)) fix g c3 (x. g (y. x x y)) (x. g (y. x x y)) c3 g (y. h h y) c3 -guard n.if eq n c0 then c1 else (times n ((y. h h y)(prd n))) c3 Now, under eager (call-by-value) evaluation. (cbv) fixed-point combinator fix := f. (x. f (y. x x y)) (x. f (y. x x y)) fix g c3 (x. g (y. x x y)) (x. g (y. x x y)) c3 g (y. h h y) c3 -guard n.if eq n c0 then c1 else (times n ((y. h h y)(prd n))) c3 if eq c3 c0 then c1 else (times c3 ((y. h h y)(prd c3))) Now, under eager (call-by-value) evaluation. (cbv) fixed-point combinator fix := f. (x. f (y. x x y)) (x. f (y. x x y)) fix g c3 (x. g (y. x x y)) (x. g (y. x x y)) c3 g (y. h h y) c3 -guard n.if eq n c0 then c1 else (times n ((y. h h y)(prd n))) c3 if eq c3 c0 then c1 else (times c3 ((y. h h y)(prd c3))) times c3 ((y. h h y)(prd c3)) Now, under eager (call-by-value) evaluation. (cbv) fixed-point combinator fix := f. (x. f (y. x x y)) (x. f (y. x x y)) fix g c3 (x. g (y. x x y)) (x. g (y. x x y)) c3 g (y. h h y) c3 -guard n.if eq n c0 then c1 else (times n ((y. h h y)(prd n))) c3 if eq c3 c0 then c1 else (times c3 ((y. h h y)(prd c3))) unguard times c3 ((y. h h y)(prd c3)) times c3 h h (prd c3)
15 Now, under eager (call-by-value) evaluation. (cbv) fixed-point combinator fix := f. (x. f (y. x x y)) (x. f (y. x x y)) fix g c3 (x. g (y. x x y)) (x. g (y. x x y)) c3 Question: Can you feel why the lambda calculus is Turing complete? Can you prove it? What does it take to be Turing complete? g (y. h h y) c3 -guard n.if eq n c0 then c1 else (times n ((y. h h y)(prd n))) c3 if eq c3 c0 then c1 else (times c3 ((y. h h y)(prd c3))) unguard times c3 ((y. h h y)(prd c3)) times c3 h h (prd c3) times c3 g (y. h h y) (prd c3) times c3 c2 c1 c1 redex (REDucible EXpression): ( x. t ) s β reduction: ( x. t ) s := [ x s ] t substitution A. only replace the FREE occurrences of x in t!! [ x s ] : B. if replacing within ( y.u ) then y should NOT be FREE in s!! DEFINE [ x s ] t, by induction on the structure of t: redex (REDucible EXpression): ( x. t ) s β reduction: ( x. t ) s := [ x s ] t substitution A. only replace the FREE occurrences of x in t!! [ x s ] : B. if replacing within ( y.u ) then y should NOT be FREE in s!! DEFINE [ x s ] t, by induction on the structure of t: 1. [ x s ] y = 2. [ x s ] y. t 1 = 3. [ x s ] t 1 t 2 =
16 redex (REDucible EXpression): ( x. t ) s β reduction: ( x. t ) s := [ x s ] t substitution A. only replace the FREE occurrences of x in t!! [ x s ] : B. if replacing within ( y.u ) then y should NOT be FREE in s!! DEFINE [ x s ] t, by induction on the structure of t: redex (REDucible EXpression): ( x. t ) s β reduction: ( x. t ) s := [ x s ] t substitution A. only replace the FREE occurrences of x in t!! [ x s ] : B. if replacing within ( y.u ) then y should NOT be FREE in s!! DEFINE [ x s ] t, by induction on the structure of t: 1. [ x s ] y = s if y=x, and y otherwise 2. [ x s ] y. t 1 = 3. [ x s ] t 1 t 2 = 1. [ x s ] y = s if y=x, and y otherwise 2. [ x s ] y. t 1 = y. [ x s ] t 1 if y x and y FV(s) A,B 3. [ x s ] t 1 t 2 = redex (REDucible EXpression): ( x. t ) s β reduction: ( x. t ) s := [ x s ] t substitution A. only replace the FREE occurrences of x in t!! [ x s ] : B. if replacing within ( y.u ) then y should NOT be FREE in s!! DEFINE [ x s ] t, by induction on the structure of t: redex (REDucible EXpression): ( x. t ) s β reduction: ( x. t ) s := [ x s ] t substitution A. only replace the FREE occurrences of x in t!! [ x s ] : B. if replacing within ( y.u ) then y should NOT be FREE in s!! DEFINE [ x s ] t, by induction on the structure of t: 1. [ x s ] y = s if y=x, and y otherwise 2. [ x s ] y. t 1 = y. [ x s ] t 1 if y x and y FV(s) A,B 3. [ x s ] t 1 t 2 = ([ x s ] t 1 ) ([ x s ] t 2 ) 1. [ x s ] y = s if y=x, and y otherwise 2. [ x s ] y. t 1 = y. [ x s ] t 1 if y x and y FV(s) A,B 3. [ x s ] t 1 t 2 = ([ x s ] t 1 ) ([ x s ] t 2 ) to py 2., renaming of BOUND y s in t 1 might be necessary!!! = alpha-conversion
17 Idea: let variable occurrences directly point to their binders, rather than referring to them by name. use natural numbers k, meaning the k-th enclosing e.g. x. y. x ( y x ) BECOMES.. 1 ( 0 1 ) Idea: let variable occurrences directly point to their binders, rather than referring to them by name. use natural numbers k, meaning the k-th enclosing distance: 0 e.g. x. y. x ( y x ) BECOMES.. 1 ( 0 1 ) distance: 1 Idea: let variable occurrences directly point to their binders, rather than referring to them by name. use natural numbers k, meaning the k-th enclosing distance: 0 e.g. x. y. x ( y x ) BECOMES.. 1 ( 0 1 ) distance: 1 Then, every CLOSED term has a unique debruijn representation! Idea: let variable occurrences directly point to their binders, rather than referring to them by name. use natural numbers k, meaning the k-th enclosing distance: 0 e.g. x. y. x ( y x ) BECOMES.. 1 ( 0 1 ) distance: 1 Then, every CLOSED term has a unique debruijn representation! what to do with free variables?? use naming context Γ V *. E.g., bca means b 2, c 1, a 0
18 fix a naming context Γ V *. lambda term (Γ = xu) y. u y removenames Γ restorenames Γ remov Γ resto Γ nameless lambda term. 1 0 (Γ = xuy) shift(d, s) := shiftb(d, 0, s) DON T shift vars with index <0!! substitution [ 1 s ](. 2 ) Γ=xu Γ =Γy increment all free vars in s by one! substitution [ 1 s ](. 2 ) Γ=xu Γ =Γy increment all free vars in s by one! [ j s ](. t 1 ) =. [ j+1 shift(1, s) ] t 1 [ j s ](. t 1 ) =. [ j+1 shift(1, s) ] t 1 shift function must keep track of BOUND vars in order to ONLY shift the FREE vars. shift function must keep track of BOUND vars in order to ONLY shift the FREE vars. shift(d, s) := shiftb(d, 0, s) substitution [ 1 s ](. 2 ) Γ=xu Γ =Γy [ j s ](. t 1 ) =. [ j+1 shift(1, s) ] t 1 DON T shift vars with index <0!! shiftb(d, b, k) = k if k<b, and k+d otherwise shiftb(d, b,. t 1 ) =. shiftb(d, b+1, t 1 ) shiftb(d, b, t 1 t 2 ) = shiftb(d, b, t 1 ) shiftb(d, b, t 2 ) increment all free vars in s by one! fix a naming context Γ V *. removenames(γ, x) = index of rightmost x in Γ removenames(γ, x. t 1 ) =. removenames(γx, t 1 ) removenames(γ, t 1 t 2 ) = removenames(γ, t 1 ) removenames(γ, t 2 ) restorenames(γ, k) = k-th name in Γ restorenames(γ,. t) = x. restorenames(γx, t 1 ) x is the first name not in Γ restorenames(γ, t 1 t 2 ) = restorenames(γ, t 1 ) restorenames(γ, t 2 ) shift function must keep track of BOUND vars in order to ONLY shift the FREE vars.
Type Systems. Lecture 2 Oct. 27th, 2004 Sebastian Maneth.
Type Systems Lecture 2 Oct. 27th, 2004 Sebastian Maneth http://lampwww.epfl.ch/teaching/typesystems/2004 Today 1. What is the Lambda Calculus? 2. Its Syntax and Semantics 3. Church Booleans and Church
More informationCS 4110 Programming Languages & Logics. Lecture 16 Programming in the λ-calculus
CS 4110 Programming Languages & Logics Lecture 16 Programming in the λ-calculus 30 September 2016 Review: Church Booleans 2 We can encode TRUE, FALSE, and IF, as: TRUE λx. λy. x FALSE λx. λy. y IF λb.
More informationProgramming Languages
CSE 230: Winter 2010 Principles of Programming Languages Lecture 10: Programming in λ-calculusc l l Ranjit Jhala UC San Diego Review The lambda calculus is a calculus of functions: e := x λx. e e 1 e 2
More informationThe Lambda Calculus. Stephen A. Edwards. Fall Columbia University
The Lambda Calculus Stephen A. Edwards Columbia University Fall 2014 Lambda Expressions Function application written in prefix form. Add four and five is (+ 4 5) Evaluation: select a redex and evaluate
More informationReview. Principles of Programming Languages. Equality. The Diamond Property. The Church-Rosser Theorem. Corollaries. CSE 230: Winter 2007
CSE 230: Winter 2007 Principles of Programming Languages Lecture 12: The λ-calculus Ranjit Jhala UC San Diego Review The lambda calculus is a calculus of functions: e := x λx. e e 1 e 2 Several evaluation
More informationλ Slide 1 Content Exercises from last time λ-calculus COMP 4161 NICTA Advanced Course Advanced Topics in Software Verification
Content COMP 4161 NICTA Advanced Course Advanced Topics in Software Verification Toby Murray, June Andronick, Gerwin Klein λ Slide 1 Intro & motivation, getting started [1] Foundations & Principles Lambda
More informationLambda-Calculus (cont): Fixpoints, Naming. Lecture 10 CS 565 2/10/08
Lambda-Calculus (cont): Fixpoints, Naming Lecture 10 CS 565 2/10/08 Recursion and Divergence Consider the application: Ω ((λ x. (x x)) (λ x. (x x))) Ω evaluates to itself in one step. It has no normal
More informationCOMP6463: λ-calculus
COMP6463: λ-calculus 1. Basics Michael Norrish Michael.Norrish@nicta.com.au Canberra Research Lab., NICTA Semester 2, 2015 Outline Introduction Lambda Calculus Terms Alpha Equivalence Substitution Dynamics
More informationIntroduction to lambda calculus Part 2
Introduction to lambda calculus Part 2 Antti-Juhani Kaijanaho 2017-01-24... 1 Untyped lambda calculus 1.1 Syntax... x, y, z Var t, u Term t, u ::= x t u λx t... In this document, I will be using the following
More informationDecidability. Human-aware Robotics. 2017/10/31 Chapter 4.1 in Sipser Ø Announcement:
Decidability 2017/10/31 Chapter 4.1 in Sipser Ø Announcement: q q q Slides for this lecture are here: http://www.public.asu.edu/~yzhan442/teaching/cse355/lectures/decidability.pdf Happy Hollaween! Delayed
More informationLecture 3. Lambda calculus. Iztok Savnik, FAMNIT. October, 2015.
Lecture 3 Lambda calculus Iztok Savnik, FAMNIT October, 2015. 1 Literature Henk Barendregt, Erik Barendsen, Introduction to Lambda Calculus, March 2000. Lambda calculus Leibniz had as ideal the following
More informationFormal Methods Lecture 6. (B. Pierce's slides for the book Types and Programming Languages )
Formal Methods Lecture 6 (B. Pierce's slides for the book Types and Programming Languages ) This Saturday, 10 November 2018, room 335 (FSEGA), we will recover the following activities: 1 Formal Methods
More informationA Stochastic l-calculus
A Stochastic l-calculus Content Areas: probabilistic reasoning, knowledge representation, causality Tracking Number: 775 Abstract There is an increasing interest within the research community in the design
More information3.2 Equivalence, Evaluation and Reduction Strategies
3.2 Equivalence, Evaluation and Reduction Strategies The λ-calculus can be seen as an equational theory. More precisely, we have rules i.e., α and reductions, for proving that two terms are intensionally
More informationFormal Methods Lecture 6. (B. Pierce's slides for the book Types and Programming Languages )
Formal Methods Lecture 6 (B. Pierce's slides for the book Types and Programming Languages ) Programming in the Lambda-Calculus, Continued Testing booleans Recall: tru = λt. λf. t fls = λt. λf. f We showed
More informationEquivalent Computers. Lecture 39: Lambda Calculus. Lambda Calculus. What is Calculus? Real Definition. Why?
#,, - Lecture 39: Lambda Calculus Equivalent Computers z z z... term = variable term term (term) λ variable. term λy. M α λv. (M [y α v]) where v does not occur in M. (λx. M)N β M [ x α N ] Turing Machine
More informationType Systems Winter Semester 2006
Type Systems Winter Semester 2006 Week 5 November 15 November 15, 2006 - version 1.0 Programming in the Lambda-Calculus, Continued Testing booleans Recall: tru = λt. λf. t fls = λt. λf. f We showed last
More informationModels of computation
Lambda-Calculus (I) jean-jacques.levy@inria.fr 2nd Asian-Pacific Summer School on Formal ethods Tsinghua University, August 23, 2010 Plan computation models lambda-notation bound variables odels of computation
More informationLecture 2. Lambda calculus. Iztok Savnik, FAMNIT. March, 2018.
Lecture 2 Lambda calculus Iztok Savnik, FAMNIT March, 2018. 1 Literature Henk Barendregt, Erik Barendsen, Introduction to Lambda Calculus, March 2000. Lambda calculus Leibniz had as ideal the following
More informationTheory of Computation (IX) Yijia Chen Fudan University
Theory of Computation (IX) Yijia Chen Fudan University Review The Definition of Algorithm Polynomials and their roots A polynomial is a sum of terms, where each term is a product of certain variables and
More informationFORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY
15-453 FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY Chomsky Normal Form and TURING MACHINES TUESDAY Feb 4 CHOMSKY NORMAL FORM A context-free grammar is in Chomsky normal form if every rule is of the form:
More informationLambda Calculus! Gunnar Gotshalks! LC-1
Lambda Calculus! LC-1 λ Calculus History! Developed by Alonzo Church during mid 1930 s! One fundamental goal was to describe what can be computed.! Full definition of λ-calculus is equivalent in power
More informationUndecidability COMS Ashley Montanaro 4 April Department of Computer Science, University of Bristol Bristol, UK
COMS11700 Undecidability Department of Computer Science, University of Bristol Bristol, UK 4 April 2014 COMS11700: Undecidability Slide 1/29 Decidability We are particularly interested in Turing machines
More informationBeyond First-Order Logic
Beyond First-Order Logic Software Formal Verification Maria João Frade Departmento de Informática Universidade do Minho 2008/2009 Maria João Frade (DI-UM) Beyond First-Order Logic MFES 2008/09 1 / 37 FOL
More informationCS 301. Lecture 17 Church Turing thesis. Stephen Checkoway. March 19, 2018
CS 301 Lecture 17 Church Turing thesis Stephen Checkoway March 19, 2018 1 / 17 An abridged modern history of formalizing algorithms An algorithm is a finite, unambiguous sequence of steps for solving a
More informationChomsky Normal Form and TURING MACHINES. TUESDAY Feb 4
Chomsky Normal Form and TURING MACHINES TUESDAY Feb 4 CHOMSKY NORMAL FORM A context-free grammar is in Chomsky normal form if every rule is of the form: A BC A a S ε B and C aren t start variables a is
More information1 Introduction. 2 Recap The Typed λ-calculus λ. 3 Simple Data Structures
CS 6110 S18 Lecture 21 Products, Sums, and Other Datatypes 1 Introduction In this lecture, we add constructs to the typed λ-calculus that allow working with more complicated data structures, such as pairs,
More informationFunctional Programming with Coq. Yuxin Deng East China Normal University
Functional Programming with Coq Yuxin Deng East China Normal University http://basics.sjtu.edu.cn/ yuxin/ September 10, 2017 Functional Programming Y. Deng@ECNU 1 Reading materials 1. The Coq proof assistant.
More informationTyping λ-terms. Types. Typed λ-terms. Base Types. The Typing Relation. Advanced Formal Methods. Lecture 3: Simply Typed Lambda calculus
Course 2D1453, 200607 Advanced Formal Methods Lecture 3: Simply Typed Lambda calculus Mads Dam KTH/CSC Some material from B. Pierce: TAPL + some from G. Klein, NICTA Typing λterms The uptyped λcalculus
More informationMost General computer?
Turing Machines Most General computer? DFAs are simple model of computation. Accept only the regular languages. Is there a kind of computer that can accept any language, or compute any function? Recall
More information1. Object Calculus. Object calculus is to OO languages what lambda calculus is to functional languages
1. Object Calculus In this section we will introduce a calculus of objects that gives a simple but powerful mathematical model to study object based languages. Object calculus is to OO languages what lambda
More informationDecidability: Church-Turing Thesis
Decidability: Church-Turing Thesis While there are a countably infinite number of languages that are described by TMs over some alphabet Σ, there are an uncountably infinite number that are not Are there
More informationLambda-Calculus (I) 2nd Asian-Pacific Summer School on Formal Methods Tsinghua University, August 23, 2010
Lambda-Calculus (I) jean-jacques.levy@inria.fr 2nd Asian-Pacific Summer School on Formal Methods Tsinghua University, August 23, 2010 Plan computation models lambda-notation bound variables conversion
More informationProgramming Language Concepts: Lecture 16
Programming Language Concepts: Lecture 16 Madhavan Mukund Chennai Mathematical Institute madhavan@cmi.ac.in http://www.cmi.ac.in/~madhavan/courses/pl2009 PLC 2009, Lecture 16, 23 March 2009 λ-calculus:
More informationThe Locally Nameless Representation
Noname manuscript No. (will be inserted by the editor) The Locally Nameless Representation Arthur Charguéraud Received: date / Accepted: date Abstract This paper provides an introduction to the locally
More informationIntroduction to Turing Machines
Introduction to Turing Machines Deepak D Souza Department of Computer Science and Automation Indian Institute of Science, Bangalore. 12 November 2015 Outline 1 Turing Machines 2 Formal definitions 3 Computability
More informationCOMP-330 Theory of Computation. Fall Prof. Claude Crépeau. Lec. 16 : Turing Machines
COMP-330 Theory of Computation Fall 2017 -- Prof. Claude Crépeau Lec. 16 : Turing Machines COMP 330 Fall 2017: Lectures Schedule 1-2. Introduction 1.5. Some basic mathematics 2-3. Deterministic finite
More informationFinal exam study sheet for CS3719 Turing machines and decidability.
Final exam study sheet for CS3719 Turing machines and decidability. A Turing machine is a finite automaton with an infinite memory (tape). Formally, a Turing machine is a 6-tuple M = (Q, Σ, Γ, δ, q 0,
More informationComputability Theory. CS215, Lecture 6,
Computability Theory CS215, Lecture 6, 2000 1 The Birth of Turing Machines At the end of the 19th century, Gottlob Frege conjectured that mathematics could be built from fundamental logic In 1900 David
More informationCMSC 330: Organization of Programming Languages. Pushdown Automata Parsing
CMSC 330: Organization of Programming Languages Pushdown Automata Parsing Chomsky Hierarchy Categorization of various languages and grammars Each is strictly more restrictive than the previous First described
More informationNon-Idempotent Typing Operators, beyond the λ-calculus
Non-Idempotent Typing Operators, beyond the λ-calculus Soutenance de thèse Pierre VIAL IRIF (Univ. Paris Diderot and CNRS) December 7, 2017 Non-idempotent typing operators P. Vial 0 1 /46 Certification
More informationTheory of Computation
Thomas Zeugmann Hokkaido University Laboratory for Algorithmics http://www-alg.ist.hokudai.ac.jp/ thomas/toc/ Lecture 12: Turing Machines Turing Machines I After having dealt with partial recursive functions,
More informationFirst-Order Logic First-Order Theories. Roopsha Samanta. Partly based on slides by Aaron Bradley and Isil Dillig
First-Order Logic First-Order Theories Roopsha Samanta Partly based on slides by Aaron Bradley and Isil Dillig Roadmap Review: propositional logic Syntax and semantics of first-order logic (FOL) Semantic
More informationType Systems Winter Semester 2006
Type Systems Winter Semester 2006 Week 7 November 29 November 29, 2006 - version 1.0 Plan PREVIOUSLY: 1. type safety as progress and preservation 2. typed arithmetic expressions 3. simply typed lambda
More informationMathematical Foundations of Programming. Nicolai Kraus. Draft of February 15, 2018
Very short lecture notes: Mathematical Foundations of Programming University of Nottingham, Computer Science, module code G54FOP, Spring 2018 Nicolai Kraus Draft of February 15, 2018 What is this? This
More informationLecture 14 Rosser s Theorem, the length of proofs, Robinson s Arithmetic, and Church s theorem. Michael Beeson
Lecture 14 Rosser s Theorem, the length of proofs, Robinson s Arithmetic, and Church s theorem Michael Beeson The hypotheses needed to prove incompleteness The question immediate arises whether the incompleteness
More informationPredicate Logic. Xinyu Feng 09/26/2011. University of Science and Technology of China (USTC)
University of Science and Technology of China (USTC) 09/26/2011 Overview Predicate logic over integer expressions: a language of logical assertions, for example x. x + 0 = x Why discuss predicate logic?
More informationLambda Calculus. Andrés Sicard-Ramírez. Semester Universidad EAFIT
Lambda Calculus Andrés Sicard-Ramírez Universidad EAFIT Semester 2010-2 Bibliography Textbook: Hindley, J. R. and Seldin, J. (2008). Lambda-Calculus and Combinators. An Introduction. Cambridge University
More informationCOMP-330 Theory of Computation. Fall Prof. Claude Crépeau. Lec. 14 : Turing Machines
COMP-330 Theory of Computation Fall 2012 -- Prof. Claude Crépeau Lec. 14 : Turing Machines 1 COMP 330 Fall 2012: Lectures Schedule 1. Introduction 1.5. Some basic mathematics 2. Deterministic finite automata
More informationLecture 2: Self-interpretation in the Lambda-calculus
Lecture 2: Self-interpretation in the Lambda-calculus H. Geuvers Nijmegen, NL 21st Estonian Winter School in Computer Science Winter 2016 H. Geuvers - Radboud Univ. EWSCS 2016 Self-interpretation in λ-calculus
More informationPredicate Logic. Xinyu Feng 11/20/2013. University of Science and Technology of China (USTC)
University of Science and Technology of China (USTC) 11/20/2013 Overview Predicate logic over integer expressions: a language of logical assertions, for example x. x + 0 = x Why discuss predicate logic?
More informationTyped Lambda Calculi. Nikos Tzeveλekos Queen Mary, University of London 1 / 23
Typed Lambda Calculi Nikos Tzeveλekos Queen Mary, University of London 1 / 23 What is the Lambda Calculus A minimal formalism expressing computation with functionals s ::= x λx.s ss All you need is lambda.
More informationCS611 Lecture 25 Solving Domain Equations 22 October 2007 Lecturer: Andrew Myers
CS611 Lecture 25 Solving Domain Equations 22 October 2007 Lecturer: Andrew Myers To develop a denotational semantics for a language with recursive types, or to give a denotational semantics for the untyped
More informationUniversal Turing Machine. Lecture 20
Universal Turing Machine Lecture 20 1 Turing Machine move the head left or right by one cell read write sequentially accessed infinite memory finite memory (state) next-action look-up table Variants don
More informationCS Lecture 29 P, NP, and NP-Completeness. k ) for all k. Fall The class P. The class NP
CS 301 - Lecture 29 P, NP, and NP-Completeness Fall 2008 Review Languages and Grammars Alphabets, strings, languages Regular Languages Deterministic Finite and Nondeterministic Automata Equivalence of
More informationThe Turing Machine. Computability. The Church-Turing Thesis (1936) Theory Hall of Fame. Theory Hall of Fame. Undecidability
The Turing Machine Computability Motivating idea Build a theoretical a human computer Likened to a human with a paper and pencil that can solve problems in an algorithmic way The theoretical provides a
More informationComputational Models Lecture 8 1
Computational Models Lecture 8 1 Handout Mode Nachum Dershowitz & Yishay Mansour. Tel Aviv University. May 17 22, 2017 1 Based on frames by Benny Chor, Tel Aviv University, modifying frames by Maurice
More informationPredicate Logic. x. x + 0 = x. Predicate logic over integer expressions: a language of logical assertions, for example. Why discuss predicate logic?
Predicate Logic Predicate logic over integer expressions: a language of logical assertions, for example x. x + 0 = x Why discuss predicate logic? It is an example of a simple language It has simple denotational
More informationCSE 105 THEORY OF COMPUTATION
CSE 105 THEORY OF COMPUTATION Spring 2016 http://cseweb.ucsd.edu/classes/sp16/cse105-ab/ Today's learning goals Sipser Ch 3.3, 4.1 State and use the Church-Turing thesis. Give examples of decidable problems.
More informationNominal Syntax and Semantics
Nominal Syntax and Semantics Andrew Pitts University of Cambridge Computer Laboratory APPSEM 2005, 1 - p. 1 How best to reconcile Mathematics of syntax syntactical issues to do with name-binding and α-conversion
More informationLimits of Computation
The real danger is not that computers will begin to think like men, but that men will begin to think like computers Limits of Computation - Sydney J. Harris What makes you believe now that I am just talking
More informationElaborating evaluation-order polymorphism
Elaborating evaluation-order polymorphism Joshua Dunfield University of British Columbia ICFP 2015 1 (prologue) ICFP in Canada for the first time since 2008 2 (prologue) ICFP in Canada for the first time
More informationTyped Arithmetic Expressions
Typed Arithmetic Expressions CS 550 Programming Languages Jeremy Johnson TAPL Chapters 3 and 5 1 Types and Safety Evaluation rules provide operational semantics for programming languages. The rules provide
More informationCS 6110 Lecture 35 Solving Domain Equations 19 April 2013 Lecturer: Andrew Myers
CS 6110 Lecture 35 Solving Domain Equations 19 April 2013 Lecturer: Andrew Myers To develop a denotational semantics for a language with recursive types, or to give a denotational semantics for the untyped
More informationSimply Typed Lambda-Calculi (II)
THEORY AND PRACTICE OF FUNCTIONAL PROGRAMMING Simply Typed Lambda-Calculi (II) Dr. ZHANG Yu Institute of Software, Chinese Academy of Sciences Fall term, 2011 GUCAS, Beijing Introduction PCF Programming
More informationContext Free Grammars
Automata and Formal Languages Context Free Grammars Sipser pages 101-111 Lecture 11 Tim Sheard 1 Formal Languages 1. Context free languages provide a convenient notation for recursive description of languages.
More informationCSCE 551: Chin-Tser Huang. University of South Carolina
CSCE 551: Theory of Computation Chin-Tser Huang huangct@cse.sc.edu University of South Carolina Church-Turing Thesis The definition of the algorithm came in the 1936 papers of Alonzo Church h and Alan
More informationOrigin in Mathematical Logic
Lambda Calculus Origin in Mathematical Logic Foundation of mathematics was very much an issue in the early decades of 20th century. Cantor, Frege, Russel s Paradox, Principia Mathematica, NBG/ZF Origin
More informationDecidability. William Chan
Decidability William Chan Preface : In 1928, David Hilbert gave a challenge known as the Entscheidungsproblem, which is German for Decision Problem. Hilbert s problem asked for some purely mechanical procedure
More informationA call-by-name lambda-calculus machine
A call-by-name lambda-calculus machine Jean-Louis Krivine University Paris VII, C.N.R.S. 2 place Jussieu 75251 Paris cedex 05 (krivine@pps.jussieu.fr) Introduction We present, in this paper, a particularly
More informationNotes from Yesterday s Discussion. Big Picture. CIS 500 Software Foundations Fall November 1. Some lessons.
CIS 500 Software Foundations Fall 2006 Notes from Yesterday s Email Discussion November 1 Some lessons This is generally a crunch-time in the semester Slow down a little and give people a chance to catch
More informationPrinciples of Program Analysis: Control Flow Analysis
Principles of Program Analysis: Control Flow Analysis Transparencies based on Chapter 3 of the book: Flemming Nielson, Hanne Riis Nielson and Chris Hankin: Principles of Program Analysis. Springer Verlag
More information6.001 Recitation 22: Streams
6.001 Recitation 22: Streams RI: Gerald Dalley, dalleyg@mit.edu, 4 May 2007 http://people.csail.mit.edu/dalleyg/6.001/sp2007/ The three chief virtues of a programmer are: Laziness, Impatience and Hubris
More informationLecture 9: The Recursion Theorem. Michael Beeson
Lecture 9: The Recursion Theorem Michael Beeson The problem of computing by recursion We still have not provided completely convincing evidence that every intuitively computable function is Turing computable,
More informationCA320 - Computability & Complexity
CA320 - Computability & Complexity David Sinclair Overview In this module we are going to answer 2 important questions: Can all problems be solved by a computer? What problems be efficiently solved by
More informationFundamentals of Computer Science
Fundamentals of Computer Science Chapter 8: Turing machines Henrik Björklund Umeå University February 17, 2014 The power of automata Finite automata have only finite memory. They recognize the regular
More informationcse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska
cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska LECTURE 13 CHAPTER 4 TURING MACHINES 1. The definition of Turing machine 2. Computing with Turing machines 3. Extensions of Turing
More informationFirst Order Logic vs Propositional Logic CS477 Formal Software Dev Methods
First Order Logic vs Propositional Logic CS477 Formal Software Dev Methods Elsa L Gunter 2112 SC, UIUC egunter@illinois.edu http://courses.engr.illinois.edu/cs477 Slides based in part on previous lectures
More informationPropositional logic. First order logic. Alexander Clark. Autumn 2014
Propositional logic First order logic Alexander Clark Autumn 2014 Formal Logic Logical arguments are valid because of their form. Formal languages are devised to express exactly that relevant form and
More informationFinite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018
Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018 Lecture 15 Ana Bove May 17th 2018 Recap: Context-free Languages Chomsky hierarchy: Regular languages are also context-free; Pumping lemma
More informationAxiomatic Semantics. Operational semantics. Good for. Not good for automatic reasoning about programs
Review Operational semantics relatively l simple many flavors (small vs. big) not compositional (rule for while) Good for describing language implementation reasoning about properties of the language eg.
More informationComputational Models Lecture 8 1
Computational Models Lecture 8 1 Handout Mode Ronitt Rubinfeld and Iftach Haitner. Tel Aviv University. May 11/13, 2015 1 Based on frames by Benny Chor, Tel Aviv University, modifying frames by Maurice
More informationIntroduction to Temporal Logic. The purpose of temporal logics is to specify properties of dynamic systems. These can be either
Introduction to Temporal Logic The purpose of temporal logics is to specify properties of dynamic systems. These can be either Desired properites. Often liveness properties like In every infinite run action
More informationFunctional Database Query Languages as. Typed Lambda Calculi of Fixed Order. Gerd G. Hillebrand and Paris C. Kanellakis
Functional Database Query Languages as Typed Lambda Calculi of Fixed Order Gerd G. Hillebrand and Paris C. Kanellakis Department of Computer Science Brown University Providence, Rhode Island 02912 CS-94-26
More informationAutomata Theory. Definition. Computational Complexity Theory. Computability Theory
Outline THEORY OF COMPUTATION CS363, SJTU What is Theory of Computation? History of Computation Branches and Development Xiaofeng Gao Dept. of Computer Science Shanghai Jiao Tong University 2 The Essential
More informationIntroduction to Kleene Algebras
Introduction to Kleene Algebras Riccardo Pucella Basic Notions Seminar December 1, 2005 Introduction to Kleene Algebras p.1 Idempotent Semirings An idempotent semiring is a structure S = (S, +,, 1, 0)
More informationFirst-Order Logic (FOL)
First-Order Logic (FOL) Also called Predicate Logic or Predicate Calculus 2. First-Order Logic (FOL) FOL Syntax variables x, y, z, constants a, b, c, functions f, g, h, terms variables, constants or n-ary
More informationComplexity Theory Part I
Complexity Theory Part I Problem Problem Set Set 77 due due right right now now using using a late late period period The Limits of Computability EQ TM EQ TM co-re R RE L D ADD L D HALT A TM HALT A TM
More informationCS156: The Calculus of Computation Zohar Manna Winter 2010
Page 3 of 35 Page 4 of 35 quantifiers CS156: The Calculus of Computation Zohar Manna Winter 2010 Chapter 2: First-Order Logic (FOL) existential quantifier x. F [x] there exists an x such that F [x] Note:
More informationTuring Machine Recap
Turing Machine Recap DFA with (infinite) tape. One move: read, write, move, change state. High-level Points Church-Turing thesis: TMs are the most general computing devices. So far no counter example Every
More informationLecture 2: Axiomatic semantics
Chair of Software Engineering Trusted Components Prof. Dr. Bertrand Meyer Lecture 2: Axiomatic semantics Reading assignment for next week Ariane paper and response (see course page) Axiomatic semantics
More informationProgramming Languages and Types
Programming Languages and Types Klaus Ostermann based on slides by Benjamin C. Pierce Subtyping Motivation With our usual typing rule for applications the term is not well typed. ` t 1 : T 11!T 12 ` t
More informationINF210 Datamaskinteori (Models of Computation)
INF210 Datamaskinteori (Models of Computation) Textbook: John Martin, Introduction to Languages and the Theory of Computation, McGraw Hill, Third Edition. Fedor V. Fomin Datamaskinteori 1 Datamaskinteori
More informationAutomated Reasoning Lecture 5: First-Order Logic
Automated Reasoning Lecture 5: First-Order Logic Jacques Fleuriot jdf@inf.ac.uk Recap Over the last three lectures, we have looked at: Propositional logic, semantics and proof systems Doing propositional
More informationCS 275 Automata and Formal Language Theory
CS 275 Automata and Formal Language Theory Course Notes Part III: Limits of Computation Chapter III.1: Introduction Anton Setzer http://www.cs.swan.ac.uk/ csetzer/lectures/ automataformallanguage/current/index.html
More informationTHE UNIVERSITY OF CALGARY FACULTY OF SCIENCE FINAL EXAMINATION COMPUTER SCIENCE 521
P. 1 of 7 THE UNIVERSITY OF CALGARY FACULTY OF SCIENCE FINAL EXAMINATION COMPUTER SCIENCE 521 December, 2016 Time: 2 hrs. Instructions The exam contains questions totaling 100 points. Answer all questions.
More informationLecture 13: Turing Machine
Lecture 13: Turing Machine Instructor: Ketan Mulmuley Scriber: Yuan Li February 19, 2015 Turing machine is an abstract machine which in principle can simulate any computation in nature. Church-Turing Thesis:
More informationTHE UNIVERSITY OF CALGARY FACULTY OF SCIENCE FINAL EXAMINATION COMPUTER SCIENCE 521
P. 1 of 7 THE UNIVERSITY OF CALGARY FACULTY OF SCIENCE FINAL EXAMINATION COMPUTER SCIENCE 521 December, 2014 Time: 2 hrs. Instructions The exam contains questions totaling 100 points. Answer all questions.
More informationCS20a: Turing Machines (Oct 29, 2002)
CS20a: Turing Machines (Oct 29, 2002) So far: DFA = regular languages PDA = context-free languages Today: Computability 1 Church s thesis The computable functions are the same as the partial recursive
More informationModels of Computation,
Models of Computation, 2010 1 The Lambda Calculus A brief history of mathematical notation. Our notation for numbers was introduced in the Western World in the Renaissance (around 1200) by people like
More information