Bool Module

This module extends the boolean-related theory by giving definitions for classic predicate logic theory objects not introduced in 'CoreThry', and adds various derived syntax functions, theorems and inference rules. Note that derivations relying on the Axiom of Choice are separated out into the 'BoolClass' module.

Functions and values

Function or value Description

add_asm_rule tm th

Full Usage: add_asm_rule tm th

Parameters:
Returns: thm

This is the assumption insertion rule. It takes a boolean term and a theorem, and returns the same theorem but with the supplied term added to its assumptions. The returned theorem is the inputted theorem if the term is already in the assumptions. `q` A |- p ------------ A u {q} |- p

tm : term
th : thm
Returns: thm

beta_patt_conv vsp tmp tm

Full Usage: beta_patt_conv vsp tmp tm

Parameters:
Returns: thm
vsp : term list
tmp : term
tm : term
Returns: thm

beta_patt_rule vsp tmp th

Full Usage: beta_patt_rule vsp tmp th

Parameters:
Returns: thm
vsp : term list
tmp : term
th : thm
Returns: thm

bspec_rule tm th

Full Usage: bspec_rule tm th

Parameters:
Returns: thm

This is the beta-reducing universal elimination rule. It strips off the outermost universal quantifier from the supplied theorem, and replaces in the body each occurrence of the stripped binding variable with the supplied term. If the supplied term is a lambda abstraction, it also performs beta-reduction on each substituted occurrence that is applied to an argument. The type of the supplied term must equal the type of the stripped binding variable. `\y. t` A |- !x. p -------------------------------- A |- p[ \y.t / x; t[s/y] / x s ]

tm : term
th : thm
Returns: thm

choose_rule (v, th0) th

Full Usage: choose_rule (v, th0) th

Parameters:
Returns: thm

This is the existential elimination rule. It removes, from the assumptions of a supplied main theorem, the body of a supplied existential theorem (but with all occurrences of the binding variable replaced with a supplied variable), and adds the assumptions of the existential theorem. The supplied variable is not allowed to be free in existential theorem's conclusion or in the original main theorem's other assumptions or its conclusion. Note that the altered body of the existential theorem does not have to be present in the assumptions of the main theorem for the rule to succeed. `y` A1 |- ?x. p A2 |- q [ "y" not free in: ---------------------------- `?x. p`, `q` or `A2\{p[y/x]}` ] A1 u A2\{p[y/x]} |- q See also: exists_rule, mk_exists_rule.

v : term
th0 : thm
th : thm
Returns: thm

cond_def

Full Usage: cond_def

Returns: thm

