computer assisted proofs
play

Computer Assisted Proofs Colin R IBA LIP ENS Lyon Course 05 10th - PowerPoint PPT Presentation

Computer Assisted Proofs Colin R IBA LIP ENS Lyon Course 05 10th Oct. 2014 1 / 18 Curry-Howard Correspondence Curry-Howard Correspondence Intuitionistic Predicate Logic 2 / 18 Curry-Howard Correspondence Proof Terms and Translation of


  1. Computer Assisted Proofs Colin R IBA LIP – ENS Lyon Course 05 10th Oct. 2014 1 / 18

  2. Curry-Howard Correspondence Curry-Howard Correspondence Intuitionistic Predicate Logic 2 / 18

  3. Curry-Howard Correspondence Proof Terms and Translation of Derivations Proof Terms for NJ Let L ( V , Σ, Π ) be a first-order language. Main Idea. ◮ A proof of ∀ x.A is a function mapping a ∈ T er ( V ar, Σ ) to a proof of A [ a/x ] . ◮ A proof of ∃ x.A is a pair ( a, t ) , where a ∈ T er ( V ar, Σ ) and t is a proof of A [ a/x ] . 3 / 18

  4. Curry-Howard Correspondence Proof Terms and Translation of Derivations Proof Terms for NJ Let L ( V , Σ, Π ) be a first-order language. Main Idea. ◮ A proof of ∀ x.A is a function mapping a ∈ T er ( V ar, Σ ) to a proof of A [ a/x ] . ◮ A proof of ∃ x.A is a pair ( a, t ) , where a ∈ T er ( V ar, Σ ) and t is a proof of A [ a/x ] . There are two worlds: ◮ individual terms { a, b, c, . . . } of L ( V , Σ, Π ) , ◮ proof terms ( λ -terms) { t, u, v, . . . } . 3 / 18

  5. Curry-Howard Correspondence Proof Terms and Translation of Derivations Proof Terms for NJ Let L ( V , Σ, Π ) be a first-order language. Main Idea. ◮ A proof of ∀ x.A is a function mapping a ∈ T er ( V ar, Σ ) to a proof of A [ a/x ] . ◮ A proof of ∃ x.A is a pair ( a, t ) , where a ∈ T er ( V ar, Σ ) and t is a proof of A [ a/x ] . There are two worlds: ◮ individual terms { a, b, c, . . . } of L ( V , Σ, Π ) , ◮ proof terms ( λ -terms) { t, u, v, . . . } . Proof Terms. t, u ∈ Λ ( V , Σ ) ::= x | λx.t | t u | ( t, u ) | π 1 t | π 2 t | in 1 t | in 2 t | () | case ⊥ t {} | case t { in 1 x 1 → u 1 | in 2 x 2 → u 2 } | λx.t | t a | ( a, t ) | let ( x, y ) = t in u 3 / 18

  6. Curry-Howard Correspondence Proof Terms and Translation of Derivations Universal Quantification Γ ⊢ t : A Γ ⊢ t : ∀ x.A ( ∀ I ) ( x / ∈ FV ( Γ )) ( ∀ E ) Γ ⊢ λx.t : ∀ x.A Γ ⊢ ta : A [ a/x ] 4 / 18

  7. Curry-Howard Correspondence Proof Terms and Translation of Derivations Universal Quantification Γ ⊢ t : A Γ ⊢ t : ∀ x.A ( ∀ I ) ( x / ∈ FV ( Γ )) ( ∀ E ) Γ ⊢ λx.t : ∀ x.A Γ ⊢ ta : A [ a/x ] . . . . . . Π ⊲ β « Π [ a/x ] » Γ ⊢ t : A x / ∈ FV ( Γ, A ) Γ ⊢ λx.t : ∀ x.A Γ ⊢ t [ a/x ] : A [ a/x ] Γ ⊢ ( λx.t ) a : A [ a/x ] 4 / 18

  8. Curry-Howard Correspondence Proof Terms and Translation of Derivations Universal Quantification Γ ⊢ t : A Γ ⊢ t : ∀ x.A ( ∀ I ) ( x / ∈ FV ( Γ )) ( ∀ E ) Γ ⊢ λx.t : ∀ x.A Γ ⊢ ta : A [ a/x ] . . . . . . Π ⊲ β « Π [ a/x ] » Γ ⊢ t : A x / ∈ FV ( Γ, A ) Γ ⊢ λx.t : ∀ x.A Γ ⊢ t [ a/x ] : A [ a/x ] Γ ⊢ ( λx.t ) a : A [ a/x ] Existential Quantification Γ ⊢ t : A [ a/x ] Γ ⊢ t : ∃ x.A Γ, y : A ⊢ u : B ( ∃ E ) ( x / ∈ FV ( Γ, B )) ( ∃ I ) Γ ⊢ ( a, t ) : ∃ x.A Γ ⊢ let ( x, y ) = t in u : B 4 / 18

  9. Curry-Howard Correspondence Proof Terms and Translation of Derivations Universal Quantification Γ ⊢ t : A Γ ⊢ t : ∀ x.A ( ∀ I ) ( x / ∈ FV ( Γ )) ( ∀ E ) Γ ⊢ λx.t : ∀ x.A Γ ⊢ ta : A [ a/x ] . . . . . . Π ⊲ β « Π [ a/x ] » Γ ⊢ t : A x / ∈ FV ( Γ, A ) Γ ⊢ λx.t : ∀ x.A Γ ⊢ t [ a/x ] : A [ a/x ] Γ ⊢ ( λx.t ) a : A [ a/x ] Existential Quantification Γ ⊢ t : A [ a/x ] Γ ⊢ t : ∃ x.A Γ, y : A ⊢ u : B ( ∃ E ) ( x / ∈ FV ( Γ, B )) ( ∃ I ) Γ ⊢ ( a, t ) : ∃ x.A Γ ⊢ let ( x, y ) = t in u : B . . . . . . . Π 1 . . ⊲ β Γ ⊢ t : A [ a/x ] « Π 2 [ Π 1 /y ][ a/x ] » Π 2 ∈ FV ( Γ, B ) x / Γ ⊢ ( a, t ) : ∃ x.A Γ, y : A ⊢ u : B Γ ⊢ u [ t/y ][ a/x ] : B Γ ⊢ let ( x, y ) = ( a, t ) in u : B 4 / 18

  10. Curry-Howard Correspondence Proof Terms and Translation of Derivations Proof Terms. t, u ∈ Λ ( V , Σ ) ::= x | λx.t | t u | ( t, u ) | π 1 t | π 2 t | in 1 t | in 2 t | () | case ⊥ t {} | case t { in 1 x 1 → u 1 | in 2 x 2 → u 2 } | λx.t | t a | ( a, t ) | let ( x, y ) = t in u Typing Rules: propositional rules augmented with Γ ⊢ t : A Γ ⊢ t : ∀ x.A ( ∀ I ) ( x / ∈ FV ( Γ )) ( ∀ E ) Γ ⊢ λx.t : ∀ x.A Γ ⊢ ta : A [ a/x ] Γ ⊢ t : A [ a/x ] Γ ⊢ t : ∃ x.A Γ, y : A ⊢ u : B ( ∃ E ) ( x / ∈ FV ( Γ, B )) ( ∃ I ) Γ ⊢ ( a, t ) : ∃ x.A Γ ⊢ let ( x, y ) = t in u : B Reduction: β -reduction of the λ -calculus with sums and products, aumgented with ( λx.t ) a t [ a/x ] ⊲ β let ( x, y ) = ( a, t ) in u u [ t/y ][ a/x ] ⊲ β and the corresponding context rules. 5 / 18

  11. Curry-Howard Correspondence Proof Terms and Translation of Derivations Example ◮ Reminder: models of first-order logic are assumed to be non-empty . ◮ ∀ x.A ⊢ ∃ x.A is derivable. 6 / 18

  12. Curry-Howard Correspondence Proof Terms and Translation of Derivations Example ◮ Reminder: models of first-order logic are assumed to be non-empty . ◮ ∀ x.A ⊢ ∃ x.A is derivable. ◮ With proof terms: h : ∀ x.A ⊢ ( x, hx ) : ∃ x.A ⊢ λh. ( x, hx ) : ∀ x.A ⇒ ∃ x.A 6 / 18

  13. Curry-Howard Correspondence Proof Terms and Translation of Derivations Example ◮ Reminder: models of first-order logic are assumed to be non-empty . ◮ ∀ x.A ⊢ ∃ x.A is derivable. ◮ With proof terms: h : ∀ x.A ⊢ ( x, hx ) : ∃ x.A ⊢ λh. ( x, hx ) : ∀ x.A ⇒ ∃ x.A ◮ this proof term is open even if ∀ x.A is closed. ◮ The variable x can be replaced by a closed term, if there is one in T er ( V , Σ ) . ◮ This variable reflects the assumption that the models of T er ( V , Σ ) are non-empty, even if T er ( V , Σ ) describes possibly empty structures. 6 / 18

  14. Curry-Howard Correspondence Main Properties Main Properties (1/2) Lemma (Curry-Howard Correspondence) A 1 , . . . , A n ⊢ A is derivable in NJ iff there is a term t whose free proof variables are among x 1 , . . . , x n and such that x 1 : A 1 , . . . , x n : A n ⊢ t : A . 7 / 18

  15. Curry-Howard Correspondence Main Properties Main Properties (1/2) Lemma (Curry-Howard Correspondence) A 1 , . . . , A n ⊢ A is derivable in NJ iff there is a term t whose free proof variables are among x 1 , . . . , x n and such that x 1 : A 1 , . . . , x n : A n ⊢ t : A . Theorem ◮ The relation ⊲ β is confluent. ◮ If Γ, x : B ⊢ t : A and Γ ⊢ u : B then Γ ⊢ t [ u/x ] : A . ◮ If Γ ⊢ t : A then Γ [ a/x ] ⊢ t [ a/x ] : A [ a/x ] ◮ The relation ⊲ β preserves typing. ◮ The relation ⊲ β is strongly normalizing on typed terms. 7 / 18

  16. Curry-Howard Correspondence Main Properties Main Properties (1/2) Lemma (Curry-Howard Correspondence) A 1 , . . . , A n ⊢ A is derivable in NJ iff there is a term t whose free proof variables are among x 1 , . . . , x n and such that x 1 : A 1 , . . . , x n : A n ⊢ t : A . Theorem ◮ The relation ⊲ β is confluent. ◮ If Γ, x : B ⊢ t : A and Γ ⊢ u : B then Γ ⊢ t [ u/x ] : A . ◮ If Γ ⊢ t : A then Γ [ a/x ] ⊢ t [ a/x ] : A [ a/x ] ◮ The relation ⊲ β preserves typing. ◮ The relation ⊲ β is strongly normalizing on typed terms. Lemma (Normal forms in the empty context) If t is typable in the empty context and in normal form for ⊲ β , then t is of the form: () λx.u ( u, v ) in i u λx.t ( a, t ) . 7 / 18

  17. Curry-Howard Correspondence Main Properties Main Properties (2/2) Lemma (Curry-Howard Correspondence) A 1 , . . . , A n ⊢ A is derivable in NJ iff there is a term t whose free proof variables are among x 1 , . . . , x n and such that x 1 : A 1 , . . . , x n : A n ⊢ t : A . Lemma (Normal forms in the empty context) If t is typable in the empty context and in normal form for ⊲ β , then t is of the form: () λx.u ( u, v ) in i u λx.t ( a, t ) . 8 / 18

  18. Curry-Howard Correspondence Main Properties Main Properties (2/2) Lemma (Curry-Howard Correspondence) A 1 , . . . , A n ⊢ A is derivable in NJ iff there is a term t whose free proof variables are among x 1 , . . . , x n and such that x 1 : A 1 , . . . , x n : A n ⊢ t : A . Lemma (Normal forms in the empty context) If t is typable in the empty context and in normal form for ⊲ β , then t is of the form: () λx.u ( u, v ) in i u λx.t ( a, t ) . Corollary In intuitionistic predicate logic, ◮ ⊢ ⊥ is not derivable, ◮ if ⊢ A ∨ B then either ⊢ A or ⊢ B . ◮ if ⊢ ∃ x.A then there exists a ∈ T er ( V , Σ ) such that ⊢ A [ a/x ] . 8 / 18

  19. Curry-Howard Correspondence Main Properties Logic with Equality (1/2) 9 / 18

  20. Curry-Howard Correspondence Main Properties Logic with Equality (1/2) Proof terms. ◮ eq I for reflexivity ( ∀ x. x = x ) ◮ eq E for Leibniz’s scheme ( ∀ xy. x = y ⇒ A [ x/z ] ⇒ A [ y/z ] ) Typing rules. Γ ⊢ t : a = b Γ ⊢ u : A [ a/x ] Γ ⊢ eq I a : a = a Γ ⊢ eq E ( a, b, t, u ) : A [ b/x ] 9 / 18

  21. Curry-Howard Correspondence Main Properties Logic with Equality (1/2) Proof terms. ◮ eq I for reflexivity ( ∀ x. x = x ) ◮ eq E for Leibniz’s scheme ( ∀ xy. x = y ⇒ A [ x/z ] ⇒ A [ y/z ] ) Typing rules. Γ ⊢ t : a = b Γ ⊢ u : A [ a/x ] Γ ⊢ eq I a : a = a Γ ⊢ eq E ( a, b, t, u ) : A [ b/x ] Equality Cuts. Π Π Γ ⊢ eq I a : a = a Γ ⊢ u : A [ a/x ] ⊲ β Γ ⊢ u : A [ a/x ] Γ ⊢ eq E ( a, a , ( eq I a ) , u ) : A [ a/x ] Reduction. eq E ( a, b , ( eq I c ) , u ) ⊲ β u (by typing, a , b and c are the same) 9 / 18

Recommend


More recommend