SUBST : (term, thm) subst -> term -> thm -> thm
A1 |- t1 = u1 , ... , An |- tn = un , A |- t[t1,...,tn]
-------------------------------------------------------------
A u A1 u ... u An |- t[ui]
Evaluating
SUBST [x1 |-> (A1 |- t1=u1) ,..., xn |-> (An |- tn=un)]
t[x1,...,xn]
(A |- t[t1,...,tn])
returns the theorem A1 u ... An |- t[u1,...,un]. The term
argument t[x1,...,xn] is a template which should match the conclusion
of the theorem being substituted into, with the variables x1, ... ,
xn marking those places where occurrences of t1, ... , tn are to
be replaced by the terms u1, ... , un, respectively. The occurrence
of ti at the places marked by xi must be free (i.e. ti must not
contain any bound variables). SUBST automatically renames bound
variables to prevent free variables in ui becoming bound after
substitution.
SUBST is a complex primitive because it performs both parallel simultaneous substitution and renaming of variables. This is for efficiency reasons, but it would be logically cleaner if SUBST were simpler.
- val x = --`x:num`--
and y = --`y:num`--
and th0 = SPEC (--`0`--) arithmeticTheory.ADD1
and th1 = SPEC (--`1`--) arithmeticTheory.ADD1;
(* x = (--`x`--)
y = (--`y`--)
th0 = |- SUC 0 = 0 + 1
th1 = |- SUC 1 = 1 + 1 *)
- SUBST [x |-> th0, y |-> th1] (--`(x+y) > SUC 0`--)
(ASSUME (--`(SUC 0 + SUC 1) > SUC 0`--));
val it = [.] |- (0 + 1) + 1 + 1 > SUC 0 : thm
- SUBST [x |-> th0, y |-> th1] (--`(SUC 0 + y) > SUC 0`--)
(ASSUME (--`(SUC 0 + SUC 1) > SUC 0`--));
val it = [.] |- SUC 0 + 1 + 1 > SUC 0 : thm
- SUBST [x |-> th0, y |-> th1] (--`(x+y) > x`--)
(ASSUME (--`(SUC 0 + SUC 1) > SUC 0`--));
val it = [.] |- (0 + 1) + 1 + 1 > 0 + 1 : thm