petar vukmirović implementation of lambda-free higher...
TRANSCRIPT
![Page 1: Petar Vukmirović Implementation of Lambda-Free Higher ...aitp-conference.org/2018/slides/hoE.pdf · Higher-Order Superposition. ... Automatic theorem proving ‒ challenge HOL](https://reader030.vdocuments.site/reader030/viewer/2022021520/5b5536cd7f8b9ae30b8e220d/html5/thumbnails/1.jpg)
Petar Vukmirović
Implementation of Lambda-Free Higher-Order Superposition
![Page 2: Petar Vukmirović Implementation of Lambda-Free Higher ...aitp-conference.org/2018/slides/hoE.pdf · Higher-Order Superposition. ... Automatic theorem proving ‒ challenge HOL](https://reader030.vdocuments.site/reader030/viewer/2022021520/5b5536cd7f8b9ae30b8e220d/html5/thumbnails/2.jpg)
Automatic theorem proving ‒ state of the art
FOL HOL
2
![Page 3: Petar Vukmirović Implementation of Lambda-Free Higher ...aitp-conference.org/2018/slides/hoE.pdf · Higher-Order Superposition. ... Automatic theorem proving ‒ challenge HOL](https://reader030.vdocuments.site/reader030/viewer/2022021520/5b5536cd7f8b9ae30b8e220d/html5/thumbnails/3.jpg)
Automatic theorem proving ‒ challenge
HOL
High-performance higher-order theorem proverthat extends first-order theorem proving gracefully.
3
![Page 4: Petar Vukmirović Implementation of Lambda-Free Higher ...aitp-conference.org/2018/slides/hoE.pdf · Higher-Order Superposition. ... Automatic theorem proving ‒ challenge HOL](https://reader030.vdocuments.site/reader030/viewer/2022021520/5b5536cd7f8b9ae30b8e220d/html5/thumbnails/4.jpg)
My approach
FOL prover
TestOptimize
Fast HOL proverAdd HO feature
4
![Page 5: Petar Vukmirović Implementation of Lambda-Free Higher ...aitp-conference.org/2018/slides/hoE.pdf · Higher-Order Superposition. ... Automatic theorem proving ‒ challenge HOL](https://reader030.vdocuments.site/reader030/viewer/2022021520/5b5536cd7f8b9ae30b8e220d/html5/thumbnails/5.jpg)
Syntax
Types:
τ ::= a | τ → τ
Terms:
t ::= X | f | t t
variable
symbol
application
5
![Page 6: Petar Vukmirović Implementation of Lambda-Free Higher ...aitp-conference.org/2018/slides/hoE.pdf · Higher-Order Superposition. ... Automatic theorem proving ‒ challenge HOL](https://reader030.vdocuments.site/reader030/viewer/2022021520/5b5536cd7f8b9ae30b8e220d/html5/thumbnails/6.jpg)
Supported HO features
Example:
X (f a) f
Applied variables+
Partial application=
Lambda-Free Higher-Order Logic Applied variable Partial application
6
![Page 7: Petar Vukmirović Implementation of Lambda-Free Higher ...aitp-conference.org/2018/slides/hoE.pdf · Higher-Order Superposition. ... Automatic theorem proving ‒ challenge HOL](https://reader030.vdocuments.site/reader030/viewer/2022021520/5b5536cd7f8b9ae30b8e220d/html5/thumbnails/7.jpg)
LFHOL iteration
E
TestOptimize
hoELFHOL
7
![Page 8: Petar Vukmirović Implementation of Lambda-Free Higher ...aitp-conference.org/2018/slides/hoE.pdf · Higher-Order Superposition. ... Automatic theorem proving ‒ challenge HOL](https://reader030.vdocuments.site/reader030/viewer/2022021520/5b5536cd7f8b9ae30b8e220d/html5/thumbnails/8.jpg)
Generalization of term representation
Approach 1:Native representation
X (f a) f
Approach 2:Applicative encoding
@(@(X, @(f, a)), f)
8
![Page 9: Petar Vukmirović Implementation of Lambda-Free Higher ...aitp-conference.org/2018/slides/hoE.pdf · Higher-Order Superposition. ... Automatic theorem proving ‒ challenge HOL](https://reader030.vdocuments.site/reader030/viewer/2022021520/5b5536cd7f8b9ae30b8e220d/html5/thumbnails/9.jpg)
Differences between the approaches
Approach 1:Native representation
Approach 2:Applicative encoding
Compact
Fast
Works well with E heuristics
Easy to implement
9
![Page 10: Petar Vukmirović Implementation of Lambda-Free Higher ...aitp-conference.org/2018/slides/hoE.pdf · Higher-Order Superposition. ... Automatic theorem proving ‒ challenge HOL](https://reader030.vdocuments.site/reader030/viewer/2022021520/5b5536cd7f8b9ae30b8e220d/html5/thumbnails/10.jpg)
Unification problem
Given the set of equations
{ s1 =? t1, …, sn =? tn }
find the substitution σ such that
{ σ(s1) = σ(t1), …, σ(sn) = σ(tn) }
10
![Page 11: Petar Vukmirović Implementation of Lambda-Free Higher ...aitp-conference.org/2018/slides/hoE.pdf · Higher-Order Superposition. ... Automatic theorem proving ‒ challenge HOL](https://reader030.vdocuments.site/reader030/viewer/2022021520/5b5536cd7f8b9ae30b8e220d/html5/thumbnails/11.jpg)
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
![Page 12: Petar Vukmirović Implementation of Lambda-Free Higher ...aitp-conference.org/2018/slides/hoE.pdf · Higher-Order Superposition. ... Automatic theorem proving ‒ challenge HOL](https://reader030.vdocuments.site/reader030/viewer/2022021520/5b5536cd7f8b9ae30b8e220d/html5/thumbnails/12.jpg)
Transformation of the equation setMatch 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
occurs-check
identity
12
![Page 13: Petar Vukmirović Implementation of Lambda-Free Higher ...aitp-conference.org/2018/slides/hoE.pdf · Higher-Order Superposition. ... Automatic theorem proving ‒ challenge HOL](https://reader030.vdocuments.site/reader030/viewer/2022021520/5b5536cd7f8b9ae30b8e220d/html5/thumbnails/13.jpg)
FOL algorithm fails on LFHOL terms
Yet, { X ← f a } is a unifier.
13
X b =? f a b
Report failureX ≠ f
collision
![Page 14: Petar Vukmirović Implementation of Lambda-Free Higher ...aitp-conference.org/2018/slides/hoE.pdf · Higher-Order Superposition. ... Automatic theorem proving ‒ challenge HOL](https://reader030.vdocuments.site/reader030/viewer/2022021520/5b5536cd7f8b9ae30b8e220d/html5/thumbnails/14.jpg)
Example
X2 (Z
2 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
orientation
decomposition
decomposition
Unifier{ X ← f a, Y ← Z b }
14
![Page 15: Petar Vukmirović Implementation of Lambda-Free Higher ...aitp-conference.org/2018/slides/hoE.pdf · Higher-Order Superposition. ... Automatic theorem proving ‒ challenge HOL](https://reader030.vdocuments.site/reader030/viewer/2022021520/5b5536cd7f8b9ae30b8e220d/html5/thumbnails/15.jpg)
LFHOL equation set transformationMatch 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
occurs-check
identity
Add { t =? s }β is var, either⍺ is not or n > m
Report failureNeither ⍺ nor β vars
Add {⍺ =? t[:p], s1=? tp+1, …, sn=? tm}
⍺ is var, matchesprefix of t
reorientation
collision
prefix match
15
![Page 16: Petar Vukmirović Implementation of Lambda-Free Higher ...aitp-conference.org/2018/slides/hoE.pdf · Higher-Order Superposition. ... Automatic theorem proving ‒ challenge HOL](https://reader030.vdocuments.site/reader030/viewer/2022021520/5b5536cd7f8b9ae30b8e220d/html5/thumbnails/16.jpg)
Standard FOL operations
s t
unifiable/matchable?
16
![Page 17: Petar Vukmirović Implementation of Lambda-Free Higher ...aitp-conference.org/2018/slides/hoE.pdf · Higher-Order Superposition. ... Automatic theorem proving ‒ challenge HOL](https://reader030.vdocuments.site/reader030/viewer/2022021520/5b5536cd7f8b9ae30b8e220d/html5/thumbnails/17.jpg)
… are performed on subterms recursively,
s
unifiable/matchable?
f(t1, t2 ,…, tn)
17
![Page 18: Petar Vukmirović Implementation of Lambda-Free Higher ...aitp-conference.org/2018/slides/hoE.pdf · Higher-Order Superposition. ... Automatic theorem proving ‒ challenge HOL](https://reader030.vdocuments.site/reader030/viewer/2022021520/5b5536cd7f8b9ae30b8e220d/html5/thumbnails/18.jpg)
… and there are twice as many subterms in HOL
s f t1 t2 … tnf t1 t2 … tnf t1 t2 … tnf t1 t2 … tn
18
unifiable/matchable?
argument subterms
prefix subterms
![Page 19: Petar Vukmirović Implementation of Lambda-Free Higher ...aitp-conference.org/2018/slides/hoE.pdf · Higher-Order Superposition. ... Automatic theorem proving ‒ challenge HOL](https://reader030.vdocuments.site/reader030/viewer/2022021520/5b5536cd7f8b9ae30b8e220d/html5/thumbnails/19.jpg)
Prefix optimization
● Traverse only argument subterms
● Use types & arity to determine the only unifiable/matchable prefix
19
f a b cf X Y
Report 1 argument trailing
![Page 20: Petar Vukmirović Implementation of Lambda-Free Higher ...aitp-conference.org/2018/slides/hoE.pdf · Higher-Order Superposition. ... Automatic theorem proving ‒ challenge HOL](https://reader030.vdocuments.site/reader030/viewer/2022021520/5b5536cd7f8b9ae30b8e220d/html5/thumbnails/20.jpg)
Advantages of prefix optimization
2x fewer subterms
No unnecessary prefixes created
No changes to E term traversal
20
![Page 21: Petar Vukmirović Implementation of Lambda-Free Higher ...aitp-conference.org/2018/slides/hoE.pdf · Higher-Order Superposition. ... Automatic theorem proving ‒ challenge HOL](https://reader030.vdocuments.site/reader030/viewer/2022021520/5b5536cd7f8b9ae30b8e220d/html5/thumbnails/21.jpg)
Indexing data structures
f(a,g(b,a))
f(x,y)
h(g(x,f(x,x)))
a
c
xf(f(x,x), f(y,y))
Query term
f(x,g(h(y),a))
Set of terms
Generalizationss =? σ(t)
Instancesσ(s) =? t
Unifiable termsσ(s) =? σ(t)
21
![Page 22: Petar Vukmirović Implementation of Lambda-Free Higher ...aitp-conference.org/2018/slides/hoE.pdf · Higher-Order Superposition. ... Automatic theorem proving ‒ challenge HOL](https://reader030.vdocuments.site/reader030/viewer/2022021520/5b5536cd7f8b9ae30b8e220d/html5/thumbnails/22.jpg)
E’s indexing data structures
Discrimination trees
Fingerprint indexing
Feature vector indexing
Discrimination trees
22
![Page 23: Petar Vukmirović Implementation of Lambda-Free Higher ...aitp-conference.org/2018/slides/hoE.pdf · Higher-Order Superposition. ... Automatic theorem proving ‒ challenge HOL](https://reader030.vdocuments.site/reader030/viewer/2022021520/5b5536cd7f8b9ae30b8e220d/html5/thumbnails/23.jpg)
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
![Page 24: Petar Vukmirović Implementation of Lambda-Free Higher ...aitp-conference.org/2018/slides/hoE.pdf · Higher-Order Superposition. ... Automatic theorem proving ‒ challenge HOL](https://reader030.vdocuments.site/reader030/viewer/2022021520/5b5536cd7f8b9ae30b8e220d/html5/thumbnails/24.jpg)
Example Query term:
24
![Page 25: Petar Vukmirović Implementation of Lambda-Free Higher ...aitp-conference.org/2018/slides/hoE.pdf · Higher-Order Superposition. ... Automatic theorem proving ‒ challenge HOL](https://reader030.vdocuments.site/reader030/viewer/2022021520/5b5536cd7f8b9ae30b8e220d/html5/thumbnails/25.jpg)
Example Query term:
25
![Page 26: Petar Vukmirović Implementation of Lambda-Free Higher ...aitp-conference.org/2018/slides/hoE.pdf · Higher-Order Superposition. ... Automatic theorem proving ‒ challenge HOL](https://reader030.vdocuments.site/reader030/viewer/2022021520/5b5536cd7f8b9ae30b8e220d/html5/thumbnails/26.jpg)
Example Query term:
26
![Page 27: Petar Vukmirović Implementation of Lambda-Free Higher ...aitp-conference.org/2018/slides/hoE.pdf · Higher-Order Superposition. ... Automatic theorem proving ‒ challenge HOL](https://reader030.vdocuments.site/reader030/viewer/2022021520/5b5536cd7f8b9ae30b8e220d/html5/thumbnails/27.jpg)
Example Query term:
No neighbour can generalize the term
Backtrack to where we can make choice
27
![Page 28: Petar Vukmirović Implementation of Lambda-Free Higher ...aitp-conference.org/2018/slides/hoE.pdf · Higher-Order Superposition. ... Automatic theorem proving ‒ challenge HOL](https://reader030.vdocuments.site/reader030/viewer/2022021520/5b5536cd7f8b9ae30b8e220d/html5/thumbnails/28.jpg)
Example Query term:
Mismatch
Backtrack further
28
![Page 29: Petar Vukmirović Implementation of Lambda-Free Higher ...aitp-conference.org/2018/slides/hoE.pdf · Higher-Order Superposition. ... Automatic theorem proving ‒ challenge HOL](https://reader030.vdocuments.site/reader030/viewer/2022021520/5b5536cd7f8b9ae30b8e220d/html5/thumbnails/29.jpg)
Example Query term:
29
![Page 30: Petar Vukmirović Implementation of Lambda-Free Higher ...aitp-conference.org/2018/slides/hoE.pdf · Higher-Order Superposition. ... Automatic theorem proving ‒ challenge HOL](https://reader030.vdocuments.site/reader030/viewer/2022021520/5b5536cd7f8b9ae30b8e220d/html5/thumbnails/30.jpg)
Example Query term:
30
![Page 31: Petar Vukmirović Implementation of Lambda-Free Higher ...aitp-conference.org/2018/slides/hoE.pdf · Higher-Order Superposition. ... Automatic theorem proving ‒ challenge HOL](https://reader030.vdocuments.site/reader030/viewer/2022021520/5b5536cd7f8b9ae30b8e220d/html5/thumbnails/31.jpg)
Example Query term:
31
![Page 32: Petar Vukmirović Implementation of Lambda-Free Higher ...aitp-conference.org/2018/slides/hoE.pdf · Higher-Order Superposition. ... Automatic theorem proving ‒ challenge HOL](https://reader030.vdocuments.site/reader030/viewer/2022021520/5b5536cd7f8b9ae30b8e220d/html5/thumbnails/32.jpg)
Example Query term:
32
![Page 33: Petar Vukmirović Implementation of Lambda-Free Higher ...aitp-conference.org/2018/slides/hoE.pdf · Higher-Order Superposition. ... Automatic theorem proving ‒ challenge HOL](https://reader030.vdocuments.site/reader030/viewer/2022021520/5b5536cd7f8b9ae30b8e220d/html5/thumbnails/33.jpg)
LFHOL challenges
1. Applied variables
2. Terms prefixes of one another
3. Prefix optimization
33
![Page 34: Petar Vukmirović Implementation of Lambda-Free Higher ...aitp-conference.org/2018/slides/hoE.pdf · Higher-Order Superposition. ... Automatic theorem proving ‒ challenge HOL](https://reader030.vdocuments.site/reader030/viewer/2022021520/5b5536cd7f8b9ae30b8e220d/html5/thumbnails/34.jpg)
LFHOL challenges
1. Applied variablesVariable can match a prefix
2. Terms prefixes of one another
3. Prefix optimization
Query term: g a b
34
![Page 35: Petar Vukmirović Implementation of Lambda-Free Higher ...aitp-conference.org/2018/slides/hoE.pdf · Higher-Order Superposition. ... Automatic theorem proving ‒ challenge HOL](https://reader030.vdocuments.site/reader030/viewer/2022021520/5b5536cd7f8b9ae30b8e220d/html5/thumbnails/35.jpg)
LFHOL challenges
1. Applied variablesVariable can match a prefix
2. Terms prefixes of one another
3. Prefix optimization
Query term: g a b
35
![Page 36: Petar Vukmirović Implementation of Lambda-Free Higher ...aitp-conference.org/2018/slides/hoE.pdf · Higher-Order Superposition. ... Automatic theorem proving ‒ challenge HOL](https://reader030.vdocuments.site/reader030/viewer/2022021520/5b5536cd7f8b9ae30b8e220d/html5/thumbnails/36.jpg)
LFHOL challenges
1. Applied variablesVariable can match a prefix
2. Terms prefixes of one another
3. Prefix optimization
Query term: g a b
36
![Page 37: Petar Vukmirović Implementation of Lambda-Free Higher ...aitp-conference.org/2018/slides/hoE.pdf · Higher-Order Superposition. ... Automatic theorem proving ‒ challenge HOL](https://reader030.vdocuments.site/reader030/viewer/2022021520/5b5536cd7f8b9ae30b8e220d/html5/thumbnails/37.jpg)
LFHOL challenges
1. Applied variables
2. Terms prefixes of one anotherTerms can be stored in inner nodes
3. Prefix optimization
37
![Page 38: Petar Vukmirović Implementation of Lambda-Free Higher ...aitp-conference.org/2018/slides/hoE.pdf · Higher-Order Superposition. ... Automatic theorem proving ‒ challenge HOL](https://reader030.vdocuments.site/reader030/viewer/2022021520/5b5536cd7f8b9ae30b8e220d/html5/thumbnails/38.jpg)
LFHOL challenges
1. Applied variables
2. Terms prefixes of one another
3. Prefix optimizationPrefix matches are allowed
Query term: f a b
38
![Page 39: Petar Vukmirović Implementation of Lambda-Free Higher ...aitp-conference.org/2018/slides/hoE.pdf · Higher-Order Superposition. ... Automatic theorem proving ‒ challenge HOL](https://reader030.vdocuments.site/reader030/viewer/2022021520/5b5536cd7f8b9ae30b8e220d/html5/thumbnails/39.jpg)
Experimentation results
Two compilation modes:
hoE - support for LFHOL
foE - support only for FOL
HOL
FOL
39
![Page 40: Petar Vukmirović Implementation of Lambda-Free Higher ...aitp-conference.org/2018/slides/hoE.pdf · Higher-Order Superposition. ... Automatic theorem proving ‒ challenge HOL](https://reader030.vdocuments.site/reader030/viewer/2022021520/5b5536cd7f8b9ae30b8e220d/html5/thumbnails/40.jpg)
Gain on LFHOL problems
hoE vs. original E
995 (encoded)LFHOL TPTP
problems
hoE
E
40
![Page 41: Petar Vukmirović Implementation of Lambda-Free Higher ...aitp-conference.org/2018/slides/hoE.pdf · Higher-Order Superposition. ... Automatic theorem proving ‒ challenge HOL](https://reader030.vdocuments.site/reader030/viewer/2022021520/5b5536cd7f8b9ae30b8e220d/html5/thumbnails/41.jpg)
Gain on LFHOL problems
Both finished on 872/995 problemshoE: 8 unique, E: 11 unique
Total runtime:
41
hoE
E
17.1s
113.9s
Mean runtime:
hoE
E
0.010s
0.013s
![Page 42: Petar Vukmirović Implementation of Lambda-Free Higher ...aitp-conference.org/2018/slides/hoE.pdf · Higher-Order Superposition. ... Automatic theorem proving ‒ challenge HOL](https://reader030.vdocuments.site/reader030/viewer/2022021520/5b5536cd7f8b9ae30b8e220d/html5/thumbnails/42.jpg)
Overhead on FOL problems
hoE vs. E foE vs. E
Minimize the overhead for existing E users
Tested on 7789 FOL TPTP problems
42
![Page 43: Petar Vukmirović Implementation of Lambda-Free Higher ...aitp-conference.org/2018/slides/hoE.pdf · Higher-Order Superposition. ... Automatic theorem proving ‒ challenge HOL](https://reader030.vdocuments.site/reader030/viewer/2022021520/5b5536cd7f8b9ae30b8e220d/html5/thumbnails/43.jpg)
foE vs. E
Total runtime:
43foE
E
foE
E
845909s
844212s
Median runtime:
foE
E
1.4s
1.3s
![Page 44: Petar Vukmirović Implementation of Lambda-Free Higher ...aitp-conference.org/2018/slides/hoE.pdf · Higher-Order Superposition. ... Automatic theorem proving ‒ challenge HOL](https://reader030.vdocuments.site/reader030/viewer/2022021520/5b5536cd7f8b9ae30b8e220d/html5/thumbnails/44.jpg)
hoE vs. E
44hoE
ETotal runtime:
hoE
E
846897s
844212s
Median runtime:
hoE
E
1.5s
1.3s
![Page 45: Petar Vukmirović Implementation of Lambda-Free Higher ...aitp-conference.org/2018/slides/hoE.pdf · Higher-Order Superposition. ... Automatic theorem proving ‒ challenge HOL](https://reader030.vdocuments.site/reader030/viewer/2022021520/5b5536cd7f8b9ae30b8e220d/html5/thumbnails/45.jpg)
Summary
● New type module● Native term representation● Elegant algorithm extensions● Prefix optimizations
● Graceful algorithm extension● Graceful data structures extension
45
Engineering viewpoint Theoretical viewpoint
![Page 46: Petar Vukmirović Implementation of Lambda-Free Higher ...aitp-conference.org/2018/slides/hoE.pdf · Higher-Order Superposition. ... Automatic theorem proving ‒ challenge HOL](https://reader030.vdocuments.site/reader030/viewer/2022021520/5b5536cd7f8b9ae30b8e220d/html5/thumbnails/46.jpg)
Future work
Integration with official E
E
TestOptimize
hoELFHOL
New features
First-class booleans
λs
Full HOL prover
46
![Page 47: Petar Vukmirović Implementation of Lambda-Free Higher ...aitp-conference.org/2018/slides/hoE.pdf · Higher-Order Superposition. ... Automatic theorem proving ‒ challenge HOL](https://reader030.vdocuments.site/reader030/viewer/2022021520/5b5536cd7f8b9ae30b8e220d/html5/thumbnails/47.jpg)
Petar Vukmirović
Implementation of Lambda-Free Higher-Order Superposition