Implementation of Lambda-Free Higher-Order Superposition Petar Vukmirović
Automatic theorem proving ‒ state of the art FOL HOL 2
Automatic theorem proving ‒ challenge HOL High-performance higher-order theorem prover that extends first-order theorem proving gracefully . 3
My approach FOL prover Add HO feature Fast HOL prover Optimize Test 4
Syntax Types: Terms: τ ::= a t ::= X variable | τ → τ | f symbol | t t application 5
Supported HO features Example: Applied variables + X ( f a ) f Partial application = Lambda-Free Applied variable Partial application Higher-Order Logic 6
LFHOL iteration E LFHOL hoE Optimize Test 7
Generalization of term representation Approach 1: Approach 2: Native representation Applicative encoding X ( f a ) f @(@( X , @( f , a )), f ) 8
Differences between the approaches Approach 1: Approach 2: Native representation Applicative encoding Compact Easy to implement Fast Works well with E heuristics 9
Unification problem Given the set of equations { s 1 = ? t 1 , …, s n = ? t n } find the substitution σ such that { σ ( s 1 ) = σ ( t 1 ), …, σ ( s n ) = σ ( t n ) } 10
FOL unification algorithm Initial set of equations S No failure is reported Remove an equation s = ? t S = Ø S ≠ Ø S is unifiable Transform S Failure is reported S is not unifiable 11
Transformation of the equation set Match s = ? t f ( s 1 , …, s n ) = ? f ( t 1 , …, t n ) Add { s 1 = ? t 1 , …, s n = ? t n } decomposition f ( s 1 , …, s n ) = ? g ( t 1 , …, t m ) Report failure collision f ( s 1 , …, s n ) = ? X Add { t = ? s } reorientation X = ? f ( s 1 , …, s n ); X not in t Apply [ X ← f ( s 1 , …, s n )] application X = ? f ( s 1 , …, s n ); X in t Report failure occurs-check X = ? X No changes identity 12 Match s , Match s , t
FOL algorithm fails on LFHOL terms X b = ? f a b X ≠ f Report failure collision Yet, { X ← f a } is a unifier. 13
Example X ← f a X 2 (Z 2 b c) d = ? f a (Y 1 c) d Z b c = ? Y c, d = ? d prefix match orientation Y ← Z b Y c = ? Z b c, d = ? d c = ? c, d = ? d prefix match decomposition Unifier d = ? d { X ← f a, Y ← Z b } decomposition 14
LFHOL equation set transformation Match s = ? t ⍺ s 1 … s n = ? ⍺ t 1 … t n Add { s 1 = ? t 1 , …, s n = ? t n } decomposition β is var, either ⍺ is Add { t = ? s } reorientation not or n > m ⍺ s 1 … s n = ? β t 1 … t m Neither ⍺ nor β Report failure collision vars ⍺ is var, matches Add { ⍺ = ? t [: p ] , s 1 = ? t p +1 , …, s n = ? t m } prefix match prefix of t X = ? f s 1 … s n ; X not in t Apply [ X ← f s 1 … s n ] application X = ? f s 1 … s n ; X in t Report failure occurs-check X = ? X 15 No changes identity Match s , Match s , t
Standard FOL operations s t unifiable/matchable? 16
… are performed on subterms recursively, s f ( t 1 , t 2 , … , t n ) unifiable/matchable? 17
… and there are twice as many subterms in HOL prefix subterms s f t 1 t 2 … t n f t 1 t 2 … t n f t 1 t 2 … t n f t 1 t 2 … t n argument subterms unifiable/matchable? 18
Prefix optimization Traverse only argument subterms ● Use types & arity to determine the only unifiable/matchable prefix ● Report 1 argument trailing f X Y f a b c 19
Advantages of prefix optimization 2x fewer No unnecessary No changes to E subterms prefixes created term traversal 20
Indexing data structures f ( a , g ( b , Generalizations a ) ) c h(g(x,f(x,x))) s = ? σ ( t ) ) y , x ( f f ( x,g ( h ( y ) ,a )) Instances a σ ( s ) = ? t x f ( f ( x , x ) , f ( y , y ) Unifiable terms ) σ ( s ) = ? σ ( t ) Query term Set of terms 21
E’s indexing data structures Discrimination trees Discrimination trees Fingerprint indexing Feature vector indexing 22
Discrimination trees Factor out operations common for many terms Flatten the term and use it as a key Query term: f ( x , f ( h ( x ), y )) Flattening: f x f h x y 23
Example Query term: 24
Example Query term: 25
Example Query term: 26
Example Query term: Backtrack to where we can make choice No neighbour can generalize the term 27
Example Query term: Backtrack further Mismatch 28
Example Query term: 29
Example Query term: 30
Example Query term: 31
Example Query term: 32
LFHOL challenges 1. Applied variables 2. Terms prefixes of one another 3. Prefix optimization 33
LFHOL challenges g a b Query term: 1. Applied variables Variable can match a prefix 2. Terms prefixes of one another 3. Prefix optimization 34
LFHOL challenges g a b Query term: 1. Applied variables Variable can match a prefix 2. Terms prefixes of one another 3. Prefix optimization 35
LFHOL challenges g a b Query term: 1. Applied variables Variable can match a prefix 2. Terms prefixes of one another 3. Prefix optimization 36
LFHOL challenges 1. Applied variables 2. Terms prefixes of one another Terms can be stored in inner nodes 3. Prefix optimization 37
LFHOL challenges f a b Query term: 1. Applied variables 2. Terms prefixes of one another 3. Prefix optimization Prefix matches are allowed 38
Experimentation results HOL Two compilation modes: hoE - support for LFHOL FOL foE - support only for FOL 39
Gain on LFHOL problems E hoE vs. original E 995 (encoded) LFHOL TPTP problems hoE 40
Gain on LFHOL problems Both finished on 872 / 995 problems hoE: 8 unique, E: 11 unique Mean runtime: 0.010 s hoE 0.013 s E Total runtime: hoE 17.1 s E 113.9 s 41
Overhead on FOL problems hoE vs. E foE vs. E Minimize the overhead for existing E users Tested on 7789 FOL TPTP problems 42
foE vs. E Median runtime: foE 1.4 s 1.3 s E E Total runtime: foE 845909 s 844212 s E foE 43
hoE vs. E Median runtime: hoE 1.5 s 1.3 s E E Total runtime: hoE 846897 s 844212 s E hoE 44
Summary Engineering viewpoint Theoretical viewpoint New type module Graceful algorithm extension ● ● Native term representation Graceful data structures extension ● ● Elegant algorithm extensions ● Prefix optimizations ● 45
Future work Integration with official E New features First-class E LFHOL Full HOL prover hoE booleans λ s Optimize Test 46
Implementation of Lambda-Free Higher-Order Superposition Petar Vukmirović
Recommend
More recommend