Superpositionwith DatatypesandCodatatypes Jasmin Blanchette Vrije Universiteit Amsterdam MPI-INF Saarbrücken Nicolas Peltier Université Grenoble Alpes Simon Robillard Chalmers University of Technology
Superposition with Datatypes and Codatatypes Introduction (co)datatypes everywhere! program verification metatheory of programming languages formalization of mathematics . . . Typical application of ATPs 1 / 28
Superposition with Datatypes and Codatatypes Introduction Partial axiomatization? 2 / 28
Superposition with Datatypes and Codatatypes Introduction Partial axiomatization? ✗ Inconvenient 2 / 28
Superposition with Datatypes and Codatatypes Introduction Partial axiomatization? ✗ Inconvenient ✗ Inefficient 2 / 28
Superposition with Datatypes and Codatatypes Introduction Partial axiomatization? ✗ Inconvenient ✗ Inefficient ✗ Incomplete 2 / 28
Superposition with Datatypes and Codatatypes Introduction Example (co)datatype τ = E : τ | F : τ → τ | G : α × τ → τ 3 / 28
Superposition with Datatypes and Codatatypes Introduction Axioms for freely generated (co)datatypes Distinctness ∀ x , E �≈ F ( x ) ∀ ¯ x , F ( x 1 ) �≈ G ( x 2 , x 3 ) ∀ ¯ x , G ( x 1 , x 2 ) �≈ E 4 / 28
Superposition with Datatypes and Codatatypes Introduction Axioms for freely generated (co)datatypes Distinctness ∀ x , E �≈ F ( x ) ∀ ¯ x , F ( x 1 ) �≈ G ( x 2 , x 3 ) ∀ ¯ x , G ( x 1 , x 2 ) �≈ E Injectivity ∀ ¯ x , F ( x 1 ) ≈ F ( x 2 ) → x 1 ≈ x 2 x , G ( x 1 , x ′ 1 ) ≈ G ( x 2 , x ′ 2 ) → x 1 ≈ x 2 ∧ x ′ 1 ≈ x ′ ∀ ¯ 2 4 / 28
Superposition with Datatypes and Codatatypes Introduction Axioms for freely generated (co)datatypes Distinctness ∀ x , E �≈ F ( x ) ∀ ¯ x , F ( x 1 ) �≈ G ( x 2 , x 3 ) ∀ ¯ x , G ( x 1 , x 2 ) �≈ E Injectivity ∀ ¯ x , F ( x 1 ) ≈ F ( x 2 ) → x 1 ≈ x 2 x , G ( x 1 , x ′ 1 ) ≈ G ( x 2 , x ′ 2 ) → x 1 ≈ x 2 ∧ x ′ 1 ≈ x ′ ∀ ¯ 2 Exhaustivity ∀ x ∃ ¯ y , x ≈ E ∨ x ≈ F ( y 1 ) ∨ x ≈ G ( y 2 , y 3 ) 4 / 28
Superposition with Datatypes and Codatatypes Introduction Acyclicity ∀ x , x �≈ F ( x ) ∀ x y , x �≈ G ( y , x ) 5 / 28
Superposition with Datatypes and Codatatypes Introduction Acyclicity ∀ x , x �≈ F ( x ) ∀ x y , x �≈ G ( y , x ) ∀ x , x �≈ F ( F ( x )) ∀ x y , x �≈ F ( G ( y , x )) ∀ x y , x �≈ G ( y , F ( x )) ∀ x ¯ y , x �≈ G ( y 1 , G ( y 2 , x )) 5 / 28
Superposition with Datatypes and Codatatypes Introduction Acyclicity ∀ x , x �≈ F ( x ) ∀ x y , x �≈ G ( y , x ) ∀ x , x �≈ F ( F ( x )) ∀ x y , x �≈ F ( G ( y , x )) ∀ x y , x �≈ G ( y , F ( x )) ∀ x ¯ y , x �≈ G ( y 1 , G ( y 2 , x )) ∀ x , x �≈ F ( F ( F ( x ))) ∀ x y , x �≈ F ( F ( G ( y , x ))) ∀ x y , x �≈ F ( G ( y , F ( x ))) ∀ x ¯ y , x �≈ F ( G ( y 1 , G ( y 2 , x ))) ∀ x y , x �≈ G ( y , F ( F ( F ( x )))) ∀ x ¯ y , x �≈ G ( y 1 , F ( F ( G ( y 2 , x )))) ∀ x ¯ y , x �≈ G ( y 1 , F ( G ( y 2 , F ( x )))) ∀ x ¯ y , x �≈ G ( y 1 , F ( G ( y 2 , G ( y 3 , x )))) ∀ x , x �≈ F ( F ( F ( F ( x )))) ∀ x y , x �≈ F ( F ( F ( G ( y , x )))) 5 / 28
Superposition with Datatypes and Codatatypes Introduction Acyclicity ∀ x , x �≈ F ( x ) ∀ x y , x �≈ G ( y , x ) ∀ x , x �≈ F ( F ( x )) ∀ x y , x �≈ F ( G ( y , x )) ∀ x y , x �≈ G ( y , F ( x )) ∀ x ¯ y , x �≈ G ( y 1 , G ( y 2 , x )) ∀ x , x �≈ F ( F ( F ( x ))) ∀ x , x �≈ Γ[ x ] ∀ x y , x �≈ F ( F ( G ( y , x ))) ∀ x y , x �≈ F ( G ( y , F ( x ))) ∀ x ¯ y , x �≈ F ( G ( y 1 , G ( y 2 , x ))) ∀ x y , x �≈ G ( y , F ( F ( F ( x )))) ∀ x ¯ y , x �≈ G ( y 1 , F ( F ( G ( y 2 , x )))) ∀ x ¯ y , x �≈ G ( y 1 , F ( G ( y 2 , F ( x )))) ∀ x ¯ y , x �≈ G ( y 1 , F ( G ( y 2 , G ( y 3 , x )))) ∀ x , x �≈ F ( F ( F ( F ( x )))) ∀ x y , x �≈ F ( F ( F ( G ( y , x )))) 5 / 28
Superposition with Datatypes and Codatatypes Introduction Codatatype fixpoints ∃ ! x , x ≈ Γ[ x ] 6 / 28
Superposition with Datatypes and Codatatypes Introduction Codatatype fixpoints ∃ ! x , x ≈ Γ[ x ] Example s ≈ F ( G ( a , F ( s ))) ∧ t ≈ F ( G ( a , F ( t ))) implies s ≈ t 6 / 28
Superposition with Datatypes and Codatatypes Axiomatic approach Solution 1 Conservative extension of the theory 7 / 28
Superposition with Datatypes and Codatatypes Axiomatic approach Acyclicity Extra predicate sub ( s , t ) “ s is a subterm of t ” Recursive definition ∀ x , sub ( x , x ) ∀ xy , sub ( x , y ) → sub ( x , F ( y )) Acyclicity ∀ x , ¬ sub ( F ( x ) , x ) 8 / 28
Superposition with Datatypes and Codatatypes Axiomatic approach Fixpoints Extra sort G ( • , E ) context = term with hole(s) Application function app : context × term → term Example app ( G ( • , E ) , F ( E )) ≈ G ( F ( E ) , E ) 9 / 28
Superposition with Datatypes and Codatatypes Axiomatic approach Existence of fixpoints Extra function cyc : context → term ∀ x , cyc ( x ) ≈ app ( x , cyc ( x )) 10 / 28
Superposition with Datatypes and Codatatypes Axiomatic approach Existence of fixpoints Extra function cyc : context → term ∀ x , cyc ( x ) ≈ app ( x , cyc ( x )) Example with x := G ( • , E ) cyc ( G ( • , E )) ≈ app ( G ( • , E ) , cyc ( G ( • , E ))) ≈ G ( cyc ( G ( • , E )) , E ) cyc (Γ) is the solution of y ≈ Γ[ y ] 10 / 28
Superposition with Datatypes and Codatatypes Axiomatic approach Existence of fixpoints Extra function cyc : context → term ∀ x , cyc ( x ) ≈ app ( x , cyc ( x )) Example with x := G ( • , E ) cyc ( G ( • , E )) ≈ app ( G ( • , E ) , cyc ( G ( • , E ))) ≈ G ( cyc ( G ( • , E )) , E ) cyc (Γ) is the solution of y ≈ Γ[ y ] Uniqueness ∀ xy , y �≈ • ∧ x ≈ app ( y , x ) → x ≈ cyc ( y ) 10 / 28
Superposition with Datatypes and Codatatypes Axiomatic approach Mutually recursive types (co)datatype α = E : α | F : β → α and β = G : α → β Solution Datatypes sub αα sub αβ sub βα sub ββ Codatatypes α β -contexts with holes for α β -terms 11 / 28
Superposition with Datatypes and Codatatypes Axiomatic approach Completeness First-order theory ≈ No uninterpreted functions Complete, but not finitely axiomatizable Conservative extension Extra symbols ✓ Encode cyclicity properties ✗ Shouldn’t be used in conjecture 12 / 28
Superposition with Datatypes and Codatatypes Axiomatic approach Conservative extension of the theory ✓ Complete ✓ Easy to implement But can we improve proof search? 13 / 28
Superposition with Datatypes and Codatatypes Inference rules Solution 2 Dedicated inference rules 14 / 28
Superposition with Datatypes and Codatatypes Inference rules Chains and cycles a ≈ F ( b ) 15 / 28
Superposition with Datatypes and Codatatypes Inference rules Chains and cycles a ≈ F ( b ) b ≈ G ( F ( c ) , d ) 15 / 28
Superposition with Datatypes and Codatatypes Inference rules Chains and cycles a ≈ F ( b ) b ≈ G ( F ( c ) , d ) c ≈ F ( h ( e )) 15 / 28
Superposition with Datatypes and Codatatypes Inference rules Chains and cycles a ≈ F ( b ) b ≈ G ( F ( c ) , d ) c ≈ F ( h ( e )) h ( x ) ≈ G ( a , e ) 15 / 28
Superposition with Datatypes and Codatatypes Inference rules Chains and cycles a ≈ F ( b ) b ≈ G ( F ( c ) , d ) c ≈ F ( h ( e )) h ( x ) ≈ G ( a , e ) a ≈ F ( G ( F ( F ( G ( a , e ))) , d ) under unifier { x ← e } 15 / 28
Superposition with Datatypes and Codatatypes Inference rules The acyclicity rule s 1 ≈ Γ 1 [ s ′ s 2 ≈ Γ 2 [ s ′ s n ≈ Γ n [ s ′ 2 ] ∨ C 1 3 ] ∨ C 2 1 ] ∨ C n . . . ( C 1 ∨ C 2 ∨ · · · ∨ C n ) θ 16 / 28
Superposition with Datatypes and Codatatypes Inference rules The acyclicity rule s 1 ≈ Γ 1 [ s ′ s 2 ≈ Γ 2 [ s ′ s n ≈ Γ n [ s ′ 2 ] ∨ C 1 3 ] ∨ C 2 1 ] ∨ C n . . . ( C 1 ∨ C 2 ∨ · · · ∨ C n ) θ mgu { s 1 ≈ s ′ 1 , . . . , s n ≈ s ′ n } 16 / 28
Superposition with Datatypes and Codatatypes Inference rules The acyclicity rule maximal literals s 1 ≈ Γ 1 [ s ′ s 2 ≈ Γ 2 [ s ′ s n ≈ Γ n [ s ′ 2 ] ∨ C 1 3 ] ∨ C 2 1 ] ∨ C n . . . ( C 1 ∨ C 2 ∨ · · · ∨ C n ) θ mgu { s 1 ≈ s ′ 1 , . . . , s n ≈ s ′ n } 16 / 28
Superposition with Datatypes and Codatatypes Inference rules The acyclicity rule maximal literals s 1 ≈ Γ 1 [ s ′ s 2 ≈ Γ 2 [ s ′ s n ≈ Γ n [ s ′ 2 ] ∨ C 1 3 ] ∨ C 2 1 ] ∨ C n . . . ( C 1 ∨ C 2 ∨ · · · ∨ C n ) θ mgu orientation of equalities { s 1 ≈ s ′ 1 , . . . , s n ≈ s ′ n } s i � � Γ i [ s i + 1 ] 16 / 28
Superposition with Datatypes and Codatatypes Inference rules Trouble with the variables { t ≈ F ( x ) ∨ p ( x ) ??? 17 / 28
Superposition with Datatypes and Codatatypes Inference rules Trouble with the variables unifier = { x ← t } t ≈ F ( x ) ∨ p ( x ) p ( t ) 17 / 28
Superposition with Datatypes and Codatatypes Inference rules Trouble with the variables unifier = { x ← Γ[ t ] } t ≈ F ( x ) ∨ p ( x ) p (Γ[ t ]) 17 / 28
Recommend
More recommend