a proof checking kernel for the calculus modulo
play

A proof checking kernel for the -calculus modulo Mathieu - PowerPoint PPT Presentation

A proof checking kernel for the -calculus modulo Mathieu Boespflug, cole Polytechnique PhD defense, 18 january 2011 Funded by Pythia of Delphi Pythia of Delphi True False Proof implies truth. 1 1 For any reasonable notion


  1. A proof checking kernel for the λΠ-calculus modulo Mathieu Boespflug, École Polytechnique PhD defense, 18 january 2011 Funded by ☙ ☙

  2. Pythia of Delphi

  3. Pythia of Delphi True False

  4. Proof implies truth. 1 1 For any reasonable notion of proof.

  5. Formal systems Example words (concat) ☙ The language of formulae ☙ The set of axioms (or assumptions ) a-z, ǫ P is an axiom (ax) P is a palindrome P is a palindrome ☙ The language of proofs (ext) xP x is a palindrome P is a palindrome Q is a palindrome QP Q is a palindrome ☙ Theorems are formulae that have proofs.

  6. Palindromes: example d is an axiom (ax) t is a palindrome (ext) rtr is a palindrome (ext) artra is a palindrome (ext) tartrat is a palindrome (ext) etartrate is a palindrome (ext) detartrated is a palindrome

  7. (concat) Palindromes: example t ∈ Γ (ax) Γ ⊢ t (ext) Γ ⊢ rtr (ext) Γ ⊢ artra d ∈ Γ (ext) Γ ⊢ tartrat (ax) Γ ⊢ d (ext) Γ ⊢ etartrate (ext) Γ ⊢ ada (ext) Γ ⊢ detartrated (ext) Γ ⊢ radar Γ ⊢ radardetartratedradar

  8. Tree of proofs ...

  9. Tree of proofs ...

  10. Proof reduction (concat) (concat) − → Γ ⊢ P Γ ⊢ Q (ext) Γ ⊢ xP x Γ ⊢ Q Γ ⊢ P (ext) Γ ⊢ xQx Γ ⊢ QxP xQ Γ ⊢ xQxP xQx (ext) Γ ⊢ xQxP xQx

  11. (concat) Proof reduction: example t ∈ Γ (ax) Γ ⊢ t (ext) Γ ⊢ rtr (ext) Γ ⊢ artra d ∈ Γ (ext) Γ ⊢ tartrat (ax) Γ ⊢ d (ext) Γ ⊢ etartrate (ext) Γ ⊢ ada (ext) Γ ⊢ detartrated (ext) Γ ⊢ radar Γ ⊢ radardetartratedradar

  12. (concat) Proof reduction: example t ∈ Γ (ax) Γ ⊢ t (ext) Γ ⊢ rtr (ext) Γ ⊢ artra (ext) Γ ⊢ tartrat (ext) Γ ⊢ etartrate d ∈ Γ (ext) Γ ⊢ detartrated (ax) Γ ⊢ d (ext) Γ ⊢ rdetartratedr (ext) Γ ⊢ ada Γ ⊢ adardetartratedrada (ext) Γ ⊢ radardetartratedradar

  13. (concat) Proof reduction: example t ∈ Γ (ax) Γ ⊢ t (ext) Γ ⊢ rtr (ext) Γ ⊢ artra (ext) Γ ⊢ tartrat (ext) Γ ⊢ etartrate (ext) Γ ⊢ detartrated (ext) Γ ⊢ rdetartratedr d ∈ Γ (ext) Γ ⊢ ardetartratedra (ax) Γ ⊢ d Γ ⊢ dardetartratedrad (ext) Γ ⊢ adardetartratedrada (ext) Γ ⊢ radardetartratedradar

  14. Proof reduction: example t ∈ Γ (ax) Γ ⊢ t (ext) Γ ⊢ rtr (ext) Γ ⊢ artra (ext) Γ ⊢ tartrat (ext) Γ ⊢ etartrate (ext) Γ ⊢ detartrated (ext) Γ ⊢ rdetartratedr (ext) Γ ⊢ ardetartratedra (ext) Γ ⊢ dardetartratedrad (ext) Γ ⊢ adardetartratedrada (ext) Γ ⊢ radardetartratedradar

  15. or (ext) rule. Proof reduction: example t ∈ Γ (ax) Γ ⊢ t ☙ Proof in normal form. (ext) Γ ⊢ rtr ☙ Proof always ends with an (ax) (ext) Γ ⊢ artra (ext) Γ ⊢ tartrat ☙ Can compute with proofs. (ext) Γ ⊢ etartrate n (ext) Γ ⊢ detartrated (ext) Γ ⊢ rdetartratedr (ext) Γ ⊢ ardetartratedra Γ , radar ⊢ radar (ext) Γ ⊢ dardetartratedrad (ext) Γ ⊢ adardetartratedrada (ext) Γ ⊢ radardetartratedradar 2 n + 1

  16. Modus Ponens Γ ⊢ A ⇒ B Γ ⊢ A Γ ⊢ B

  17. Computation Rule: Computation with proofs of logical formulae Γ ,A ⊢ B Γ ⊢ A ⇒ B Γ ⊢ A Γ ⊢ B Γ ⊢ A ⇒ B − → Γ ,A ⊢ B Γ ⊢ B Γ ⊢ A ⇒ B Γ ⊢ A Γ ⊢ B

  18. Modulo --- formula rewriting inside formulae. reflexive tactics). Proofs ← → Programs Formulae ← → Types ☙ Want to reason on proofs / programs . ☙ If we can write proofs inside formulae then we should be able to compute ☙ Computation is a means to reduce proof effort (e.g. Four Colour Theorem,

  19. Dedukti Dedukti ( λ Π modulo)

  20. Dedukti Coq HOL PVS Epigram Isabelle Agda ... ... Dedukti ( λ Π modulo)

  21. Thesis Analysis, transformation and compilation of programs is a simple and effective method for checking proofs.

  22. Conversion test Γ ⊢ A A ≡ β R B Γ ⊢ B

  23. Normalization by Evaluation terms model 1. 2. interpretation ⟦ · ⟧ reification ↓ · ∀ M . ∀ N . M ≡ N ⇒ ⟦ M ⟧ = ⟦ N ⟧ (soundness), ∀ M . ↓ ⟦ M ⟧ = M if M is in normal form (reproduction).

  24. From program to data � x � = B x � λx . M � = Lam ( λx . � M � ) � M · N � = App � M � � N �

  25. Data evaluation � x � = B x � λx . M � = Lam ( λx . � M � ) � M · N � = App � M � � N � eval ( B x ) = x eval ( Lam f ) = λx . eval ( f x ) eval ( App M N ) = app ( eval M ) ( eval N ) app f N = f N

  26. Evaluation to a residualizing semantics � x � = B x � λx . M � = Lam ( λx . � M � ) � M · N � = App � M � � N � eval ( B x ) = x eval ( Lam f ) = Lam ( λx . eval ( f x )) eval ( App M N ) = app ( eval M ) ( eval N ) app ( Lam f ) N = f N app M N = App M N

  27. Interpretation � x � = B x � λx . M � = Lam ( λx . � M � ) � M · N � = App � M � � N � eval ( B x ) = x eval ( Lam f ) = Lam ( λx . eval ( f x )) eval ( App M N ) = app ( eval M ) ( eval N ) app ( Lam f ) N = f N app M N = App M N ⟦ M ⟧ = eval � M � .

  28. Partial evaluation of eval ◦ � · � ⟦ x ⟧ = x ⟦ λx . M ⟧ = Lam ( λx . ⟦ M ⟧) ⟦ M · N ⟧ = app ⟦ M ⟧ ⟦ N ⟧

  29. Reification ⟦ x ⟧ = x ⟦ λx . M ⟧ = Lam ( λx . ⟦ M ⟧) ⟦ M · N ⟧ = app ⟦ M ⟧ ⟦ N ⟧ ↓ n F m = m ↓ n Lam f = λn . ↓ n +1 ( f ( F n )) ↓ n App M N = ( ↓ n M ) · ( ↓ n N )

  30. Rewrite Rules and extensions . App (. . .( App ( Con ˆ default . . . . . . ⟦ _ ⟧ = _ . . . . the Calculus of Constructions. . ⟦ x ⟧ = x ⟦ c P 1 . . . P n ⟧ = App (. . .( App ( Con ˆ c ) ⟦ P 1 ⟧). . .) ⟦ P n ⟧ fix ( λc . λx 1 . · · · λx n . case ( x 1 , . . . , x n ) of     − → → c P 11 . . . P 1 n M 1 (⟦ P 11 ⟧ , . . . , ⟦ P 1 n ⟧) ⟦ M 1 ⟧         = − → → c P m 1 . . . P mn M m (⟦ P m 1 ⟧ , . . . , ⟦ P mn ⟧) ⟦ M m ⟧ → c ) x 1 ). . .) x n ) ☙ Untyped NbE extends naturally to residual forms and reduction rules of

  31. Optimizations eval/apply transformation. constructors. ☙ Removal of intermediate closure allocation by standard ☙ Constructors of object-level datatypes interpreted as metalevel ☙ Native pattern matching.

  32. Micro benchmarks 3 2 1 0 append even sort exp38 queens ucea ahn singlearity evalapply constructors whnf

  33. Synthetic benchmark 100 50 n/a 0 Cooper n = 5 Standard VM NbE NbE accu

  34. Context-free typing

  35. An alternative interpretation ⟦ x ⟧ = x ⟦ λx . M ⟧ = Lam ( λx . ⟦ M ⟧) ⟦ M · N ⟧ = App ⟦ M ⟧ ⟦ N ⟧

  36. Dependent product elimination (app) Γ ⊢ M : Π x : A . B Γ ⊢ N : A Γ ⊢ M N : { N / x } B

  37. Dependent product elimination (app) (app-ho) Γ ⊢ M : Π x : A . B Γ ⊢ N : A Γ ⊢ M N : { N / x } B Γ ⊢ M : Pi A f Γ ⊢ N : A Γ ⊢ M N : f N ☙ Easy implementation of capture avoiding substitution.

  38. Dependent product introduction ⟦ λx . M ⟧ = Lam ( λx . ⟦ M ⟧) � �� � f

  39. Dependent product introduction ⟦ λx . M ⟧ = Lam ( λx . ⟦ M ⟧) � �� � f

  40. Dependent product introduction f ( Var n )

  41. Dependent product introduction f [ n : A ]

  42. Dependent product introduction Γ ,x : A ⊢ M : B (abs) Γ ⊢ λx : A . M : Π x : A . B

  43. Dependent product introduction Γ ,x : A ⊢ M : B (abs) Γ ⊢ λx : A . M : Π x : A . B ⊢ M : f [ n : A ] (abs-ho) ⊢ Lam A f : Pi A f ☙ Drop explicit context in judgements.

  44. Towards a LCF style proof checker for dependently typed theories Example: ☙ Type decorated variable occurrences in HOL. ☙ Proofs checked by construction. ☙ Allows cheap combination of proofs. ☙ No context — no checking that contexts are compatible. Γ ′ ⊢ N : A ′ Γ ⊢ M : Π x : A . B Γ ⊢ { N / x } B

  45. Towards a LCF style proof checker for dependently typed theories Example: ☙ Type decorated variable occurrences in HOL. ☙ Proofs checked by construction. ☙ Allows cheap combination of proofs. ☙ No context — no checking that contexts are compatible. Γ ′ ⊢ N : A ′ Γ ⊢ M : Π x : A . B Γ ⊢ { N / x } B

  46. A purely functional kernel checked proofs. ☙ Proof checked by construction means no need for global registry of ☙ No state during proof checking.

  47. A purely functional kernel checked proofs. ☙ Proof checked by construction means no need for global registry of ☙ No state during proof checking. ◦ ◦ ◦ ◦ ◦ t t t = ◦ ◦ ◦

  48. A purely functional kernel checked proofs. ☙ Proof checked by construction means no need for global registry of ☙ No state during proof checking. ◦ ◦ ◦ ◦ ◦ ◦ ◦ [ ◦ : A ] ◦ ◦

  49. Managing dual interpretations

  50. Code explosion: example a 1 ( a 2 ( a 3 ( a 4 ( a 5 ( a 6 ( a 7 a 8 ))))))

  51. Recuperating sharing [ ] [ [ [ [ ] ] ] [ [ ] [ ] [ ] [ ] ] [ [ ] ] [ [ [ [ si x ∈ dom ( ρ ) . [ x ] ] ρ = ρ ( x ) ] ρ = � s, s � [ s ] [ λx : A . M ] [ A ] ] ρ ( λy . � Lam ˆ y ( λx . [ [ M ] ] ρ [ x �→ x ] ) , Lam ( λx . ⟦ M ⟧) � ) ] ρ = Let [ ] ρ ( λy . � Pi ˆ y ( λx . ⟦ B ⟧) � ) [Π x : A . B ] [ A ] y ( λx . [ [ B ] ] ρ [ x �→ x ] ) , Pi ˇ ] ρ = Let [ ] ρ ( λy . � App ˆ y � )) [ M N ] [ N ] ] ρ ( λx . Let [ [ M ] x ˆ y, app ˇ x ˇ ] ρ = Let [

  52. Connecting subterms to their code

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