tabled higher order logic programming
play

Tabled higher-order logic programming Brigitte Pientka Department - PowerPoint PPT Presentation

Tabled higher-order logic programming Brigitte Pientka Department of Computer Science Carnegie Mellon University Pittsburgh, PA, 15213-3891, USA Thesis Committee: Frank Pfenning (Chair) Robert Harper Dana Scott David Warren, University of


  1. Tabled higher-order logic programming Brigitte Pientka Department of Computer Science Carnegie Mellon University Pittsburgh, PA, 15213-3891, USA Thesis Committee: Frank Pfenning (Chair) Robert Harper Dana Scott David Warren, University of New York at Stony Brook Tabled higher-order logic programming – p.1/47

  2. � � � Outline Logical frameworks and certified code Tabled higher-order logic programming - Basic idea and challenges - Experiments and Evaluation - Improving efficiency Conclusion and future work Tabled higher-order logic programming – p.2/47

  3. � � Deductive systems and logical frameworks Deductive systems are plentiful computer science. Axioms and inference rules Examples: operational semantics, type system, logic, etc. Tabled higher-order logic programming – p.3/47

  4. � � � � � Deductive systems and logical frameworks Deductive systems are plentiful computer science. Axioms and inference rules Examples: operational semantics, type system, logic, etc. Logical framework: meta-language for deductive systems High-level specifications (e.g. type system) Execution via logic programming interpretation (e.g. type checker) Meta-reasoning via theorem prover combining induction and logic programming search (e.g. type preservation) Tabled higher-order logic programming – p.3/47

  5. ✆ ✟ ✆ ✟ ✆ ✁ ✠ ✠✡ ✁ ✁ ✝ ✠ ✁ ✠ ✁ ✡ ☛ � ✞ Declarative description of subtyping types :: = zero pos nat bit �✄✂ �✄☎ Example: and nat Tabled higher-order logic programming – p.4/47

  6. ✞ ✟ ✆ ✆ ✆ ✁ ✠ ✠✡ ✁ ✁ ✝ ✠ ✁ ✠ ✁ ✡ ☛ � ✟ Declarative description of subtyping types :: = zero pos nat bit �✄✂ �✄☎ Example: and nat pn zn nb zero nat pos nat nat bit Tabled higher-order logic programming – p.4/47

  7. ✠ ✆ ☛ ✡ � ✠ ✟ ✂ ✠✡ ✠ ✟ ✞ ✝ � ✆ ✆ � ✁ � � ✁ ☎ ✁ � ✁ ✂ ✁ � ☎ � � Declarative description of subtyping types :: = zero pos nat bit �✄✂ �✄☎ Example: and nat pn zn nb zero nat pos nat nat bit tr refl Tabled higher-order logic programming – p.4/47

  8. ✆ ☎ � ✆ � � � ✆ ✂ ✄ � � � ✂ ✝ ✁ ☎ � ✂ ✄ � ✁ ☎ ✄ ✄ ✁ � ☎ ✟ ✁ � � ✁ � ✂ � ✂ ✁ ✆ � ✁ ☎ � ✂ � ☎ ✂ Typing rules for Mini-ML expressions ::= 0 1 fun app tp-sub ☎ �✄☎ tp-fun fun Tabled higher-order logic programming – p.5/47

  9. Implementation of subtyping zn: sub zero nat. pn: sub pos nat. nb: sub nat bit. refl: sub T T. tr: sub T S <- sub T R <- sub R S. Tabled higher-order logic programming – p.6/47

  10. Implementation of subtyping zn: sub zero nat. ?- sub zero bit. pn: sub pos nat. nb: sub nat bit. refl: sub T T. tr: sub T S <- sub T R <- sub R S. Tabled higher-order logic programming – p.6/47

  11. Implementation of subtyping zn: sub zero nat. ?- sub zero bit. pn: sub pos nat. nb: sub nat bit. yes refl: sub T T. tr: sub T S Proof: (tr nb zn) <- sub T R <- sub R S. Tabled higher-order logic programming – p.6/47

  12. � Implementation of typing rules tp sub: of E T <- of E T’ <- sub T’ T. tp fun: of (fun x.E x) (T1 => T2) <-( x:exp.of x T1 -> of (E x) T2). “forall x:exp , assume of x T1 and show of (E x) T2 ” Tabled higher-order logic programming – p.7/47

  13. � � � � Higher-order logic programming Higher-order data-types: -abstraction – – dependent types Dynamic program clauses Explicit proof objects Tabled higher-order logic programming – p.8/47

  14. � � � � � Higher-order logic programming Higher-order data-types: -abstraction – – dependent types Dynamic program clauses Explicit proof objects Different approaches: Prolog, Isabelle, Twelf Tabled higher-order logic programming – p.8/47

  15. � � � � Application: certified code Code Producer Code Consumer Program Safety policy Safety policy Certificate Generate Certificate Check Certificate proof Foundational proof-carrying code : [Appel, Felty 00] Temporal-logic proof carrying code [Bernard,Lee02] Foundational typed assembly language : [Crary 03] Proof-carrying authentication: [Felten, Appel 99] Tabled higher-order logic programming – p.9/47

  16. � � � Application: certified code Code Producer Code Consumer Program Safety policy Safety policy Certificate Generate Certificate Check Certificate proof Large-scale applications Typical code size: 70,000 – 100,000 lines includes data-type definitions and proofs Higher-order logic program: 5,000 lines Over 600 – 700 clauses Tabled higher-order logic programming – p.9/47

  17. � � � Some limitations in practice Straightforward specifications are not executable. Redundancy severely hampers performance. Meta-reasoning capabilities limited in practice. Overcome some of these limitations using tabelling and other optimizations! Tabled higher-order logic programming – p.10/47

  18. � � This thesis Tabled higher-order logic programming allows us to efficiently execute logical systems (interpreter using tabled search) automate the reasoning with and about them. (meta-theorem prover using tabled search) This is a significant step towards applying logical frameworks in practice. Tabled higher-order logic programming – p.11/47

  19. � � � � � � Contributions Tabled higher-order logic programming Characterization based on uniform proofs (ICLP’02) Implementation of a tabled interpreter Case studies (parsing, refinement types, rewriting)(LFM’02) Efficient data-structures and algorithms Foundation for meta-variables (LFM’03) Optimizing higher-order unification (CADE’03) Higher-order term indexing (ICLP’03) Meta-reasoning based on tabled search Tabled higher-order logic programming – p.12/47

  20. � � � Outline Logical frameworks and certified code Tabled higher-order logic programming - Basic idea and challenges - Experiments and Evaluation - Improving efficiency Conclusion and future work Tabled higher-order logic programming – p.13/47

  21. � � � Outline Logical frameworks and certified code Tabled higher-order logic programming - Basic idea and challenges - Experiments and Evaluation - Improving efficiency Conclusion and future work Tabled higher-order logic programming – p.13/47

  22. The idea “...it is very common for the proofs to have repeated sub-proofs that should be hoisted out and proved only once ...” [Necula,Lee97] Tabled higher-order logic programming – p.14/47

  23. The idea “...it is very common for the proofs to have repeated sub-proofs that should be hoisted out and proved only once ...” [Necula,Lee97] Redundant computation Tabled higher-order logic programming – p.14/47

  24. The idea “...it is very common for the proofs to have repeated sub-proofs that should be hoisted out and proved only once ...” [Necula,Lee97] Redundant computation Tabled higher-order logic programming – p.14/47

  25. The idea “...it is very common for the proofs to have repeated sub-proofs that should be hoisted out and proved only once ...” [Necula,Lee97] Redundant computation Infinite computation Tabled higher-order logic programming – p.14/47

  26. � Recall...subtyping tp sub: of E T <- of E T’ <- sub T’ T. tp fun: of (fun x.E x) (T1 => T2) <-( x:exp.of x T1 -> of (E x) T2). “forall x:exp , assume of x T1 and show of (E x) T2 ” Tabled higher-order logic programming – p.15/47

  27. � ✁ � Proof tree λ of (fun x. x) T tp_sub tp_fun λ of (fun x. x) T u: of x T 2 of x T 3 1 sub T 1 T tp_sub u T 2 = S u: of x T 2 of x ( T 4 x u) T 3 = S sub ( T 4 x u) T 3 T = S S Tabled higher-order logic programming – p.16/47

  28. � � ✁ Proof tree of (fun λ x. x) T tp_sub tp_fun λ x. x) of (fun T u: of x T 2 of x T 3 1 sub T 1 T tp_sub u T 2 = S u: of x T 2 of x ( T 4 x u) T 3 = S sub ( T 4 x u) T 3 T = S S Loop detection Tabled higher-order logic programming – p.16/47

  29. ✁ � � Proof tree of (fun λ x. x) T tp_sub tp_fun λ x. x) of (fun T u: of x T 2 of x T 3 1 sub T 1 T tp_sub u T 2 = S u: of x T 2 of x ( T 4 x u) T 3 = S sub ( T 4 x u) T 3 T = S S Loop detection How can we detect loops? Tabled higher-order logic programming – p.16/47

  30. � ☎ � Loops modulo strengthening Dependencies among terms u:of x T of x (T x u) Tabled higher-order logic programming – p.17/47

  31. � ☎ � ☎ � Loops modulo strengthening Dependencies among terms u:of x T of x (T x u) strengthen u:of x T of x T Tabled higher-order logic programming – p.17/47

  32. ☎ ☎ � ☎ � � � � � Loops modulo strengthening Dependencies among terms u:of x T of x (T x u) strengthen u:of x T of x T Dependencies among propositions u:of x T sub (T x u) T Tabled higher-order logic programming – p.17/47

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