files for summary
files for summary
thm:
REFL `x`
gives `|- x = x`
ASSUME `a`
gives `a |- a`
equal:
BETA_CONV `(\x. A) y`
gives `|- (\x. A) y = A[y/x]`
SYM `ASM1 |- a = b`
gives `ASM1 |- b = a`
DEPTH_BINOP_CONV op c
For example, DEPTH_BINOP_CONV `+` c rewrites
x,y,z,w in `(x + ((y + z) + w))` (fails if any
of these rewrites fail)
PATH_CONV path c
For example, PATH_CONV ["b";"l";"r";"r"] c rewrites the
operand of the operand of the operator of the abstraction body
with c.
SYM_CONV rewrites `a = b` to `b = a`
bool:
PINST tyin tmin th instantiates types in th according to tyin and terms
according to tmin.
TRUTH: `|- T`
OR_DEF: `(\/) = \t1 t2. !t. (t1 ==> t) ==> (t2 ==> t) ==> t`
DISJ1 `ASM |- a` `b` gives `ASM |- a \/ b`
DISJ2 `a` `ASM |- b` gives `ASM |- a \/ b`
DISJ_CASES `ASM1 |- a \/ b` `ASM2,a |- c` `ASM3,b |- c` gives
`ASM1,ASM2,ASM3 |- c`
SIMPLE_DISJ_CASES `ASM1,a |- c` `ASM2,b |- c` gives
`ASM1,ASM2,a \/ b |- c` (a and b must be the first
hypotheses)
F_DEF: `F = !t:bool. t`
NOT_DEF: `(~) = \t. t ==> F`
NOT_ELIM `ASM |- ~a` gives `ASM |- a ==> F`
NOT_INTRO `ASM |- a ==> F` gives `ASM |- ~a`
EQF_INTRO `ASM |- ~a` gives `ASM |- a = F`
EQF_ELIM `ASM |- a = F` gives `ASM |- ~a`
NEG_DISCH `a` `ASM,a |- F` gives `ASM |- ~a` (if the conclusion of the
initial theorem is not F, then NEG_DISCH acts like DISCH)
CONTR `a` `ASM |- F` gives `ASM |- a`
drule:
For the rest of the file, I will treat '@' as a metavariable for
an instantiation (written postfix). For instance, I may mention
the terms `a ==> b`, `a@`, and `b@`; this means that
`a@ ==> b@` is an instantiation of `a ==> b`.
tactics:
t1 THEN t2
Apply t1, then apply t2 to all subgoals created.
t THENL [t1;t2;...;tn]
Apply t, then apply t1 to the first subgoal, ..., tn to the last subgoal
(there must be exactly n subgoals).
t1 ORELSE t2
Apply t1; if it fails, apply T2.
FAIL_TAC s
A tactic which always fails (with error message s).
NO_TAC
A tactic which always fails.
ALL_TAC
A tactic which does nothing (the identity tactic).
REPEAT t
Apply t, then apply it again to all subgoals, etc.; until it fails.
CHANGED_TAC t
Apply t; fail if the result is a single subgoal which is equal to the
original goal (warning: does not use alpha-equivalence!)
A theorem tactical takes a theorem tactic and a theorem and does something
to the current goal. Typically, it will preprocess the theorem somehow
before handing the result to the theorem tactic. (In fact, the
tactical may apply the theorem tactic multiple times, sequentially
or in parallel (in different subgoals).)
ALL_THEN = I
(all_then is the theorem tactical which does nothing to the theorem
before handing it to the theorem tactic)
NO_THEN
theorem tactical which always fails
REPEAT_TCL thtc
= (thtc THEN_TCL (REPEAT_TCL thtc)) ORELSE_TCL ALL_THEN
REPEAT_GTCL ???
I don't understand why REPEAT_GTCL is different than REPEAT_TCL.
Fortunately, REPEAT_GTCL is never used, so it can't be very important :-)
LABEL_TAC s th
Adds th as a new assumption, with label s. (Assumes that any hypotheses
of th are also hypotheses of the goal.)
USE_ASSUM s tht
Find the first assumption with label s (call this assumption th).
Applies tactic (tht th).
FIND_ASSUM tht tm
Find the first assumption whose conclusion is equal (not alpha-equivalent!)
to tm (call this assumption th). Applies tactic (tht th).
POP_ASSUM tht
Call the first (most recently added) assumption th. Removes th
from assumption list, and applies tactic (tht th).
ASSUM_LIST thlt
Applies tactic (thlt thl), where thl is the list of assumptions.
POP_ASSUM_LIST thlt
Applies tactic (thlt thl) after removing all assumptions, where thl
is the list of assumptions.
RULE_ASSUM_TAC thth
Replaces every assumption with thth applied to that assumption.
ACCEPT_TAC th
A tactic which solves the current goal, assuming the conclusion of th
is alpha-equivalent to the goal.
CONV_TAC c
Create tactic from a conversion. This allows the conversion to return
|- p rather than |- p = T on a term "p". It also eliminates any goals of
the form "T" automatically.
REFL_TAC
Accepts if the current goal is of the form `a = a`.
ABS_TAC
Converts goal `(\x. a) = (\x. b)` to `a = b`.
MK_COMB_TAC
Converts goal `f a = g b` to `f = g` and `a = b`.
AP_TERM_TAC
Converts goal `f a = f b` to `a = b`.
AP_THM_TAC
Converts goal `f a = g a` to `f = g`.
BINOP_TAC
Converts goal `f a b = f c d` to `a = c` and `b = d`.
SUBST1_TAC `|- a = b`
Converts goal `P[a]` to `P[b]`
SUBST_ALL_TAC `|- a = b`
Rewrites `a` to `b` in goal and all assumptions.
BETA_TAC
Does all possible beta-reductions in goal.
DISCH_TAC
Converts goal `a ==> b` to `b` and adds `a` as a new assumption.
(Treats goal `~a` as `a ==> F`.)
MP_TAC `|- a`
Converts goal `b` to `a ==> b`.
EQ_TAC
Converts goal `(a:bool) = b` to `a ==> b` and `b ==> a`.
UNDISCH_TAC `a`
Finds an assumption with a conclusion alpha-equivalent to `a`.
Removes this assumption, and converts goal `b` to `a ==> b`.
SPEC_TAC (`x`,`a`)
Converts goal `P[a]` to `!x. P[x]`
X_GEN_TAC `x`
Converts goal `!y. P[y]` to `P[x]`
GEN_TAC
Converts goal `!x. P[x]` to `P[x]`
EXISTS_TAC `a`
Converts goal `?x. P[x]` to `P[a]`
CONJ_TAC
Converts goal `a /\ b` to `a` and `b`
DISJ1_TAC
Converts goal `a \/ b` to `a`
DISJ2_TAC
Converts goal `a \/ b` to `b`
DISJ_CASES_TAC `|- a \/ b`
Creates two subgoals. Adds assumption `a` in one subgoal, `b` in the other.
CONTR_TAC `|- F`
Accepts the goal.
MATCH_ACCEPT_TAC `|- a`
First applies (REPEAT GEN_TAC), then accepts if the conclusion is an
instance of `a`
DISCH_THEN tht
Converts goal `a ==> b` to `b`, then applies tactic (tht `|- a`).
(Treats `~a` as `a ==> F`)
STRIP_ASSUME_TAC th
Starts with (REPEAT_TCL STRIP_THM_THEN) applied to th.
Call the resulting theorem(s) gth. If gth is `F`, or equal to the
goal, then solve the goal; if gth is already an assumption, do nothing;
otherwise, add gth as an assumption.
STRUCT_CASES_TAC th
Starts with (REPEAT_TCL STRIP_THM_THEN) applied to th.
Call the resulting theorem(s) gth. If gth is an equality, then use
it to rewrite the goal; otherwise, add gth as an assumption.
STRIP_GOAL_THEN tht
= FIRST [GEN_TAC; CONJ_TAC; DISCH_THEN tht]
(If the current goal is a forall, then generalize; if it is a conjunction,
prove the two cases separately; if it is an implication `a ==> b` then
convert to `b` and apply (tht `a`).)
ABBREV_TAC `x = a`
Rewrites `a` to `x` in the goal and all assumptions, then adds `a = x`
as a new assumption.
EXPAND_TAC `x`
Finds the first assumption of the form `a = x`, rewrites `x` to `a` in
the goal, and beta-reduces the goal.
FIRST_X_ASSUM tht
Like FIRST_ASSUM, but removes the assumption successfully used by the
tactic.
X_META_EXISTS_TAC `x`
Converts goal `?y. P[y]` to `P[x]`, where `x` is a metavariable.
META_EXISTS_TAC
Converts goal `?x. P[x]` to `P[x]`, where `x` is a metavariable.
CHEAT_TAC
Introduce the goal as a new axiom, then solve the goal.
RECALL_ACCEPT_TAC f x = ACCEPT_TAC (f x)
As a side-effect, prints out the time taken to compute (f x); delays
this computation until it is required.
ANTS_TAC
Converts goal `(p ==> q) ==> r` to `p` and `q ==> r`
itab:
ITAUT_TAC
Intuitionistic theorem prover: understands
and,forall,implies,not,iff (boolean equality),or,exists,T,F;
applies a long list of rules dealing with the above types of terms
until it runs out of rules to apply or proves the theorem.
Either succeeds or leaves the goal state unchanged.
simp:
REWR_CONV `|- a = b`
A conversion which rewrites `a@` to `b@`
term_order
An ordering function which is AC-compatible for any binary operator.
net_of_cong th net
Adds a component to net for a congruence rule. (This is a rule of the
form `P1 ==> (P2 ==> (...(Pn ==> (a = b))))` ). Entered at level 4.
mk_rewrites cf th rew_list
Prepends rewrites for th to new_list
I will describe the action in terms of a notional
add_rew function.
(add_rew l `|- !x. P[x]`) --> (add_rew l `|- P[x]`)
(add_rew l `|- P1 /\ P2`) --> (add_rew l `|- P1`), (add_rew l `|- P2`)
if cf, then (add_rew l `|- P1 ==> P2`) --> (add_rew (`P1`::l) `|- P2`)
(add_rew l `|- a = b`) adds a conditional rewrite with conditions l
(if l is empty, this is an unconditional rewrite;
if cf is false, then l is always empty)
(add_rew l `|- ~(a = b)`) --> (add_rew l `|- (a = b) = F`), (add_rew l `|- (b = a)
= F`)
(add_rew l `|- ~a`) --> (add_rew l `|- a = F`)
If none of the above hold, (add_rew l `|- a`) --> (add_rew l `|- a = T`)
ss_of_prover newprover ss
Replaces the prover in the simpset with newprover.
ss_of_provers newprovers ss
Prepends newprovers to the list of subprovers in the simpset.
ss_of_maker newmaker ss
Replaces the rewrite maker in the simpset with newmaker.
*)
AUGMENT_SIMPSET th ss
Uses the rewrite maker from the simpset (always (mk_rewrites true))
to create a list of rewrite theorems from th; use (net_of_thm true)
to add these theorems to the conversion net in the simpset.
Note that there are only two congruence rules used in HOL Light: one for
rewriting `if g then t else e` and one for rewriting `p ==> q`.
ONCE_DEPTH_SQCONV ss lev
= (IMP_REWRITES_CONV ONCE_DEPTH_SQCONV ss lev) ORELSEC
(GEN_SUB_CONV ONCE_DEPTH_SQCONF ss lev)
DEPTH_SQCONV ss lev
= THENQC (GEN_SUB_CONV DEPTH_SQCONV ss lev)
(IMP_REWRITES_CONV DEPTH_SQCONV ss lev)
REDEPTH_SQCONV ss lev
= REPEATQC (DEPTH_CONV ss lev)
TOP_DEPTH_SQCONV ss lev
= REPEATQC ((IMP_REWRITES_CONV TOP_DEPTH_SQCONV ss lev) ORELSEC
(GEN_SUB_CONV TOP_DEPTH_SQCONV ss lev))
TOP_SWEEP_SQCONV ss lev
= THENQC (REPEATC (IMP_REWRITES_CONV TOP_SWEEP_SQCONV ss lev))
(GEN_SUB_CONV TOP_SWEEP_SQCONV ss lev)
Basic rewrites:
There is a global set of "basic rewrites". These are canonicalized with
(mk_rewrites false) (so there is no handling of conditional rewrites),
and added to a basic conversion net.
There is also a set of basic congruences; since HOL has only two congruence
rules, I won't bother documenting set_basic_congs, extend_basic_congs,
basic_congs.
PURE_REWRITE_CONV thl
= GENERAL_REWRITE_CONV true TOP_DEPTH_CONV empty_net thl
REWRITE_CONV thl
= GENERAL_REWRITE_CONV true TOP_DEPTH_CONV (basic_net()) thl
PURE_ONCE_REWRITE_CONV thl
= GENERAL_REWRITE_CONV false ONCE_DEPTH_CONV empty_net thl
ONCE_REWRITE_CONV thl
= GENERAL_REWRITE_CONV false ONCE_DEPTH_CONV (basic_net()) thl
LIMITED_REWRITE_CONV n thl
Rewrite n times with
(GEN_REWRITE_CONV ONCE_DEPTH_CONV ths THENC
GENERAL_REWRITE_CONV true TOP_DEPTH_CONV (basic_net()) [])
PURE_REWRITE_RULE thl
= CONV_RULE(PURE_REWRITE_CONV thl)
REWRITE_RULE thl
= CONV_RULE(REWRITE_CONV thl)
PURE_ONCE_REWRITE_RULE thl
= CONV_RULE(PURE_ONCE_REWRITE_CONV thl)
ONCE_REWRITE_RULE thl
= CONV_RULE(ONCE_REWRITE_CONV thl)
PURE_ASM_REWRITE_RULE, ASM_REWRITE_RULE,
PURE_ONCE_ASM_REWRITE_RULE, ONCE_ASM_REWRITE_RULE
As non-"ASM_", but adds theorem hypotheses to the rewrite list.
PURE_ASM_REWRITE_TAC, ASM_REWRITE_TAC,
PURE_ONCE_ASM_REWRITE_TAC, ONCE_ASM_REWRITE_TAC
As non-"ASM_", but adds current assumptions to the rewrite list.
ONCE_SIMPLIFY_CONV ss
= GEN_SIMPLIFY_CONV ONCE_DEPTH_SQCONV ss 1
SIMPLIFY_CONV ss
= GEN_SIMPLIFY_CONV TOP_DEPTH_SQCONV ss 3
basic_ss thl
Canonicalizes thl with (mk_rewrites true), then adds the rewrites
to (basic_net()) with (net_of_thm true). Also adds the basic congruences.
Returns the resulting simpset.
SIMP_CONV
= SIMPLIFY_CONV (basic_ss [])
PURE_SIMP_CONV
= SIMPLIFY_CONV empty_ss
ONCE_SIMP_CONV
= ONCE_SIMPLIFY_CONV (basic_ss []) thl
theorems:
AC thl `a = b`
Returns `|- a = b` or fails; succeeds if ordered rewriting using thl
can rewrite `a = b` to `T` or `c = c`
ind-defs:
RIGHT_BETAS [`x`;`y`] `|- f = \x y. A[x,y]` gives
`|- f x y = A[x,y]`
SIMPLE_DISJ_PAIR `P \/ Q |- R` gives
(`P |- R`, `Q |- R`)
FORALL_IMPS_CONV
Rewrites `!x y. P[x,y] ==> Q` to `(?x y. P[x,y]) ==> Q`
AND_IMPS_CONV
Rewrites:
(* (!x1..xn. P1[xs] ==> Q[xs]) /\ ... /\ (!x1..xn. Pm[xs] ==> Q[xs]) *)
(* -> (!x1..xn. P1[xs] \/ ... \/ Pm[xs] ==> Q[xs]) *)
BACKCHAIN_TAC:
"Simplified version of MATCH_MP_TAC to avoid quantifier troubles."
MONO_ABS_TAC:
(* ?- (\x. P[x]) x1 .. xn ==> (\y. Q[y]) x1 .. xn *)
(* ================================================== *)
(* ?- !x1. P[x1] x2 .. xn ==> Q[x1] x2 .. xn *)
mono_tactics:
A global variable holding a set of tactics for proving monotonicity.
APPLY_MONOTAC
Prove `a ==> a` automatically; otherwise, select a tactic from
mono_tactics and apply it.
MONO_STEP_TAC
= REPEAT GEN_TAC THEN APPLY_MONOTAC
MONO_TAC
= REPEAT MONO_STEP_TAC THEN ASM_REWRITE_TAC[]
class:
This is an axiom:
val ( ETA_AX ) : thm = |- !t. (\x. t x) = t
ETA_CONV
Rewrites `(\x. f x)` to `f`
This is an axiom:
val ( SELECT_AX ) : thm = |- !P x. P x ==> P ((@) P)
simple_new_specification th
Like new_specification, but gets the new constant names from the
bound variable names in the theorem.
BOOL_CASES_TAC `a`
Creates two subgoals. In the first, rewrite `a` to `T` within the goal;
in the second, rewrite `a` to `F`.
ASM_CASES_TAC `a`
Creates two subgoals. In the first, add `a` as an assumption; in the second,
add `~a` as an assumption.
TAUT tm
Tries to prove the term. Starts with (REPEAT GEN_TAC), then rewrites with
the basic rewrites and does case splits on free boolean variables
using BOOL_CASES_TAC.
This defines a new type "one", with one element; and functions that
map between bool and one (where the single element of "one" maps to `T`).
val one_tydef : thm =
|- (!a. one_ABS (one_REP a) = a) /\ (!r. r = one_REP (one_ABS r) = r)
This is the definition of "one", the name of the sole value of type "one".
val one_DEF : thm = |- one = (@x. T)
canon:
REFUTE_THEN tht changes the goal from `p` to `F` and runs tht on the
assumption `|- ~p`.
SPLIT_TAC lev
Starts by replacing any assumption `|- a /\ b` with separate assumptions
`|- a` and `|- b`. Then, up to lev levels deep, it removes an assumption
`|- a \/ b`, splits into two subgoals, adds assumption `|- a` in one
subgoal, and adds assumption `|- b` in the other.
ASM_FOL_TAC
Uses the technique of FOL_CONV, but applies throughout the entire goalstate
(goal and assumptions).
meson:
ASM_MESON_TAC thl
Tries to prove the goal using meson; uses the assumptions and the theorems
in thl.
MESON_TAC thl
Tries to prove the goal using meson; ignores assumptions.
quot:
lift_function:
(* Given a welldefinedness theorem for a curried function f, of the form: *)
(* *)
(* |- !x1 x1' .. xn xn'. (x1 == x1') /\ ... /\ (xn == xn') *)
(* ==> (f x1 .. xn == f x1' .. f nx') *)
(* *)
(* where each "==" is either equality or some fixed binary relation R, a *)
(* new operator called "opname" is introduced which lifts "f" up to the *)
(* R-equivalence classes. Two theorems are returned: the actual definition *)
(* and a useful consequence for lifting theorems. *)
(* *)
(* The function also needs the second (more complicated) type bijection, and *)
(* the reflexivity and transitivity (not symmetry!) of the equivalence *)
(* relation. The use also gives a name for the new function. *)
lift_theorem:
(* Lifts a theorem. This can be done by higher order rewriting alone. *)
(* *)
(* NB! All and only the first order variables must be bound by quantifiers. *)
recursion.ml:
pair.ml:
LET, LET_END, GABS, and GEQ are syntactic markers used by the
parser and printer, so that you can read in a let expression, or
an extended lambda expression, and print it back out.
GEN_PAIR_TAC converts a goal of the form `!x. P[x]` (where `x` has a
pair type) to `P[(FST x, SND x)]`; but a comment says that rewriting with
FORALL_PAIR_THM (below) is better.
LET_TAC
replaces "let x = t in p[x]" in goal with "p[x]" given a new
hypothesis "t = x".
num.ml:
We define a new type, "ind"; we are going to axiomatize that "ind" has
an infinite number of elements.
Now define the natural number representations as a subset of ind, using the
inductive definition
`NUM_REP IND_0 /\
(!i. NUM_REP i ==> NUM_REP (IND_SUC i))`
This returns the following theorems:
val ( NUM_REP_RULES ) : thm =
|- NUM_REP IND_0 /\ (!i. NUM_REP i ==> NUM_REP (IND_SUC i))
val ( NUM_REP_INDUCT ) : thm =
|- !NUM_REP'. NUM_REP' IND_0 /\ (!i. NUM_REP' i ==> NUM_REP' (IND_SUC i))
==> (!a. NUM_REP a ==> NUM_REP' a)
val ( NUM_REP_CASES ) : thm =
|- !a. NUM_REP a = (a = IND_0) \/ (?i. (a = IND_SUC i) /\ NUM_REP i)
Now we define the type "num", which has a bijection with the NUM_REP
subset of ind. This gives the following theorems:
val num_tydef : thm * thm =
(|- mk_num (dest_num a) = a, |- NUM_REP r = dest_num (mk_num r) = r)
Now we can use the decimal number 0, rather than the symbol _0; we prove
new versions of the above four theorems, replacing _0 with 0. (We give
them the same names as the old theorems, which are now inaccessible.)
INDUCT_TAC takes a goal `!x. P[x]` and creates subgoals `P[0]` and
`P[SUC n]` (the latter with an assumption `P[n]`).
arith.ml:
PRE_ELIM_TAC takes a goal `P[PRE n]` and creates two subgoals. In the
first, the goal is changed to `P[0]`, `n` is rewritten to `0` throughout
the goal state, and an assumption `n=0` is added. In the second, the
goal is changed to `P[m]`, `n` is rewritten to `SUC m` throughout
the goal state, and an assumption `n = SUC m` is added.
LE_IMP `|- a <= b` gives (GEN_ALL `|- b <= p ==> a <= p`)
wf.ml:
WF_INDUCT_THEN
WF_INDUCT_TAC
Perform wellfounded induction over a nominated measure function. Sometimes
avoids explicit "!n t. size(t) = n ==> ..." goal.
calc_num.ml:
NUM_EVEN_CONV, NUM_ODD_CONV
rewrite terms of the form `EVEN k` and `ODD k` respectively, where k
is a numeral.
NUM_RED_CONV reduces `SUC j`, `PRE j`, `FACT j`, `j < k`, `j <= k`,
`j > k`, `j >= k`, `j = k`, `EVEN j`, `ODD j`, `j + k`, `j - k`,
`j * k`, `j EXP k`, `j DIV k`, or `j MOD k` (where j and k are numerals).
num_CONV rewrites `j` to `SUC (J-1)`, where J-1 is the numeral for j - 1.
ind-types.ml:
This is the definition of a new type, "(A)recspace"; and its in and out
functions, "_mk_rec" and "_dest_rec".
val recspace_tydef : thm * thm =
(|- _mk_rec (_dest_rec a) = a, |- ZRECSPACE r = _dest_rec (_mk_rec r) = r)
list.ml:
LIST_INDUCT_TAC takes a goal of the form `!l. P[l]` and creates two
subgoals: `P[ [] ]` and `P[CONS h t]`. The latter subgoal has a new
assumption `P[t]`.
realax.ml:
The operators +,-,*,<,<=,>,>= are overloaded; there are versions for
num, real, int. If an expression does not make it clear which type is
used, they default to the current "prioritized" type.