New methods. In search of a missing link
New methods. In search of a missing link Is there a mysterious Missing link theory? – Structural Resolution (also S-Resolution) Is there place for a DISCOVERY here, which could expose A BETTER STRUCTURED resolution?
What IS S-Resolution?
Outline Motivation Coalgebraic Semantics for Structural Resolution The Three Tier Tree calculus for Structural Resolution Type-Theoretic view of Structural Resolution Conclusions and Future work
Fibrational Coalgebraic Semantics of LP in 3 ideas Idea 1: Logic programs as coalgebras Definition For a functor F , a coalgebra is a pair ( U , c ) consisting of a set U and a function c : U → F ( U ). 1. Let At be the set of all atoms appearing in a program P . Then P can be identified with a P f P f -coalgebra ( At , p ), where p : At − → P f ( P f ( At )) sends an atom A to the set of bodies of those clauses in P with head A . Example T ← Q , R T ← S p ( T ) = {{ Q , R } , { S }}
Fibrational Coalgebraic Semantics of CoALP in 3 ideas Idea 2: Derivations modelled by coalgebra for the comonad on P f P f In general, if U : H - coalg − → C has a right adjoint G , the composite functor UG : C − → C possesses the canonical structure of a comonad C ( H ), called the cofree comonad on H . One can form a coalgebra for a comonad C ( H ). ◮ Taking p : At − → P f P f ( At ), the corresponding C ( P f P f )-coalgebra where C ( P f P f ) is the cofree comonad on P f P f is given as follows: C ( P f P f )( At ) is given by a limit of the form ... − → At × P f P f ( At × P f P f ( At )) − → At × P f P f ( At ) − → At . This gives a “tree-like” structure: we call them & V -trees.
Example Example T ← Q , R T ← S Q ← S ← R T Q R S R This models and-or parallel trees known in LP [AMAST 2010]
Fibrational Coalgebraic Semantics of CoALP in 3 ideas Idea 3: Add Lawvere Theories to model first-order signature Definition A Lawvere theory consists of a small category L with strictly associative finite products, and a strict finite-product preserving functor I : N op → L . Take Lawvere Theory L Σ to model the terms over Σ ∗ ob ( L Σ ) is N . ∗∗ For each n ∈ Nat , let x 1 ,..., x n be a specified list of distinct variables. ∗∗∗ ob ( L Σ )( n , m ) is the set of m -tuples ( t 1 ,..., t m ) of terms generated by the function symbols in Σ and variables x 1 ,..., x n . ∗∗∗∗ composition in L Σ is first-order substitution.
Fibrational Coalgebraic Semantics of CoALP in 3 ideas Idea 3: Add Lawvere Theories to model first-order signature Definition A Lawvere theory consists of a small category L with strictly associative finite products, and a strict finite-product preserving functor I : N op → L . Take Lawvere Theory L Σ to model the terms over Σ ∗ ob ( L Σ ) is N . ∗∗ For each n ∈ Nat , let x 1 ,..., x n be a specified list of distinct variables. ∗∗∗ ob ( L Σ )( n , m ) is the set of m -tuples ( t 1 ,..., t m ) of terms generated by the function symbols in Σ and variables x 1 ,..., x n . ∗∗∗∗ composition in L Σ is first-order substitution. Take the functor At : L op Σ → Set that sends a natural number n to the set of all atomic formulae generated by Σ and n variables.
Fibrational Coalgebraic Semantics of CoALP in 3 ideas Idea 3: Add Lawvere Theories to model first-order signature Definition A Lawvere theory consists of a small category L with strictly associative finite products, and a strict finite-product preserving functor I : N op → L . Take Lawvere Theory L Σ to model the terms over Σ ∗ ob ( L Σ ) is N . ∗∗ For each n ∈ Nat , let x 1 ,..., x n be a specified list of distinct variables. ∗∗∗ ob ( L Σ )( n , m ) is the set of m -tuples ( t 1 ,..., t m ) of terms generated by the function symbols in Σ and variables x 1 ,..., x n . ∗∗∗∗ composition in L Σ is first-order substitution. Take the functor At : L op Σ → Set that sends a natural number n to the set of all atomic formulae generated by Σ and n variables. Model a program P by the [ L op Σ , P f P f ]-coalgebra.
Examples Program Stream : “fibers” given by term arities. Take the fiber of 1 to model all terms with 1 free variable. Then & V -trees:
Examples Program Stream : “fibers” given by term arities. Take the fiber of 1 to model all terms with 1 free variable. Then & V -trees: stream ( x )
Examples Program Stream : “fibers” given by term arities. Take the fiber of 1 to model all terms with 1 free variable. Then & V -trees: stream ( x ) stream ( scons ( x , x )) bit ( x ) stream ( x )
Examples Program Stream : “fibers” given by term arities. Take the fiber of 1 to model all terms with 1 free variable. Then & V -trees: stream ( x ) stream ( scons ( x , x )) bit ( x ) stream ( x ) Note the finite size stream ( scons ( 0 , scons ( x , x ))) bit ( 0 ) stream ( scons ( x , x )) bit ( x ) stream ( x )
Examples Program ListNat : “fibers” given by term arities. Take the fiber of 2 to model all terms with 2 free variables. Then & V -trees:
Examples Program ListNat : “fibers” given by term arities. Take the fiber of 2 to model all terms with 2 free variables. Then & V -trees: list ( X ) list ( nil ) list ( cons ( 0 , nil )) list ( cons ( X , Y )) nat ( 0 ) list ( nil ) nat ( X ) list ( Y ) Note the partial nature...
� Structural Resolution: Discovery A: (A) Structural Properties of Programs Uniquely determine Structural Properties of Computations S-Resolution for LP Coalgebraic structural Semantics properties
A Problem: Structures suggested by the CoAlgebraic semantics do not really fit into LP tradition ◮ each & ∨ -tree gives only partial computation compared to SLD-resolution; ◮ seems to suggest laziness? ◮ introduces the (alien to LP) restriction on substitutions, due to fibers; ◮ the restriction works almost like term-matching... ◮ seems to suggest connection to term-rewriting systems? ◮ accounts for many choices in rewriting... ◮ seems to suggest and-or parallelism?
A Problem: Structures suggested by the CoAlgebraic semantics do not really fit into LP tradition ◮ each & ∨ -tree gives only partial computation compared to SLD-resolution; ◮ seems to suggest laziness? ◮ introduces the (alien to LP) restriction on substitutions, due to fibers; ◮ the restriction works almost like term-matching... ◮ seems to suggest connection to term-rewriting systems? ◮ accounts for many choices in rewriting... ◮ seems to suggest and-or parallelism? In short, it introduced more questions than answers...
Outline Motivation Coalgebraic Semantics for Structural Resolution The Three Tier Tree calculus for Structural Resolution Type-Theoretic view of Structural Resolution Conclusions and Future work
Our running example Example 1. nat ( s ( x )) ← nat ( x ) 2. nat ( 0 ) ← 3. stream ( scons ( x , y )) ← nat ( x ) , stream ( y ) Note: double-hopeless for SLD-resolution-based ATP!
Defining structural resolution from first principles... Main credo: we do not impose types or extra annotations, but look deep for “sub-atomic” structures innate in first-order proofs.
Defining structural resolution from first principles... Main credo: we do not impose types or extra annotations, but look deep for “sub-atomic” structures innate in first-order proofs. Given a logic program P there is a first-order signature Σ in P ... Σ P ⊢ A P A ⊢ = ⇒ Example For our example, Σ = { 0 , s , scons , nat , stream } + Variables.
Tier-1: Term-trees, given Σ: Let N ∗ denote the set of all finite words over N . A set L ⊆ N ∗ is a (finitely branching) tree language , satisfying prefix closedness conditions. A term tree is a map L → Σ ∪ Var , satisfying term arity restrictions. → ε stream 0 scons y 0 0 0 1 x
Tier-1: Term-trees, given Σ: Let N ∗ denote the set of all finite words over N . A set L ⊆ N ∗ is a (finitely branching) tree language , satisfying prefix closedness conditions. A term tree is a map L → Σ ∪ Var , satisfying term arity restrictions. → ε stream 0 scons y 0 0 0 1 x Given two terms t 1 , t 2 , and a substitution θ , θ is a unifier if θ ( t 1 ) = θ ( t 2 ), and matcher if t 1 = θ ( t 2 ).
Tier-1: Term-trees, given Σ: Let N ∗ denote the set of all finite words over N . A set L ⊆ N ∗ is a (finitely branching) tree language , satisfying prefix closedness conditions. A term tree is a map L → Σ ∪ Var , satisfying term arity restrictions. → ε stream 0 scons y 0 0 0 1 x Given two terms t 1 , t 2 , and a substitution θ , θ is a unifier if θ ( t 1 ) = θ ( t 2 ), and matcher if t 1 = θ ( t 2 ). Notation: Term (Σ) Set of finite term trees over Σ Term ∞ (Σ) Set of infinite term trees over Σ Term ω (Σ) Set of finite and infinite term trees over Σ
Constructing the structural resolution from first principles... ◮ Given a logic program P there is a first-order signature Σ... ◮ First tier of Terms builds on it... Σ Term (Σ) P ⊢ A P A ⊢ = ⇒
Tier-2: rewriting trees A rewriting tree is a map L → Term (Σ) ∪ Clause (Σ) ∪ Var R , subject to conditions (Term-matching). stream ( scons ( x , y )) our running example X 1 X 2 3 1. nat ( s ( x )) ← 2. nat ( 0 ) ← nat ( x ) stream ( y ) 3. stream ( scons ( x , y )) ← X 3 X 4 X 5 X 6 X 7 X 8 nat ( x ) , stream ( y ) Interesting: all rewriting trees are finite for our “difficult” example!
Tier-2: rewriting trees A rewriting tree is a map L → Term (Σ) ∪ Clause (Σ) ∪ Var R , subject to conditions (Term-matching). stream ( scons ( x , y )) our running example X 1 X 2 3 1. nat ( s ( x )) ← 2. nat ( 0 ) ← nat ( x ) stream ( y ) 3. stream ( scons ( x , y )) ← X 3 X 4 X 5 X 6 X 7 X 8 nat ( x ) , stream ( y ) Interesting: all rewriting trees are finite for our “difficult” example! Notation: Rew ( P ) all finite rewriting trees over P and Term (Σ) Rew ∞ ( P ) all infinite rewriting trees over P and Term (Σ) Rew ω ( P ) all finite and infinite rewriting trees over P and Term (Σ)
Tier-2: rewriting trees A rewriting tree is a map L → Term (Σ) ∪ Clause (Σ) ∪ Var R , subject to conditions (Term-matching). stream ( scons ( x , y )) our running example X 1 X 2 3 1. nat ( s ( x )) ← 2. nat ( 0 ) ← nat ( x ) stream ( y ) 3. stream ( scons ( x , y )) ← X 3 X 4 X 5 X 6 X 7 X 8 nat ( x ) , stream ( y ) Interesting: all rewriting trees are finite for our “difficult” example! Notation: Rew ( P ) all finite rewriting trees over P and Term (Σ) Rew ∞ ( P ) all infinite rewriting trees over P and Term (Σ) Rew ω ( P ) all finite and infinite rewriting trees over P and Term (Σ)
Constructing the structural resolution from first principles... ◮ Given a logic program P there is a first-order signature Σ... ◮ First tier of Terms builds on it... ◮ Term-trees give rise to a new tier of rewriting trees... Rew ( P ) Σ Term (Σ) P ⊢ A P A ⊢ = ⇒
Tier-3: Derivation trees A derivation tree is a map L → Rew ( P ). ε stream ( scons ( y , z )) X 1 X 2 3 nat ( y ) stream ( z ) X 3 X 4 X 5 X 6 X 7 X 8 ↓ X 3 ↓ X 4 ↓ X 8 [0] stream ( sc ( s ( y1 )) , z )) [1] stream ( sc ( 0 , z )) [2] stream ( sc ( y , sc ( y1 , z1 ))) . . . . . . . . . . . . . . . . . . . . . . . . . . .
Tier-3: Derivation trees A derivation tree is a map L → Rew ( P ). ε stream ( scons ( y , z )) X 1 X 2 3 nat ( y ) stream ( z ) X 3 X 4 X 5 X 6 X 7 X 8 ↓ X 3 ↓ X 4 ↓ X 8 [0] stream ( sc ( s ( y1 )) , z )) [1] stream ( sc ( 0 , z )) [2] stream ( sc ( y , sc ( y1 , z1 ))) . . . . . . . . . . . . . . . . . . . . . . . . . . . Note: this derivation tree is infinite.
Tier-3 laws and notation Notation: Der ( P ) all finite derivation trees over Rew ( P ) Der ∞ ( P ) all infinite derivation trees over Rew ( P ) Der ω ( P ) all finite and infinite derivation trees over Rew ( P )
Tier-3 laws and notation Notation: Der ( P ) all finite derivation trees over Rew ( P ) Der ∞ ( P ) all infinite derivation trees over Rew ( P ) Der ω ( P ) all finite and infinite derivation trees over Rew ( P ) An SLD-derivation for a program P and goal A corresponds to a branch in a derivation tree for P and A . x / s ( x ′ ) x ′ / 0 → → nat ( s ( s ( x ′ ))) nat ( s ( x )) nat ( s ( s ( 0 ))) 1 X 1 1 X 1 1 X 1 nat ( s ( x ′ )) nat ( x ) nat ( s ( 0 )) X 2 X 3 1 X 3 1 X 3 nat ( x ′ ) nat ( 0 ) X 4 X 5 X 4 2
Constructing the structural resolution from first principles... ◮ Given a logic program P there is a first-order signature Σ... ◮ First tier of Terms builds on it... ◮ Term-trees give rise to a new tier of rewriting trees. ◮ And then, derivations by Structural resolution emerge! Der ( P ) Der ∞ ( P ) Rew ( P ) Der ω ( P ) Σ Term (Σ) P A ⊢
Gains: ◮ We found a missing theory of constructive resolution! ◮ Now to prove P ⊢ A , we need to construct a rewriting tree rew ∈ Rew ( P ) that proves A : P ⊢ rew : A To prove ListNat ⊢ list ( cons ( x , y )), we need to construct a rewriting tree that proves it: x / 0 y / nil → → list ( cons ( x , y )) list ( cons ( 0 , y )) X 1 X 2 X 3 4 X 1 X 2 X 3 4 nat ( x ) list ( y ) nat ( 0 ) list ( y ) X 4 X 5 X 6 X 7 X 8 X 9 X 10 X 11 1 X 5 X 6 X 7 X 8 X 9 X 10 X 11 list ( cons ( 0 , nil )) X 1 X 2 X 3 4 nat ( 0 ) list ( y ) 1 X 5 X 6 X 7 X 8 X 9 3 X 11
Gains The structural approach allowed to: ◮ Formulate the theory of Universal Productivity ◮ Show Finite derivations sound and complete wrt Herbrnad models; ◮ Show Infinite derivations sound wrt Complete Herbrand models; ◮ Formulate finite coinductive proofs matching infinite derivations.
New theory of universal productivity for resolution A program P is productive, if it gives rise to rewriting trees only in Rew ( P ).
New theory of universal productivity for resolution A program P is productive, if it gives rise to rewriting trees only in Rew ( P ). In the class of Productive LPs, we can further distinguish: ◮ finite LP that give rise to derivations in Der ( P ), ◮ inductive LPs all derivations for which are in Der ω ( P ); ◮ coinductive LPs all derivations for which are in Der ∞ ( P )
New theory of universal productivity for resolution A program P is productive, if it gives rise to rewriting trees only in Rew ( P ). In the class of Productive LPs, we can further distinguish: ◮ finite LP that give rise to derivations in Der ( P ), ◮ inductive LPs all derivations for which are in Der ω ( P ); ◮ coinductive LPs all derivations for which are in Der ∞ ( P ) ⋆ 1. P 1 . Peano num- ⋆ 2. P 2 . Infinite ⋆ 3. P 3 . Bad recursion. bers. streams. nat ( s ( x )) ← nat ( x ) stream ( scons ( x , y )) ← bad ( x ) ← bad ( x ) nat ( 0 ) ← nat ( x ) , stream ( y ) inductive definition coinductive definition non-well-founded Productive inductive Productive coinductive Non-productive program program program rewriting trees in rewriting trees in rewriting trees do not Rew ( P ), derivation Rew ( P ), derivation belong to Rew ( P ) trees Der ω ( P ) trees in Der ∞ ( P )
� � � � � � � Theory of universal Productivity in LP! Coinductively Syntactic semi-decision defined via guardedness Inductively defined Non-productive Productive Finitely Logic programs defined
� � � Structural Resolution: Discovery B: (B) Structures suggested by (A) can give a sound calculus, and solve problems known to be hard for LP: universal productivity and coinductive proof inference. B. 3TC tree structures S-Resolution for LP A. Coalgebraic structural Semantics properties
More questions still: ◮ What is the proof-theoretic meaning of S-Resolution? ◮ What is the constructive content of proofs by resolution? ◮ How do the rewriting trees relate to term rewriting systems? ◮ Does the informal analogy of 3TC P ⊢ rew : A really have any relation to type theory? ◮ How exactly does the intuition that rewriting trees may serve as proof-witnesses in S-derivations relate to the type theory setting?
Outline Motivation Coalgebraic Semantics for Structural Resolution The Three Tier Tree calculus for Structural Resolution Type-Theoretic view of Structural Resolution Conclusions and Future work
Horn formula view of LP κ 1 : ⇒ Nat (0) κ 2 : Nat ( x ) ⇒ Nat ( s ( x )) κ 3 : ⇒ List ( nil ) κ 4 : Nat ( x ) , List ( y ) ⇒ List ( cons ( x , y ))
Formalism: LP-Unif, LP-TM and LP-Struct ◮ Term-matching reduction: Φ ⊢ { A 1 ,..., A i ,..., A n } → κ , σ { A 1 ,..., σ B 1 ,..., σ B m ,..., A n } , if there exists κ : ∀ x . B 1 ,..., B n ⇒ C ∈ Φ such that C �→ σ A i .
Formalism: LP-Unif, LP-TM and LP-Struct ◮ Term-matching reduction: Φ ⊢ { A 1 ,..., A i ,..., A n } → κ , σ { A 1 ,..., σ B 1 ,..., σ B m ,..., A n } , if there exists κ : ∀ x . B 1 ,..., B n ⇒ C ∈ Φ such that C �→ σ A i . ◮ Unification reduction: Φ ⊢ { A 1 ,..., A i ,..., A n } � κ , γ · γ ′ { γ A 1 ,..., γ B 1 ,..., γ B m ,..., γ A n } , if there exists κ : ∀ x . B 1 ,..., B n ⇒ C ∈ Φ such that C ∼ γ A i .
Formalism: LP-Unif, LP-TM and LP-Struct ◮ Term-matching reduction: Φ ⊢ { A 1 ,..., A i ,..., A n } → κ , σ { A 1 ,..., σ B 1 ,..., σ B m ,..., A n } , if there exists κ : ∀ x . B 1 ,..., B n ⇒ C ∈ Φ such that C �→ σ A i . ◮ Unification reduction: Φ ⊢ { A 1 ,..., A i ,..., A n } � κ , γ · γ ′ { γ A 1 ,..., γ B 1 ,..., γ B m ,..., γ A n } , if there exists κ : ∀ x . B 1 ,..., B n ⇒ C ∈ Φ such that C ∼ γ A i . ◮ Substitutional reduction: Φ ⊢ { A 1 ,..., A i ,..., A n } ֒ → κ , γ · γ ′ { γ A 1 ,..., γ A i ,..., γ A n } , if there exists κ : ∀ x . B 1 ,..., B n ⇒ C ∈ Φ such that C ∼ γ A i .
Formalism: LP-Unif, LP-TM and LP-Struct ◮ Term-matching reduction: Φ ⊢ { A 1 ,..., A i ,..., A n } → κ , σ { A 1 ,..., σ B 1 ,..., σ B m ,..., A n } , if there exists κ : ∀ x . B 1 ,..., B n ⇒ C ∈ Φ such that C �→ σ A i . ◮ Unification reduction: Φ ⊢ { A 1 ,..., A i ,..., A n } � κ , γ · γ ′ { γ A 1 ,..., γ B 1 ,..., γ B m ,..., γ A n } , if there exists κ : ∀ x . B 1 ,..., B n ⇒ C ∈ Φ such that C ∼ γ A i . ◮ Substitutional reduction: Φ ⊢ { A 1 ,..., A i ,..., A n } ֒ → κ , γ · γ ′ { γ A 1 ,..., γ A i ,..., γ A n } , if there exists κ : ∀ x . B 1 ,..., B n ⇒ C ∈ Φ such that C ∼ γ A i . ◮ LP-TM: (Φ , → ) LP-Unif: (Φ , � ) LP-Struct: (Φ , → µ · ֒ → 1 )
Execution behavior of LP-TM ◮ Consider query List ( cons ( x , y )): { List ( cons ( x , y )) } → κ 4 , [ x / x 1 , y / y 1 ] { Nat ( x ) , List ( y ) } Note Partial nature
Execution behavior of LP-TM ◮ Consider query List ( cons ( x , y )): { List ( cons ( x , y )) } → κ 4 , [ x / x 1 , y / y 1 ] { Nat ( x ) , List ( y ) } Note Partial nature ◮ Consider following Stream predicate: κ : Stream ( y ) ⇒ Stream ( cons ( x , y )) ◮ In LP-TM: { Stream ( cons ( x , y )) } → κ , [ x / x 1 , y / y 1 ] { Stream ( y ) }
Execution behavior of LP-TM ◮ Consider query List ( cons ( x , y )): { List ( cons ( x , y )) } → κ 4 , [ x / x 1 , y / y 1 ] { Nat ( x ) , List ( y ) } Note Partial nature ◮ Consider following Stream predicate: κ : Stream ( y ) ⇒ Stream ( cons ( x , y )) ◮ In LP-TM: { Stream ( cons ( x , y )) } → κ , [ x / x 1 , y / y 1 ] { Stream ( y ) } Note finiteness
LP-Struct: BList For query List ( cons ( x , y )), in LP-Struct: ◮ { List ( cons ( x , y )) } → { Nat ( x ) , List ( y ) }
LP-Struct: BList For query List ( cons ( x , y )), in LP-Struct: ◮ { List ( cons ( x , y )) } → { Nat ( x ) , List ( y ) } ◮ ֒ → [ 0 / x ] { Nat (0) , List ( y ) } → { List ( y ) }
LP-Struct: BList For query List ( cons ( x , y )), in LP-Struct: ◮ { List ( cons ( x , y )) } → { Nat ( x ) , List ( y ) } ◮ ֒ → [ 0 / x ] { Nat (0) , List ( y ) } → { List ( y ) } ◮ ֒ → [ 0 / x , nil / y ] { List ( nil ) } → / 0
LP-Struct: Stream κ : Stream ( y ) ⇒ Stream ( cons ( x , y )) For query Stream ( cons ( x , y )), in LP-Struct: ◮ { Stream ( cons ( x , y )) } → { Stream ( y ) }
LP-Struct: Stream κ : Stream ( y ) ⇒ Stream ( cons ( x , y )) For query Stream ( cons ( x , y )), in LP-Struct: ◮ { Stream ( cons ( x , y )) } → { Stream ( y ) } ◮ ֒ → [ cons ( x 1 , y 1 ) / y ] { Stream ( cons ( x 1 , y 1 )) } → { Stream ( y 1 ) }
LP-Struct: Stream κ : Stream ( y ) ⇒ Stream ( cons ( x , y )) For query Stream ( cons ( x , y )), in LP-Struct: ◮ { Stream ( cons ( x , y )) } → { Stream ( y ) } ◮ ֒ → [ cons ( x 1 , y 1 ) / y ] { Stream ( cons ( x 1 , y 1 )) } → { Stream ( y 1 ) } ◮ ֒ → [ cons ( x 2 , y 2 ) / y 1 , cons ( x 1 , cons ( x 2 , y 2 )) / y ] { Stream ( cons ( x 2 , y 2 )) } → { Stream ( y 2 ) }
LP-Struct: Stream κ : Stream ( y ) ⇒ Stream ( cons ( x , y )) For query Stream ( cons ( x , y )), in LP-Struct: ◮ { Stream ( cons ( x , y )) } → { Stream ( y ) } ◮ ֒ → [ cons ( x 1 , y 1 ) / y ] { Stream ( cons ( x 1 , y 1 )) } → { Stream ( y 1 ) } ◮ ֒ → [ cons ( x 2 , y 2 ) / y 1 , cons ( x 1 , cons ( x 2 , y 2 )) / y ] { Stream ( cons ( x 2 , y 2 )) } → { Stream ( y 2 ) } ◮ ֒ → [ cons ( x 3 , y 3 ) / y 2 , cons ( x 2 , cons ( x 3 , y 3 )) / y 1 , cons ( x 1 , cons ( x 2 , cons ( x 3 , y 3 ))) / y ] { Stream ( cons ( x 3 , y 3 )) } → { Stream ( y 3 ) }
LP-Struct: Stream κ : Stream ( y ) ⇒ Stream ( cons ( x , y )) For query Stream ( cons ( x , y )), in LP-Struct: ◮ { Stream ( cons ( x , y )) } → { Stream ( y ) } ◮ ֒ → [ cons ( x 1 , y 1 ) / y ] { Stream ( cons ( x 1 , y 1 )) } → { Stream ( y 1 ) } ◮ ֒ → [ cons ( x 2 , y 2 ) / y 1 , cons ( x 1 , cons ( x 2 , y 2 )) / y ] { Stream ( cons ( x 2 , y 2 )) } → { Stream ( y 2 ) } ◮ ֒ → [ cons ( x 3 , y 3 ) / y 2 , cons ( x 2 , cons ( x 3 , y 3 )) / y 1 , cons ( x 1 , cons ( x 2 , cons ( x 3 , y 3 ))) / y ] { Stream ( cons ( x 3 , y 3 )) } → { Stream ( y 3 ) } ◮ ... ◮ Partial answer: cons ( x 1 , cons ( x 2 , cons ( x 3 , y 3 ))) / y
Formalization of a Type System ◮ Term t ::= x | f ( t 1 ,..., t n ) Atomic Formula A , B , C , D ::= P ( t 1 ,..., t n ) (Horn) Formula F ::= A 1 ,..., A n ⇒ A Proof Term p , e ::= κ | a | λ a . e | e e ′
Formalization of a Type System ◮ Term t ::= x | f ( t 1 ,..., t n ) Atomic Formula A , B , C , D ::= P ( t 1 ,..., t n ) (Horn) Formula F ::= A 1 ,..., A n ⇒ A Proof Term p , e ::= κ | a | λ a . e | e e ′ ◮ Girard’s observation on intuitionistic sequent calculus with atomic formulas B ⊢ C A ⊢ D B , D ⊢ C cut B ⊢ A axiom σ B ⊢ σ C subst A , B ⊢ C
Formalization of a Type System ◮ Term t ::= x | f ( t 1 ,..., t n ) Atomic Formula A , B , C , D ::= P ( t 1 ,..., t n ) (Horn) Formula F ::= A 1 ,..., A n ⇒ A Proof Term p , e ::= κ | a | λ a . e | e e ′ ◮ Girard’s observation on intuitionistic sequent calculus with atomic formulas B ⊢ C A ⊢ D B , D ⊢ C cut B ⊢ A axiom σ B ⊢ σ C subst A , B ⊢ C ◮ Is ⊢ Q provable?
Formalization of a Type System ◮ Term t ::= x | f ( t 1 ,..., t n ) Atomic Formula A , B , C , D ::= P ( t 1 ,..., t n ) (Horn) Formula F ::= A 1 ,..., A n ⇒ A Proof Term p , e ::= κ | a | λ a . e | e e ′ ◮ Girard’s observation on intuitionistic sequent calculus with atomic formulas B ⊢ C A ⊢ D B , D ⊢ C cut B ⊢ A axiom σ B ⊢ σ C subst A , B ⊢ C ◮ Is ⊢ Q provable? ◮ We internalized “ ⊢ ” as “ ⇒ ” and add proof term annotations e : F e : ∀ x . F gen κ : ∀ x . F axiom e : ∀ x . F e 1 : A ⇒ D e 2 : B , D ⇒ C λ a . λ b . ( e 2 b ) ( e 1 a ) : A , B ⇒ C cut e : [ t / x ] F inst
Soundness of LP-TM and LP-Unif ◮ Soundness of LP-Unif If Φ ⊢ { A } � ∗ γ / 0 , then there exists a proof e : ∀ x . ⇒ γ A given axioms Φ. ◮ Soundness of LP-TM If Φ ⊢ { A } → ∗ / 0 , then there exists a proof e : ∀ x . ⇒ A given axioms Φ. ◮ For example: { BList ( cons ( x , y )) } � { Bit ( x ) , BList ( y ) } � [ 0 / x ] { BList ( y ) } � [ 0 / x , nil / y ] � / 0 ◮ yields a proof ( λ a . ( κ 4 a ) κ 1 ) κ 3 , β -reducible to ( κ 4 κ 3 ) κ 1 .
Soundness of LP-TM and LP-Unif ◮ Soundness of LP-Unif If Φ ⊢ { A } � ∗ γ / 0 , then there exists a proof e : ∀ x . ⇒ γ A given axioms Φ. ◮ Soundness of LP-TM If Φ ⊢ { A } → ∗ / 0 , then there exists a proof e : ∀ x . ⇒ A given axioms Φ. ◮ For example: { BList ( cons ( x , y )) } � { Bit ( x ) , BList ( y ) } � [ 0 / x ] { BList ( y ) } � [ 0 / x , nil / y ] � / 0 ◮ yields a proof ( λ a . ( κ 4 a ) κ 1 ) κ 3 , β -reducible to ( κ 4 κ 3 ) κ 1 . ◮ Compare with the 3TC proof-witness: x / 0 y / nil → ... → list ( cons ( x , y )) list ( cons ( 0 , nil )) X 1 X 2 X 3 4 X 1 X 2 X 3 4 nat ( x ) list ( y ) nat ( 0 ) list ( y ) X 4 X 5 X 6 X 7 X 8 X 9 X 10 X 11 1 X 5 X 6 X 7 X 8 X 9 3 X 11
LP-Struct is equivalent to LP-Unif ... for logic programs subject to realisability transformation κ 1 : ⇒ Nat (0 , c κ 1 ) κ 2 : Nat ( x , u ) ⇒ Nat ( s ( x ) , f κ 2 ( u )) κ 3 : ⇒ BList ( nil , c κ 3 ) κ 4 : Bit ( x , u 1 ) , BList ( y , u 2 ) ⇒ BList ( cons ( x , y , f κ 4 ( u 1 , u 2 ))) ◮ { BList ( cons ( x , y , u )) } ֒ → [ f κ 4 ( u 1 , u 2 ) / u ] { BList ( cons ( x , y , f κ 4 ( u 1 , u 2 ))) } → { Bit ( x , u 1 ) , BList ( y , u 2 ) }
LP-Struct is equivalent to LP-Unif ... for logic programs subject to realisability transformation κ 1 : ⇒ Nat (0 , c κ 1 ) κ 2 : Nat ( x , u ) ⇒ Nat ( s ( x ) , f κ 2 ( u )) κ 3 : ⇒ BList ( nil , c κ 3 ) κ 4 : Bit ( x , u 1 ) , BList ( y , u 2 ) ⇒ BList ( cons ( x , y , f κ 4 ( u 1 , u 2 ))) ◮ { BList ( cons ( x , y , u )) } ֒ → [ f κ 4 ( u 1 , u 2 ) / u ] { BList ( cons ( x , y , f κ 4 ( u 1 , u 2 ))) } → { Bit ( x , u 1 ) , BList ( y , u 2 ) } ◮ ֒ → [ 0 / x , c κ 1 / u 1 ] { Bit (0 , c κ 1 ) , BList ( y , u 2 ) } → { BList ( y , u 2 ) } ◮ ֒ → [ 0 / x , nil / y , c κ 3 / u 2 ] { BList ( nil , c κ 3 ) } → / 0 Note the substitution for u / f κ 4 ( c κ 1 , c κ 3 ) matches the earlier computed proof term ( κ 4 κ 3 ) κ 1 .
Results about Realizability Transformation ◮ Guarantees productivity = Termination of term-matching reduction Directly inherited from 3TC ◮ Preserves Provability ◮ Records Proof in the extra argument substitutions ◮ Preserves Computational behaviour of LP-Unif ◮ Helps to prove Operational Equivalence of LP-Unif and LP-Struct ◮ Helps to prove soundness of LP-Struct
Gains from type-theoretic semantics for S-Resolution: 1. We established a direct relation to term-rewriting via LP-Struct; 2. We established a natural typed λ -calculus characterisation; 3. LP-Struct is sound wrt the type system; 4. Proof-witness is now formally defined as type inhabitant; directly inherited from 3TC 5. S-resolution is not equivalent to SLD-resolution, in general; 6. We exactly described the class of LPs that have structural properties (for which S-resolution and SLD-resolution are equivalent); directly inherited from 3TC 7. and gave an automated and static way to transform LPs to their constructive variants (via realisability transformation).
� � � � � Structural Resolution: Discovery C: (C) The 3 Tier Tree calculus gives genuine insight into constructive nature of first-order automated proof: Horn-formulas as types and proof-witnesses as type inhabitants. 3TC tree Horn formulas as types structures proof-witness S-Resolution for LP Coalgebraic Type-theoretic structural Semantics Semantics properties
Recommend
More recommend