proof theoretic foundations of indexing in logic
play

Proof-Theoretic Foundations of Indexing in Logic Programming Iliano - PowerPoint PPT Presentation

Indexing over Predicates Indexing over Terms Beyond Horn Clauses Conclusions Proof-Theoretic Foundations of Indexing in Logic Programming Iliano Cervesato iliano@cmu.edu Carnegie Mellon University Supported by grant NPRP 4-341-1-059, Usable


  1. Indexing over Predicates Indexing over Terms Beyond Horn Clauses Conclusions Proof-Theoretic Foundations of Indexing in Logic Programming Iliano Cervesato iliano@cmu.edu Carnegie Mellon University Supported by grant NPRP 4-341-1-059, Usable automated data inference for end-users LFMTP’14 Vienna, Austria, July 2014

  2. Indexing over Predicates Indexing over Terms Beyond Horn Clauses Conclusions The Two Worlds of Computational Logic Logical world Universal language Abstract specifications Simple and natural reasoning Computational world Return answers fast! Pragmatics Logical status?

  3. Indexing over Predicates Indexing over Terms Beyond Horn Clauses Conclusions Justifying Pragmatics Logically Forward/Backward proof search — focusing Goal/Clause selection — ordered logic Unification — (contextual) reasoning about equality WAM-style compilation — currying

  4. Indexing over Predicates Indexing over Terms Beyond Horn Clauses Conclusions Justifying Pragmatics Logically Forward/Backward proof search — focusing Goal/Clause selection — ordered logic Unification — (contextual) reasoning about equality WAM-style compilation — currying What about indexing?

  5. Indexing over Predicates Indexing over Terms Beyond Horn Clauses Conclusions Justifying Pragmatics Logically Forward/Backward proof search — focusing Goal/Clause selection — ordered logic Unification — (contextual) reasoning about equality WAM-style compilation — currying What about indexing? Cuts context lookup from O ( n ) to O (1) — exponential savings!

  6. Indexing over Predicates Indexing over Terms Beyond Horn Clauses Conclusions Justifying Pragmatics Logically Forward/Backward proof search — focusing Goal/Clause selection — ordered logic Unification — (contextual) reasoning about equality WAM-style compilation — currying What about indexing? Cuts context lookup from O ( n ) to O (1) — exponential savings! Backward logic programming: select relevant clauses Forward logic programming: identify rules affected by new facts Theorem proving: retrieve relevant lemmas

  7. Indexing over Predicates Indexing over Terms Beyond Horn Clauses Conclusions This Work Provide a logical justification for indexing . . . in the context of backward logic programming Punch line: Polarization + Linearity Roadmap: � Indexing over predicate symbols Horn clauses Indexing over first-order terms Beyond Horn clauses

  8. Indexing over Predicates Indexing over Terms Beyond Horn Clauses Conclusions Backward Proof Search for Horn Clauses ::= p ( � t ) Atoms: a — negative G ::= a | ⊤ | G 1 ∧ G 2 Goals: D ::= G ⊃ a | ∀ x . D Clauses: Γ ::= · | Γ , D Programs: Case study: the usual append program ∀ l . ⊤ ⊃ app (nil , l , l ) ∀ x , l 1 , l 2 , l 3 . app ( l 1 , l 2 , l 3 ) ⊃ app (c( x , l 1 ) , l 2 , c( x , l 3 ))) In Prolog: append ( [ ] , L , L ) . append ( [X | L1 ] , L2 , [X | L3 ] ) : − append (L1 , L2 , L3 ) .

  9. Indexing over Predicates Indexing over Terms Beyond Horn Clauses Conclusions Backward Proof Search for Horn Clauses    Γ − → G 1 Γ − → G 2    ∧ R ⊤ R  Inversion   Γ − → ⊤ Γ − → G 1 ∧ G 2   Γ , D , D − → a     atm R   Γ , D − → a . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  Chaining   ⊢ t Γ , [ t / x ] D − → a Γ − → G ⊃ L ∀ L   Γ , G ⊃ a − → a Γ , ∀ x . D − → a

  10. Indexing over Predicates Indexing over Terms Beyond Horn Clauses Conclusions Outline Indexing over Predicates 1 Indexing over Terms 2 Beyond Horn Clauses 3 Conclusions 4

  11. Indexing over Predicates Indexing over Terms Beyond Horn Clauses Conclusions Clause Selection → p ( � Γ , D , D − t ) atm R → p ( � Γ , D − t )

  12. Indexing over Predicates Indexing over Terms Beyond Horn Clauses Conclusions Clause Selection → p ( � → p ( � ⊢ t Γ , [ t / x ] D − t ) Γ , D , D − t ) atm R ∀ L → p ( � → p ( � Γ , D − t ) Γ , ∀ x . D − t )

  13. Indexing over Predicates Indexing over Terms Beyond Horn Clauses Conclusions Clause Selection → p ( � → p ( � ⊢ t Γ , [ t / x ] D − t ) Γ , D , D − Γ − → G t ) atm R ⊃ L ∀ L → p ( � → p ( � Γ , G ⊃ p ( � → p ( � Γ , D − t ) Γ , ∀ x . D − t ) t ) − t ) Clause D is selected long before a match is established

  14. Indexing over Predicates Indexing over Terms Beyond Horn Clauses Conclusions Clause Selection → p ( � → p ( � ⊢ t Γ , [ t / x ] D − t ) Γ , D , D − Γ − → G t ) atm R ⊃ L ∀ L → p ( � → p ( � Γ , G ⊃ p ( � → p ( � Γ , D − t ) Γ , ∀ x . D − t ) t ) − t ) Clause D is selected long before a match is established What we want: → p ( � Γ , D p , D p − t ) atm ′ R → p ( � Γ , D p − t )

  15. Indexing over Predicates Indexing over Terms Beyond Horn Clauses Conclusions Clause Selection → p ( � → p ( � ⊢ t Γ , [ t / x ] D − t ) Γ , D , D − Γ − → G t ) atm R ⊃ L ∀ L → p ( � → p ( � Γ , G ⊃ p ( � → p ( � Γ , D − t ) Γ , ∀ x . D − t ) t ) − t ) Clause D is selected long before a match is established What we want: → p ( � Γ , D p , D p − t ) atm ′ R → p ( � Γ , D p − t ) What is the logical status of D p ?

  16. Indexing over Predicates Indexing over Terms Beyond Horn Clauses Conclusions Internalizing Indexing An old idea: Associate an index atom i p with each predicate p Guard each clause D for p with i p : i p ⊃ D Release i p to start search for p ( � i p ⊃ p ( � t ): t ) But . . .

  17. Indexing over Predicates Indexing over Terms Beyond Horn Clauses Conclusions Internalizing Indexing An old idea: Associate an index atom i p with each predicate p Guard each clause D for p with i p : i p ⊃ D Release i p to start search for p ( � i p ⊃ p ( � t ): t ) But . . . Checking a guard must succeed immediately Make i p into a positive atom — p + Init R (convenient separation of name spaces) Γ; p + − → p +

  18. Indexing over Predicates Indexing over Terms Beyond Horn Clauses Conclusions Internalizing Indexing An old idea: Associate an index atom i p with each predicate p Guard each clause D for p with i p : i p ⊃ D Release i p to start search for p ( � i p ⊃ p ( � t ): t ) But . . . Checking a guard must succeed immediately Make i p into a positive atom — p + Init R (convenient separation of name spaces) Γ; p + − → p + Used guards must not linger Make p + linear

  19. Indexing over Predicates Indexing over Terms Beyond Horn Clauses Conclusions Indexing append ∀ l . ⊤ ⊃ app (nil , l , l ) Clauses ∀ x , l 1 , l 2 , l 3 . app ( l 1 , l 2 , l 3 ) ⊃ app (c( x , l 1 ) , l 2 , c( x , l 3 )) app + − ◦ ∀ l . 1 ⊃ app (nil , l , l ) app + − ◦ ∀ x , l 1 , l 2 , l 3 . (app + − ◦ app ( l 1 , l 2 , l 3 )) ⊃ app (c( x , l 1 ) , l 2 , c( x , l 3 )) app (c( m , nil) , c( n , c( o , nil)) , c( m , c( n , c( o , nil)))) Goals ( ?- append([m],[n,o],[m,n,o]) in Prolog) app + − ◦ app (c( m , nil) , c( n , c( o , nil)) , c( m , c( n , c( o , nil))))

  20. Indexing over Predicates Indexing over Terms Beyond Horn Clauses Conclusions Approach Transform programs into a focused linear program with negative and positive atoms Goals: � G � Clauses: � Programs: � Γ � � D � � Target logic: H ::= p + − ◦ a Head formulas: Goal formulas: G ::= H | 1 | G 1 ⊗ G 2 D ::= G ⊃ a | ∀ x . D Program formulas: Γ ::= · | Γ , p + − Programs: ◦ D ∆ ::= · | p + Active indices: Γ; ∆ − → G Goal G is derivable from Γ and ∆ Γ; ∆ , D − → a Clause D derives a using Γ and ∆

  21. Indexing over Predicates Indexing over Terms Beyond Horn Clauses Conclusions Backward Proof Search for Indexed Horn Clauses    Γ; · − → G 1 Γ; · − → G 2     1 R ⊗ R  Inversion   Γ; · − → 1 Γ; · − → G 1 ⊗ G 2  Γ , p + − ◦ D ; q + , p + −  ◦ D − → a     atm R  Γ , p + − ◦ D ; q + −   → a . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  Chaining   ⊢ t Γ; · , [ t / x ] D − → a Γ; · − → G ⊃ L ∀ L   Γ; · , G ⊃ a − → a Γ; · , ∀ x . D − → a

  22. Indexing over Predicates Indexing over Terms Beyond Horn Clauses Conclusions Backward Proof Search for Indexed Horn Clauses  Inversion Γ; p + −  → a − ◦ R → p + −  Γ; · − ◦ a . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  Chaining  Γ; q + −  → p + Γ; D − → a Init R − ◦ L Γ; p + − Γ; q + , p + −   → p + ◦ D − → a

  23. Indexing over Predicates Indexing over Terms Beyond Horn Clauses Conclusions Does it Work?

  24. Indexing over Predicates Indexing over Terms Beyond Horn Clauses Conclusions Does it Work? Lemma (Completeness) If Γ − → G , then � Γ � ; · − → � G � If Γ , D − → a , then � Γ � ; · , � � D � � − → a Lemma (Soundness) If � Γ � ; · − → � G � , then Γ − → G If � Γ � ; · , � � − → a , then Γ , D − → a � D �

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