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