lollipops taste of lollipops taste of lollipops taste of
play

Lollipops taste of Lollipops taste of Lollipops taste of Vanilla - PDF document

Lollipops taste of Lollipops taste of Lollipops taste of Vanilla too Vanilla too Vanilla too Post-ICLP'94 Workshop on Proof-Theoretical Extensions of Logic Programming Iliano Cervesato Iliano Cervesato Dipartimento di Informatica


  1. Lollipops taste of Lollipops taste of Lollipops taste of Vanilla too Vanilla too Vanilla too Post-ICLP'94 Workshop on Proof-Theoretical Extensions of Logic Programming Iliano Cervesato Iliano Cervesato Dipartimento di Informatica Università di Torino Corso Svizzera, 185 10149 Torino - Italy iliano@di.unito.it S. Margherita Ligure, Italy June 18 th , 1994 Iliano Cervesato - Lollipops taste of Vanilla too 1

  2. Overview Overview Overview • Meta-programming in logic programming – Meta-programs – The current trend – Granularity of a meta-program – The Vanilla meta-interpreter for Prolog • The linear logic programming language Lolli – Linear logic – Uniform proofs – The Τ , &, −ο , ⇒ , ∀ fragment – Lolli – Operational semantics • A Vanilla meta-interpreter for Lolli – Syntactic restrictions – The representation function – A vanilla meta-interpreter for the core of Lolli – Soundness of the meta-interpreter – Extensions and examples of use • Conclusions and future work Iliano Cervesato - Lollipops taste of Vanilla too 2

  3. Meta-programs Meta-programs Meta-programs ... are programs that treat other programs as data . Advantages: – powerful extensions of the base language are easily encoded – programming tools can be developed as needed – is a valid support to rapid prototyping Drawbacks: – low efficiency (in part recovered through partial evaluation) Applications: – software development (integrated programming environments) – software analysis – artificial intelligence (knowledge based systems) – theorem proving Iliano Cervesato - Lollipops taste of Vanilla too 3

  4. The current trend The current trend The current trend There have been many proposal to improve the meta-programming capabilities of Prolog: – 1982: Bowen & Kowalski's paper – 1985: MetaProlog (Bowen et al.) – 1989: Reflective Prolog (Costantini, Lanzarone) – 1990: Gödel (Hill, Lloyd) – 1991: 'Log (Cervesato, Rossi) No or little work has been done to investigate the meta-programming attitude of the new generation logic programming languages ( λ -Prolog, Lolli, Forum, Elf, ...). The underlying theory makes new techniques available to explore the properties of the meta- programs. Iliano Cervesato - Lollipops taste of Vanilla too 4

  5. The granularity of a The granularity of a The granularity of a meta-program meta-program meta-program ... is the ratio between what is simulated and what is passed over to the underlying interpreter Direct Simulation execution Efficiency Flexibility Examples: • solve(G) :- G. Vanilla • solve(true). solve((A,B)) :- solve(A), solve(B). solve(A) :- clause(A,B), solve(B). [Bowen-Kowalski] • solve(P,Gs) :- empty(G). solve(P,Gs) :- select(Gs,G,Gs'), member(C,P), rename(C,G,C'), parts(C',H,B), unify(H,G,S), append(G',B,G"), apply(S,G",G'"), solve(P,G'"). Iliano Cervesato - Lollipops taste of Vanilla too 5

  6. The Vanilla meta- The Vanilla meta- The Vanilla meta- interpreter for Prolog interpreter for Prolog interpreter for Prolog solve(true). • Vanilla is a medium solve((A,B)) :- granularity meta-interpreter solve(A), solve(B). • it achieves the function- solve(A) :- alities of the Horn core of clause(A,B), Prolog solve(B). Extra-logical functionalities can be added: solve((A;B)) :- solve(A); Disjunction solve(B). solve(not A) :- Negation as failure not solve(A). solve(bagof(X,G,Xs) :- Grouping bagof(X,solve(G),Xs). solve(A) :- functor(A,F,N), System calls system(F,N), A. Vanilla can be enhanced to deal correctly with control directives such as cut ( ! ). Iliano Cervesato - Lollipops taste of Vanilla too 6

  7. Linear logic Linear logic Linear logic ... refines traditional logic by constraining the number of times an assumption is used in a proof. Weakening and contraction are ruled out. This calls for a finer set of connectives: Connectives Context ¬ ∧ ∨ → Traditional T F Unbound 1 ⊥ ⊗ ℘ −ο ⊥ Multiplicative Split Τ 0 ⊕ Additive & Copy ! ? Exponential Unbound Example of sequent rules: ∆  →  ll ∆  →  ll ∆  →  ll ∆  →  ll B C B C 1 2 ⊗ & L L ∆ ∆  →  ll ⊗ ∆  →  ll , & B C B C 1 2 Controlled forms of weakening and contraction are made availabe through the use of ! and ? ∆  →  ll ∆  →  ll ∆  →  ll ,! ,! , E B B E B E ! ! ! W C D ∆  →  ll ∆  →  ll ∆  →  ll ,! ,! ,! B E B E B E Iliano Cervesato - Lollipops taste of Vanilla too 7

  8. Uniform proofs Uniform proofs Uniform proofs The logical connectives in a logic programming language should be used by the interpreter as search directives for finding proofs of goals Solving a goal G in a program ∆ = building a ∆  →  bottom up deduction for the sequent G Such a proof must be: • cut-free • goal directed A cut-free proof Ξ of the sequent is ∆  →  G uniform iff every left rules is applied to sequents with an atomic rhs only. • Horn intuitionistic logic YES • Full intuitionistic logic NO! • Full linear logic NO! We can identify maximal fragments of logic having the uniform proof property • hereditary Harrop formulas (the language freely generated from Τ , ∧ , → and ∀ ) Iliano Cervesato - Lollipops taste of Vanilla too 8

  9. The Τ , &, −ο , ⇒ , ∀ The Τ , &, −ο , ⇒ , ∀ The Τ , &, −ο , ⇒ , ∀ fragment fragment fragment Intuitionistic implication : A ⇒ B = !A −ο B Then, the language freely generated from Τ , &, −ο , ⇒ , ∀ HAS the uniform proof property The uniform proof property is preserved if we allow positive occurrences of 1 , ⊕ , ⊗ , ! and ∃ : R ::= Τ | A | R 1 & R 2 | G −ο R | G ⇒ ⇒ R | ∀ ∀ x . R G ::= Τ | A | G 1 & G 2 | R −ο G | R ⇒ ⇒ G | ∀ ∀ x . G | 1 | G 1 ⊗ G 2 | G 1 ⊕ G 2 | ! G | ∃ x . G Specialized sequents: − Γ ∆  →  ll ; G Unbound context: Bound Goal Γ = ! A 1 , ..., ! A n context formula set of R-Formulas multiset of G-Formula R-Formulas Iliano Cervesato - Lollipops taste of Vanilla too 9

  10. Sequent calculus rules Sequent calculus rules Sequent calculus rules Γ ∆  →  , ; , B B C id absorb Γ  →  Γ ∆  →  ; , ; A A B C 1 T R R 1 Γ ∆  →  Γ ∅  →  ; T ; Γ ∆  →  Γ ∆  →  Γ ∆  →  Γ ∆  →  ; ; ; ; B C B C 1 2 ⊗ & R R Γ ∆  →  Γ ∆ ∆  →  ⊗ ; & ; , B C B C 1 2 Γ ∆  →  Γ ∅  →  ; , ; B C B − o ! R R Γ ∆  →  − Γ ∅  →  ; o ; ! B C B Γ ∆  →  Γ ∆  →  , ; ; B C B i ⇒ ⊕ R Ri Γ ∆  →  ⇒ Γ ∆  →  ⊕ ; ; B C B B 1 2 Γ ∆  →  Γ ∆  →  ; [ / ] ; [ / ] B c x B t x ∀ ∃ R R Γ ∆  →  ∀ Γ ∆  →  ∃ ; . ; . x B x B ∃ ∀ where is a term in , and is not present in the lower sequent of t R c R Γ ∅  →  Γ ∅  →  Γ ∆  →  Γ ∆  →  ; ... ; ; ... ; B B C C 1 n 1 1 m m BC Γ ∆ ∆  →  ; ,..., , B A 1 m ≥ σ provided that , n m 0, is atomic and there exist a substitution A ≡ σ such that & ... & B D D 1 p = ο − ⊗ ⊗ ⊗ ⊗ ⊗ with ! ... ! ... D A B B C C m 1 1 n 1 Iliano Cervesato - Lollipops taste of Vanilla too 10

  11. Lolli Lolli Lolli Concrete syntax Τ −>> erase 1 −>> true −>> { A } ! A −>> A & B A & B A ⊗ B −>> A , B A ⊕ B −>> A ; B A −ο B −>> A -o B and B :− A ⇒ B −>> A ⇒ A => B and B <= A ∀ x . A −>> ∀ forall x \ A ∃ x . A −>> exists x \ A Example: toggling a switch s toggle s G :- on s, Without resource (off s -o G). consumption, turning toggle s G :- s on would keep it off s, also off (on s -o G). LINEAR off s. Iliano Cervesato - Lollipops taste of Vanilla too 11

  12. Operational semantics Operational semantics Operational semantics • D ; ∅ �� LOLLI true • D ; R �� LOLLI erase • D ; R �� LOLLI { G } iff D ; ∅ �� LOLLI G • D ; R 1 + R 2 �� LOLLI G 1 , G 2 iff D ; R 1 �� LOLLI G 1 and D ; R 2 �� LOLLI G 2 • D ; R �� LOLLI G 1 & G 2 iff D ; R �� LOLLI G 1 and D ; R �� LOLLI G 2 • D ; R �� LOLLI G 1 ; G 2 iff D ; R �� LOLLI G 1 or D ; R �� LOLLI G 2 • D ; R �� LOLLI r -o G iff D ; R + r �� LOLLI G • D ; R �� LOLLI d => G iff D ∪ d ; R �� LOLLI G • D ; R �� LOLLI forall x \ G iff D ; R �� LOLLI [ c / x ] G where c is a new constant • D ; R �� LOLLI exists x \ G iff D ; R �� LOLLI [ t / x ] G for some term t • D ∪ h :- b ; R �� LOLLI A σ = match( A , h ) and if D ∪ h :- b ; R �� LOLLI b σ • D ; R + h :- b �� LOLLI A σ = match( A , h ) and if D ; R �� LOLLI b σ • D ; R + c 1 & ... & c n �� LOLLI A D ; R + c i �� LOLLI A if for some i =1... n where σ = match( A , A 1 & ... & A n ) iff A σ = A i σ for some i =1... n Iliano Cervesato - Lollipops taste of Vanilla too 12

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