a proof theoretic foundation for tabled higher order
play

A proof-theoretic foundation for tabled higher-order logic - PowerPoint PPT Presentation

A proof-theoretic foundation for tabled higher-order logic programming Brigitte Pientka Department of Computer Science Carnegie Mellon University Pittsburgh, PA, 15217, USA A proof-theoretic foundation for tabled higher-order logic programming


  1. A proof-theoretic foundation for tabled higher-order logic programming Brigitte Pientka Department of Computer Science Carnegie Mellon University Pittsburgh, PA, 15217, USA A proof-theoretic foundation for tabled higher-order logic programming – p.1/31

  2. Outline • What is higher-order logic programming? • Example: Type-system using subtyping • Tabled higher-order logic programming – How higher-order tabling works – Characterization based on uniform proofs – Soundness proof • Related and future work A proof-theoretic foundation for tabled higher-order logic programming – p.2/31

  3. Higher-order logic programming What means higher-order? • Terms: (dependently) typed λ -calculus • Clauses: implication, universal quantification A proof-theoretic foundation for tabled higher-order logic programming – p.3/31

  4. Higher-order logic programming What means higher-order? • Terms: (dependently) typed λ -calculus • Clauses: implication, universal quantification Framework for specifying and implementing • logical systems • proofs about them A proof-theoretic foundation for tabled higher-order logic programming – p.3/31

  5. Higher-order logic programming What means higher-order? • Terms: (dependently) typed λ -calculus • Clauses: implication, universal quantification Framework for specifying and implementing • logical systems (safety logics, type system . . . ) • proofs about them A proof-theoretic foundation for tabled higher-order logic programming – p.3/31

  6. Higher-order logic programming What means higher-order? • Terms: (dependently) typed λ -calculus • Clauses: implication, universal quantification Framework for specifying and implementing • logical systems (safety logics, type system . . . ) • proofs about them (correctness, soundness . . . ) A proof-theoretic foundation for tabled higher-order logic programming – p.3/31

  7. Higher-order logic programming What means higher-order? • Terms: (dependently) typed λ -calculus • Clauses: implication, universal quantification Framework for specifying and implementing • logical systems (safety logics, type system . . . ) • proofs about them (correctness, soundness . . . ) Languages: • λ Prolog[Miller91], Isabelle[Paulson86] • Elf [Pfenning91] A proof-theoretic foundation for tabled higher-order logic programming – p.3/31

  8. Proof search via logic programming Generic proof search over logical systems • factor effort for each particular logical system Infinite computation leads to non-termination. • Many specifications are not executable. Redundant computation hampers performance. • Sub-proofs may be repeated. • There may be many ways to prove a query. A proof-theoretic foundation for tabled higher-order logic programming – p.4/31

  9. First-order tabled computation • Resolution with memoization [Tamaki,Sato86] • Memoize atomic subgoals and re-use results • Finds all possible answers to a query • Terminates for programs in a finite domain • Combine tabled and non-tabled execution • Very successful: XSB system [Warren et.al. ] A proof-theoretic foundation for tabled higher-order logic programming – p.5/31

  10. This talk 1. Tabled higher-order logic programming • Term: (dependently) typed λ -calculus • Clauses: universal quantification, implication 2. High-level description based on uniform proofs 3. Soundness proof A proof-theoretic foundation for tabled higher-order logic programming – p.6/31

  11. Outline • What is higher-order logic programming? • Example: Type-system using subtyping • Tabled higher-order logic programming – How higher-order tabling works – Characterization based on uniform proofs – Soundness proof • Related and future work A proof-theoretic foundation for tabled higher-order logic programming – p.7/31

  12. Declarative description of subtyping types τ :: = zero | pos | nat | bit | τ 1 ⇒ τ 2 | . . . Example: 6 = 110 and 110 ∈ nat A proof-theoretic foundation for tabled higher-order logic programming – p.8/31

  13. Declarative description of subtyping types τ :: = zero | pos | nat | bit | τ 1 ⇒ τ 2 | . . . Example: 6 = 110 and 110 ∈ nat pn zn nb zero � nat pos � nat nat � bit A proof-theoretic foundation for tabled higher-order logic programming – p.8/31

  14. Declarative description of subtyping types τ :: = zero | pos | nat | bit | τ 1 ⇒ τ 2 | . . . Example: 6 = 110 and 110 ∈ nat pn zn nb zero � nat pos � nat nat � bit T � R R � S tr refl T � S T � T A proof-theoretic foundation for tabled higher-order logic programming – p.8/31

  15. Typing rules for Mini-ML expressions e ::= ǫ | e 0 | e 1 | lam x.e | app e 1 e 2 τ ′ � τ tp-sub Γ , x : τ 1 ⊢ e : τ 2 Γ ⊢ e : τ ′ tp-lam x Γ ⊢ e : τ Γ ⊢ lam x.e : τ 1 ⇒ τ 2 A proof-theoretic foundation for tabled higher-order logic programming – p.9/31

  16. 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. A proof-theoretic foundation for tabled higher-order logic programming – p.10/31

  17. Implementation of subtyping zn: sub zero nat. pn: sub pos nat. nb: sub nat bit. Not executable! refl: sub T T. tr: sub T S <- sub T R <- sub R S. A proof-theoretic foundation for tabled higher-order logic programming – p.10/31

  18. Implementation of typing rules tp sub: of E T <- of E T’ <- sub T’ T. of (lam λ x.E x) (T1 => T2) tp lam: <-( Π x:exp.of x T1 -> of (E x) T2). “forall x:exp , assume of x T1 and show of (E x) T2 ” A proof-theoretic foundation for tabled higher-order logic programming – p.11/31

  19. Implementation of typing rules tp sub: of E T <- of E T’ <- sub T’ T. of (lam λ x.E x) (T1 => T2) tp lam: <-( Π x:exp.of x T1 -> of (E x) T2). “forall x:exp , assume of x T1 and show of (E x) T2 ” Redundancy: tp sub is always applicable! A proof-theoretic foundation for tabled higher-order logic programming – p.11/31

  20. Outline • What is higher-order logic programming? • Example: Type-system using subtyping • Tabled higher-order logic programming – How higher-order tabling works – Characterization based on uniform proofs – Soundness proof • Related and future work A proof-theoretic foundation for tabled higher-order logic programming – p.12/31

  21. Outline • What is higher-order logic programming? • Example: Type-system using subtyping • Tabled higher-order logic programming – How higher-order tabling works – Characterization based on uniform proofs – Soundness proof • Related and future work A proof-theoretic foundation for tabled higher-order logic programming – p.12/31

  22. Tabled higher-order logic programming • Eliminate redundant and infinite paths from proof search using a memo-table • Table entry: ( Γ → a , A ) - Γ : context of assumptions (i.e. x:exp, u:of x T1 ) - a : atomic goal (i.e. of (lam λ x. x) T ) - A : list of answer substitutions for all free variables in Γ and a • Depth-first multi-stage strategy adopted from first-order strategy [Tamaki,Sato89] A proof-theoretic foundation for tabled higher-order logic programming – p.13/31

  23. How higher-order tabling works... Stage 1 · → of (lam λ x.x) T Entry Answers A proof-theoretic foundation for tabled higher-order logic programming – p.14/31

  24. How higher-order tabling works... Stage 1 · → of (lam λ x.x) T Entry Answers · → of (lam λ x.x) T A proof-theoretic foundation for tabled higher-order logic programming – p.14/31

  25. How higher-order tabling works... Stage 1 · → of (lam λ x.x) T tp_sub · → of (lam λ x.x) R, sub R T Entry Answers · → of (lam λ x.x) T A proof-theoretic foundation for tabled higher-order logic programming – p.14/31

  26. How higher-order tabling works... Stage 1 · → of (lam λ x.x) T tp_sub · → of (lam λ x.x) R, Suspend sub R T Entry Answers · → of (lam λ x.x) T A proof-theoretic foundation for tabled higher-order logic programming – p.14/31

  27. How higher-order tabling works... Stage 1 · → of (lam λ x.x) T tp_sub · → of (lam λ x.x) R, Suspend sub R T tp_lam x:exp, u:of x T1 → of x T2 Entry Answers · → of (lam λ x.x) T A proof-theoretic foundation for tabled higher-order logic programming – p.14/31

  28. How higher-order tabling works... Stage 1 · → of (lam λ x.x) T tp_sub · → of (lam λ x.x) R, Suspend sub R T tp_lam x:exp, u:of x T1 → of x T2 Entry Answers · → of (lam λ x.x) T x:exp, u:of x T1 → of x T2 A proof-theoretic foundation for tabled higher-order logic programming – p.14/31

  29. How higher-order tabling works... Stage 1 · → of (lam λ x.x) T tp_sub · → of (lam λ x.x) R, Suspend sub R T u tp_lam T1 = S, T2 = S, T = (S ⇒ S) x:exp, u:of x T1 → of x T2 Entry Answers · → of (lam λ x.x) T x:exp, u:of x T1 → of x T2 A proof-theoretic foundation for tabled higher-order logic programming – p.14/31

  30. How higher-order tabling works... Stage 1 · → of (lam λ x.x) T tp_sub · → of (lam λ x.x) R, Suspend sub R T u tp_lam T1 = S, T2 = S, T = (S ⇒ S) x:exp, u:of x T1 → of x T2 Entry Answers · → of (lam λ x.x) T T = (S ⇒ S) x:exp, u:of x T1 → of x T2 T1 = S, T2 = S A proof-theoretic foundation for tabled higher-order logic programming – p.14/31

Recommend


More recommend