E ffjc i e n t e n c
- d
i n g s
- f
fj r s t
- r
d e r H
- r
n p r
- b
l e ms i n e q u a t i
- n
a l l
- g
i c
K
- e
n C l a e s s e n N i c k S ma l l b
- n
e
E ffjc i e n t e n c o d i n g s o f fj r s t - - - PowerPoint PPT Presentation
E ffjc i e n t e n c o d i n g s o f fj r s t - o r d e r H o r n p r o b l e ms i n e q u a t i o n a l l o g i c K o e n C l a e s s e n N i c k S ma l l b o n e E q
E ffjc i e n t e n c
i n g s
fj r s t
d e r H
n p r
l e ms i n e q u a t i
a l l
i c
K
n C l a e s s e n N i c k S ma l l b
e
E q u a t i
a l t h e
e m p r
e r s a r e a w e s
e ! B u t t h e r e ’ s a p r
l e m …
H i g h p e r f
m a n c e ! R e a d a b l e p r
s !
R e a s
i n g a b
t a l g e b r a
R e a s
i n g a b
t a l g e b r a
R e a s
i n g a b
t f u n c t i
a l p r
r a m s
s
t [ ] = [ ] s
t ( x : x s ) = i n s e r t x ( s
t x s ) i n s e r t x [ ] = x : [ ] i n s e r t x ( y : y s ) = i f x < y t h e n x : y : y s e l s e y : ( i n s e r t x y s )
R e a s
i n g a b
t f u n c t i
a l p r
r a m s
s
t [ ] = [ ] s
t ( x : x s ) = i n s e r t x ( s
t x s ) i n s e r t x [ ] = x : [ ] i n s e r t x ( y : y s ) = i f x < y t h e n x : y : y s e l s e y : ( i n s e r t x y s )
O u r p a p e r
Wh a t ? T e a c h a u n i t e q u a l i t y p r
e r h
t
e a s
a b
t H
n c l a u s e s H
? B y e n c
i n g H
n c l a u s e s a s e q u a t i
s ( l e a v i n g e x i s t i n g e q u a t i
s a l
e ) Wh y ? T
e t a p r
e r t h a t s p e c i a l i s e s i n m
t l y
q u a t i
a l r e a s
i n g
T h e p l a n
H
n c l a u s e : a t m
t
e p
i t i v e l i t e r a l
. g . f ( x ) = x p ( x ) g ( x ) = a
r p ( x ) q ( x ) f a l s e
t a g e 1 : h
t
n c
e c l a u s e s
t h e f
m :
a = b c = d
t a g e 2 : h
t
n c
e c l a u s e s
t h e f
m :
a
1
= b
1
… a
= b
n
c = d
t a g e 3 : h
t
n c
e p r e d i c a t e s S k i p p e d : h
t
n c
e g
l c l a u s e s
S t a g e 1 :
H
t
n c
e a b i n a r y c l a u s e ( a = b c = d )
s a n e q u a t i
T h e i d e a
W e a r e g
n g t
x i
a t i s e a f u n c t i
i f e q : i f e q ( x , y , z , w ) = i f x = y t h e n z e l s e w Tie n w e c a n e n c
e a = b c = d
s :
I f a = b t h e n i f e q ( a , b , c , d ) = c = d ; i f a ≠ b t h e n i f e q ( a , b , c , d ) = d . B u t h
t
x i
a t i s e i f e q e q u a t i
a l l y ?
A x i
s f
i f e q
A x i
1 : i f e q ( x , x , y , z ) = y A x i
2 : x ≠ y i f e q ( x , y , z , w ) = w
F
H
n f
m u l a s , w e
l y n e e d t h e fj r s t a x i
!
G i v e n a = b c = d
i f e q ( a , b , c , d ) = d i f e q ( x , x , y , z ) = y I f a = b t h e n i f e q ( a , b , c , d ) = d i f e q ( a , a , c , d ) = c s
= d .
H
t
i s c h a r g e a c
d i t i
a l
=
Tii s d e d u c t i
r u l e ( p
i t i v e u n i t r e s
u t i
) i s e n
g h f
H
n r e a s
i n g
S t a g e 2 :
H
t
n c
e a n n
r y c l a u s e ( e . g . a = b c = d e = f )
s a n e q u a t i
C l a u s e s w i t h m a n y n e g a t i v e l i t e r a l s
O p t i
# 1 : r e p e a t e d l y a p p l y t h e e n c
i n g a = b & c = d e = f → e = g b e c
e s a = b i f e q ( c , d , e , f ) = f b e c
e s i f e q ( a , b , i f e q ( c , d , e , f ) , f ) = f
C l a u s e s w i t h m a n y n e g a t i v e l i t e r a l s
O p t i
# 2 : t u p l i n g a = b & c = d e = f
e c
e s p a i r ( a , c ) = p a i r ( b , d ) e = f
e c
e s i f e q ( p a i r ( a , c ) , p a i r ( b , d ) , e , f ) = f w h e r e p a i r m u s t b e f r e s h . ( t h i s i s n
s
n d f
n
n p r
l e m s ! )
x a m p l e : L A T 2 2 4
S t a g e 3 :
H
t
n c
e p r e d i c a t e s u s i n g e q u a t i
s
E n c
i n g p r e d i c a t e s
I d e a : a d d a c
s t a n t t r u e a n d e n c
e p ( t ) a s p ( t ) = t r u e
E n c
i n g p r e d i c a t e s
I d e a : a d d a c
s t a n t t r u e a n d e n c
e p ( t ) a s p ( t ) = t r u e
E n c
i n g p r e d i c a t e s
I d e a : a d d a c
s t a n t t r u e a n d e n c
e p ( t ) a s p ( t ) = t r u e S a t i s fj a b l e : (x , y . x = y ) ¬ p
n s a t i s fj a b l e : (x , y . x = y ) p ≠ t r u e
u t i
# 1 : u s e t y p e s S
u t i
# 2 : . . .
E n c
i n g p r e d i c a t e s
S a t i s fj a b l e : (x , y . x = y ) ¬ p
n s a t i s fj a b l e : (x , y . x = y ) p ≠ t r u e
n c
i n g p r e d i c a t e s i s
l y u n s
n d b e c a u s e y
c a n g
r
x , y . x = y
= t r u e
h i s i s
l y a p r
l e m i f x , y . x = y
s p r
a b l e b u t t h e f
m u l a i s s a t i s fj a b l e
. e . , w h e n t h e p r
l e m h a s a m
e l
d
a i n s i z e 1
S
fj r s t c h e c k i f t h e r e i s a m
e l
s i z e 1
a s y
e a s y : p r e d i c a t e s a r e c
s t a n t
a l u e d , a n d a l l e q u a l i t y l i t e r a l s a r e t r u e , s
h i s i s a H O R N S A T p r
l e m
I f t h e r e i s a m
e l
s i z e 1 , t h e p r
l e m i s s a t i s fj a b l e O t h e r w i s e , e n c
i n g p r e d i c a t e s i s s
n d
f x , y . x = y
s p r
a b l e , t h e p r
l e m i s u n s a t i s fj a b l e
A n a l t e r n a t i v e e n c
i n g
T h e i f e q
n c
i n g i s s u b
t i m a l
i f e q ( a , b , c , d ) = d
Tie p r
e r
l y n e e d s t
a k e a a n d b e q u a l B u t i t w i l l a l s
e e d l e s s l y r e a s
a b
t c a n d d
a = b c = d
e c
e s :
f r e s h ( a , x
1
, …, x
n
) = c f r e s h ( b , x
1
, …, x
n
) = d
E n c
i n g # 2
A l l f r e e v a r i a b l e s
a , b , c a n d d ( s u b s t i t u t i
) A f r e s h f u n c t i
s y m b
G i v e n a = b c = d
f r e s h ( a , x
1
, …, x
n
) = c f r e s h ( b , x
1
, …, x
n
) = d I f a = b t h e n f r e s h ( a , x
1
, …, x
n
) = c f r e s h ( b , x
1
, …, x
n
) = d s
= d .
E n c
i n g # 2 : a = b c = d
f r e s h ( a , x
1
, …, x
n
) = c f r e s h ( b , x
1
, …, x
n
) = d
I f t h e s e e q u a t i
s a r e
i e n t e d l e f t
i g h t t h e n t h e p r
e r c a n
l y :
a r a m
u l a t e i n t
a r a m
u l a t e i n t
e d u c e c = d
c e a a n d b a r e s h
n e q u a l Tii s i s a b
t w h a t w e ’ d g e t w i t h a d e d i c a t e d p r
e r ! D
n s i d e : n
h a v e t w
l a u s e s t
e a s
a b
t
E n c
i n g # 2
R e s u l t s
P r
e r S
v e d R a t i n g 1 s
v e d E ( n
e n c
e d ) 1 9 7 2 E ( e n c
e d ) 1 7 1 7 T w e e 1 6 8 3 2 9 W a l d m e i s t e r 1 3 7 8 1 5 S P A S S ( n
e n c
e d ) 1 3 7 3 7 p r
l e m s
r a t i n g 1 s
v e d i n t
a l , a l l a r e h e a v i l y e q u a t i
a l
u t
1 2 r a t i n g 1 H
n p r
l e m s t
a l C
c l u s i
: t h e e q u a t i
a l p r
e r s a r e r e s p e c t a b l e ( b u t n
g r e a t ) a t g e n e r a l
u r p
e r e a s
i n g – b u t v e r y g
a t e q u a t i
a l r e a s
i n g !
P
s i b l e h e u r i s t i c s
… i f e q ( s , t , u , v ) …
1 . P r i
i t i s e i n f e r e n c e s t h a t m a k e t h e fj r s t t w
r g u m e n t s e q u a l
v e s m
e r a t i n g 1 p r
l e m s b u t f e w e r p r
l e m s
e r a l l 2 . D
’ t d
n y i n f e r e n c e s
t h e t h i r d a n d f
r t h a r g u m e n t
i m p l e m e n t e d , b u t
g h t t
e l p M
e ?
F u l l fj r s t
d e r l
i c ?
a = b c = d ∨ c = e i s t h e s a m e a s i f e q ( a , b , c , d ) = c b u t
l y i f w e c a n a x i
a t i s e x ≠ y i f e q ( x , y , z , w ) = w !
t ’ s k n
n h
t
h i s … w i t h a b
t 1 d i fg e r e n t a x i
s p l u s c
g r u e n c e a x i
s f
e a c h f u n c t i
s y m b
F u l l fj r s t
d e r l
i c ?
a = b c = d ∨ c = e i s t h e s a m e a s i f e q ( a , b , c , d ) = c b u t
l y i f w e c a n a x i
a t i s e x ≠ y i f e q ( x , y , z , w ) = w !
t ’ s k n
n h
t
h i s … w i t h a b
t 1 d i fg e r e n t a x i
s p l u s c
g r u e n c e a x i
s f
e a c h f u n c t i
s y m b
H e l p ! I n e e d s
e h e u r i s t i c s
C
c l u s i
s
G
l : a c h e a p w a y t
u r n a n e q u a t i
a l p r
e r i n t
n “ e q u a t i
a l
l u s ” p r
e r
n c
i n g s w
k w e l l f
m
t l y
q u a t i
a l p r
l e m s
e a c h i n g t h e p r
e r e x t r a h e u r i s t i c s s e e m s t
e a g
i d e a
a n w e a d j u s t t h e p r
e r ’ s s t r a t e g y a b i t m
e r a d i c a l l y ? ( I g n
i n g c e r t a i n i n f e r e n c e s , a l w a y s c h
i n g c e r t a i n i n f e r e n c e s , … )
u l l fj r s t
d e r l
i c – c a n i t b e d
e ?
e c
i n g p r
s ?
I n t h e p a p e r : f
r e n c
i n g s , h
t
a n d l e c
j e c t u r e s , p r
s
c
r e c t n e s s Y
c a n t r y i t
t u s i n g T w e e (
T P T P )
. . a n d a l s
a t c h T w e e l
e a t C A S C !