Conditional The internal constant for conditional expressions is called "COND". It *) has special support in the parser/printer, so that *) `if c then t1 else t2` *) is parsed/printed for the internal term *) `COND c t1 t2`. *) |- COND = (\p (t1:'a) t2. @x. ((p <=> true) ==> x = t1) /\ ((p <=> false) ==> x = t2))

Returns: thm

conj_lemma

Full Usage: conj_lemma

Returns: thm
Returns: thm

conj_lemma0

Full Usage: conj_lemma0

Returns: thm
Returns: thm

conj_rule th01 th02

Full Usage: conj_rule th01 th02

Parameters:
Returns: thm

This is the conjunction introduction rule. It conjoins the two supplied theorems and unions their assumptions. A1 |- p A2 |- q ------------------ A1 u A2 |- p /\ q

th01 : thm
th02 : thm
Returns: thm

conjunct1_lemma

Full Usage: conjunct1_lemma

Returns: thm
Returns: thm

conjunct1_rule th

Full Usage: conjunct1_rule th

Parameters:
Returns: thm

This is the conjunction elimination rule for the LHS. It removes the RHS conjunct from the supplied conjunction theorem. A |- p /\ q ----------- A |- p See also: conjunct2_rule, conjunct_rule, mk_conj_rule.

th : thm
Returns: thm

conjunct2_lemma

Full Usage: conjunct2_lemma

Returns: thm
Returns: thm

conjunct2_rule th

Full Usage: conjunct2_rule th

Parameters:
Returns: thm

This is the conjunction elimination rule for the RHS. It removes the LHS conjunct from the supplied conjunction theorem. A |- p /\ q ----------- A |- q See also: conjunct1_rule, conjunct_rule, mk_conj_rule.

th : thm
Returns: thm

contr_rule tm th

Full Usage: contr_rule tm th

Parameters:
Returns: thm

This is the intuitionistic contradiction rule. It takes a boolean term and a theorem with falsity as its conclusion. It returns a theorem with the supplied term as its conclusion, under the same assumptions as the supplied theorem. `p` A |- false ---------------- A |- p See also: ccontr_rule, deduct_contrapos_rule.

tm : term
th : thm
Returns: thm

deduct_antisym_rule th01 th02

Full Usage: deduct_antisym_rule th01 th02

Parameters:
Returns: thm

This is the antisymmetry rule for deduction. It takes two theorem arguments. It returns a theorem stating that the supplied conclusions are equivalent, under the unioned assumptions but with each theorem's conclusion removed from the other's assumptions. A1 |- p A2 |- q -------------------------- A1\{q} u A2\{p} |- p <=> q See also: imp_antisym_rule, undisch_rule.

th01 : thm
th02 : thm
Returns: thm

deduct_contrapos_rule tm1 th

Full Usage: deduct_contrapos_rule tm1 th

Parameters:
Returns: thm

This is the contraposition rule for deduction. It swaps and logically negates the supplied assumption term and the conclusion of the supplied theorem. Note that the supplied term does not have to be present in the assumptions of the supplied theorem for the rule to succeed. If the logical negation of the supplied theorem's conclusion is the supplied term, then it will not occur in the resulting theorem's assumptions. `q` A |- p --------------------- (A u {~p})\{q} |- ~ q See also: not_intro_rule, disch_rule, contr_rule, ccontr_rule.

tm1 : term
th : thm
Returns: thm

dest_cond tm

Full Usage: dest_cond tm

Parameters:
Returns: term * term * term
tm : term
Returns: term * term * term

dest_disj tm

Full Usage: dest_disj tm

Parameters:
Returns: term * term
tm : term
Returns: term * term

dest_not tm

Full Usage: dest_not tm

Parameters:
Returns: term

Breaks apart a negation, returning its body. dest_not is a term destructor for negations: "~t" |> parse_term |> dest_not returns "t". Fails if term is not a negation.

tm : term
Returns: term

dest_uexists tm

Full Usage: dest_uexists tm

Parameters:
Returns: term * term
tm : term
Returns: term * term

disj1_lemma

Full Usage: disj1_lemma

Returns: thm
Returns: thm

disj1_rule th tm

Full Usage: disj1_rule th tm

Parameters:
Returns: thm

This is the disjunction introduction rule for the LHS. It disjoins the supplied boolean term to the RHS of the supplied theorem. A |- p `q` ------------ A |- p \/ q See also: disj2_rule, disj_cases_rule, mk_disj1_rule.

th : thm
tm : term
Returns: thm

disj2_lemma

Full Usage: disj2_lemma

Returns: thm
Returns: thm

disj2_rule tm th

Full Usage: disj2_rule tm th

Parameters:
Returns: thm

This is the disjunction introduction rule for the RHS. It disjoins the supplied boolean term to LHS of the supplied theorem. `p` A |- q ------------ A |- p \/ q Si veda anche: disj1_rule, disj_cases_rule, mk_disj2_rule.

tm : term
th : thm
Returns: thm

disj_cases_lemma

Full Usage: disj_cases_lemma

Returns: thm
Returns: thm

disj_cases_rule th0 th01 th02

Full Usage: disj_cases_rule th0 th01 th02

Parameters:
Returns: thm

This is the disjunction elimination rule. It takes a disjunction theorem and two extra theorems that share the same conclusion. It returns a theorem with the same conclusion as the extra theorems. The assumptions of the returned theorem union the assumptions of the extra theorems, but with the disjunction theorem's LHS removed from the first's assumptions and its RHS removed from the second's, unioned together with the disjunction theorem's assumptions. A |- p \/ q A1 |- r A2 |- r --------------------------------- A u A1\{p} u A2\{q} |- r See also: disj1_rule, disj2_rule, mk_disj_rule.

th0 : thm
th01 : thm
th02 : thm
Returns: thm

disj_def

Full Usage: disj_def

Returns: thm

Disjunction |- $\/ = (\p1 p2. !p. (p1 ==> p) ==> (p2 ==> p) ==> p)

Returns: thm

disj_lemma0

Full Usage: disj_lemma0

Returns: thm
Returns: thm

eq_imp_rule1 th

Full Usage: eq_imp_rule1 th

Parameters:
Returns: thm

This is the first equivalence elimination rule. It takes a theorem stating the equivalence of two boolean terms, and returns a theorem stating that the LHS implies the RHS, under the same assumptions. A |- p <=> q ------------ A |- p ==> q See also: eq_imp_rule2, imp_antisym_rule, eq_mp_rule, undisch_rule, mk_imp_rule.

th : thm
Returns: thm

eq_imp_rule2 th

Full Usage: eq_imp_rule2 th

Parameters:
Returns: thm

This is the second equivalence elimination rule. It takes a theorem stating the equivalence of two boolean terms, and returns a theorem stating that the RHS implies the LHS, under the same assumptions. A |- p <=> q ------------ A |- q ==> p See also: eq_imp_rule1, imp_antisym_rule, eq_mp_rule, undisch_rule, mk_imp_rule.

th : thm
Returns: thm

eqf_elim_rule th

Full Usage: eqf_elim_rule th

Parameters:
Returns: thm

This is the falsity equivalence elimination rule. It takes an equality theorem with falsity on the RHS, and returns the logical negation of the LHS, under the same assumptions. A |- p <=> false ---------------- A |- ~ p See also: eqf_intro_rule, not_intro_rule, not_elim_rule, mk_not_rule, eqt_elim_rule, deduct_contrapos_rule.

th : thm
Returns: thm

eqf_intro_rule th

Full Usage: eqf_intro_rule th

Parameters:
Returns: thm

This is the falsity equivalence introduction rule. It takes a theorem with logical negation at its top level, and returns a theorem stating that the body of the negation is equivalent to falsity, under the same assumptions. A |- ~ p ---------------- A |- p <=> false See also: eqf_elim_rule, not_elim_rule, not_intro_rule, mk_not_rule, eqt_intro_rule.

th : thm
Returns: thm

eqt_elim_rule th

Full Usage: eqt_elim_rule th

Parameters:
Returns: thm

This is the truth equivalence elimination rule. It takes an equality theorem that has truth on the RHS, and returns a theorem stating that the LHS holds, under the same assumptions. A |- p <=> true --------------- A |- p See also: eqt_intro_rule, eqf_elim_rule.

th : thm
Returns: thm

eqt_intro_rule th

Full Usage: eqt_intro_rule th

Parameters:
Returns: thm

This is the truth equivalence introduction rule. It takes any theorem, and returns the theorem stating that the conclusion is equivalent to truth, under the same assumptions. A |- p --------------- A |- p <=> true See also: eqt_elim_rule, eqf_intro_rule.

th : thm
Returns: thm

eta_conv tm

Full Usage: eta_conv tm

Parameters:
Returns: thm

eta_conv : term -> thm This is the eta reduction rule. It takes a lambda abstraction term, where the body is a function application, and the binding variable is the argument subterm of the function application and not free in the function subterm. It returns a theorem stating that the term is equal to the function subterm, under no assumptions. `\x. f x` ---------------- |- (\x. f x) = f See also: beta_conv.

tm : term
Returns: thm

false_def

Full Usage: false_def

Returns: thm

Falsity |- false <=> (!p. p)

Returns: thm

false_tm

Full Usage: false_tm

Returns: term
Returns: term

flatstrip_disj tm

Full Usage: flatstrip_disj tm

Parameters:
Returns: term list
tm : term
Returns: term list

fun_eq_thm

Full Usage: fun_eq_thm

Returns: thm

|- !f g. f = g <=> (!x. f x = g x)

Returns: thm

gen_rule v th

Full Usage: gen_rule v th

Parameters:
Returns: thm

gen_rule : term -> thm -> thm This is the universal introduction rule. It universally quantifies the supplied theorem with the supplied binding variable, under the same assumptions. The binding variable must not occur free in the assumptions. `x` A |- p [ "x" not free in `A` ] ------------ A |- !x. p See also: list_gen_rule, spec_rule, mk_forall_rule.

v : term
th : thm
Returns: thm

imp_antisym_rule th01 th02

Full Usage: imp_antisym_rule th01 th02

Parameters:
Returns: thm

This is the antisymmetry rule for implication. It takes two implication theorem arguments, where the LHS of each is the same (modulo alpha- equivalence) as the RHS of the other. It returns a theorem stating the logical equivalence of the two sides, under the unioned assumptions. A1 |- p ==> q A2 |- q ==> p ------------------------------ A1 u A2 |- p <=> q See also: eq_imp_rule1, eq_imp_rule2, deduct_antisym_rule, disch_rule, eqt_intro_rule.

th01 : thm
th02 : thm
Returns: thm

imp_trans_rule tha thb

Full Usage: imp_trans_rule tha thb

Parameters:
Returns: thm

imp_trans_rule : thm -> thm -> thm This is the transitivity rule for implication. It takes two implication theorem arguments, where the first theorem's RHS is the same (modulo alpha-equivalence) as the second theorem's LHS. It returns a theorem stating that the first theorem's LHS implies the second theorem's RHS, under the unioned assumptions of the two theorems. A1 |- p ==> q A2 |- q ==> r ------------------------------ A1 u A2 |- p ==> r See also: list_imp_trans_rule, eq_trans_rule, disch_rule, imp_anitsym_asm_rule.

tha : thm
thb : thm
Returns: thm

is_bool_eqthm th

Full Usage: is_bool_eqthm th

Parameters:
Returns: bool

checks for a bool equality theorem is_bool_eqthm not_true_thm returns true; is_bool_eqthm truth_thm returns false

th : thm
Returns: bool

is_cond tm

Full Usage: is_cond tm

Parameters:
Returns: bool
tm : term
Returns: bool

is_disj tm

Full Usage: is_disj tm

Parameters:
Returns: bool

Tests a term to see if it is a disjunction. is_disj ("t1 \/ t2" |> parse_term) returns true. If the term is not a disjunction the result is false. Never fails.

tm : term
Returns: bool

is_not tm

Full Usage: is_not tm

Parameters:
Returns: bool

Tests a term to see if it is a logical negation. "~t" |> parse_term |> is_not returns true. If the term is not a logical negation the result is false. Never fails.

tm : term
Returns: bool

is_uexists tm

Full Usage: is_uexists tm

Parameters:
Returns: bool
tm : term
Returns: bool

list_bspec_rule tms th

Full Usage: list_bspec_rule tms th

Parameters:
Returns: thm
tms : term list
th : thm
Returns: thm

list_gen_rule tms th

Full Usage: list_gen_rule tms th

Parameters:
Returns: thm
tms : term list
th : thm
Returns: thm

list_imp_trans_rule ths

Full Usage: list_imp_trans_rule ths

Parameters:
    ths : thm list

Returns: thm
ths : thm list
Returns: thm

list_mk_disj tms

Full Usage: list_mk_disj tms

Parameters:
Returns: term
tms : term list
Returns: term

list_spec_rule tms th

Full Usage: list_spec_rule tms th

Parameters:
Returns: thm

This is the compound universal elimination rule. It strips off an outermost universal quantifier from the supplied theorem for each item in the supplied term list, replacing each occurrence of a stripped binding variable in the body with its corresponding item in the term list. The type of each term in the term list must equal the type of its corresponding binding variable. [`t1`;`t2`;..] A |- !x1 x2 .. . p ----------------------------------- A |- p[t1/x1;t2/x2;..] See also: spec_rule, spec_all_rule, bspec_rule, list_gen_rule.

tms : term list
th : thm
Returns: thm

load

Full Usage: load

Returns: (string * thm) list

Force module evaluation

Returns: (string * thm) list

mk_cond (tm1, tm2, tm3)

Full Usage: mk_cond (tm1, tm2, tm3)

Parameters:
Returns: term
tm1 : term
tm2 : term
tm3 : term
Returns: term

mk_disj (tm1, tm2)

Full Usage: mk_disj (tm1, tm2)

Parameters:
Returns: term
tm1 : term
tm2 : term
Returns: term

mk_not tm0

Full Usage: mk_not tm0

Parameters:
Returns: term
tm0 : term
Returns: term

mk_uexists (v, tm0)

Full Usage: mk_uexists (v, tm0)

Parameters:
Returns: term
v : term
tm0 : term
Returns: term

not_def

Full Usage: not_def

Returns: thm

|- $~ = (\p. p ==> false)

Returns: thm

not_elim_rule th

Full Usage: not_elim_rule th

Parameters:
Returns: thm

This is the logical negation elimination rule. It takes a logical negation theorem, and returns an implication with the negated term on the LHS and falsity on the RHS, under the same assumptions. A |- ~ p ---------------- A |- p ==> false See also: not_intro_rule, eqf_intro_rule, eqf_elim_rule.

th : thm
Returns: thm

not_intro_rule th

Full Usage: not_intro_rule th

Parameters:
Returns: thm

This is the logical negation introduction rule. It takes an implication theorem where the RHS is falsity, and returns the logical negation of the LHS, under the same assumptions. A |- p ==> false ---------------- A |- ~ p See also: not_elim_rule, eqf_elim_rule, eqf_intro_rule, deduct_contrapos_rule.

th : thm
Returns: thm

p

Full Usage: p

Returns: term
Returns: term

p1_

Full Usage: p1_

Returns: term
Returns: term

p2_

Full Usage: p2_

Returns: term
Returns: term

p_

Full Usage: p_

Returns: term
Returns: term

prove_asm_rule th01 th02

Full Usage: prove_asm_rule th01 th02

Parameters:
Returns: thm

This is the assumption proving rule. It takes two theorems, and returns the second theorem but with the conclusion of the first theorem removed from the assumptions (if present) and the assumptions from the first theorem added. Note that the first theorem's conclusion does not have to be in the second's assumptions for the rule to succeed. A1 |- p A2 |- q ------------------ A1 u (A2\{p}) |- q See also: mp_rule, undisch_rule.

th01 : thm
th02 : thm
Returns: thm

q

Full Usage: q

Returns: term
Returns: term

r

Full Usage: r

Returns: term
Returns: term

spec_all_rule th

Full Usage: spec_all_rule th

Parameters:
Returns: thm

This is the compound default universal elimination rule. It strips off all the outer universal quantifiers from the supplied theorem. Note that the supplied theorem does not have to be a universal quantification for the rule to succeed (in which case the resulting theorem is the same as the supplied theorem). A |- !x1 x2 .. xn. p -------------------- A |- p See also: spec_rule, list_spec_rule, bspec_rule, list_gen_rule.

th : thm
Returns: thm

spec_rule tm th

Full Usage: spec_rule tm th

Parameters:
Returns: thm

This is the universal elimination rule. It strips off the outermost universal quantifier from the supplied theorem, and replaces in the body each occurrence of the stripped binding variable with the supplied term. The type of the supplied term must equal the type of the stripped binding variable. `t` A |- !x. p ---------------- A |- p[t/x]

tm : term
th : thm
Returns: thm

strip_disj tm

Full Usage: strip_disj tm

Parameters:
Returns: term list
tm : term
Returns: term list

sym_conv tm

Full Usage: sym_conv tm

Parameters:
Returns: thm

This is the symmetry conversion for equality. It transforms the supplied equality term by swapping its LHS with its RHS, under no assumptions. `t1 = t2` ---------------------- |- t1 = t2 <=> t2 = t1 See also: sym_rule, refl_conv.

tm : term
Returns: thm

truth_thm

Full Usage: truth_thm

Returns: thm

|- true

Returns: thm

uexists_def

Full Usage: uexists_def

Returns: thm

Unique existential quantification |- $?! = (\(P:'a->bool). ?x. P x /\ (!y. P y ==> y = x))

Returns: thm

undisch_rule th

Full Usage: undisch_rule th

Parameters:
Returns: thm

This is the undischarge rule. It takes an implication theorem, and removes the antecedent from the conclusion and adds it to the assumptions. A |- p ==> q ------------ A u {p} |- q See also: disch_rule, mp_rule, prove_asm_rule.

th : thm
Returns: thm