A Prolog T ec hnology Theorem Pro v er | Mark Stic k el - - PDF document

a prolog t ec hnology theorem pro v er mark stic k el jar
SMART_READER_LITE
LIVE PREVIEW

A Prolog T ec hnology Theorem Pro v er | Mark Stic k el - - PDF document

A Prolog T ec hnology Theorem Pro v er | Mark Stic k el (JAR 1988) 1 Mark E. Stic k el A Prolog T ec hnology Theorem Pro v er: Implemen tation b y an Extended Prolog Compiler Journal of Automated Reasoning


slide-1
SLIDE 1 A Prolog T ec hnology Theorem Pro v er | Mark Stic k el (JAR 1988) 1 Mark E. Stic k el A Prolog T ec hnology Theorem Pro v er: Implemen tation b y an Extended Prolog Compiler Journal
  • f
Automated Reasoning v
  • l.
4, pp. 353-380, 1988 Discussion led b y John Harrison Univ ersit y
  • f
Cam bridge
  • PTTP:
history and its place in A TP
  • Horn
clauses and Prolog
  • F
rom Prolog to PTTP
  • Renemen
ts John Harrison Univ ersit y
  • f
Cam bridge, 26 June 1997
slide-2
SLIDE 2 A Prolog T ec hnology Theorem Pro v er | Mark Stic k el (JAR 1988) 2 Mo del elimination The deductiv e pro cedure underlying PTTP is Donald Lo v eland's MESON mo del elimination metho d, whic h w as in v en ted in the sixties. Mo del elimination is describ ed b y Lo v eland in JA CM v
  • l.
15 (1968), pp. 236-251 and MESON is describ ed in his 1978 b
  • k:
`Automated Theorem Pro ving: A Logical Basis' (North-Holland). ME w as dev elop ed b efore Lo v eland had heard
  • f
resolution. Lo v eland's later dev elopmen t
  • f
linear resolution w as quite separate. ME is a general pro
  • f
metho d for rst
  • rder
logic, and do es not (directly) supp
  • rt
equalit y reasoning, arithmetic etc. John Harrison Univ ersit y
  • f
Cam bridge, 26 June 1997
slide-3
SLIDE 3 A Prolog T ec hnology Theorem Pro v er | Mark Stic k el (JAR 1988) 3 PTTP The idea underlying Stic k el's PTTP w as to implemen t the MESON pro cedure using `Prolog T ec hnology'. That is, he made just a few small mo dications to a standard Prolog system (details later) and
  • btained
a system complete for rst
  • rder
logic. It's probably thanks to PTTP that mo del elimination didn't disapp ear completely against the bac kground
  • f
the in tense in terest in resolution. SETHEO (from Munic h), winner
  • f
the 1996 CADE theorem pro ving comp etition, is basically a w ell-engineered v ersion
  • f
PTTP . The second-placed system, Otter, is the curren t resolution agship. There are implemen tations
  • f
similar algorithms in Isab elle (meson_tac) and in HOL (MESON_TAC), though here clauses are interpr ete d not c
  • mpile
d. John Harrison Univ ersit y
  • f
Cam bridge, 26 June 1997
slide-4
SLIDE 4 A Prolog T ec hnology Theorem Pro v er | Mark Stic k el (JAR 1988) 4 Where ME b elongs W e can divide the standard rst
  • rder
theorem pro ving metho ds in to t w
  • main
groups:
  • The
b
  • ttom-up,
`lo cal' metho ds, e.g. resolution (Robinson, JA CM 1965) and the in v erse metho d (Maslo v, Dok. Ak ad. Nauk 1964).
  • The
top-do wn, `global' metho ds, e.g. mo del elimination and tableaux. In some sense, al l these can b e seen as searc h for a pro
  • f
in cut-free sequen t calculus, using unication to disco v er instan tiations for quan tiers. The b
  • ttom-up
metho ds start at the assumptions and deduce an ev er-increasing set
  • f
facts till they reac h the conclusion. T
  • p-do
wn metho d w
  • rk
bac kw ards from the conclusion, breaking it do wn to subproblems un til the assumptions are reac hed. John Harrison Univ ersit y
  • f
Cam bridge, 26 June 1997
slide-5
SLIDE 5 A Prolog T ec hnology Theorem Pro v er | Mark Stic k el (JAR 1988) 5 T
  • p-do
wn vs. b
  • ttom-up
The b
  • ttom-up
metho ds ha v e sev eral adv an tages. Eectiv ely they p erform pro
  • f
at the meta-lev el: w e can regard free v ariables as implicitly univ ersally quan tied. Therefore it is p
  • ssible
to apply subsumption to the curren t set
  • f
facts, and a v
  • id
pro ving the same lemma t wice. By con trast, in top-do wn (`global') metho ds, the free v ariables in dieren t subgoals need to b e correlated. Ho w ev er, top-do wn metho ds are more goal-directed: w e don't just gro w a big set
  • f
facts and hop e w e reac h the conclusion. Moreo v er, they are m uc h more economical to implemen t, since w e
  • nly
need to store the curren t subgoals. In fact, they are al l v ery Prolog-lik e: apart from the PTTP implemen tation
  • f
MESON, there is a complete tableau pro v er called leanT A P that requires
  • nly
5 lines
  • f
Prolog. John Harrison Univ ersit y
  • f
Cam bridge, 26 June 1997
slide-6
SLIDE 6 A Prolog T ec hnology Theorem Pro v er | Mark Stic k el (JAR 1988) 6 leanT A P This is due to Bec k ert and P
  • segga;
see the Journal
  • f
Automated Reasoning, v
  • l.
15, pp. 339-358, 1995. prove((E,F),A,B,C,D) :- !,prove(E,[F|A],B,C,D). prove((E;F),A,B,C,D) :- !,prove(E,A,B,C,D), prove(F,A,B,C,D). prove(all(I,J),A,B,C,D) :- !, \+length(C,D),copy_term((I,J,C),(G,F, C)), append(A,[all(I,J)],E),prove(F,E,B,[G |C],D) . prove(A,_,[C|D],_,_) :- ((A=
  • (B);-(A)=B)
  • >
(unify(B,C);prove(A,[],D,_,_))). prove(A,[E|F],B,C,D) :- prove(E,F,[A|B],C,D). This sort
  • f
naiv e tableau pro v er is the core
  • f
Isab elle's fast_tac and HOL's TAB_TAC. John Harrison Univ ersit y
  • f
Cam bridge, 26 June 1997
slide-7
SLIDE 7 A Prolog T ec hnology Theorem Pro v er | Mark Stic k el (JAR 1988) 7 Horn clauses and Prolog A clause is a disjunction
  • f
literals, where a literal is either an atomic form ula
  • r
its negation: L 1 _
  • _
L n W e sa y it is a Horn clause if it has at most
  • ne
unnegated literal. In this case w e can write it as L 1 ^
  • ^
L k 1 ^ L k +1 ^
  • ^
L n = ) L k
  • r
simply `L 1 ' if n = 1. These are the clauses that are allo w ed in a Prolog database. The Prolog syn tax for the protot ypical Horn clause is: L k :-
  • L
1 ; : : : ; L k 1 ; L k +1 ; : : : ; L n Prolog allo ws us to deduce an atomic form ula from suc h a database b y bac k c haining through the rules, using unication to instan tiate v ariables (written in upp er case in Prolog). John Harrison Univ ersit y
  • f
Cam bridge, 26 June 1997
slide-8
SLIDE 8 A Prolog T ec hnology Theorem Pro v er | Mark Stic k el (JAR 1988) 8 Wh y is Prolog inadequate? Prolog certainly has a limited abilit y to pro v e theorems. Ho w ev er it is inadequate as a general rst
  • rder
pro v er for three reasons:
  • Most
Prolog implemen tations ha v e unsound unication
  • Prolog
is limited to Horn clauses
  • Prolog's
depth-rst searc h strategy is incomplete. W e arriv e at PTTP b y xing eac h
  • f
these problems. W e will consider them in turn. John Harrison Univ ersit y
  • f
Cam bridge, 26 June 1997
slide-9
SLIDE 9 A Prolog T ec hnology Theorem Pro v er | Mark Stic k el (JAR 1988) 9 Unsound unication It has long b een usual for Prolog implemen tations to
  • mit
the so-called `o ccurs c hec k', e.g. allo wing X and f (X ) to b e unied. This is either for (probably b
  • gus)
eciency reasons,
  • r
b ecause circular data structures are sometimes considered useful. Ho w ev er it's disastrous for theorem pro ving, e.g. it w
  • uld
allo w us to deduce SUC(Y) < Y from X < SUC(X). The x is easy: just do unication prop erly . John Harrison Univ ersit y
  • f
Cam bridge, 26 June 1997
slide-10
SLIDE 10 A Prolog T ec hnology Theorem Pro v er | Mark Stic k el (JAR 1988) 10 Limitation to Horn clauses It is not alw a ys p
  • ssible
to reduce theorem pro ving problems to Horn clause sets acceptable to Prolog. F
  • r
example, w e migh t w an t to use the facts A _ B and A = ) B to deduce B . Ho w ev er there is no equiv alen t in terms
  • f
Horn clauses. The solution adopted in PTTP is to extend the notion
  • f
`Horn clause': A 1 ^
  • A
n = ) B to allo w an y
  • r
all
  • f
the literals in v
  • lv
ed to b e negated. No w w e can tak e an y problem and reduce it to something based
  • n
these pseudo-Horn clauses. John Harrison Univ ersit y
  • f
Cam bridge, 26 June 1997
slide-11
SLIDE 11 A Prolog T ec hnology Theorem Pro v er | Mark Stic k el (JAR 1988) 11 Con trap
  • sitiv
es W e tak e the fact w e w an t to pro v e (ma yb e an implication under a set
  • f
assumptions), negate it, Sk
  • lemize
it and reduce it to clausal form. W e w an t to deriv e ?. F
  • r
eac h clause: P 1 _ : : : _ P n w e form n c
  • ntr
ap
  • sitives
  • f
the form: P 1 ^
  • ^
P i1 ^ P i+1 ^
  • ^
P n = ) P i and
  • ne
more
  • f
the form: P 1 ^ : : : ^ P n = ) ? No w w e try to solv e the goal ?
  • a
la Prolog. John Harrison Univ ersit y
  • f
Cam bridge, 26 June 1997
slide-12
SLIDE 12 A Prolog T ec hnology Theorem Pro v er | Mark Stic k el (JAR 1988) 12 Incompleteness Unfortunately , while Prolog-st yle bac k c haining is complete for true Horn clauses, this is not so for pseudo-Horn clauses. Consider the in tended example
  • f
deducing B from A _ B and A = ) B . The con trap
  • sitiv
es are: B = ) ? :A = ) B :B = ) A :A ^ :B = ) ? A = ) B :B = ) :A A ^ :B = ) ? It is immediate that no Prolog-st yle searc h can terminate in success b ecause there are no unit clauses. John Harrison Univ ersit y
  • f
Cam bridge, 26 June 1997
slide-13
SLIDE 13 A Prolog T ec hnology Theorem Pro v er | Mark Stic k el (JAR 1988) 13 Ancestor unication W e can restore completeness b y an extra rule: as w ell as unication with the conclusion
  • f
a rule, w e allo w unication with the ne gation
  • f
an anc estor. This is treated as a unit clause and can solv e a goal; note that the v ariables, if an y , are correlated. F
  • r
example ? B A :B No w w e can unify :B and the negation
  • f
B . The logical justication is simple: if w e are trying to pro v e a goal, here B , w e ma y assume its negation :B , since if that is false w e are immediately nished. John Harrison Univ ersit y
  • f
Cam bridge, 26 June 1997
slide-14
SLIDE 14 A Prolog T ec hnology Theorem Pro v er | Mark Stic k el (JAR 1988) 14 Searc h strategy Although this is no w complete as a c alculus, the usual Prolog depth-rst searc h with rules tried in
  • rder
is trivially incomplete. F
  • r
example, the rules P (f (X )) = ) P (X ) and P (f (a)) cannot solv e the goal P (a) b ecause Prolog will k eep applying the rst rule ad innitum: P (a) P (f (a)) P (f (f (a))) P (f (f (f (a))))
  • W
e need to use a searc h strategy that will allo w all p
  • ssible
pro
  • fs
to b e found. The most
  • b
vious is breadth-rst searc h. But this blo ws up the storage requiremen t: the minimal storage usage is
  • ne
  • f
PTTP's strong p
  • in
ts. Instead, most implemen tations use depth rst iter ative de ep ening: searc h for pro
  • fs
  • f
depth 1, then if that fails, depth 2, then if that fails, depth 3, and so
  • n.
John Harrison Univ ersit y
  • f
Cam bridge, 26 June 1997
slide-15
SLIDE 15 A Prolog T ec hnology Theorem Pro v er | Mark Stic k el (JAR 1988) 15 Searc h alternativ es V arious searc h mo des ha v e b een exp erimen ted with
  • Lo
v eland
  • riginally
used iterativ e deep ening where `depth' is maxim um heigh t
  • f
pro
  • f
tree.
  • Stic
k el then used depth = size
  • f
pro
  • f
tree (n um b er
  • f
no des).
  • P
aulson uses b est-rst searc h (not iterativ e deep ening).
  • SETHEO
allo ws heigh t
  • r
size b
  • unds;
the former is b etter
  • n
a v erage.
  • Harrison
uses an
  • ptimized
v ersion
  • f
size b
  • unds,
whic h seems b etter still. John Harrison Univ ersit y
  • f
Cam bridge, 26 June 1997
slide-16
SLIDE 16 A Prolog T ec hnology Theorem Pro v er | Mark Stic k el (JAR 1988) 16 Implemen tation renemen ts
  • Making
larger DFID incremen ts automatically (e.g. if all the clauses are units
  • r
ha v e 3 assumptions, w e can incremen t b y 3 eac h time).
  • Av
  • iding
rep etitions do wn a branc h
  • f
the pro
  • f
tree. (Though these ma y
  • nly
app ear after later instan tiation, so there are trade-os to b e made.)
  • P
erforming `in telligen t bac ktrac king', e.g. if a goal is solv ed using a unit clause
  • r
ancestor without instan tiation
  • f
the goal, no
  • ther
solutions need b e tried. More adv anced
  • ptimizations
can in teract badly with iterativ e deep ening.
  • Extending
the system to nonclausal assertions,
  • a
la Prolog, e.g. P ^ (Q _ R ) = ) S instead
  • f
t w
  • separate
clauses. This a v
  • ids
rep eating the solution
  • f
P . John Harrison Univ ersit y
  • f
Cam bridge, 26 June 1997
slide-17
SLIDE 17 A Prolog T ec hnology Theorem Pro v er | Mark Stic k el (JAR 1988) 17 Renemen ts to the calculus It suces to generate rules with conclusion ?
  • nly
if all the literals in the clause are negated. Often this is just the
  • riginal
goal. Also, there is Plaisted's `p
  • sitiv
e renemen t'. There are alternativ e v ersions
  • f
ME that
  • nly
use `natural' con trap
  • sitiv
es, e.g. Lo v eland's Ne ar-Horn Pr
  • lo
g, Plaisted's Mo die d Pr
  • blem
R e duction F
  • rmat
and Baumgartner & F urbac h's R estart Mo del Elimination. There are also v arious tec hniques for cac hing and lemmatizing. These w ere
  • riginally
used b y Lo v eland, and fell
  • ut
  • f
fa v
  • ur,
but are no w attracting atten tion again. F
  • r
example, SETHEO uses sev eral quite sophisticated tec hniques. John Harrison Univ ersit y
  • f
Cam bridge, 26 June 1997