logic and computation
play

Logic and Computation Zena M. Ariola University Of Oregon Outline - PowerPoint PPT Presentation

Logic and Computation Zena M. Ariola University Of Oregon Outline of Lectures Lecture 1: - calculus Minimal Propositional Logic and simply typed - calculus as deduction system and as a computation engine


  1. Logic and Computation Zena M. Ariola University Of Oregon

  2. Outline of Lectures • Lecture 1: λ - calculus • Minimal Propositional Logic and simply typed λ - calculus • as deduction system and as a computation engine • Hilbert axioms and Combinatory Logic • Lecture 2: • Second-order Propositional Logic and System F • Classical Logic and Control effects • Lecture 3 : Sequent calculus as a logic and as a PL • Lecture 4: Applications in compilations, execution, design and reasoning of program � 2

  3. The foundational crisis of mathematics At the beginning of the 19th center set theory was born This theory was very promising because it offered a common foundation to all the fields of mathematics. ℛ = { x ∣ x ∉ x } ℛ ∈ ℛ ⟺ ℛ ∉ ℛ Georg Cantor (1845-1918) � 3

  4. Need of logic to define mathematics Let’s devise a complete and finite set of axioms from which all true statements can be derived. Gentzen introduced a formal system which modeled mathematical reasoning quite directly David Hilbert (1862-1943) Gerhard Gentzen (1909-1945) Gödel in 1935 published his incompleteness result. Kurt Gödel (1906-1978) � 4

  5. Natural Deduction

  6. Natural Deduction - Gentzen (1935) Formulae: A , B ::= X ∣ A ⊃ B ∣ A ∧ B ∣ A ∨ B Γ ⊢ A Judgement: If all assumptions in Γ are true then A is true Introduction and Elimination rules � 6

  7. Natural deduction Γ , A ` A Ax Γ ` A Γ ` B Γ ` A ^ B Γ ` A ^ B ^ I ^ E 1 ^ E 2 Γ ` A ^ B Γ ` A Γ ` B Γ , A ` B Γ ` A � B Γ ` A Γ ` A � B � I � E Γ ` B Γ ` A _ B Γ , A ` C Γ , B ` C Γ ` A Γ ` B Γ ` A _ B _ I 1 Γ ` A _ B _ I 2 _ E Γ ` C � 7

  8. Harmony (Dummett 1976) Local Soundness shows that the elimination rules are not too strong. Γ ` A _ B Γ ` B Local Completeness show that the elimination rules are not too weak Γ ` A ^ B Γ ` A � 8

  9. Local Soundness Elimination rules applied to the result of an introduction rule do not produce new information. D E B E Γ ` A Γ ` B D ⟹ ^ I Γ ` A ^ B Γ ` A ^ E Γ ` A Local Reductions � 9

  10. Local Soundness Elimination rules applied to the result of an introduction rule do not produce new information. D I Γ , A ` B E A B ⟹ D [ E / A ] Γ ` A � B � I ` Γ ` A Γ ` B � E Γ ` B Local Reductions � 10

  11. Local Soundness D Γ , A ` B Γ ` A � B � I E E D [ E / A ] E = ) Γ ` A Γ ` B � E Γ ` B A � A , B ` A � A A � A ` B � ( A � A ) � I A ` A B , A ` A ` ( A � A ) � B � ( A � A ) � I ` A � A � I B ` A � A � I � E = ` B � ( A � A ) � I ` B � ( A � A ) ) � 11

  12. Local Completeness The elimination rules are strong enough to get all the pieces out of a structured proposition so that they can be recomposed. A proof can always end with an introduction rule. 𝒠 𝒠 𝒠 Γ ` A ^ B Γ ` A ^ B ^ E ^ E A B = ) Γ ` A ^ B Γ ` A Γ ` B ^ I Γ ` A ^ B Local Expansion � 12

  13. Local completeness The elimination rules are strong enough to get all the pieces out of a structured proposition so that they can be recomposed. A proof can always end with an introduction rule. 𝒠 Γ , A ` A � B Γ , A ` A 𝒠 � E Γ , A ` B Γ ` A � B A B = ) Γ ` A � B � I A Local Expansion � 13

  14. Caution with variables Γ ` 8 x . P ( x ) x Γ ` P ( x ) I Γ ` P ( M ) 8 E Γ ` 8 x . P ( x ) 8 I P x ===== ` 8 x . 9 y . x 6 = y x = 0 ` x = 0 x 0 x = 0 ` 8 x . x = 0 ` 9 y . y 6 = y x x 0 Z 1 n n n x 2 dx [ Y X n !1 n 2 a i a i a i lim 0 i = 1 i = 1 i = 1 � 14

  15. Lambda calculus

  16. First [1932] version of lambda-calculus Church. Postulates for the Foundations of Logic, Annals of Mathematics, 33(2), 1932 Church. Postulates for the Foundations of Logic, Annals of Mathematics, 34(4), 1934. λ x . e Church introduced the notation for the function x x e with parameter and body .Variable is bound and Alonzo Church can be renamed without changing the meaning of the (1903-1995) function. Church proposes to encode all these different notations as operators which take a function as parameter: ∀ x . P ( x ) = ∀ ( λ x . P ( x )) ∃ x . P ( x ) = ∃ ( λ x . P ( x )) There is only one mechanism to introduce a variable - Higher-order abstract syntax � 16

  17. Lambda calculus M , N ::= x variable λ x . M abstraction M N application &( M , N ) M and N ¬ ( M ) not M ι ( M ) an integer x such that M x Y ( M , N ) forall x. if M(x) then N(x) X ( M ) ∃ x , Mx A ( M , N ) abstraction from N with respect to M 37 axioms (36 in the revision) and 5 inference rules λ x . M = α λ z . M [ z / x ] ( λ x . M ) N = β M [ N / x ] � 17

  18. 
 Propositions as Terms Predicates and propositions are lambda-calculus terms A ⊃ ( A & A ) Similar to logic programming today (e.g. Prolog) Predicates takes predicates in input (higher-order logic) Sets are identified with their characteristic function: = x ∈ A A x { x | P ( x ) } = λ x . P x { x } = λ y . x = y = A ∪ B λ x . A x ∨ B x λ x . ¬( x x ) The set of all x's such that x does not belong to x: � 18

  19. Lambda calculus is inconsistent R = λ x . ¬( x x ) Does R contains itself? Given = R 2 R R R = ( λ x . ¬ ( x x ))( λ x . ¬ ( x x )) = ¬ ( R R ) = R 62 R R ∈ R ⟺ R ∉ R How did Church react? This is not a paradox because he did not accept excluded middle (every proposition is either true or false). R is neither � 19

  20. Curry paradox (1942) Let’s focus on implication: ( X � ( X � Y )) � ( X � Y ) ( 1 ) ( MP ) X � Y , X ` Y X , X = Y ` Y ( Eq ) We define the term/proposition: term/proposition: X = X � ( X � Z ) = X � ( X � Z ) ( 4 ) X = ( X � ( X � Z )) � ( X � Z ) ( 5 ) � � � � ( 6 ) ( X � ( X � Z )) � ( X � Z ) ( 1 ) provable: It ( 7 ) X � ( X � Z ) ( 5 ) and ( Eq ) ( 8 ) ( 4 ) and ( Eq ) X ( 9 ) ( MP ) and ( 7 ) , ( 8 ) X � Z ( 10 ) ( MP ) and ( 8 ) , ( 9 ) Z cannot use -calculus as a logic, if we can define the formula X ! For it is Everything is provable � 20

  21. Fixed point theorem X = X ⊃ ( X ⊃ Z ) Can we define the formula Fixed point theorem. For every F there exists an X such that F X = X. D = λ x . F ( x x ) Proof. Let X = D D Take X = D D = F ( D D ) = F ( X ) We were looking for a proposition: X = X ⊃ ( X ⊃ Z ) X = ( λ x . x ⊃ ( x ⊃ Z )) X X λ x . x ⊃ ( x ⊃ Z ) becomes the fixed point of � 21

  22. How to solve the problem? Let’s get rid off the logical connectives Computation Recognize that not all terms represent propositions Type system � 22

  23. Pure Lambda-calculus Church with his students Kleene and Rosser (1935) studied the pure lambda- calculus : M ::= x ∣ λ x . M ∣ M M ( λ x . M ) N → M [ N / x ] They orient the beta-axiom: M → M 1 → M 2 → ⋯ → N → Terms represent computation: Theorem (Church-Rosser). beta-reduction is confluent A normal form (i.e. the answer of a program) if it exists is unique � 23

  24. Lambda-calculus as a computational model Church (1936), it is undecidable if a term has a normal form Hilbert program cannot be realized Kleene (1935) and Turing (1937) show the correspondence of the following computational models: - Partial recursive functions - Turing machines - Functions defined by lambda-terms f : N → N is lambda-definable if there exists a term A function F ∀ n ∈ N . F ⌜ n ⌝ = ⌜ f n ⌝ such that � 24

  25. Lambda calculus as the prototypical Functional programming language Functional language = lambda-calculus + evaluation strategy + data structures John McCarthy designed LISP (LISt Processor) in 1958 as an implementation of lambda-calculus, but implemented substitution incorrectly (1927-2011) Peter Landin described ISWIM (If you See What I Mean) in The Next 700 Programming Languages, published in the Communications of the ACM in 1966. (1930-2009) � 25

  26. Simple Theory of Types (Church, 1940) Types σ , τ ::= ι ∣ o ∣ σ → τ ⊃ : o → o → o ∀ : ( ι → o ) → o M ::= x ∣ λ x : σ . M ∣ M M Terms Static semantics Γ , x : σ ` x : σ Γ , x : σ ` M : τ Γ ` M : σ ! τ Γ ` N : σ Γ ` M N : τ Γ ` λ x : σ . M : σ ! τ ⊢ a ⊃ a : o ⊢ λ x . σ . λ y . τ . x : σ → τ → σ ⊢ λ x : σ → τ . λ y : τ → ρ . λ z : σ . y ( xz ) : ( σ → τ ) → ( τ → ρ ) → σ → ρ ⊢ λ x : σ . λ y : ( τ → σ ) → σ . y ( λ z : τ . x ) : σ → (( τ → σ ) → σ ) → σ � 26

  27. Properties Not every type has an inhabitant (i.e. a closed term of that type): ( σ → σ ) → σ Theorem (Subject reduction) Γ ⊢ N : τ Γ ⊢ M : τ M → → N and then . Theorem (Strong Normalization) there is no infinite reduction Γ ⊢ M : τ sequence starting from M � 27

  28. Formulae as Types A , B ::= X ∣ A ⊃ B Formulae σ , τ ::= b ∣ σ → τ Types Change of perspective: formulae are not terms � 28

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend