Some Tactics and Laws for the CADi
Theorem-prover
section setlaws parents setdefs, corelaws |
This section contains general-purpose tactics, and laws, with (some of) their proofs,
on the assumption that the definitions of setdefs.z are present.
Written by Sam Valentine.
Last updated September 1999.
The following tactics are supplied as part of the CADi
system.
They are intended to serve two purposes:
a) to be directly useful in proof work;
b) to be used as models when users develop their own tactics.
The current version of this library should be regarded as very
provisional, since both the rules of inference and the tactic
language are still in the course of development.
The proof system manipulates sequents.
Each sequent used in a proof becomes a goal of the proof process,
so in this document the words "goal" and "sequent" will be used
interchangably.
Tactics can take several sorts of argument.
In this document we proceed "top-down", considering first
those tactics which operate on goals, then those
which operate on predicates, then those which operate
on expressions, and finally those for schema texts and declarations.
The tactics given below are those which "blow" a predicate,
one or more expressions, a schema text, a series of declarations, etc.
They make frequent recursive calls on themselves and on each other.
Their design aim is to apply all simplifications which
one would always want, except perhaps in very special circumstances,
but to do nothing else.
They are intended never to fail,
but may cause "Nothing changed" to be reported.
"blowPred" takes a single predicate argument, which may
appear anywhere and be of any form.
The main section of the tactic has a matcher which fans out
into some eleven different cases, corresponding to the sort of
predicate supplied. For each of these any applicable immediate
simplifications are sought, usually after a recursive call to
simplify the constituent elements.
Finally, "resolution" and "linear decision" are tried, using the result
of the previous simplifications.
"blowPred" always succeeds.
If it achieves nothing, the report "Nothing changed" is given.
blowPred pred p | rec repeat
match p ::
expr q, r | q = r
"apply tactic" q "blowExpr"; "apply tactic" r "blowExpr";
!("absorption" p
match p ::
| (_exprs) = (_exprs)
"expansion" p; repeat ::
|
_decls
=
_decls
"expansion" p; repeat ::
| p
skip :: .) ::
expr q, r | q
r
match r ::
| (_
_)
!("expansion" r
skip) ::
| (_
_)
!("expansion" r
skip) ::
| id _expr
!("expansion" r
skip) ::
| r
skip :: . ;
"apply tactic" q "blowExpr" ; "apply tactic" r "blowExpr";
!("absorption" p; repeat
"expansion" p; repeat
skip) ::
stxt dec; pred prred
|
dec
prred
|
dec
prred
"apply tactic" dec "blowStxt";
"apply tactic" prred "blowPred";
!("absorption" p; repeat
"one-point" p; repeat
skip) ::
stxt dec; pred prred |
1 dec
prred
"apply tactic" dec "blowStxt";
"apply tactic" prred "blowPred";
!("absorption" p
"one-point" p
"expansion" p); repeat ::
pred q |
q
"apply tactic" q "blowPred"; ("absorption" p
skip) ::
pred q, r
| q
r
| q
r
| q
r
| q
r
"apply tactic" q "blowPred"; "apply tactic" r "blowPred";
!("absorption" p
skip) ::
| p
!("predication" p; repeat
"expansion" p; repeat
skip) :: . ;
-- this last line does xor, true, false, and all schemas
!("resolution" p; match p :: | true
skip :: | false
skip :: .
"linear decision" p
skip)
"blowExpr" is the expression counterpart of "blowPred".
It takes a single expression argument, which may
appear anywhere and be of any form.
The main section of the tactic has a matcher which fans out
into over twenty different cases, corresponding to the sort of
expression supplied. For each of these any applicable immediate
simplifications are sought, usually after a recursive call to
simplify the constituent elements.
"blowExpr" always succeeds. If it achieves nothing, the report
"Nothing changed" is given.
blowExpr expr t | rec repeat
match t ::
|
_expr
"expansion" t ::
expr p | p . 1
| p . 2
"apply tactic" p "blowExpr"; !("absorption" t
skip) ::
exprs es | ( es )
"apply tactic" es "blowExprs" ::
decls ds |
ds
"apply tactic" ds "blowConstDecls" ::
expr e |
e
"apply tactic" e "blowExpr" ::
expr p, q | p
q
"apply tactic" p "blowExpr"; "apply tactic" q "blowExpr" ::
pred p; expr q, r | if p then q else r
"apply tactic" p "blowPred";
("absorption" t; repeat
"apply tactic" q "blowExpr"; "apply tactic" r "blowExpr";
("absorption" t
skip)) ::
stxt s; expr ct | { s
ct }
|
s
ct
"apply tactic" s "blowStxt";
"apply tactic" ct "blowExpr";
!("absorption" t
"one-point" t; repeat
skip) ::
stxt s; expr ct |
s
ct
| let s
ct
"apply tactic" s "blowStxt";
"apply tactic" ct "blowExpr";
!("absorption" t; repeat
"one-point" t; repeat
skip) ::
expr fun, args | fun args
match fun ::
| (_
_)
!("expansion" fun
skip) ::
| first
!("expansion" fun
skip) ::
| second
!("expansion" fun
skip) ::
| fun
skip :: . ;
!("evaluation" t
"apply tactic" fun "blowExpr";
!(("expansion" t;
match t :: pred prred |
_decl | prred
_expr
"expansion" prred; repeat :: .)
"apply tactic" args "blowExpr"));
!("evaluation" t
skip) ::
stxt s | [s]
"apply tactic" s "blowStxt" ::
|
!("expansion" t; repeat
skip) ::
expr r, s | r
s
"apply tactic" r "blowExpr"; "apply tactic" s "blowExpr";
!("expansion" t
skip) ::
exprs es | _name[es]
"apply tactic" es "blowExprs" ::
| t
!("evaluation" t
"absorption" t; repeat
skip) :: .
blowExprs exprs ts | match ts :: expr e; exprs es | e, es
"apply tactic" e "blowExpr";
"apply tactic" es "blowExprs" :: | ts
skip :: .
blowStxt stxt s |
match s
:: decls ds | ds | _pred
"apply tactic" ds s "blowDecls";
match s :: pred barpart2 | _decls | barpart2
"apply tactic" barpart2 "blowPred"
:: .
:: .
blowDecls decls ds; stxt s |
match ds
:: decl d; decls ds2 | d; ds2
match d
:: expr e | _name : e
"apply tactic" e "blowExpr"
; match e
:: | { _stxt
_expr }
"normalization" d
:: | { _exprs }
"normalization" d
:: | e
skip
:: .
:: expr e | _name == e
"apply tactic" e "blowExpr"
:: expr e | e
"apply tactic" e "blowExpr";
!("distribution" d
skip)
:: . ;
match ds
:: decl dd; decls dds2 | dd; dds2
"apply tactic" dds2 s "blowDecls"
:: .
:: |
skip
:: .
blowConstDecls decls ds |
match ds
:: expr e; decls ds2 | _name == e; ds2
"apply tactic" e "blowExpr" ; "apply tactic" ds2 "blowConstDecls"
:: |
skip
:: .
Sets
Proof by induction
Mathematical induction provides a method of
proving properties of all members of finite sets.
The induction principles are formulated as follows.
Relations
L87 ==
[V] ? (id V)~ = id V |
Orders
Functions
Relational operations on functions
IT 22-Jan-2002