#|
Copyright (C) 1994 by Natarajan Shankar.  All Rights Reserved.
This script is hereby placed in the public domain, and therefore unlimited
editing and redistribution is permitted.
NO WARRANTY
Natarajan Shankar PROVIDES ABSOLUTELY NO WARRANTY.  THE EVENT SCRIPT IS
PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,
INCLUDING, BUT NOT LIMITED TO, ANY IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND
PERFORMANCE OF THE SCRIPT IS WITH YOU.  SHOULD THE SCRIPT PROVE DEFECTIVE, YOU
ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
IN NO EVENT WILL Natarajan Shankar BE LIABLE TO YOU FOR ANY DAMAGES, ANY LOST
PROFITS, LOST MONIES, OR OTHER SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES
ARISING OUT OF THE USE OR INABILITY TO USE THIS SCRIPT (INCLUDING BUT NOT
LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED
BY THIRD PARTIES), EVEN IF YOU HAVE ADVISED US OF THE POSSIBILITY OF SUCH
DAMAGES, OR FOR ANY CLAIM BY ANY OTHER PARTY.
|#
;   The Mechanical Proof of Goedel's Incompleteness Theorem
;                            by
;                        N. Shankar

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;  I:  Defining the Proof-checker for Z2         ;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;BOOT-STRAP loads basic library of axioms about lists, litatoms, and numbers.
;;;;;;;

Event: Start with the initial thm theory.

Event: For efficiency, compile those definitions not yet compiled.

;;;;;;;Turn off the use of the compiled lisp definitions for the non-BOOT-STRAP

;;;;;;;functions.

Event: Enable defined functions; name this event ‘turn-off-lisp-defns’.

;;;;;;;Recognizers for function, variable, and predicate symbols.

Definition: function (fn) = (car (fn) = 2) Definition: variable (x) = (x ∈ N) Definition: predicate (p) = (car (p) = 3)

;;;;;;;Degree (arity) and index (subscript) of a function/predicate symbol.

Definition: degree (fn) = fix (cddr (fn)) Definition: index (fn) = fix (cadr (fn))

;;;;;;;(V X) generates the Xth variable

Definition: v (x) = fix (x) Theorem: numberp-fix fix (x) ∈ N Theorem: variable-v variable (v (x))

;;;;;;;FN generates function symbol with index X and arity Y.

Definition: fn (x, y) = cons (2, cons (fix (x), fix (y)))

;;;;;;;P generates the predicate symbol with index X and arity Y.

Definition: p (x, y) = cons (3, cons (fix (x), fix (y))) Theorem: function-fn function (fn (x, y)) Theorem: predicate-p predicate (p (x, y))

;;;;;;;F-NOT is the negation shell.

Event: Add the shell f-not, with recognizer function symbol f-notp and 1 accessor: arg, with type restriction (none-of) and default value zero.

;;;;;;;F-OR is the disjunction shell.

Event: Add the shell f-or, with recognizer function symbol f-orp and 2 accessors: arg1 , with type restriction (none-of) and default value zero; arg2 , with type restriction (none-of) and default value zero.

;;;;;;;FORSOME is the existential quantification shell.

Event: Add the shell forsome, with recognizer function symbol forsomep and 2 accessors: bind, with type restriction (one-of numberp) and default value zero; body, with type restriction (none-of) and default value zero.

;;;;;;;EQL is the equality predicate for Z2 expressions.  Strict equality EQUAL cannot
;;;;;;;be used since expressions will be Goedel-encoded, and it is possible
;;;;;;;two different expressions to have the same Goedel-encoding.  EQL essentially
;;;;;;;checks that its two arguments have the same encoding.

Definition: fix1 (x) = if x ∈ N then x

else nil endif

Theorem: bind-count forsomep (x) → (count (bind (x)) < count (x))

Definition: eql (x, y) = if listp (x)

then if listp (y) then eql (car (x), car (y)) ∧ eql (cdr (x), cdr (y))

else f endif elseif listp (y) then f elseif f-notp (x) then if f-notp (y) then eql (arg (x), arg (y))

else f endif elseif f-notp (y) then f elseif f-orp (x) then if f-orp (y) then eql (arg1 (x), arg1 (y)) ∧ eql (arg2 (x), arg2 (y))

else f endif elseif f-orp (y) then f elseif forsomep (x) then if forsomep (y)

then (bind (x) = bind (y)) ∧ eql (body (x), body (y)) else f endif elseif forsomep (y) then f else fix1 (x) = fix1 (y) endif Theorem: eql-comm eql (x, y) = eql (y, x)

Theorem: equal-eql (x = y) → eql (x, y)

Theorem: numberp-eql ((x ∈ N) ∨ (y ∈ N)) → (eql (x, y) = (x = y))

Theorem: listp-eql eql (cons (x, y), cons (u, v)) = (eql (x, u) ∧ eql (y, v))

Theorem: f-notp-eql eql (f-not (x), f-not (y)) = eql (x, y)

Theorem: f-orp-eql eql (f-or (x, y), f-or (u, v)) = (eql (x, u) ∧ eql (y, v))

Theorem: forsomep-eql eql (forsome (x, y), forsome (u, v)) = ((fix (x) = fix (u)) ∧ eql (y, v))

;;;;;;;MEMB checks if X is a member of Y, using EQL.

Definition: memb (x, y) = if listp (y)

then if eql (x, car (y)) then t

else memb (x, cdr (y)) endif else f endif

Theorem: degree-fn degree (fn (x, y)) = fix (y)

Theorem: degree-p degree (p (x, y)) = fix (y)

Theorem: index-fn index (fn (x, y)) = fix (x)

Theorem: index-p index (p (x, y)) = fix (x)

Theorem: not-function ((x ≃ nil) ∨ predicate (x)) → (¬ function (x))

Theorem: not-predicate ((x ≃ nil) ∨ function (x)) → (¬ predicate (x))

Event: Enable index; name this event ‘g0616’.

Event: Enable degree; name this event ‘g0617’.

Event: Enable v; name this event ‘g0618’.

Event: Enable fn; name this event ‘g0619’.

Event: Enable p; name this event ‘g0620’.

Event: Enable function; name this event ‘g0621’.

Event: Enable predicate; name this event ‘g0622’.

;;;;;;;X is a function or a predicate.

Definition: func-pred (x) = (function (x) ∨ predicate (x))

;;;;;;;APPEND concatenates two lists.

Definition: append (x, y) = if listp (x) then cons (car (x), append (cdr (x), y))

else y endif

;;;;;;;DEL deletes all occurrences of X from list Y, using EQL.

Definition: del (x, y) = if listp (y)

then if eql (x, car (y)) then del (x, cdr (y))

else cons (car (y), del (x, cdr (y))) endif else y endif

Theorem: not-memb-del ¬ memb (x, del (x, y))

;;;;;;;COLLECT-FREE collects a list of all the free variables in the
;;;;;;;expression/list of expressions EXP, depending on (ZEROP FLG).

Definition: collect-free (exp, flg)

= if flg ≃ 0

then if variable (exp) then cons (exp, nil)

elseif f-notp (exp) then collect-free (arg (exp), 0)

elseif f-orp (exp)

then append (collect-free (arg1 (exp), 0), collect-free (arg2 (exp), 0))

elseif forsomep (exp)

then del (bind (exp), collect-free (body (exp), 0)) elseif listp (exp) then collect-free (cdr (exp), 1) else nil endif

elseif listp (exp)

then append (collect-free (car (exp), 0), collect-free (cdr (exp), 1))

else nil endif

Definition: sentence (exp) = (collect-free (exp, 0) = nil)

;;;;;;;COVERING collects a list of all bound variables that govern free occurrences
;;;;;;;of VAR in EXP.

Definition: covering (exp, var, flg) = if flg ≃ 0

then if f-notp (exp) then covering (arg (exp), var, 0)

elseif f-orp (exp)

then append (covering (arg1 (exp), var, 0), covering (arg2 (exp), var, 0)) elseif forsomep (exp) then if memb (var, collect-free (exp, 0))

then cons (bind (exp), covering (body (exp), var, 0)) else nil endif

elseif listp (exp) then covering (cdr (exp), var, 1)

else nil endif elseif listp (exp) then append (covering (car (exp), var, 0), covering (cdr (exp), var, 1)) else nil endif

;;;;;;;X and Y have no common elements.

Definition: nil-intersect (x, y) = if listp (x) then (¬ memb (car (x), y)) ∧ nil-intersect (cdr (x), y)

else t endif

;;;;;;;TERM is FREE-FOR VAR in EXP, if no free occurrence of VAR in EXP is governed
;;;;;;;by a variable which occurs free in TERM.

Definition: free-for (exp, var, term, flg) = nil-intersect (covering (exp, var, flg), collect-free (term, 0))

;;;;;;;(F-EQUAL X Y) is the Z2 expression for (x=y).

Definition: f-equal (x, y) = list (p (0, 2), x, y)

Theorem: or-memb-append memb (x, append (y, z)) = (memb (x, y) ∨ memb (x, z))

Theorem: memb-del (¬ eql (x, z)) → (memb (x, del (z, y)) = memb (x, y))

;;;;;;;VAR-LIST checks that LIST is a list of N variables.

Definition: var-list (list, n) = if (n ≃ 0) ∨ (list ≃ nil) then (n ≃ 0) ∧ (list ≃ nil)

else variable (car (list)) ∧ var-list (cdr (list), n − 1) endif

;;;;;;;SYMB checks that X is either the equality symbol, or appears in list SYMBOLS.

Definition: symb (x, symbols) = ((x = p (0, 2)) ∨ memb (x, symbols))

;;;;;;;TERMP checks that EXP is either a variable or an n-ary function symbol (in SYMBOLS)
;;;;;;;applied to n smaller terms.

Definition: termp (exp, flg, symbols) = if flg ≃ 0

then if listp (exp)

then function (car (exp)) ∧ symb (car (exp), symbols) ∧ termp (cdr (exp), 1, symbols) ∧ (length (cdr (exp)) = degree (car (exp)))

else variable (exp) endif elseif exp ≃ nil then t else termp (car (exp), 0, symbols) ∧ termp (cdr (exp), 1, symbols) endif

;;;;;;;ATOMP checks that EXP is an n-ary predicate symbol applied to n terms.

Definition: atomp (exp, symbols) = (predicate (car (exp))

∧ symb (car (exp), symbols)

∧ (length (cdr (exp)) = degree (car (exp)))

∧ termp (cdr (exp), 1, symbols))

Theorem: atomp-reduc atomp (cons (x, y), symbols) = (predicate (x)

∧ symb (x, symbols)

∧ (length (y) = degree (x)) ∧ termp (y, 1, symbols))

Theorem: atomp-f-equal atomp (f-equal (x, y), symbols) = (termp (x, 0, symbols) ∧ termp (y, 0, symbols))

;;;;;;;SUBST substitutes TERM for all free occurrences of VAR in EXP.

Definition: subst (exp, var, term, flg) = if flg ≃ 0

then if variable (exp)

then if exp = var then term else exp endif

elseif f-notp (exp) then f-not (subst (arg (exp), var, term, 0)) elseif f-orp (exp) then f-or (subst (arg1 (exp), var, term, 0),

subst (arg2 (exp), var, term, 0))

elseif forsomep (exp)

then if eql (bind (exp), var) then exp

else forsome (bind (exp), subst (body (exp), var, term, 0)) endif elseif listp (exp) then cons (car (exp), subst (cdr (exp), var, term, 1)) else exp endif

elseif listp (exp)

then cons (subst (car (exp), var, term, 0), subst (cdr (exp), var, term, 1))

else exp endif

;;;;;;;SUB checks if every element of X occurs in Y, using EQL.

Definition: sub (x, y) = if listp (x) then memb (car (x), y) ∧ sub (cdr (x), y)

else t endif

;;;;;;;SUBSET checks if every element of X occurs in Y, using EQUAL.

Definition: subset (x, y) = if listp (x) then (car (x) ∈ y) ∧ subset (cdr (x), y)

else t endif Theorem: sub-subset subset (x, y) → sub (x, y)

Theorem: subst-f-equal subst (f-equal (x, y), var, term, 0) = f-equal (subst (x, var, term, 0), subst (y, var, term, 0))

Event: Enable f-equal; name this event ‘g0623’.

Event: Enable atomp; name this event ‘g0253’.

;;;;;;;FORMULA checks if EXP is a well-formed formula.

Definition: formula (exp, symbols) = if f-notp (exp) then formula (arg (exp), symbols)

elseif f-orp (exp)

then formula (arg1 (exp), symbols) ∧ formula (arg2 (exp), symbols) elseif forsomep (exp) then formula (body (exp), symbols) else atomp (exp, symbols) endif

Theorem: formula-f-equal formula (f-equal (x, y), symbols) = (termp (x, 0, symbols) ∧ termp (y, 0, symbols))

;;;;;;;(F-AND X Y) denotes (X ^Y).

Definition: f-and (x, y) = f-not (f-or (f-not (x), f-not (y)))

;;;;;;;(F-IMPLIES X Y) denotes (X => Y).

Definition: f-implies (x, y) = f-or (f-not (x), y)

;;;;;;;(FORALL X EXP) denotes (Ax exp).

Definition: ∀ var exp = f-not (forsome (var, f-not (exp)))

;;;;;;;PAIREQUALS returns a formula of the form
;;;;;;;((x1=y1) -> (...-> ((xn=yn) -> EXP))).

Definition: pairequals (vars1 , vars2 , exp) = if listp (vars1 ) ∧ listp (vars2 )

then f-implies (f-equal (car (vars1 ), car (vars2 )),

pairequals (cdr (vars1 ), cdr (vars2 ), exp))

else exp endif Definition: second (x) = cadr (x)

Definition: third (x) = caddr (x)

Definition: fourth (x) = cadddr (x)

;;;;;;;FOL-AXIOM-PROOF checks if CONC is a logical axiom (in a theory with
;;;;;;;SYMBOLS), using hints from HINTS.  The axioms are: [1] propositional
;;;;;;;axioms of the form, "((not A) or A)";  [2] substitution axioms of
;;;;;;;the form, "[t/x]A -> (forsome x A)";  [3] Identity axioms of the form,
;;;;;;;"(x=x)";  [4] Equality axioms for functions, of the form,
;;;;;;;"((x1=y1) -> (...-> ((xn=yn) -> ((fx1...xn)=(fy1...yn)))))";
;;;;;;;[5] Equality axioms for predicates, of the form,
;;;;;;;"((x1=y1) -> (...-> ((xn=yn) -> ((px1...xn) -> (py1...yn)))))".

Definition: fol-axiom-proof (conc, hints, symbols) = if car (hints) = 1

then formula (second (hints), symbols)

∧ eql (conc, f-or (f-not (second (hints)), second (hints))) elseif car (hints) = 2 then formula (second (hints), symbols) ∧ variable (third (hints)) ∧ termp (fourth (hints), 0, symbols) ∧ free-for (second (hints), third (hints), fourth (hints), 0) ∧ eql (conc,

f-implies (subst (second (hints), third (hints), fourth (hints), 0),

forsome (third (hints), second (hints))))

elseif car (hints) = 3

then termp (second (hints), 0, symbols)

∧ eql (conc, f-equal (second (hints), second (hints))) elseif car (hints) = 4 then termp (third (hints), 1, symbols)

∧ termp (fourth (hints), 1, symbols)

∧ function (second (hints))

∧ (length (third (hints)) = degree (second (hints))) ∧ (length (fourth (hints)) = degree (second (hints))) ∧ eql (conc,

pairequals (third (hints), fourth (hints), f-equal (cons (second (hints), third (hints)),

cons (second (hints), fourth (hints))))) elseif car (hints) = 5 then termp (third (hints), 1, symbols)

∧ termp (fourth (hints), 1, symbols) ∧ predicate (second (hints)) ∧ (length (third (hints)) = degree (second (hints))) ∧ (length (fourth (hints)) = degree (second (hints))) ∧ eql (conc,

pairequals (third (hints), fourth (hints), f-implies (cons (second (hints), third (hints)),

cons (second (hints), fourth (hints)))))

else f endif

;;;;;;;FOL-RULES checks if CONC follows from the SUB-GOALS by an application
;;;;;;;of one of the logical rules of inference, using hints from HINTS.
;;;;;;;The rules of inference are:  [1] Expansion: derive "(A or B)" from "B";
;;;;;;;[2] Contraction: derive "A" from "(A or A)";
;;;;;;;[3] Associativity: derive "((A or B) or C)" from "(A or (B or C))";
;;;;;;;[4] Cut: derive "(B or C)" from "(A or B)" and "((not B) or C)";
;;;;;;;[5] E-introduction: derive "((forsome x A) -> B)" from "(A -> B)",
;;;;;;;provided "x" does not occur free in "B".

Definition: fol-rules (conc, hints, sub-goals, symbols) = if car (hints) = 1

then formula (second (hints), symbols) ∧ formula (car (sub-goals), symbols) ∧ eql (conc, f-or (second (hints), car (sub-goals)))

elseif car (hints) = 2 then formula (second (hints), symbols)

∧ eql (sub-goals, list (f-or (second (hints), second (hints)))) ∧ eql (conc, second (hints))

elseif car (hints) = 3 then formula (second (hints), symbols)

∧ formula (third (hints), symbols) ∧ formula (fourth (hints), symbols) ∧ eql (sub-goals,

list (f-or (second (hints),

f-or (third (hints), fourth (hints)))))

∧ eql (conc,

f-or (f-or (second (hints), third (hints)), fourth (hints)))

elseif car (hints) = 4 then formula (second (hints), symbols)

∧ formula (third (hints), symbols)

∧ formula (fourth (hints), symbols)

∧ eql (sub-goals,

list (f-or (second (hints), third (hints)),

f-or (f-not (second (hints)), fourth (hints))))

∧ eql (conc, f-or (third (hints), fourth (hints))) elseif car (hints) = 5 then variable (second (hints))

∧ formula (third (hints), symbols) ∧ formula (fourth (hints), symbols) ∧ (¬ memb (second (hints), collect-free (fourth (hints), 0))) ∧ eql (sub-goals, list (f-implies (third (hints), fourth (hints)))) ∧ eql (conc,

f-implies (forsome (second (hints), third (hints)),

fourth (hints)))

else f endif

;;;;;;;Some notation for: [1] Set-theoretic membership: "(x in y)";
;;;;;;;[2] Null Set: "(phi)";  [3] Pairing: "{x, y}";
;;;;;;;[4] Union: "(x U y)";  [5] Integerhood:  "(I x)" defined as
;;;;;;;"x is transitive and linearly ordered";
;;;;;;;[6] Successor: "(S x)" defined as "(x U {x})", where "{x}" is "{x, x}";
;;;;;;;[7] If-and-only-if: "(A <-> B)".

Definition: isin (x, y) = list (p (1, 2), x, y)

Definition: phi = list (fn (0, 0))

Definition: z-pair (x, y) = list (fn (1, 2), x, y)

Definition: z-union (x, y) = list (fn (2, 2), x, y)

Definition: z-int (x) = list (p (2, 1), x)

Definition: z-succ (x) = list (fn (3, 1), x)

Definition: f-iff (x, y) = f-and (f-implies (x, y), f-implies (y, x))

;;;;;;;Z2-AXIOMS checks if CONC is a set-theoretic axiom from Z2.
;;;;;;;These axioms are:
;;;;;;;[1] Extensionality: "(x=y) <-> (forall z ((z in x) <-> (z in y)))".
;;;;;;;[2] Null set: "(not (x in (phi)))".
;;;;;;;[3] Pairing: "(z in {x, y}) <-> ((z=x) v (z=y))".
;;;;;;;[4] Union: "(z in (x U y)) <-> ((z in x) v (z in y))".
;;;;;;;[5] Induction:  "A[(phi)] ^(forall x (((I x) ^A[x]) -> A[(S x)])
;;;;;;;                    -> (forall x ((I x) -> A[x]))"

Definition: z2-axioms (conc, hints, symbols) = if car (hints) = 1

then variable (fourth (hints))

∧ termp (second (hints), 0, symbols) ∧ termp (third (hints), 0, symbols) ∧ (¬ memb (fourth (hints), collect-free (second (hints), 0))) ∧ (¬ memb (fourth (hints), collect-free (third (hints), 0))) ∧ eql (conc,

f-iff (f-equal (second (hints), third (hints)),

∀ fourth, hints f-iff (isin (fourth (hints),

second (hints)), isin (fourth (hints),

third (hints)))))

elseif car (hints) = 2 then termp (second (hints), 0, symbols)

∧ eql (conc, f-not (isin (second (hints), phi))) elseif car (hints) = 3 then termp (list (second (hints), third (hints), fourth (hints)), 1, symbols)

∧ eql (conc,

f-iff (isin (fourth (hints),

z-pair (second (hints), third (hints))), f-or (f-equal (fourth (hints), second (hints)), f-equal (fourth (hints), third (hints)))))

elseif car (hints) = 4 then termp (list (second (hints), third (hints), fourth (hints)), 1, symbols)

∧ eql (conc,

f-iff (isin (fourth (hints),

z-union (second (hints), third (hints))), f-or (isin (fourth (hints), second (hints)), isin (fourth (hints), third (hints)))))

elseif car (hints) = 5 then variable (third (hints))

∧ formula (second (hints), symbols) ∧ eql (conc,

f-implies (f-and (subst (second (hints), third (hints), phi, 0),

∀ third, hints f-implies (f-and (z-int (third (hints)),

second (hints)), subst (second (hints), third (hints), z-succ (third (hints)),

0))),

∀ third, hints f-implies (z-int (third (hints)),

second (hints))))

else f endif

;;;;;;;X is a list with no duplicates.

Definition: set (x) = if listp (x) then (¬ memb (car (x), cdr (x))) ∧ set (cdr (x))

else t endif

;;;;;;;Returns the element paired to X in the alist Y.

Definition: assoc (x, y) = if listp (y)

then if eql (caar (y), x) then cdar (y) else assoc (x, cdr (y)) endif

else 0 endif

;;;;;;;Returns the list of symbols following the last occurrence of SYM in SYMBOLS.

Definition: rest-of (sym, symbols) = if listp (symbols)

then if eql (car (symbols), sym) ∧ (¬ memb (sym, cdr (symbols))) then cdr (symbols) else rest-of (sym, cdr (symbols)) endif

else nil endif

;;;;;;;SYMB-DEFN-PROOF checks if CONC is admissible as the definition of a new
;;;;;;;function or predicate symbol.  The definition of a predicate symbol
;;;;;;;must have the form, "(px1...xn) <-> A", where the "xi" are distinct
;;;;;;;variables, and "A" is a formula w.r.t. the symbols that follow "p" in SYMBOLS
;;;;;;;which contains no free variables other than the "xi".
;;;;;;;The definition of a function symbol must have the form, "[(fx1...xn)/x]A",
;;;;;;;where the "x" and the "xi" are distinct, "A" is a formula w.r.t. the
;;;;;;;symbols that follow "f" in SYMBOLS, and "(forsome-unique x A)" is
;;;;;;;provable in a theory which only contains the symbols that follow "f" in SYMBOLS.

Definition: symb-defn-proof (conc, hints, sub-goals, defn, symbols) = if predicate (caar (hints))

then set (cdar (hints))

∧ var-list (cdar (hints), degree (caar (hints)))

∧ eql (conc, f-iff (car (hints), defn))

∧ sub (collect-free (defn, 0), cdar (hints))

∧ formula (defn, rest-of (caar (hints), symbols)) elseif function (caar (hints)) then set (cons (fourth (hints), cons (second (hints), cdar (hints))))

∧ var-list (cdar (hints), degree (caar (hints)))

∧ variable (second (hints)) ∧ variable (fourth (hints)) ∧ formula (third (hints), rest-of (caar (hints), symbols)) ∧ sub (collect-free (third (hints), 0),

cons (second (hints), cdar (hints))) ∧ free-for (third (hints), second (hints), car (hints), 0) ∧ free-for (third (hints), second (hints), fourth (hints), 0) ∧ eql (conc, subst (third (hints), second (hints), car (hints), 0)) ∧ eql (conc, defn) ∧ eql (sub-goals,

list (forsome (second (hints), third (hints)), f-implies (f-and (third (hints),

subst (third (hints), second (hints), fourth (hints), 0)),

f-equal (second (hints), fourth (hints)))))

else f endif

;;;;;;;A formal proof is represented as 4-tuple: <step hints conclusion sub-proofs>,
;;;;;;;where the conclusion is derived from the conclusions of the sub-proofs
;;;;;;;by means of a proof-step given by the combination of `step' and `hints'.
;;;;;;;CONC returns the conclusion of a proof/list of proofs.

Definition: conc (pf , flg) = if flg ≃ 0 then third (pf )

elseif listp (pf ) then cons (conc (car (pf ), 0), conc (cdr (pf ), 1))

else nil endif

;;;;;;;PRF checks if PF is well-formed proof in a theory whose function/predicate
;;;;;;;symbols appear in SYMBOLS, where the definitions of the defined symbols
;;;;;;;appear in DEFNS, and GIVEN is a list of assumptions.  The argument GIVEN is
;;;;;;;there merely to facilitate the proof of essential incompleteness, and is never
;;;;;;;actually used to demonstrate the existence of a proof.  One can obviously
;;;;;;;introduce an inconsistency through GIVEN.
;;;;;;;PRF recurses down PF and checks if the conclusion is either [1] a logical axiom;
;;;;;;;[2] follows from the conclusion of the sub-proofs (which are themselves

;;;;;;;well-formed) by means of one of the rules of inference; [3] a set-theoretic
;;;;;;;axiom; [4] a function/predicate definition; [5] an assumption from GIVEN.

Definition: prf (pf , given, defns, flg, symbols) = if flg ≃ 0

then if pf ≃ nil then f elseif ¬ formula (conc (pf , 0), symbols) then f elseif car (pf ) = 1 then fol-axiom-proof (conc (pf , 0), second (pf ), symbols) elseif car (pf ) = 2 then fol-rules (conc (pf , 0), second (pf ), conc (fourth (pf ), 1), symbols)

∧ prf (fourth (pf ), given, defns, 1, symbols) elseif car (pf ) = 3 then z2-axioms (conc (pf , 0), second (pf ), symbols) elseif car (pf ) = 4 then symb-defn-proof (conc (pf , 0),

second (pf ),

conc (fourth (pf ), 1),

assoc (caar (second (pf )), defns), symbols)

∧ if function (caar (cadr (pf ))) then prf (cadddr (pf ), given, defns,

                         1,

rest-of (caar (cadr (pf )), symbols))

else t endif

elseif car (pf ) = 5 then memb (conc (pf , 0), given)

else f endif elseif pf ≃ nil then t else prf (car (pf ), given, defns, 0, symbols)

∧ prf (cdr (pf ), given, defns, 1, symbols) endif

;;;;;;;PROVES checks that PF is a well-formed proof whose conclusion is EXP.

Definition: proves (pf , exp, given, defns, symbols) = (eql (conc (pf , 0), exp)

∧ formula (exp, symbols)

∧ prf (pf , given, defns, 0, symbols))

;;;;;;;What follows is a series of rewrite rules which convert the proof-checker above
;;;;;;;into a set of rewrite rules.  Functions like PROP-AXIOM construct axioms
;;;;;;;whose proofs are constructed by `proof-constructors' like PROP-AXIOM-PROOF.

Definition: prop-axiom (exp) = f-or (f-not (exp), exp)

Definition: subst-axiom (exp, var, term) = f-implies (subst (exp, var, term, 0), forsome (var, exp))

Definition: ident-axiom (var) = f-equal (var, var)

Definition: prop-axiom-proof (exp) = list (1, list (1, exp), prop-axiom (exp))

Definition: subst-axiom-proof (exp, var, term) = list (1, list (2, exp, var, term), subst-axiom (exp, var, term))

Definition: ident-axiom-proof (var) = list (1, list (3, var), f-equal (var, var))

Definition: equal-axiom1 (vars1 , vars2 , fn) = pairequals (vars1 , vars2 , f-equal (cons (fn, vars1 ), cons (fn, vars2 )))

Definition: equal-axiom1-proof (fn, vars1 , vars2 ) = list (1, list (4, fn, vars1 , vars2 ), equal-axiom1 (vars1 , vars2 , fn))

Definition: equal-axiom2 (vars1 , vars2 , pr) = pairequals (vars1 , vars2 , f-implies (cons (pr, vars1 ), cons (pr, vars2 )))

Definition: equal-axiom2-proof (pr, vars1 , vars2 ) = list (1, list (5, pr, vars1 , vars2 ), equal-axiom2 (vars1 , vars2 , pr))

Theorem: formula-f-not formula (f-not (x), symbols) = formula (x, symbols)

Theorem: formula-f-or formula (f-or (x, y), symbols) = (formula (x, symbols) ∧ formula (y, symbols))

Theorem: formula-forsome formula (forsome (x, y), symbols) = formula (y, symbols)

;;;;;;;The lemma below establishes that PROP-AXIOM-PROOF constructs a well-formed proof
;;;;;;;of a propositional axiom.  Once this is proved, the definition of PROP-AXIOM-PROOF
;;;;;;;is irrelevant and is disabled.

Theorem: prop-axiom-proves formula (exp, symbols) → proves (prop-axiom-proof (exp), f-or (f-not (exp), exp), given, defns, symbols)

Theorem: subst-length (flg ≄ 0) → (length (subst (exp, var, term, flg)) = length (exp))

Theorem: subst-termp (termp (exp, flg, symbols) ∧ termp (term, 0, symbols)) → termp (subst (exp, var, term, flg), flg, symbols)

Event: Disable atomp; name this event ‘g0606’.

Theorem: subst-formula (formula (exp, symbols) ∧ termp (term, 0, symbols)) → formula (subst (exp, var, term, 0), symbols)

Event: Enable atomp; name this event ‘g0607’.

Theorem: subst-axiom-proves ((lhs = subst (exp, var, term, 0)) ∧ variable (var) ∧ termp (term, 0, symbols) ∧ formula (exp, symbols) ∧ free-for (exp, var, term, 0)) → proves (subst-axiom-proof (exp, var, term),

f-implies (lhs, forsome (var, exp)), given, defns, symbols)

Theorem: formula-pairequals (termp (vars1 , 1, symbols) ∧ termp (vars2 , 1, symbols) ∧ formula (exp, symbols)) → formula (pairequals (vars1 , vars2 , exp), symbols)

Theorem: equal-axiom1-proves (function (fn) ∧ symb (fn, symbols) ∧ (length (vars1 ) = degree (fn)) ∧ (length (vars2 ) = degree (fn)) ∧ termp (vars1 , 1, symbols) ∧ termp (vars2 , 1, symbols) ∧ (concl = equal-axiom1 (vars1 , vars2 , fn))) → proves (equal-axiom1-proof (fn, vars1 , vars2 ), concl, given, defns, symbols)

Theorem: equal-axiom2-proves (predicate (pr) ∧ symb (pr, symbols) ∧ (length (vars1 ) = degree (pr)) ∧ (length (vars2 ) = degree (pr)) ∧ termp (vars1 , 1, symbols) ∧ termp (vars2 , 1, symbols) ∧ (concl = equal-axiom2 (vars1 , vars2 , pr))) → proves (equal-axiom2-proof (pr, vars1 , vars2 ), concl, given, defns, symbols)

Theorem: ident-axiom-proves termp (var, 0, symbols) → proves (ident-axiom-proof (var), f-equal (var, var), given, defns, symbols)

Definition: assum-proof (exp) = list (5, nil, exp)

Theorem: assum-proof-proves ((exp ∈ given) ∧ formula (exp, symbols)) → proves (assum-proof (exp), exp, given, defns, symbols)

Theorem: memb-member (x ∈ y) → memb (x, y)

Definition: fun-defn-proof (fn, vars, x, y, exp, pf1 , pf2 ) = list (4,

list (cons (fn, vars), x, exp, y), subst (exp, x, cons (fn, vars), 0), list (pf1 , pf2 ))

Theorem: fun-defn-proof-proves (var-list (vars, degree (fn)) ∧ variable (x) ∧ variable (y) ∧ set (cons (y, cons (x, vars))) ∧ function (fn) ∧ symb (fn, symbols) ∧ formula (a-prime, symbols) ∧ subset (collect-free (exp, 0), cons (x, vars)) ∧ free-for (exp, x, cons (fn, vars), 0) ∧ free-for (exp, x, y, 0) ∧ (a-prime = assoc (fn, defns)) ∧ proves (pf1 , forsome (x, exp), given, defns, rest-of (fn, symbols)) ∧ proves (pf2 ,

f-implies (f-and (exp, subst (exp, x, y, 0)), f-equal (x, y)), given, defns, rest-of (fn, symbols))

∧ (a-prime = subst (exp, x, cons (fn, vars), 0))) → proves (fun-defn-proof (fn, vars, x, y, exp, pf1 , pf2 ),

a-prime, given, defns, symbols)

Event: Enable fun-defn-proof; name this event ‘g0591’.

Definition: pred-defn-proof (pr, vars, defn) = list (4, list (cons (pr, vars)), f-iff (cons (pr, vars), defn))

Theorem: var-list-termp var-list (vars, length (vars)) → termp (vars, 1, symbols)

Theorem: var-list-length (length (vars) ≠ fix (n)) → (¬ var-list (vars, n))

Theorem: memb-rest-of (¬ memb (x, z)) → (¬ memb (x, rest-of (y, z)))

Theorem: termp-rest-of (¬ termp (exp, flg, symbols)) → (¬ termp (exp, flg, rest-of (symb, symbols)))

Event: Disable atomp; name this event ‘g0594’.

Theorem: formula-rest-of (¬ formula (exp, symbols)) → (¬ formula (exp, rest-of (symb, symbols)))

Event: Enable atomp; name this event ‘g0595’.

Theorem: pred-defn-proof-proves (var-list (vars, degree (pr)) ∧ set (vars) ∧ predicate (pr) ∧ symb (pr, symbols) ∧ (defn = assoc (pr, defns)) ∧ formula (defn, rest-of (pr, symbols)) ∧ subset (collect-free (defn, 0), vars) ∧ (concl = f-iff (cons (pr, vars), defn))) → proves (pred-defn-proof (pr, vars, defn), concl, given, defns, symbols)

Event: Enable pred-defn-proof; name this event ‘g0592’.

Definition: expan-proof (a, b, pf ) = list (2, list (1, a), f-or (a, b), list (pf ))

Definition: contrac-proof (a, pf ) = list (2, list (2, a), a, list (pf ))

Definition: assoc-proof (a, b, c, pf ) = list (2, list (3, a, b, c), f-or (f-or (a, b), c), list (pf ))

Definition: cut-proof (a, b, c, pf1 , pf2 ) = list (2, list (4, a, b, c), f-or (b, c), list (pf1 , pf2 ))

Definition: forsome-intro-proof (var, a, b, pf ) = list (2, list (5, var, a, b), f-implies (forsome (var, a), b), list (pf ))

Event: Enable fol-axiom-proof; name this event ‘g0624’.

Event: Enable fun-defn-proof; name this event ‘g0625’.

Theorem: expan-proof-proves (formula (a, symbols) ∧ proves (pf , b, given, defns, symbols)) → proves (expan-proof (a, b, pf ), f-or (a, b), given, defns, symbols)

Theorem: assoc-proof-proves proves (pf , f-or (a, f-or (b, c)), given, defns, symbols) → proves (assoc-proof (a, b, c, pf ), f-or (f-or (a, b), c), given, defns, symbols)

Theorem: contrac-proof-proves proves (pf , f-or (a, a), given, defns, symbols) → proves (contrac-proof (a, pf ), a, given, defns, symbols)

Theorem: cut-proof-proves (proves (pf1 , f-or (a, b), given, defns, symbols) ∧ proves (pf2 , f-or (f-not (a), c), given, defns, symbols) ∧ formula (f-or (b, c), symbols)) → proves (cut-proof (a, b, c, pf1 , pf2 ), f-or (b, c), given, defns, symbols)

Theorem: forsome-intro-proves (proves (pf , f-implies (a, b), given, defns, symbols) ∧ (¬ memb (var, collect-free (b, 0))) ∧ variable (var) ∧ formula (f-implies (forsome (var, a), b), symbols))

→ proves (forsome-intro-proof (var, a, b, pf ), f-implies (forsome (var, a), b), given, defns, symbols)

Event: Enable prop-axiom-proof; name this event ‘g2752’. Event: Enable subst-axiom-proof; name this event ‘g2753’. Event: Enable equal-axiom1-proof; name this event ‘g2754’. Event: Enable equal-axiom2-proof; name this event ‘g2755’. Event: Enable ident-axiom-proof; name this event ‘g2756’. Event: Enable assum-proof; name this event ‘g2757’. Event: Enable fun-defn-proof; name this event ‘g2758’. Event: Enable expan-proof; name this event ‘g2759’. Event: Enable contrac-proof; name this event ‘g2760’. Event: Enable assoc-proof; name this event ‘g2761’. Event: Enable cut-proof; name this event ‘g2762’. Event: Enable forsome-intro-proof; name this event ‘g2763’. Event: Enable fol-rules; name this event ‘g0626’. Theorem: nlistp-proves (pf ≃ nil) → (¬ proves (pf , exp, given, defns, symbols)) Definition: ext-axiom (x, terma, termb) = f-iff (f-equal (terma, termb), ∀ x f-iff (isin (x, terma), isin (x, termb)))

Definition: ext-axiom-proof (x, terma, termb) = list (3, list (1, terma, termb, x), ext-axiom (x, terma, termb))

Theorem: ext-axiom-proof-proves ((¬ memb (x, collect-free (terma, 0))) ∧ (¬ memb (x, collect-free (termb, 0))) ∧ variable (x) ∧ memb (p (1, 2), symbols) ∧ termp (terma, 0, symbols) ∧ termp (termb, 0, symbols)) → proves (ext-axiom-proof (x, terma, termb),

f-iff (f-equal (terma, termb),

∀ x f-iff (isin (x, terma), isin (x, termb))), given, defns, symbols)

Event: Enable ext-axiom-proof; name this event ‘g0374’.

Definition: null-axiom (term) = f-not (isin (term, phi))

Definition: null-axiom-proof (term) = list (3, list (2, term), null-axiom (term))

Theorem: null-axiom-proof-proves (subset (list (fn (0, 0), p (1, 2)), symbols) ∧ termp (term, 0, symbols)) → proves (null-axiom-proof (term),

f-not (isin (term, phi)),

given, defns, symbols)

Event: Enable null-axiom-proof; name this event ‘g0375’.

Definition: pair-axiom (x, terma, termb) = f-iff (isin (x, z-pair (terma, termb)),

f-or (f-equal (x, terma), f-equal (x, termb)))

Definition: pair-axiom-proof (x, terma, termb) = list (3, list (3, terma, termb, x), pair-axiom (x, terma, termb))

Theorem: pair-axiom-proof-proves (termp (x, 0, symbols) ∧ termp (terma, 0, symbols) ∧ termp (termb, 0, symbols) ∧ subset (list (fn (1, 2), p (1, 2)), symbols)) → proves (pair-axiom-proof (x, terma, termb),

f-iff (isin (x, z-pair (terma, termb)),

f-or (f-equal (x, terma), f-equal (x, termb))), given, defns, symbols)

Event: Enable pair-axiom-proof; name this event ‘g0376’.

Definition: union-axiom (x, terma, termb) = f-iff (isin (x, z-union (terma, termb)), f-or (isin (x, terma), isin (x, termb)))

Definition: union-axiom-proof (x, terma, termb) = list (3, list (4, terma, termb, x), union-axiom (x, terma, termb))

Theorem: union-axiom-proof-proves (termp (x, 0, symbols) ∧ termp (terma, 0, symbols) ∧ termp (termb, 0, symbols) ∧ memb (p (1, 2), symbols) ∧ memb (fn (2, 2), symbols)) → proves (union-axiom-proof (x, terma, termb),

f-iff (isin (x, z-union (terma, termb)),

f-or (isin (x, terma), isin (x, termb))), given, defns, symbols)

Event: Enable union-axiom-proof; name this event ‘g0377’.

Definition: ind-axiom (form, x) = f-implies (f-and (subst (form, x, phi, 0),

∀ x f-implies (f-and (z-int (x), form),

subst (form, x, z-succ (x), 0))),

∀ x f-implies (z-int (x), form))

Definition: ind-axiom-proof (form, x) = list (3, list (5, form, x), ind-axiom (form, x))

Event: Disable predicate; name this event ‘g0627’.

Theorem: ind-axiom-proof-proves (formula (form, symbols) ∧ variable (x) ∧ subset (list (fn (0, 0), fn (3, 1), p (2, 1)), symbols) ∧ (concl = ind-axiom (form, x))) → proves (ind-axiom-proof (form, x), concl, given, defns, symbols)

Event: Enable predicate; name this event ‘g0629’.

Event: Enable ind-axiom-proof; name this event ‘g0378’.

Event: Enable prf; name this event ‘g0379’.

Theorem: proves-is-formula proves (pf , exp, given, defns, symbols) → formula (exp, symbols)

Theorem: proves-is-formula-again (¬ formula (exp, symbols)) → (¬ proves (pf , exp, given, defns, symbols))

Event: Enable proves; name this event ‘g0380’.

;;;;;;;The commutativity of disjunction is the first example of a `derived inference rule'.
;;;;;;;COMMUT-PROOF constructs a proof of "(B or A)" given a proof of "(A or B)".

Definition: commut-proof (a, b, pf ) = cut-proof (a, b, a, pf , prop-axiom-proof (a))

;;;;;;;The lemma below establishes that this is the required proof.  The definition
;;;;;;;of COMMUT-PROOF then becomes irrelevant and is disabled.

Theorem: commut-proof-proves proves (pf , f-or (a, b), given, defns, symbols) → proves (commut-proof (a, b, pf ), f-or (b, a), given, defns, symbols)

Event: Enable commut-proof; name this event ‘g2766’.

Definition: detach-proof (a, b, pf1 , pf2 ) = contrac-proof (b,

cut-proof (a, b, b, commut-proof (b, a, expan-proof (b, a, pf1 )), pf2 ))

Event: Enable proves-is-formula; name this event ‘g0503’.

;;;;;;;Modus Ponens is proved as a derived inference rule below.

Theorem: detach-proof-proves (proves (pf1 , a, given, defns, symbols) ∧ proves (pf2 , f-implies (a, b), given, defns, symbols)) → proves (detach-proof (a, b, pf1 , pf2 ), b, given, defns, symbols)

Event: Enable detach-proof; name this event ‘g2767’.

Theorem: formula-f-implies formula (f-implies (x, y), symbols) = (formula (x, symbols) ∧ formula (y, symbols))

Theorem: covering-f-implies covering (f-implies (x, y), var, 0) = append (covering (x, var, 0), covering (y, var, 0))

Theorem: member-append (x ∈ append (y, z)) = ((x ∈ y) ∨ (x ∈ z))

Theorem: collect-free-f-implies collect-free (f-implies (x, y), 0) = append (collect-free (x, 0), collect-free (y, 0))

Event: Enable f-implies; name this event ‘g0344’.

Definition: list-implies (list, conc) = if list ≃ nil then conc

elseif cdr (list) ≃ nil then f-implies (car (list), conc)

else f-implies (car (list), list-implies (cdr (list), conc)) endif

Definition: list-detach-proof (alist, b, pflist, pf2 )

= if alist ≃ nil then pf2 elseif cdr (alist) ≃ nil then detach-proof (car (alist), b, car (pflist), pf2 ) else list-detach-proof (cdr (alist),

b,

cdr (pflist),

detach-proof (car (alist), list-implies (cdr (alist), b), car (pflist), pf2 )) endif

Theorem: formula-list-implies (formula (list-implies (alist, b), symbols) ∧ listp (alist)) → formula (list-implies (cdr (alist), b), symbols)

;;;;;;;PROVES-LIST checks that PFLIST is a list of proofs of the elements of
;;;;;;;the list EXPLIST.

Definition: proves-list (pflist, explist, given, defns, symbols) = if explist ≃ nil then pflist = nil

else proves (car (pflist), car (explist), given, defns, symbols)

∧ proves-list (cdr (pflist), cdr (explist), given, defns, symbols) endif

Theorem: detach-rule-corr (proves-list (pflist, alist, given, defns, symbols) ∧ proves (pf2 , list-implies (alist, b), given, defns, symbols) ∧ formula (b, symbols)) → proves (list-detach-proof (alist, b, pflist, pf2 ), b, given, defns, symbols)

Event: Enable list-detach-proof; name this event ‘g0220’.

Definition: rt-expan-proof (a, b, pf ) = commut-proof (b, a, expan-proof (b, a, pf ))

Theorem: rt-expan-proof-proves (proves (pf , a, given, defns, symbols) ∧ formula (b, symbols)) → proves (rt-expan-proof (a, b, pf ), f-or (a, b), given, defns, symbols)

Event: Enable rt-expan-proof; name this event ‘g0227’.

;;;;;;;MAKE-DISJUNCT returns a disjunction of a given list of formulas.

Definition: make-disjunct (flist) = if flist ≃ nil then nil

elseif cdr (flist) ≃ nil then car (flist)

else f-or (car (flist), make-disjunct (cdr (flist))) endif

Definition: m1-proof (exp, flist, pf ) = if flist ≃ nil then nil

elseif cdr (flist) ≃ nil then pf

elseif exp = car (flist)

then rt-expan-proof (car (flist), make-disjunct (cdr (flist)), pf )

else expan-proof (car (flist), make-disjunct (cdr (flist)), m1-proof (exp, cdr (flist), pf )) endif

;;;;;;;The rule below asserts that if "A" is provable, so is any disjunction
;;;;;;;which contains "A" as a disjunct.

Theorem: m1-proof-proves (formula (make-disjunct (flist), symbols) ∧ (exp ∈ flist) ∧ proves (pf , exp, given, defns, symbols)) → proves (m1-proof (exp, flist, pf ),

make-disjunct (flist), given, defns, symbols)

Event: Enable m1-proof; name this event ‘g0228’.

;;;;;;;Note that the lemma in the above form contains MAKE-DISJUNCT in the
;;;;;;;conclusion which might prevent a match with a disjunction of the
;;;;;;;form "(A or B)".  This is remedied by moving it to the hypothesis in
;;;;;;;the rephrased form below.  The lemma had to first be proved in the
;;;;;;;above form to get the induction right.

Theorem: m1-proof-proves1 (formula (make-disjunct (flist), symbols) ∧ (exp ∈ flist) ∧ proves (pf , exp, given, defns, symbols) ∧ (concl = make-disjunct (flist))) → proves (m1-proof (exp, flist, pf ), concl, given, defns, symbols)

Event: Enable m1-proof-proves; name this event ‘g0504’.

Definition: rt-assoc-proof (a, b, c, pf ) = commut-proof (f-or (b, c),

a,

assoc-proof (b, c, a, commut-proof (f-or (c, a),

b,

assoc-proof (c, a, b, commut-proof (f-or (a,

b), c, pf )))))

Theorem: rt-assoc-proof-proves proves (pf , f-or (f-or (a, b), c), given, defns, symbols) → proves (rt-assoc-proof (a, b, c, pf ), f-or (a, f-or (b, c)), given, defns, symbols)

Event: Enable rt-assoc-proof; name this event ‘g0231’.

Definition: insert-proof (a, b, c, pf ) = commut-proof (f-or (a, c),

b,

assoc-proof (a, c, b, expan-proof (a, f-or (c, b), commut-proof (b, c, pf ))))

Theorem: insert-proof-proves (proves (pf , f-or (b, c), given, defns, symbols) ∧ formula (a, symbols)) → proves (insert-proof (a, b, c, pf ), f-or (b, f-or (a, c)), given, defns, symbols)

Event: Enable insert-proof; name this event ‘g0232’.

Definition: m2-proof-step (exp1 , exp2 , flist, pf ) = if flist ≃ nil then nil

elseif cdr (flist) ≃ nil

then if exp2 = car (flist) then pf else nil endif elseif exp2 = car (flist) then rt-assoc-proof (exp1 ,

exp2 ,

make-disjunct (cdr (flist)),

rt-expan-proof (f-or (exp1 , exp2 ), make-disjunct (cdr (flist)), pf ))

else insert-proof (car (flist), exp1 , make-disjunct (cdr (flist)), m2-proof-step (exp1 , exp2 , cdr (flist), pf )) endif

Theorem: m2-proof-step-proves (formula (make-disjunct (flist), symbols) ∧ (exp2 ∈ flist) ∧ proves (pf , f-or (exp1 , exp2 ), given, defns, symbols)) → proves (m2-proof-step (exp1 , exp2 , flist, pf ),

f-or (exp1 , make-disjunct (flist)), given, defns, symbols)

Theorem: m2-proof-step-proves1 (formula (make-disjunct (flist), symbols) ∧ (exp2 ∈ flist) ∧ proves (pf , f-or (exp1 , exp2 ), given, defns, symbols) ∧ (concl = f-or (exp1 , make-disjunct (flist)))) → proves (m2-proof-step (exp1 , exp2 , flist, pf ), concl, given, defns, symbols)

Event: Enable m2-proof-step; name this event ‘g0233’.

Event: Enable m2-proof-step-proves; name this event ‘g0234’.

Definition: m2-proof (exp1 , exp2 , flist, pf ) = if flist ≃ nil then nil

elseif exp1 = exp2 then m1-proof (exp1 , flist, contrac-proof (exp1 , pf )) elseif exp1 = car (flist) then m2-proof-step (exp1 , exp2 , cdr (flist), pf ) elseif exp2 = car (flist) then m2-proof-step (exp2 , exp1 , cdr (flist), commut-proof (exp1 , exp2 , pf )) else expan-proof (car (flist),

make-disjunct (cdr (flist)),

m2-proof (exp1 , exp2 , cdr (flist), pf )) endif

;;;;;;;The rule below asserts that if "(A or B)" is provable, so is any
;;;;;;;disjunction which contains "A" and "B" as disjuncts.

Theorem: m2-proof-proves (formula (make-disjunct (flist), symbols) ∧ (exp1 ∈ flist) ∧ (exp2 ∈ flist) ∧ proves (pf , f-or (exp1 , exp2 ), given, defns, symbols)) → proves (m2-proof (exp1 , exp2 , flist, pf ),

make-disjunct (flist), given, defns, symbols)

Theorem: m2-proof-proves1 (formula (make-disjunct (flist), symbols) ∧ (exp1 ∈ flist) ∧ (exp2 ∈ flist) ∧ proves (pf , f-or (exp1 , exp2 ), given, defns, symbols) ∧ (concl = make-disjunct (flist))) → proves (m2-proof (exp1 , exp2 , flist, pf ), concl, given, defns, symbols)

Event: Enable m2-proof; name this event ‘g0235’.

Event: Enable m2-proof-proves; name this event ‘g0236’.

Definition: m3-proof (exp1 , exp2 , flist2 , pf ) = contrac-proof (make-disjunct (flist2 ),

contrac-proof (f-or (make-disjunct (flist2 ),

make-disjunct (flist2 )), m2-proof (f-or (make-disjunct (flist2 ),

make-disjunct (flist2 )), exp1 , cons (f-or (make-disjunct (flist2 ),

make-disjunct (flist2 )), cons (make-disjunct (flist2 ),

flist2 )), assoc-proof (make-disjunct (flist2 ),

make-disjunct (flist2 ),

exp1 ,

commut-proof (f-or (make-disjunct (flist2 ), exp1 ),

make-disjunct (flist2 ), m2-proof (f-or (make-disjunct (flist2 ), exp1 ),

exp2 ,

cons (f-or (make-disjunct (flist2 ), exp1 ),

flist2 ), assoc-proof (make-disjunct (flist2 ), exp1 , exp2 , commut-proof (f-or (exp1 ,

exp2 ), make-disjunct (flist2 ), pf ))))))))

Definition: form-list (flist, symbols) = if listp (flist)

then formula (car (flist), symbols) ∧ form-list (cdr (flist), symbols)

else t endif

Theorem: subset-cons subset (x, y) → subset (x, cons (z, y))

Theorem: formlist-formula-make-disj (listp (flist) ∧ form-list (flist, symbols)) → formula (make-disjunct (flist), symbols)

Theorem: m3-proof-proves (proves (pf , make-disjunct (cons (f-or (exp1 , exp2 ), flist2 )), given, defns, symbols) ∧ (exp1 ∈ flist2 ) ∧ (exp2 ∈ flist2 )) → proves (m3-proof (exp1 , exp2 , flist2 , pf ),

make-disjunct (flist2 ), given, defns, symbols)

Event: Enable m3-proof; name this event ‘g0222’.

Theorem: m3-proof-proves1 (proves (pf , make-disjunct (cons (f-or (exp1 , exp2 ), flist2 )), given, defns, symbols) ∧ (exp1 ∈ flist2 ) ∧ (exp2 ∈ flist2 ) ∧ (concl = make-disjunct (flist2 ))) → proves (m3-proof (exp1 , exp2 , flist2 , pf ), concl, given, defns, symbols)

Event: Enable m3-proof-proves; name this event ‘g0229’.

Definition: m-proof (flist1 , flist2 , pf ) = if flist1 ≃ nil then nil

elseif cdr (flist1 ) ≃ nil then m1-proof (car (flist1 ), flist2 , pf )

elseif cddr (flist1 ) ≃ nil

then m2-proof (car (flist1 ), cadr (flist1 ), flist2 , pf )

else m3-proof (car (flist1 ), cadr (flist1 ), flist2 , m-proof (cons (f-or (car (flist1 ), cadr (flist1 )), cddr (flist1 )),

cons (f-or (car (flist1 ), cadr (flist1 )),

flist2 ), assoc-proof (car (flist1 ),

cadr (flist1 ),

make-disjunct (cddr (flist1 )), pf ))) endif

;;;;;;;The rule below is the important lemma on disjuncts which asserts that
;;;;;;;if a disjunction of formulas {"A1",...,"Am"} is provable, so is any
;;;;;;;disjunction of formulas {"B1",...,"Bn"} which contains all the "Ai".

Theorem: m-proof-proves (form-list (flist2 , symbols) ∧ listp (flist1 ) ∧ listp (flist2 ) ∧ subset (flist1 , flist2 ) ∧ proves (pf , make-disjunct (flist1 ), given, defns, symbols)) → proves (m-proof (flist1 , flist2 , pf ),

make-disjunct (flist2 ), given, defns, symbols)

Definition: termp1 (exp, flg) = if flg ≃ 0

then if listp (exp)

then function (car (exp)) ∧ (length (cdr (exp)) = degree (car (exp))) ∧ termp1 (cdr (exp), 1)

else variable (exp) endif elseif exp ≃ nil then t else termp1 (car (exp), 0) ∧ termp1 (cdr (exp), 1) endif

Theorem: termp-termp1 termp (exp, flg, symbols) → termp1 (exp, flg)

Definition: atomp1 (exp) = (predicate (car (exp))

∧ (length (cdr (exp)) = degree (car (exp)))

∧ termp1 (cdr (exp), 1))

Event: Disable atomp; name this event ‘g0345’.

Theorem: atomp-atomp1 atomp (exp, symbols) → atomp1 (exp)

Definition: dble-neg-type (exp) = (f-notp (exp) ∧ f-notp (arg (exp)))

Definition: neg (exp1 , exp2 ) = ((exp1 = f-not (exp2 )) ∨ (exp2 = f-not (exp1 )))

Definition: neg-list (exp, list) = if f-notp (exp) then arg (exp) ∈ list

else f-not (exp) ∈ list endif

Definition: elem-form (exp) = (atomp1 (exp)

∨ (forsomep (exp) ∧ (exp = forsome (bind (exp), body (exp)))))

Definition: neg-elem-form (exp) = (f-notp (exp) ∧ elem-form (arg (exp)))

Definition: prop-atomp (exp) = (elem-form (exp) ∨ neg-elem-form (exp))

Definition: form-count (exp) = if f-notp (exp) then 1 + form-count (arg (exp))

elseif f-orp (exp)

then 1 + (form-count (arg1 (exp)) + form-count (arg2 (exp))) else 1 endif Definition: list-count (list) = if listp (list) then form-count (car (list)) + list-count (cdr (list))

else 0 endif

Definition: nor-type (exp) = (f-notp (exp) ∧ f-orp (arg (exp)))

Theorem: lessp-list-count listp (flist) → (list-count (cdr (flist)) < list-count (flist))

Theorem: f-orp-list-count (f-orp (car (flist)) ∧ listp (flist)) → (list-count (cons (arg1 (car (flist)), cons (arg2 (car (flist)), cdr (flist))))

< list-count (flist))

Theorem: nor-type-list-count1 (listp (flist) ∧ nor-type (car (flist))) → (list-count (cons (f-not (arg1 (arg (car (flist)))), cdr (flist)))

< list-count (flist))

Theorem: nor-type-list-count2 (listp (flist) ∧ nor-type (car (flist))) → (list-count (cons (f-not (arg2 (arg (car (flist)))), cdr (flist)))

< list-count (flist))

Theorem: dble-neg-list-count (listp (flist) ∧ dble-neg-type (car (flist))) → (list-count (cons (arg (arg (car (flist))), cdr (flist)))

< list-count (flist))

Event: Enable list-count; name this event ‘g0240’.

;;;;;;;TAUTOLOGYP1 is the tautology-checker.  It recurses through a list of
;;;;;;;formulas FLIST and builds up a list of literals AUXLIST.  If AUXLIST
;;;;;;;is ever to contain a literal and its negation, TAUTOLOGYP1 returns T.
;;;;;;;Otherwise, it returns F.

Definition: tautologyp1 (flist, auxlist) = if listp (flist)

then if f-orp (car (flist))

then tautologyp1 (cons (arg1 (car (flist)),

cons (arg2 (car (flist)), cdr (flist))), auxlist)

elseif nor-type (car (flist)) then tautologyp1 (cons (f-not (arg1 (arg (car (flist)))), cdr (flist)),

auxlist)

∧ tautologyp1 (cons (f-not (arg2 (arg (car (flist)))), cdr (flist)),

auxlist)

elseif dble-neg-type (car (flist))

then tautologyp1 (cons (arg (arg (car (flist))), cdr (flist)), auxlist) else neg-list (car (flist), auxlist)

∨ tautologyp1 (cdr (flist),

cons (car (flist), auxlist)) endif

else f endif

Theorem: form-list-append (form-list (x, symbols) ∧ form-list (y, symbols)) → form-list (append (x, y), symbols)

Definition: neg-proof (exp1 , exp2 ) = if exp1 = f-not (exp2 ) then prop-axiom-proof (exp2 )

else commut-proof (exp2 , exp1 , prop-axiom-proof (exp1 )) endif

Theorem: neg-proof-proves (formula (exp1 , symbols) ∧ formula (exp2 , symbols) ∧ neg (exp1 , exp2 ) ∧ (concl = f-or (exp1 , exp2 ))) → proves (neg-proof (exp1 , exp2 ), concl, given, defns, symbols)

Definition: neg-list-proof (exp, flist) = if f-not (exp) ∈ flist

then m2-proof (exp, f-not (exp), cons (exp, flist), neg-proof (exp, f-not (exp)))

else m2-proof (exp, arg (exp), cons (exp, flist), neg-proof (exp, arg (exp))) endif

Theorem: neg-list-proof-proves (formula (exp, symbols) ∧ form-list (flist, symbols) ∧ neg-list (exp, flist) ∧ (concl = make-disjunct (cons (exp, flist)))) → proves (neg-list-proof (exp, flist), concl, given, defns, symbols)

Theorem: subset-ident subset (x, x)

Theorem: subset-car subset (x, cons (y, x))

Theorem: subset-append subset (cons (exp, list2 ), append (cons (exp, list1 ), list2 ))

Theorem: m-proof-proves1 (form-list (flist2 , symbols) ∧ subset (flist1 , flist2 ) ∧ proves (pf , make-disjunct (flist1 ), given, defns, symbols) ∧ (concl = make-disjunct (flist2 ))) → proves (m-proof (flist1 , flist2 , pf ), concl, given, defns, symbols)

Event: Enable m-proof-proves; name this event ‘g0505’.

Event: Enable neg-list-proof; name this event ‘g0256’.

Definition: prop-atom-proof1 (flist1 , flist2 ) = m-proof (cons (car (flist1 ), flist2 ),

append (flist1 , flist2 ),

neg-list-proof (car (flist1 ), flist2 ))

Theorem: prop-atom-proof1-proves (form-list (flist1 , symbols) ∧ listp (flist1 ) ∧ form-list (flist2 , symbols) ∧ neg-list (car (flist1 ), flist2 ) ∧ (concl = make-disjunct (append (flist1 , flist2 )))) → proves (prop-atom-proof1 (flist1 , flist2 ), concl, given, defns, symbols)

Event: Enable prop-atom-proof1; name this event ‘g0259’.

Theorem: subset-append-car subset (append (list1 , cons (exp, list2 )), append (cons (exp, list1 ), list2 ))

Theorem: form-list-append-car (form-list (cons (exp, list1 ), symbols) ∧ ((list2 = nil) ∨ form-list (list2 , symbols))) → form-list (append (list1 , cons (exp, list2 )), symbols)

Definition: prop-atom-proof2 (flist1 , flist2 , pf ) = m-proof (append (cdr (flist1 ), cons (car (flist1 ), flist2 )),

append (flist1 , flist2 ), pf )

Theorem: prop-atom-proof2-proves (form-list (flist1 , symbols) ∧ listp (flist1 ) ∧ form-list (flist2 , symbols) ∧ proves (pf ,

make-disjunct (append (cdr (flist1 ), cons (car (flist1 ), flist2 ))), given, defns, symbols)

∧ (concl = make-disjunct (append (flist1 , flist2 )))) → proves (prop-atom-proof2 (flist1 , flist2 , pf ), concl, given, defns, symbols)

Event: Enable prop-atom-proof2; name this event ‘g0258’.

Definition: cancel-proof (a, b, pf1 , pf2 ) = contrac-proof (b, cut-proof (a, b, b, pf2 , rt-expan-proof (f-not (a), b, pf1 )))

Theorem: cancel-proof-proves (proves (pf1 , f-not (a), given, defns, symbols) ∧ proves (pf2 , f-or (a, b), given, defns, symbols)) → proves (cancel-proof (a, b, pf1 , pf2 ), b, given, defns, symbols)

Event: Enable cancel-proof; name this event ‘g0255’.

Definition: nlistp-nor-type-proof (a, b, pf1 , pf2 ) = cancel-proof (b,

f-not (f-or (a, b)), pf2 , cancel-proof (a,

f-or (b, f-not (f-or (a, b))),

pf1 ,

m-proof (list (f-not (f-or (a, b)), a, b), list (a, b, f-not (f-or (a, b))), prop-axiom-proof (f-or (a, b)))))

Definition: listp-nor-type-proof (a, b, c, pf1 , pf2 ) = m-proof (list (f-not (f-or (a, b)), c, c),

list (f-not (f-or (a, b)), c),

rt-assoc-proof (f-not (f-or (a, b)), c, c, cut-proof (b,

f-or (f-not (f-or (a, b)), c), c, rt-assoc-proof (b,

f-not (f-or (a, b)), c, cut-proof (a,

f-or (b,

f-not (f-or (a,

b))),

c,

m-proof (list (f-not (f-or (a,

b)),

a, b), list (a, b, f-not (f-or (a,

b))),

prop-axiom-proof (f-or (a,

b))),

pf1 )),

pf2 )))

Definition: nor-proof (a, b, clist, pf1 , pf2 ) = if clist ≃ nil then nlistp-nor-type-proof (a, b, pf1 , pf2 )

else listp-nor-type-proof (a, b, make-disjunct (clist), pf1 , pf2 ) endif

Definition: nlistp-dble-neg-proof (a, pf ) = contrac-proof (f-not (f-not (a)),

cut-proof (a, f-not (f-not (a)), f-not (f-not (a)), rt-expan-proof (a, f-not (f-not (a)), pf ), commut-proof (f-not (f-not (a)),

f-not (a),

prop-axiom-proof (f-not (a)))))

Definition: listp-dble-neg-proof (a, c, pf ) = commut-proof (c,

f-not (f-not (a)), cut-proof (a,

c,

f-not (f-not (a)),

pf ,

commut-proof (f-not (f-not (a)), f-not (a), prop-axiom-proof (f-not (a)))))

Definition: dble-neg-proof (a, clist, pf ) = if clist ≃ nil then nlistp-dble-neg-proof (a, pf )

else listp-dble-neg-proof (a, make-disjunct (clist), pf ) endif

Definition: f-orp-proof (a, b, clist, pf ) = if clist ≃ nil then pf

else assoc-proof (a, b, make-disjunct (clist), pf ) endif

;;;;;;;TAUT-PROOF1 is the proof-constructor that constructs the proof for a formula
;;;;;;;asserted to be a tautology by TAUTOLOGYP1.  TAUT-PROOF1 and TAUTOLOGYP1 recurse
;;;;;;;in the same way.

Definition: taut-proof1 (flist, auxlist) = if listp (flist)

then if f-orp (car (flist))

then f-orp-proof (arg1 (car (flist)), arg2 (car (flist)), append (cdr (flist), auxlist), taut-proof1 (cons (arg1 (car (flist)),

cons (arg2 (car (flist)), cdr (flist))),

auxlist))

elseif nor-type (car (flist))

then nor-proof (arg1 (arg (car (flist))), arg2 (arg (car (flist))), append (cdr (flist), auxlist), taut-proof1 (cons (f-not (arg1 (arg (car (flist)))), cdr (flist)),

auxlist),

taut-proof1 (cons (f-not (arg2 (arg (car (flist)))),

cdr (flist)), auxlist))

elseif dble-neg-type (car (flist))

then dble-neg-proof (arg (arg (car (flist))), append (cdr (flist), auxlist), taut-proof1 (cons (arg (arg (car (flist))),

cdr (flist)), auxlist))

elseif neg-list (car (flist), auxlist) then prop-atom-proof1 (flist, auxlist) else prop-atom-proof2 (flist,

auxlist,

taut-proof1 (cdr (flist),

cons (car (flist), auxlist))) endif

else nil endif

;;;;;;;The lemma below is a form of the tautology theorem.  If (TAUTOLOGYP1 FLIST AUXLIST)
;;;;;;;is T, then (TAUT-PROOF1 FLIST AUXLIST) constructs a correct proof of
;;;;;;;the disjunction of the formulas in FLIST and AUXLIST.  We still have to
;;;;;;;show that the tautology-checker TAUTOLOGYP1 is correct w.r.t the truth-table
;;;;;;;definition of a tautology.

Theorem: taut-thm1 (form-list (flist, symbols) ∧ form-list (auxlist, symbols) ∧ tautologyp1 (flist, auxlist)) → proves (taut-proof1 (flist, auxlist),

make-disjunct (append (flist, auxlist)), given, defns, symbols)

Event: Enable taut-proof1; name this event ‘g0275’.

Theorem: taut-thm2 (form-list (flist, symbols) ∧ form-list (auxlist, symbols) ∧ tautologyp1 (flist, auxlist) ∧ (concl = make-disjunct (append (flist, auxlist)))) → proves (taut-proof1 (flist, auxlist), concl, given, defns, symbols)

;;;;;;;EVAL evaluates the truth-value of the Boolean expression EXP,
;;;;;;;where the truth-value assigned to atoms are specified in ALIST.

Definition: eval (exp, alist) = if f-notp (exp) then ¬ eval (arg (exp), alist)

elseif f-orp (exp)

then eval (arg1 (exp), alist) ∨ eval (arg2 (exp), alist)

else exp ∈ alist endif

Theorem: member-eval ((exp ∈ flist) ∧ eval (exp, alist)) → eval (make-disjunct (flist), alist)

Theorem: eval-make-disjunct (listp (list1 ) ∧ listp (list2 )) → (eval (make-disjunct (append (list1 , list2 )), alist)

= (eval (make-disjunct (list1 ), alist) ∨ eval (make-disjunct (list2 ), alist)))

Theorem: neg-list-eval (listp (flist1 ) ∧ neg-list (car (flist1 ), flist2 )) → eval (make-disjunct (append (flist1 , flist2 )), alist)

Theorem: eval-prop-atomp (listp (flist1 ) ∧ eval (make-disjunct (append (cdr (flist1 ), cons (car (flist1 ), flist2 ))),

alist))

→ eval (make-disjunct (append (flist1 , flist2 )), alist)

Theorem: eval-prop-atomp1 (listp (flist1 ) ∧ eval (make-disjunct (append (cdr (flist1 ), cons (car (flist1 ), flist2 ))),

alist)

∧ (concl = make-disjunct (append (flist1 , flist2 )))) → eval (concl, alist)

Theorem: neg-list-eval1 (listp (flist1 ) ∧ neg-list (car (flist1 ), flist2 ) ∧ (concl = make-disjunct (append (flist1 , flist2 )))) → eval (concl, alist)

;;;;;;;The lemma below is one half of the correctness of the tautology-checker.
;;;;;;;It asserts that any formula checked to be a tautology, evaluates to
;;;;;;;true under any assignment of truth-values to the atoms.

Theorem: taut-eval tautologyp1 (flist, auxlist) → eval (make-disjunct (append (flist, auxlist)), alist)

;;;;;;;FALSIFY attempts to return a falsifying assignment corresponding to a list of literals.

Definition: falsify (list) = if list ≃ nil then nil

elseif f-notp (car (list)) then cons (arg (car (list)), falsify (cdr (list)))

else falsify (cdr (list)) endif

;;;;;;;FALSIFY-TAUT attempts to return an assignment which falsifies a non-tautology.

Definition: falsify-taut (flist, auxlist) = if listp (flist)

then if f-orp (car (flist))

then falsify-taut (cons (arg1 (car (flist)),

cons (arg2 (car (flist)), cdr (flist))), auxlist)

elseif nor-type (car (flist))

then if falsify-taut (cons (f-not (arg2 (arg (car (flist)))),

cdr (flist)), auxlist)

then falsify-taut (cons (f-not (arg2 (arg (car (flist)))),

cdr (flist)), auxlist)

else falsify-taut (cons (f-not (arg1 (arg (car (flist)))), cdr (flist)),

auxlist) endif

elseif dble-neg-type (car (flist))

then falsify-taut (cons (arg (arg (car (flist))), cdr (flist)), auxlist) elseif neg-list (car (flist), auxlist) then f else falsify-taut (cdr (flist), cons (car (flist), auxlist)) endif

else falsify (auxlist) endif

Theorem: not-falsify-taut tautologyp1 (flist, auxlist) = (¬ falsify-taut (flist, auxlist))

Theorem: eval-member ((¬ f-notp (exp)) ∧ (¬ f-orp (exp)) ∧ (exp ∈ alist)) → eval (exp, alist)

Definition: prop-atomp-list (flist) = if listp (flist)

then (¬ f-orp (car (flist)))

∧ (¬ nor-type (car (flist)))

∧ (¬ dble-neg-type (car (flist))) ∧ (¬ neg-list (car (flist), cdr (flist))) ∧ prop-atomp-list (cdr (flist))

else t endif

Theorem: member-falsify (exp ∈ falsify (list)) = (f-not (exp) ∈ list)

Theorem: alist-cons-eval2 ((x ∉ flist) ∧ listp (flist) ∧ prop-atomp-list (flist) ∧ (¬ eval (make-disjunct (flist), alist))) → (¬ eval (make-disjunct (flist), cons (x, alist)))

Theorem: prop-atomp-list-eval (listp (flist) ∧ prop-atomp-list (flist)) → (¬ eval (make-disjunct (flist), falsify (flist)))

Theorem: not-eval-prop-atomp eval (make-disjunct (append (flist1 , cons (exp, flist2 ))), alist) = eval (make-disjunct (cons (exp, append (flist1 , flist2 ))), alist)

;;;;;;;The lemma below is the second half of the correctness of the tautology-checker.
;;;;;;;It asserts that if AUXLIST does not contain both a literal and its negation,
;;;;;;;then any formula which is checked to not be a tautology is falsifiable.

Theorem: not-taut-false (prop-atomp-list (auxlist) ∧ (¬ tautologyp1 (flist, auxlist))) → (¬ eval (make-disjunct (append (flist, auxlist)),

falsify-taut (flist, auxlist)))

;;;;;;;TAUTOLOGYP is TAUTOLOGYP1 with AUXLIST set to NIL.

Definition: tautologyp (flist) = tautologyp1 (flist, nil)

Definition: taut-proof (flist) = taut-proof1 (flist, nil)

Theorem: form-list-append-nil make-disjunct (append (flist, nil)) = make-disjunct (flist)

Theorem: tautology-theorem (form-list (flist, symbols) ∧ tautologyp (flist) ∧ (concl = make-disjunct (flist))) → proves (taut-proof (flist), concl, given, defns, symbols)

Theorem: taut-eval2 (tautologyp1 (flist, auxlist) ∧ (concl = make-disjunct (append (flist, auxlist)))) → eval (concl, alist)

Theorem: tautologies-are-true (listp (flist) ∧ tautologyp (flist)) → eval (make-disjunct (flist), alist)

Theorem: not-taut-falsify2 (prop-atomp-list (auxlist) ∧ (¬ tautologyp1 (flist, auxlist)) ∧ (concl = make-disjunct (append (flist, auxlist)))) → (¬ eval (concl, falsify-taut (flist, auxlist)))

Theorem: truths-are-tautologies (¬ tautologyp (flist)) → (¬ eval (make-disjunct (flist), falsify-taut (flist, nil)))

Definition: lis-not (flist) = if flist ≃ nil then nil

else cons (f-not (car (flist)), lis-not (cdr (flist))) endif

Definition: taut-conseq (flist, exp) = tautologyp (append (lis-not (flist), cons (exp, nil)))

Definition: tautconseq-proof (flist, exp, pflist) = list-detach-proof (flist,

exp, pflist, taut-proof (append (lis-not (flist), cons (exp, nil))))

Event: Disable f-implies; name this event ‘g0873’.

Theorem: eval-f-implies eval (f-implies (x, y), alist) = (eval (x, alist) → eval (y, alist))

Theorem: list-implies-reduc list-implies (flist, exp) = make-disjunct (append (lis-not (flist), cons (exp, nil)))

Event: Enable f-implies; name this event ‘g0874’.

Theorem: append-exp-form-list (form-list (flist, symbols) ∧ formula (exp, symbols)) → form-list (append (lis-not (flist), cons (exp, nil)), symbols)

Theorem: eval-tautologyp eval (make-disjunct (flist), falsify-taut (flist, nil)) → tautologyp (flist)

Theorem: proves-list-form-list proves-list (pflist, flist, given, defns, symbols) → form-list (flist, symbols)

Theorem: taut-conseq-proves (formula (exp, symbols) ∧ taut-conseq (flist, exp) ∧ proves-list (pflist, flist, given, defns, symbols)) → proves (tautconseq-proof (flist, exp, pflist), exp, given, defns, symbols)

Event: Enable tautconseq-proof; name this event ‘g0276’.

Theorem: eval-tautconseq (form-list (flist, symbols) ∧ formula (exp, symbols) ∧ eval (make-disjunct (append (lis-not (flist), cons (exp, nil))),

falsify-taut (append (lis-not (flist), cons (exp, nil)), nil)))

→ taut-conseq (flist, exp)

Event: Enable taut-conseq; name this event ‘g0277’.

Event: Enable falsify-taut; name this event ‘g0282’.

;;;;;;;The lemma below is the frequently used form of the tautology theorem.
;;;;;;;It asserts that if EXP is a tautological consequence of a list of
;;;;;;;provable formulas FLIST, then EXP is provable.  "B" is the
;;;;;;;tautological consequence of {"A1",...,"An"} if "(A1->(...->(An->B)))" is
;;;;;;;a tautology.  A formula is a tautology if it evaluates to true under its
;;;;;;;falsifying assignment.

Theorem: eval-tautconseq-proof-proves (formula (exp, symbols) ∧ eval (make-disjunct (append (lis-not (flist), cons (exp, nil))),

falsify-taut (append (lis-not (flist), cons (exp, nil)), nil))

∧ proves-list (pflist, flist, given, defns, symbols)) → proves (tautconseq-proof (flist, exp, pflist), exp, given, defns, symbols)

Event: Enable taut-conseq-proves; name this event ‘g0283’.

;;;;;;;The rules below are some properties of the various logical connectives which
;;;;;;;follow as straightforward consequences of the tautology theorem.

Definition: f-iff-mp-proof1 (a, b, pf1 , pf2 ) = tautconseq-proof (list (f-iff (a, b), a), b, list (pf1 , pf2 ))

;;;;;;;The rule of detachment for `<->' (first form).

Theorem: f-iff-mp-proves1 (proves (pf1 , f-iff (a, b), given, defns, symbols) ∧ proves (pf2 , a, given, defns, symbols)) → proves (f-iff-mp-proof1 (a, b, pf1 , pf2 ), b, given, defns, symbols)

Event: Enable f-iff-mp-proof1; name this event ‘g0284’.

Definition: f-iff-mp-proof2 (a, b, pf1 , pf2 ) = tautconseq-proof (list (f-iff (a, b), b), a, list (pf1 , pf2 ))

;;;;;;;The rule of detachment for `<->' (second form).

Theorem: f-iff-mp-proves2 (proves (pf1 , f-iff (a, b), given, defns, symbols) ∧ proves (pf2 , b, given, defns, symbols)) → proves (f-iff-mp-proof2 (a, b, pf1 , pf2 ), a, given, defns, symbols)

Definition: trans-implies-proof (a, b, c, pf1 , pf2 ) = tautconseq-proof (list (f-implies (a, b), f-implies (b, c)),

f-implies (a, c), list (pf1 , pf2 ))

;;;;;;;The transitivity of `->'.

Theorem: transitivity-of-implies (proves (pf1 , f-implies (a, b), given, defns, symbols) ∧ proves (pf2 , f-implies (b, c), given, defns, symbols)) → proves (trans-implies-proof (a, b, c, pf1 , pf2 ),

f-implies (a, c), given, defns, symbols)

Event: Enable trans-implies-proof; name this event ‘g0285’.

;;;;;;;The transitivity of `<->'.

Definition: trans-f-iff-proof (a, b, c, pf1 , pf2 ) = tautconseq-proof (list (f-iff (a, b), f-iff (b, c)), f-iff (a, c), list (pf1 , pf2 ))

Theorem: transitivity-of-iff (proves (pf1 , f-iff (a, b), given, defns, symbols) ∧ proves (pf2 , f-iff (b, c), given, defns, symbols)) → proves (trans-f-iff-proof (a, b, c, pf1 , pf2 ),

f-iff (a, c), given, defns, symbols)

Event: Enable trans-f-iff-proof; name this event ‘g0286’.

Definition: and-split-proof1 (a, b, pf1 ) = tautconseq-proof (list (f-and (a, b)), a, list (pf1 ))

;;;;;;;Derive "A" from "(A and B)".

Theorem: and-split1 proves (pf1 , f-and (a, b), given, defns, symbols) → proves (and-split-proof1 (a, b, pf1 ), a, given, defns, symbols)

Definition: and-split-proof2 (a, b, pf1 ) = tautconseq-proof (list (f-and (a, b)), b, list (pf1 ))

;;;;;;;Derive "B" from "(A and B)".

Theorem: and-split2 proves (pf1 , f-and (a, b), given, defns, symbols) → proves (and-split-proof2 (a, b, pf1 ), b, given, defns, symbols)

Definition: and-join-proof (a, b, pf1 , pf2 ) = tautconseq-proof (list (a, b), f-and (a, b), list (pf1 , pf2 ))

;;;;;;;Derive "(A and B)" from "A" and "B".

Theorem: and-join (proves (pf1 , a, given, defns, symbols) ∧ proves (pf2 , b, given, defns, symbols)) → proves (and-join-proof (a, b, pf1 , pf2 ), f-and (a, b), given, defns, symbols)

Event: Enable and-split-proof1; name this event ‘g0287’.

Event: Enable and-split-proof2; name this event ‘g0288’.

Event: Enable and-join-proof; name this event ‘g0289’.

Definition: iff-split-proof1 (a, b, pf1 ) = tautconseq-proof (list (f-iff (a, b)), f-implies (a, b), list (pf1 ))

;;;;;;;Derive "(A -> B)" from "(A <-> B)".

Theorem: iff-split1 proves (pf1 , f-iff (a, b), given, defns, symbols) → proves (iff-split-proof1 (a, b, pf1 ), f-implies (a, b), given, defns, symbols)

Event: Enable iff-split-proof1; name this event ‘g0290’.

Definition: iff-split-proof2 (a, b, pf1 ) = tautconseq-proof (list (f-iff (a, b)), f-implies (b, a), list (pf1 ))

;;;;;;;Derive "(B -> A)" from "(A <-> B)".

Theorem: iff-split2 proves (pf1 , f-iff (a, b), given, defns, symbols) → proves (iff-split-proof2 (a, b, pf1 ), f-implies (b, a), given, defns, symbols)

Event: Enable iff-split-proof2; name this event ‘g0291’.

Definition: iff-join-proof (a, b, pf1 , pf2 ) = tautconseq-proof (list (f-implies (a, b), f-implies (b, a)),

f-iff (a, b), list (pf1 , pf2 ))

;;;;;;;Derive "(A <-> B)" from "(A -> B)" and "(B -> A)".

Theorem: iff-join (proves (pf1 , f-implies (a, b), given, defns, symbols) ∧ proves (pf2 , f-implies (b, a), given, defns, symbols)) → proves (iff-join-proof (a, b, pf1 , pf2 ), f-iff (a, b), given, defns, symbols)

Event: Enable iff-join-proof; name this event ‘g0292’.

Definition: contra-pos-proof1 (a, b, pf1 ) = tautconseq-proof (list (f-implies (a, b)),

f-implies (f-not (b), f-not (a)), list (pf1 ))

;;;;;;;Derive "((not B) -> (not A))" from "(A -> B)".

Theorem: contra-pos1 proves (pf1 , f-implies (a, b), given, defns, symbols) → proves (contra-pos-proof1 (a, b, pf1 ),

f-implies (f-not (b), f-not (a)), given, defns, symbols)

Event: Enable contra-pos-proof1; name this event ‘g0293’.

Definition: contra-pos-proof2 (a, b, pf ) = tautconseq-proof (list (f-implies (f-not (b), f-not (a))),

f-implies (a, b),

list (pf ))

;;;;;;;Derive "(A -> B)" from "((not B) -> (not A))".

Theorem: contra-pos2 proves (pf , f-implies (f-not (b), f-not (a)), given, defns, symbols) → proves (contra-pos-proof2 (a, b, pf ), f-implies (a, b), given, defns, symbols)

Event: Enable contra-pos-proof2; name this event ‘g0294’.

Definition: iff-commute-proof (a, b, pf ) = tautconseq-proof (list (f-iff (a, b)), f-iff (b, a), list (pf ))

;;;;;;;Derive "(B <-> A)" from "(A <-> B)".

Theorem: iff-commute-proof-proves proves (pf , f-iff (a, b), given, defns, symbols) → proves (iff-commute-proof (a, b, pf ), f-iff (b, a), given, defns, symbols)

Event: Enable iff-commute-proof; name this event ‘g0884’.

Theorem: formula-f-iff formula (f-iff (a, b), symbols) = (formula (a, symbols) ∧ formula (b, symbols))

Theorem: collect-free-f-iff (var ∈ collect-free (f-iff (a, b), 0)) = ((var ∈ collect-free (a, 0)) ∨ (var ∈ collect-free (b, 0)))

Theorem: covering-f-iff covering (f-iff (a, b), var, 0) = append (append (covering (a, var, 0), covering (b, var, 0)),

append (covering (b, var, 0), covering (a, var, 0)))

Theorem: eval-f-iff eval (f-iff (a, b), alist) = (eval (a, alist) = eval (b, alist))

Event: Enable f-iff; name this event ‘g0885’.

;;;;;;;Now we get into some rules about quantifiers.

Definition: forall-intro-proof (a, b, var, pf ) = tautconseq-proof (list (f-implies (forsome (var, f-not (b)), f-not (a))),

f-implies (a, f-not (forsome (var, f-not (b)))), list (forsome-intro-proof (var,

f-not (b), f-not (a), contra-pos-proof1 (a, b, pf ))))

Theorem: memb-member-numberp (x ∈ N) → (memb (x, y) = (x ∈ y))

;;;;;;;Derive "(A -> (forall x B))" from "(A -> B)", provided "x" does not occur free in "A".

Theorem: forall-intro-proof-proves (proves (pf , f-implies (a, b), given, defns, symbols) ∧ variable (var) ∧ (var ∉ collect-free (f-not (a), 0)) ∧ (concl = f-implies (a, ∀ var b))) → proves (forall-intro-proof (a, b, var, pf ), concl, given, defns, symbols)

Event: Enable forall-intro-proof; name this event ‘g0295’.

Definition: generalise-proof (var, a, pf1 ) = tautconseq-proof (list (f-implies (f-not (∀ var a), ∀ var a)),

∀ var a,

list (forall-intro-proof (f-not (∀ var a), a, var, tautconseq-proof (list (a),

f-implies (f-not (∀ var a), a),

list (pf1 )))))

Theorem: collect-free-flg (flg ∉ N) → (collect-free (exp, flg) = collect-free (exp, 0))

Theorem: covering-flg (flg ∉ N) → (covering (exp, var, flg) = covering (exp, var, 0))

Theorem: subst-flg (flg ∉ N) → (subst (exp, var, term, flg) = subst (exp, var, term, 0))

Theorem: variablep-collect-free (¬ variable (var)) → (var ∉ collect-free (exp, flg))

Theorem: member-del x ∉ del (x, y)

Theorem: forsome-collect-free-reduc (var ∈ N) → (var ∉ collect-free (forsome (var, exp), 0))

;;;;;;;Derive "(forall x A)" from "A".

Theorem: generalise-proof-proves (proves (pf1 , a, given, defns, symbols) ∧ variable (var) ∧ (concl = ∀ var a)) → proves (generalise-proof (var, a, pf1 ), concl, given, defns, symbols)

Event: Enable generalise-proof; name this event ‘g0300’.

Definition: subst-rule-proof (a, var, term, pf1 ) = tautconseq-proof (list (f-implies (f-not (subst (a, var, term, 0)),

forsome (var, f-not (a))),

f-not (forsome (var, f-not (a)))), subst (a, var, term, 0), list (subst-axiom-proof (f-not (a), var, term), generalise-proof (var, a, pf1 )))

;;;;;;;Derive "[t/x]A" from "A", where "t" is free for "x" in "A".

Theorem: subst-rule-proof-proves (variable (var) ∧ termp (term, 0, symbols) ∧ proves (pf1 , a, given, defns, symbols) ∧ free-for (a, var, term, 0) ∧ (a-prime = subst (a, var, term, 0))) → proves (subst-rule-proof (a, var, term, pf1 ), a-prime, given, defns, symbols)

Event: Enable subst-rule-proof; name this event ‘g0886’.

;;;;;;;"[x/x]A" is equal to "A".

Theorem: subst-var-var subst (exp, var, var, flg) = exp

Definition: e-intro-proof (var, c) = subst-axiom-proof (c, var, var)

Theorem: append-nil-intersect nil-intersect (append (x, y), z) = (nil-intersect (x, z) ∧ nil-intersect (y, z))

Theorem: var-covering-var var ∉ covering (exp, var, flg)

Theorem: nil-intersect-cons ((¬ memb (z, x)) ∧ nil-intersect (x, y)) → nil-intersect (x, cons (z, y))

Theorem: nil-intersect-nil nil-intersect (x, nil)

;;;;;;;"(C -> (forsome x C))" is a theorem.

Theorem: e-intro-proof-proves (formula (c, symbols) ∧ variable (var)) → proves (e-intro-proof (var, c),

f-implies (c, forsome (var, c)), given, defns, symbols)

Event: Enable e-intro-proof; name this event ‘g0306’.

Definition: all-elim-proof (var, c) = tautconseq-proof (list (f-implies (f-not (c), forsome (var, f-not (c)))),

f-implies (∀ var c, c),

list (e-intro-proof (var, f-not (c))))

;;;;;;;"((forall x C) -> C)" is a theorem.

Theorem: all-elim-proof-proves (formula (c, symbols) ∧ variable (var)) → proves (all-elim-proof (var, c), f-implies (∀ var c, c), given, defns, symbols)

Event: Enable all-elim-proof; name this event ‘g0307’.

Theorem: member-del1 (¬ eql (x, y)) → ((x ∈ del (y, z)) = (x ∈ z))

;;;;;;;"[t/x]A" is equal to "A", if "x" does not occur free in "A".

Theorem: subst-ident (var ∉ collect-free (exp, flg)) → (subst (exp, var, term, flg) = exp)

;;;;;;;"y" is free in "[t/x]A" iff either "y" is free in "t" and "x" is free in "A"
;;;;;;;                                or "y" is not "x" and "y" is free in "A".

Theorem: collect-free-subst (variable (var) ∧ variable (var1 ) ∧ (var ∉ covering (exp, var1 , flg))) → ((var ∈ collect-free (subst (exp, var1 , term, flg), flg))

= (((var ≠ var1 ) ∧ (var ∈ collect-free (exp, flg)))

∨ ((var1 ∈ collect-free (exp, flg)) ∧ (var ∈ collect-free (term, 0)))))

;;;;;;;If "y" is a `new' variable, the bound variables governing free occurrences
;;;;;;;of "y" in "[y/x]A" are the ones that govern free occurrences of "x" in "A".

Theorem: free-for-subst (variable (aux) ∧ variable (var) ∧ (aux ∉ collect-free (a, flg)) ∧ (aux ∉ covering (a, var, flg))) → (covering (subst (a, var, aux, flg), aux, flg) = covering (a, var, flg))

Theorem: not-free-covering (variable (var) ∧ (var ∉ collect-free (exp, flg))) → (covering (exp, var, flg) = nil)

Theorem: not-member-delete2 (x ∈ del (y, z)) = ((¬ eql (x, y)) ∧ (x ∈ z))

Theorem: collect-free-subst1 (variable (var1 ) ∧ variable (var) ∧ (var ∉ collect-free (exp, flg)) ∧ (var ∉ collect-free (term, 0))) → (var ∉ collect-free (subst (exp, var1 , term, flg), flg))

Theorem: collect-free-subst2 (variable (var) ∧ variable (var1 ) ∧ (var ≠ var1 ) ∧ (var ∈ collect-free (exp, flg))) → (var ∈ collect-free (subst (exp, var1 , term, flg), flg))

Theorem: subst-covering-unchanged (variable (var) ∧ variable (var1 ) ∧ (var ≠ var1 ) ∧ (var ∉ collect-free (term, 0))) → (covering (subst (exp, var1 , term, flg), var, flg) = covering (exp, var, flg))

Definition: var-set (list, n) = if n ≃ 0 then list = nil

else variable (car (list)) ∧ (car (list) ∉ cdr (list)) ∧ var-set (cdr (list), n − 1) endif

Theorem: nil-intersect-append nil-intersect (x, append (y, z)) = (nil-intersect (x, y) ∧ nil-intersect (x, z))

Theorem: var-set-length var-set (x, count) → var-set (x, length (x))

Theorem: nil-intersect-subst (variable (var) ∧ var-set (x, length (x)) ∧ nil-intersect (x, collect-free (exp, flg)) ∧ nil-intersect (x, collect-free (term, 0))) → nil-intersect (x, collect-free (subst (exp, var, term, flg), flg))

Theorem: nil-intersect-cons2 nil-intersect (x, cons (y, z)) = ((¬ memb (y, x)) ∧ nil-intersect (x, z))

;;;;;;;PAR-SUBST is the first definition of simultaneous substitution.
;;;;;;;It returns "[t1/x1, t2/x2,...,tn/xn]A".  It employs a list of
;;;;;;;new variables "yi" and evaluates "[t1/y1]...[tn/yn][yn/xn]...[y1/x1]A".
;;;;;;;This is in order to avoid substituting for an occurrence of an "xi"
;;;;;;;in some "tj".  This definition of simultaneous substitution while
;;;;;;;clumsy, turns out to be convenient for the proof of instantiation rule,
;;;;;;;which by necessity must be derived from the substitution rule above.

Definition: par-subst (exp, vars, terms, auxvars) = if listp (vars) ∧ listp (terms) ∧ listp (auxvars)

then subst (par-subst (subst (exp, car (vars), car (auxvars), 0), cdr (vars), cdr (terms), cdr (auxvars)),

car (auxvars), car (terms),

              0)

else exp endif

;;;;;;;The unsubstituted free variables in EXP remain free after PAR-SUBST.

Theorem: par-subst-collect-free (variable (aux) ∧ (aux ∈ collect-free (exp, 0)) ∧ var-set (auxlist, length (varlist)) ∧ var-set (varlist, length (varlist)) ∧ (aux ∉ varlist) ∧ (aux ∉ auxlist)) → (aux ∈ collect-free (par-subst (exp, varlist, termlist, auxlist), 0))

;;;;;;;The COVERING of an unsubsubstituted free variables in EXP is unchanged
;;;;;;;after PAR-SUBST, provided it does not occur free in TERMLIST.

Theorem: par-subst-covering ((length (termlist) = length (varlist)) ∧ (aux ∉ collect-free (termlist, 1)) ∧ (aux ∉ auxlist) ∧ (aux ∉ varlist) ∧ var-set (varlist, length (varlist)) ∧ var-set (auxlist, length (varlist)) ∧ variable (aux)) → (covering (par-subst (exp, varlist, termlist, auxlist), aux, 0)

= covering (exp, aux, 0))

;;;;;;;FREE-FOR-LIST checks if each term in TERMLIST is free for the corresponding
;;;;;;;variable in VARLIST, in A.

Definition: free-for-list (a, varlist, termlist) = if listp (varlist) ∧ listp (termlist)

then free-for (a, car (varlist), car (termlist), 0)

∧ free-for-list (a, cdr (varlist), cdr (termlist)) else t endif

;;;;;;;The variables covering AUX in (SUBST EXP VAR AUX 0) are the ones covering VAR
;;;;;;;in EXP, and that is unaffected by PAR-SUBST, when the hypotheses below hold.

Theorem: covering-par-subst (variable (var) ∧ variable (aux) ∧ (aux ∉ collect-free (termlist, 1)) ∧ (aux ∉ collect-free (exp, 0)) ∧ (aux ∉ covering (exp, var, 0)) ∧ (aux ∉ auxlist) ∧ (aux ∉ varlist) ∧ var-set (varlist, length (varlist)) ∧ var-set (auxlist, length (varlist)) ∧ (length (termlist) = length (varlist))) → (covering (par-subst (subst (exp, var, aux, 0), varlist, termlist, auxlist),

aux,

             0)

= covering (exp, var, 0))

;;;;;;;INST-CONDITIONS lays down the various conditions for PAR-SUBST to be a proper
;;;;;;;simultaneous substitution: (1) VARS and AUXVARS must be sets of variables,
;;;;;;;(2) TERMS must be a list of terms, (3) AUXVARS must be a list of new variables,
;;;;;;;(4) the AUXVARS must be free the respective VARS in A, and (5) the TERMS must
;;;;;;;be free for the respective VARS in A.

Definition: inst-conditions (a, vars, terms, auxvars, symbols) = (var-set (vars, length (vars))

∧ var-set (auxvars, length (vars)) ∧ termp (terms, 1, symbols) ∧ (length (terms) = length (vars)) ∧ nil-intersect (auxvars, collect-free (terms, 1)) ∧ nil-intersect (auxvars, collect-free (a, 0)) ∧ nil-intersect (auxvars, vars) ∧ free-for-list (a, vars, auxvars) ∧ free-for-list (a, vars, terms))

;;;;;;;FREE-FOR-LIST is unaffected by an irrelevant substitution into A.

Theorem: free-for-list-elim (variable (var) ∧ variable (aux) ∧ var-set (vars, length (vars)) ∧ (var ∉ vars) ∧ (aux ∉ vars) ∧ free-for-list (a, vars, terms)) → free-for-list (subst (a, var, aux, 0), vars, terms)

;;;;;;;PAR-SUBST-PROOF constructs the proof of the instance of A, given the proof of A.

Definition: par-subst-proof (a, vars, terms, auxvars, pf1 ) = if listp (vars) ∧ listp (terms) ∧ listp (auxvars)

then subst-rule-proof (par-subst (subst (a, car (vars), car (auxvars), 0), cdr (vars), cdr (terms), cdr (auxvars)),

car (auxvars), car (terms), par-subst-proof (subst (a,

car (vars), car (auxvars), 0), cdr (vars), cdr (terms), cdr (auxvars), subst-rule-proof (a,

car (vars), car (auxvars), pf1 )))

else pf1 endif

;;;;;;;The lemma below is the first form of the Instantiation Rule.
;;;;;;;It asserts that if A is provable, so is any instance of it as
;;;;;;;constructed by PAR-SUBST.

Theorem: par-subst-proof-proves (inst-conditions (a, vars, terms, auxvars, symbols) ∧ proves (pf1 , a, given, defns, symbols)) → proves (par-subst-proof (a, vars, terms, auxvars, pf1 ),

par-subst (a, vars, terms, auxvars), given,

defns, symbols)

;;;;;;;Since PAR-SUBST is not a very efficient way to carry out simultaneous
;;;;;;;substitution, we will prove it to be equivalent to a different
;;;;;;;form of simultaneous substitution.

Definition: del-pairs (var, vars, terms) = if listp (vars) ∧ listp (terms)

then if eql (car (vars), var) then del-pairs (var, cdr (vars), cdr (terms))

else cons (car (terms), del-pairs (var, cdr (vars), cdr (terms))) endif else terms endif

Definition: getsub (var, vars, terms) = if listp (vars) ∧ listp (terms)

then if eql (car (vars), var) then car (terms)

else getsub (var, cdr (vars), cdr (terms)) endif else var endif

Theorem: del-pairs-getsub variable (var) → (getsub (var, del (var, vars), del-pairs (var, vars, terms)) = var)

;;;;;;;PARALLEL-SUBST below is the more efficient form of simultaneous substitution.
;;;;;;;It recurses down EXP and replaces any free occurrence of a variable in
;;;;;;;VARS by the corresponding term in TERMS.

Definition: parallel-subst (exp, vars, terms, flg) = if flg ≃ 0

then if variable (exp) then getsub (exp, vars, terms)

elseif f-notp (exp)

then f-not (parallel-subst (arg (exp), vars, terms, 0))

elseif f-orp (exp)

then f-or (parallel-subst (arg1 (exp), vars, terms, 0),

parallel-subst (arg2 (exp), vars, terms, 0))

elseif forsomep (exp) then forsome (bind (exp),

parallel-subst (body (exp), del (bind (exp), vars), del-pairs (bind (exp), vars, terms), 0))

elseif listp (exp) then cons (car (exp), parallel-subst (cdr (exp), vars, terms, 1)) else exp endif

elseif listp (exp)

then cons (parallel-subst (car (exp), vars, terms, 0),

parallel-subst (cdr (exp), vars, terms, 1))

else exp endif

Theorem: getsub-not-memb (¬ memb (var, varlist)) → (getsub (var, varlist, terms) = var)

Theorem: eql-trans (eql (x, y) ∧ eql (y, z)) → eql (x, z)

Theorem: getsub-del-pairs (getsub (var, vars, terms) = var) → (getsub (var, del (var1 , vars), del-pairs (var1 , vars, terms)) = var)

Event: Enable eql-trans; name this event ‘g0636’.

;;;;;;;The lemma below asserts that the effect of a single substitution
;;;;;;;followed by a simultaneous substitution, can be got by extending the
;;;;;;;simultaneous substitution.

Theorem: newvar-unchanged-by-parallel-subst ((getsub (newvar, vars, terms) = newvar) ∧ variable (var) ∧ variable (newvar)) → (parallel-subst (subst (exp, var, newvar, flg), vars, terms, flg)

= parallel-subst (exp, cons (var, vars), cons (newvar, terms), flg))

Theorem: not-free-in-terms-step (variable (var) ∧ variable (newvar) ∧ (newvar ≠ var) ∧ (newvar ∉ collect-free (terms, 1))) → (newvar ∉ collect-free (getsub (var, vars, terms), 0))

Theorem: collect-terms-del-pairs (newvar ∉ collect-free (terms, 1)) → (newvar ∉ collect-free (del-pairs (var, vars, terms), 1))

Theorem: collect-free-parallel-subst (variable (newvar) ∧ (newvar ∉ collect-free (exp, flg)) ∧ (newvar ∉ collect-free (terms, 1))) → (newvar ∉ collect-free (parallel-subst (exp, vars, terms, flg), flg))

Theorem: parallel-subst-not-free-var (variable (var) ∧ (var ∉ collect-free (exp, flg))) → (parallel-subst (exp, cons (var, vars), cons (term, terms), flg)

= parallel-subst (exp, vars, terms, flg))

Theorem: subst-parallel-subst (variable (newvar) ∧ (newvar ∉ collect-free (exp, flg)) ∧ (newvar ∉ collect-free (terms, 1))) → (subst (parallel-subst (exp, vars, terms, flg), newvar, newterm, flg)

= parallel-subst (exp, vars, terms, flg))

;;;;;;;A PARALLEL-SUBST where VAR is replaced by NEWVAR, followed by a single substitution
;;;;;;;where NEWVAR is replaced by NEWTERM, is equivalent to the same PARALLEL-SUBST
;;;;;;;with VAR replaced by NEWTERM instead.

Theorem: parallel-subst-subst (variable (newvar) ∧ variable (var) ∧ (newvar ∉ collect-free (exp, flg)) ∧ (newvar ∉ collect-free (terms, 1)) ∧ (newvar ∉ covering (exp, var, flg))) → (subst (parallel-subst (exp, cons (var, vars), cons (newvar, terms), flg),

newvar, newterm, flg)

= parallel-subst (exp, cons (var, vars), cons (newterm, terms), flg))

;;;;;;;A null parallel-substitution leaved EXP unchanged.

Theorem: parallel-subst-nil ((vars ≃ nil) ∨ (terms ≃ nil)) → (parallel-subst (exp, vars, terms, flg) = exp)

;;;;;;;Finally, the desired lemma that PAR-SUBST is equivalent to PARALLEL-SUBST,
;;;;;;;if the hypothesis conditions hold.

Theorem: parallel-subst-same-as-par-subst (var-set (vars, length (vars)) ∧ var-set (auxvars, length (auxvars)) ∧ (length (auxvars) = length (vars)) ∧ nil-intersect (auxvars, vars) ∧ free-for-list (exp, vars, auxvars) ∧ nil-intersect (auxvars, collect-free (terms, 1)) ∧ nil-intersect (auxvars, collect-free (exp, 0))) → (par-subst (exp, vars, terms, auxvars)

= parallel-subst (exp, vars, terms, 0))

;;;;;;;We still have to show that list of new variables AUXVARS can be constructed.
;;;;;;;That is done in the sequence of events (definitions and lemmas) below.

Definition: make-newvars (index, number) = if number ≃ 0 then nil

else cons (1 + index, make-newvars (1 + index, number − 1)) endif

Definition: find-hi-index (varlist) = if listp (varlist)

then if car (varlist) < find-hi-index (cdr (varlist)) then find-hi-index (cdr (varlist)) else fix (car (varlist)) endif

else 0 endif

Definition: make-auxvars (varlist, number) = make-newvars (find-hi-index (varlist), number)

Theorem: not-member-varlist (find-hi-index (varlist) < var) → (var ∉ varlist)

Theorem: newvars-make-newvars (find-hi-index (varlist) ≤ index) → nil-intersect (make-newvars (index, number), varlist)

Theorem: var-set-make-newvars-step (var ≤ index) → (var ∉ make-newvars (index, number))

Theorem: append-var-list (var-list (x, length (x)) ∧ var-list (y, length (y))) → var-list (append (x, y), length (append (x, y)))

Definition: covering-list (exp, vars, flg) = if listp (vars)

then append (covering (exp, car (vars), flg),

covering-list (exp, cdr (vars), flg))

else nil endif

Theorem: free-for-list-newvars-covering-list (var-set (newvars, length (newvars)) ∧ nil-intersect (newvars, covering-list (exp, vars, 0))) → free-for-list (exp, vars, newvars)

Theorem: var-list-var-set var-set (vars, length) → var-list (vars, length)

Theorem: find-hi-index-append find-hi-index (append (list1 , list2 )) = if find-hi-index (list1 ) < find-hi-index (list2 )

then find-hi-index (list2 ) else find-hi-index (list1 ) endif

Definition: collect-vars (exp, vars, terms) = append (vars,

append (collect-free (terms, 1), append (collect-free (exp, 0), covering-list (exp, vars, 0))))

Theorem: nil-intersect-newvars-vars nil-intersect (make-newvars (find-hi-index (collect-vars (exp, vars, terms)),

length),

vars)

Theorem: nil-intersect-newvars-terms nil-intersect (make-newvars (find-hi-index (collect-vars (exp, vars, terms)),

length),

collect-free (terms, 1))

Theorem: nil-intersect-newvars-exp nil-intersect (make-newvars (find-hi-index (collect-vars (exp, vars, terms)),

length),

collect-free (exp, 0))

Theorem: var-set-make-newvars-again var-set (make-newvars (index, number), number)

Theorem: length-make-newvars length (make-newvars (x, n)) = fix (n)

Theorem: free-for-list-newvars-exp free-for-list (exp,

vars,

make-newvars (find-hi-index (collect-vars (exp, vars, terms)), length))

Event: Enable make-newvars; name this event ‘g0347’.

Definition: instance-proof (a, vars, terms, pf1 ) = par-subst-proof (a,

vars, terms, make-auxvars (collect-vars (a, vars, terms), length (vars)), pf1 )

Theorem: par-subst-proof-proves1 ((concl = par-subst (a, vars, terms, auxvars)) ∧ inst-conditions (a, vars, terms, auxvars, symbols) ∧ proves (pf1 , a, given, defns, symbols)) → proves (par-subst-proof (a, vars, terms, auxvars, pf1 ),

concl, given, defns, symbols)

Event: Enable par-subst-proof; name this event ‘g0346’.

Event: Enable find-hi-index; name this event ‘g0350’.

Event: Enable find-hi-index-append; name this event ‘g0351’.

;;;;;;;The Instantiation Rule can then be phrased as shown below, in terms
;;;;;;;of PARALLEL-SUBST instead of PAR-SUBST.

Theorem: instance-proof-proves ((a-prime = parallel-subst (a, vars, terms, 0)) ∧ var-set (vars, length (vars)) ∧ termp (terms, 1, symbols) ∧ (length (terms) = length (vars)) ∧ free-for-list (a, vars, terms) ∧ proves (pf1 , a, given, defns, symbols)) → proves (instance-proof (a, vars, terms, pf1 ), a-prime, given, defns, symbols)

Definition: list-exis-quantify (vars, a) = if listp (vars)

then forsome (car (vars), list-exis-quantify (cdr (vars), a))

else a endif

Theorem: not-member-del-pairs (¬ memb (x, y)) → (del-pairs (x, y, z) = z)

Theorem: not-member-delete-equals (¬ memb (x, y)) → (del (x, y) = y)

Definition: pairlist (vars, terms) = if listp (vars) ∧ listp (terms)

then cons (cons (car (vars), car (terms)), pairlist (cdr (vars), cdr (terms))) else nil endif

Theorem: parallel-subst-list-exis-quant var-set (vars, length (vars)) → (parallel-subst (list-exis-quantify (vars, a), vars, terms, 0)

= list-exis-quantify (vars, a))

Definition: list-e-intro-proof (varlist, a) = if listp (varlist)

then if listp (cdr (varlist))

then trans-implies-proof (a, list-exis-quantify (cdr (varlist), a), list-exis-quantify (varlist, a), list-e-intro-proof (cdr (varlist), a), e-intro-proof (car (varlist),

list-exis-quantify (cdr (varlist),

a)))

else e-intro-proof (car (varlist), a) endif else prop-axiom-proof (a) endif

Theorem: formula-list-exis (formula (a, symbols) ∧ var-set (vars, length (vars))) → formula (list-exis-quantify (vars, a), symbols)

Event: Enable instance-proof; name this event ‘g0353’.

Event: Disable f-implies; name this event ‘g0354’.

Theorem: a-implies-a formula (a, symbols) → proves (prop-axiom-proof (a), f-implies (a, a), given, defns, symbols)

Theorem: parallel-subst-f-implies parallel-subst (f-implies (a, b), vars, terms, 0) = f-implies (parallel-subst (a, vars, terms, 0),

parallel-subst (b, vars, terms, 0))

Theorem: subst-f-implies subst (f-implies (x, y), var, term, 0) = f-implies (subst (x, var, term, 0), subst (y, var, term, 0))

Event: Enable f-implies; name this event ‘g0355’.

;;;;;;;The iterated forsome-introduction rule:
;;;;;;;   "A -> (forsome x1 (...(forsome xn A)))".

Theorem: list-e-intro-proof-proves1 (var-set (varlist, length (varlist)) ∧ formula (a, symbols)) → proves (list-e-intro-proof (varlist, a),

f-implies (a, list-exis-quantify (varlist, a)), given, defns, symbols)

Event: Enable list-e-intro-proof; name this event ‘g0348’.

Theorem: list-e-intro-proof-proves (var-set (varlist, length (varlist)) ∧ formula (a, symbols) ∧ (a-prime = list-exis-quantify (varlist, a))) → proves (list-e-intro-proof (varlist, a),

f-implies (a, a-prime),

given, defns, symbols)

Definition: subst-thm-a-proof (a, vars, terms) = instance-proof (f-implies (a, list-exis-quantify (vars, a)),

vars, terms, list-e-intro-proof (vars, a))

Theorem: not-free-list-exis (var-set (vars, length (vars)) ∧ (var ∈ vars)) → (var ∉ collect-free (list-exis-quantify (vars, a), 0))

Theorem: not-memb-del2 (¬ memb (x, y)) → (¬ memb (x, del (z, y)))

Theorem: covering-list-exis (var-set (vars, length (vars)) ∧ (var ∈ vars) ∧ (var ∈ N)) → (covering (list-exis-quantify (vars, a), var, 0) = nil)

Theorem: free-for-list-step1 (var-set (vars, length (vars)) ∧ var-set (bvars, length (bvars)) ∧ subset (vars, bvars) ∧ free-for-list (a, vars, terms)) → free-for-list (f-implies (a, list-exis-quantify (bvars, a)), vars, terms)

;;;;;;;The first substitution theorem:
;;;;;;; "[t1/x1, t2/x2,...,tn/xn]A -> (forsome x1 (...(forsome xn A)))".

Theorem: subst-thm-a (var-set (vars, length (vars)) ∧ termp (terms, 1, symbols) ∧ (length (terms) = length (vars)) ∧ free-for-list (a, vars, terms) ∧ formula (a, symbols) ∧ (a-prime = f-implies (parallel-subst (a, vars, terms, 0),

list-exis-quantify (vars, a))))

→ proves (subst-thm-a-proof (a, vars, terms), a-prime, given, defns, symbols)

Event: Enable subst-thm-a-proof; name this event ‘g0356’.

Definition: list-all-quantify (vars, a) = if listp (vars) then ∀ car, vars list-all-quantify (cdr (vars), a)

else a endif

Theorem: parallel-subst-list-all-quant var-set (vars, length (vars)) → (parallel-subst (list-all-quantify (vars, a), vars, terms, 0)

= list-all-quantify (vars, a))

Definition: list-all-elim-proof (vars, a) = if listp (vars)

then if cdr (vars) ≃ nil then all-elim-proof (car (vars), a) else trans-implies-proof (list-all-quantify (vars, a),

list-all-quantify (cdr (vars), a),

a,

all-elim-proof (car (vars),

list-all-quantify (cdr (vars),

a)),

list-all-elim-proof (cdr (vars), a)) endif

else prop-axiom-proof (a) endif Theorem: formula-list-all-quant (var-set (vars, length (vars)) ∧ formula (a, symbols)) → formula (list-all-quantify (vars, a), symbols)

Theorem: all-elim-proof-proves-again (variable (var) ∧ formula (a, symbols) ∧ (a-prime = f-implies (∀ var a, a))) → proves (all-elim-proof (var, a), a-prime, given, defns, symbols)

Theorem: list-all-elim-proof-proves1 (var-set (vars, length (vars)) ∧ formula (a, symbols)) → proves (list-all-elim-proof (vars, a),

f-implies (list-all-quantify (vars, a), a), given, defns, symbols)

Event: Enable list-all-elim-proof; name this event ‘g0357’.

Theorem: not-free-list-all (var-set (vars, length (vars)) ∧ (var ∈ vars)) → (var ∉ collect-free (list-all-quantify (vars, a), 0))

Theorem: covering-list-all (var-set (vars, length (vars)) ∧ (var ∈ vars) ∧ (var ∈ N)) → (covering (list-all-quantify (vars, a), var, 0) = nil)

Theorem: free-for-list-step2 (var-set (vars, length (vars)) ∧ var-set (bvars, length (bvars)) ∧ subset (vars, bvars) ∧ free-for-list (a, vars, terms)) → free-for-list (f-implies (list-all-quantify (bvars, a), a), vars, terms)

Definition: subst-thm-b-proof (a, vars, terms) = instance-proof (f-implies (list-all-quantify (vars, a), a),

vars, terms, list-all-elim-proof (vars, a))

Theorem: list-all-elim-proof-proves (var-set (vars, length (vars)) ∧ formula (a, symbols) ∧ (a-prime = f-implies (list-all-quantify (vars, a), a))) → proves (list-all-elim-proof (vars, a), a-prime, given, defns, symbols)

;;;;;;;The second substitution theorem:
;;;;;;;    "(forall x1 (...(forall xn A))) -> [t1/x1, ..., tn/xn]A".

Theorem: subst-thm-b (var-set (vars, length (vars)) ∧ termp (terms, 1, symbols) ∧ (length (terms) = length (vars)) ∧ formula (a, symbols) ∧ free-for-list (a, vars, terms) ∧ (a-prime = f-implies (list-all-quantify (vars, a),

parallel-subst (a, vars, terms, 0))))

→ proves (subst-thm-b-proof (a, vars, terms), a-prime, given, defns, symbols)

Event: Enable subst-thm-b-proof; name this event ‘g0358’.

Definition: distrib-rule-proof-a (var, a, b, pf1 ) = forsome-intro-proof (var,

a,

forsome (var, b),

trans-implies-proof (a, b, forsome (var, b), pf1 , e-intro-proof (var, b)))

;;;;;;;The first distribution rule:  Derive "(forsome x A) -> (forsome x B)" from "A -> B".

Theorem: distrib-rule-proof-a-proves (variable (var) ∧ proves (pf1 , f-implies (a, b), given, defns, symbols)) → proves (distrib-rule-proof-a (var, a, b, pf1 ),

f-implies (forsome (var, a), forsome (var, b)), given, defns, symbols)

Event: Enable distrib-rule-proof-a; name this event ‘g0360’.

Definition: distrib-rule-proof-b (var, a, b, pf1 ) = forall-intro-proof (∀ var a,

b, var, trans-implies-proof (∀ var a, a, b, all-elim-proof (var, a), pf1 ))

;;;;;;;The second distribution rule:  Derive "(forall x A) -> (forall x B)" from "A -> B".

Theorem: distrib-rule-proof-b-proves (variable (var) ∧ proves (pf , f-implies (a, b), given, defns, symbols) ∧ (a-prime = f-implies (∀ var a, ∀ var b))) → proves (distrib-rule-proof-b (var, a, b, pf ), a-prime, given, defns, symbols)

Event: Enable distrib-rule-proof-b; name this event ‘g0361’.

Theorem: formula-forall formula (∀ var exp, symbols) = formula (exp, symbols)

Theorem: collect-free-forsome variable (var) → (collect-free (forsome (var, exp), 0) = del (var, collect-free (exp, 0)))

Theorem: collect-free-forall variable (var) → (collect-free (∀ var exp, 0) = del (var, collect-free (exp, 0)))

Theorem: covering-forall variable (var) → (covering (∀ var exp, x, 0)

= if memb (x, collect-free (∀ var exp, 0)) then cons (var, covering (exp, x, 0)) else nil endif)

Theorem: parallel-subst-forall variable (var) → (parallel-subst (∀ var exp, vars, terms, 0)

= ∀ var parallel-subst (exp, del (var, vars), del-pairs (var, vars, terms), 0))

Theorem: subst-forall variable (var) → (subst (∀ var exp, x, term, 0)

= if var = x then ∀ var exp else ∀ var subst (exp, x, term, 0) endif)

Event: Enable forall; name this event ‘g0363’.

Definition: list-f-iff (lhs, rhs) = if listp (lhs) ∧ listp (rhs)

then cons (f-iff (car (lhs), car (rhs)), list-f-iff (cdr (lhs), cdr (rhs))) else nil endif

Definition: f-iff-distrib-rule-a-proof (var, a, a-prime, pf ) = iff-join-proof (forsome (var, a),

forsome (var, a-prime), distrib-rule-proof-a (var,

a,

a-prime,

iff-split-proof1 (a, a-prime, pf )),

distrib-rule-proof-a (var, a-prime, a, iff-split-proof2 (a, a-prime, pf )))

Theorem: f-iff-distrib-rule-a-proof-proves (proves (pf , f-iff (a, a-prime), given, defns, symbols) ∧ variable (var)) → proves (f-iff-distrib-rule-a-proof (var, a, a-prime, pf ),

f-iff (forsome (var, a), forsome (var, a-prime)), given, defns, symbols)

Definition: not-iff-proof (a, b, pf ) = tautconseq-proof (list (f-iff (a, b)), f-iff (f-not (a), f-not (b)), list (pf ))

Theorem: not-iff-proof-proves proves (pf , f-iff (a, b), given, defns, symbols) → proves (not-iff-proof (a, b, pf ),

f-iff (f-not (a), f-not (b)),

given, defns, symbols)

Event: Enable not-iff-proof; name this event ‘g0317’.

Event: Enable f-iff-distrib-rule-a-proof; name this event ‘g0318’.

Definition: or-iff-proof (a1 , a2 , b1 , b2 , pf1 , pf2 ) = tautconseq-proof (list (f-iff (a1 , b1 ), f-iff (a2 , b2 )),

f-iff (f-or (a1 , a2 ), f-or (b1 , b2 )), list (pf1 , pf2 ))

Theorem: or-iff-proof-proves (proves (pf1 , f-iff (a1 , b1 ), given, defns, symbols) ∧ proves (pf2 , f-iff (a2 , b2 ), given, defns, symbols)) → proves (or-iff-proof (a1 , a2 , b1 , b2 , pf1 , pf2 ),

f-iff (f-or (a1 , a2 ), f-or (b1 , b2 )), given, defns, symbols)

Event: Enable or-iff-proof; name this event ‘g0319’.

;;;;;;;EQN-FORM checks if A and A-PRIME are identical modulo the equivalences
;;;;;;;given in the list GIVEN.  It is used to prove the equivalence theorem.

Definition: eqn-form (a-prime, a, given) = if a-prime = a then t

elseif f-iff (a, a-prime) ∈ given then t elseif f-notp (a) ∧ f-notp (a-prime) then eqn-form (arg (a-prime), arg (a), given) elseif f-orp (a) ∧ f-orp (a-prime) then eqn-form (arg1 (a-prime), arg1 (a), given)

∧ eqn-form (arg2 (a-prime), arg2 (a), given) elseif forsomep (a) ∧ forsomep (a-prime) then (bind (a) = bind (a-prime))

∧ eqn-form (body (a-prime), body (a), given) else f endif

Definition: getpf (x, y, z) = if listp (y) ∧ listp (z)

then if x = car (y) then car (z)

else getpf (x, cdr (y), cdr (z)) endif else x endif

Theorem: getpf-proves (proves-list (pflist, list, given, defns, symbols) ∧ (concl ∈ list)) → proves (getpf (concl, list, pflist), concl, given, defns, symbols)

Event: Disable proves; name this event ‘g0596’.

Theorem: eql-trans2 (eql (x, z) ∧ eql (y, z)) → eql (x, y)

Theorem: eql-trans3 (eql (x, y) ∧ eql (x, z)) → eql (y, z)

Theorem: proves-eql (proves (pf , conc1 , given, defns, symbols) ∧ eql (conc1 , conc2 ) ∧ formula (conc2 , symbols)) → proves (pf , conc2 , given, defns, symbols)

Event: Enable proves; name this event ‘g0598’.

Theorem: getsub-proves (proves-list (pflist, list, given, defns, symbols) ∧ memb (concl, list) ∧ formula (concl, symbols)) → proves (getsub (concl, list, pflist), concl, given, defns, symbols)

Event: Enable proves-eql; name this event ‘g0600’.

;;;;;;;EQN-FORM-PROOF is the proof-constructor which constructs the proof of the
;;;;;;;equivalence of A and A-PRIME from the proofs of the equivalences in GIVEN.

Definition: eqn-form-proof (a-prime, a, given, pflist) = if a-prime = a then tautconseq-proof (nil, f-iff (a, a), nil)

elseif f-iff (a, a-prime) ∈ given

then getpf (f-iff (a, a-prime), given, pflist)

elseif f-notp (a) ∧ f-notp (a-prime)

then not-iff-proof (arg (a), arg (a-prime), eqn-form-proof (arg (a-prime), arg (a), given, pflist))

elseif f-orp (a) ∧ f-orp (a-prime)

then or-iff-proof (arg1 (a), arg2 (a), arg1 (a-prime), arg2 (a-prime), eqn-form-proof (arg1 (a-prime), arg1 (a), given, pflist), eqn-form-proof (arg2 (a-prime), arg2 (a), given, pflist)) elseif forsomep (a) ∧ forsomep (a-prime) then f-iff-distrib-rule-a-proof (bind (a),

body (a),

body (a-prime),

eqn-form-proof (body (a-prime), body (a), given, pflist))

else nil endif

;;;;;;;The equivalence theorem:  If A and A-PRIME are identical modulo the
;;;;;;;proven equivalences in GIVEN (whose proofs are in PFLIST), then
;;;;;;; "A <-> A-PRIME" is provable.

Theorem: eqn-form-proof-proves1 (formula (f-iff (a, a-prime), symbols) ∧ eqn-form (a-prime, a, list) ∧ proves-list (pflist, list, given, defns, symbols)) → proves (eqn-form-proof (a-prime, a, list, pflist),

f-iff (a, a-prime), given, defns, symbols)

Event: Enable eqn-form-proof; name this event ‘g0338’.

Definition: elim-link-proof (x, y, z, pf1 , pf2 ) = tautconseq-proof (list (f-implies (x, f-implies (y, z)), f-implies (x, y)),

f-implies (x, z), list (pf1 , pf2 ))

Theorem: elim-link-proof-proves (proves (pf1 , f-implies (x, f-implies (y, z)), given, defns, symbols) ∧ proves (pf2 , f-implies (x, y), given, defns, symbols)) → proves (elim-link-proof (x, y, z, pf1 , pf2 ),

f-implies (x, z), given, defns, symbols)

Event: Enable elim-link-proof; name this event ‘g0499’.

Definition: elim-args-proof (hyp, args, exp, pflist, pf ) = if listp (args)

then elim-args-proof (hyp, cdr (args), exp, cdr (pflist), elim-link-proof (hyp,

car (args),

list-implies (cdr (args), exp), pf , car (pflist)))

else pf endif

Definition: dist-f-implies (hyp, list) = if listp (list)

then cons (f-implies (hyp, car (list)), dist-f-implies (hyp, cdr (list)))

else nil endif

Event: Enable list-implies-reduc; name this event ‘g0506’.

Theorem: elim-args-proof-proves (formula (exp, symbols) ∧ proves-list (pflist, dist-f-implies (hyp, args), given, defns, symbols) ∧ proves (pf , f-implies (hyp, list-implies (args, exp)), given, defns, symbols)) → proves (elim-args-proof (hyp, args, exp, pflist, pf ),

f-implies (hyp, exp), given, defns, symbols)

Event: Enable elim-args-proof; name this event ‘g0507’.

Definition: symmetry-proof1 (x, y) = tautconseq-proof (list (f-equal (x, x),

f-implies (f-equal (x, y),

f-implies (f-equal (x, x),

f-implies (f-equal (x, x),

f-equal (y, x))))),

f-implies (f-equal (x, y), f-equal (y, x)), list (ident-axiom-proof (x),

equal-axiom2-proof (p (0, 2), list (x, x), list (y, x))))

Event: Disable f-equal; name this event ‘g0365’.

Theorem: equal-equal-axiom2 formula (f-implies (f-equal (x, y),

f-implies (f-equal (u, v),

f-implies (f-equal (x, u), f-equal (y, v)))),

symbols) → proves (equal-axiom2-proof (p (0, 2), list (x, u), list (y, v)),

f-implies (f-equal (x, y),

f-implies (f-equal (u, v),

f-implies (f-equal (x, u), f-equal (y, v)))),

given, defns, symbols)

Event: Enable f-equal; name this event ‘g0368’.

;;;;;;;The symmetry theorem: "(x = y) -> (y = x)"
;;;;;;;The next few events lead up to the proof of the equality theorem.

Theorem: symmetry-theorem1 formula (f-equal (x, y), symbols) → proves (symmetry-proof1 (x, y),

f-implies (f-equal (x, y), f-equal (y, x)), given, defns, symbols)

Event: Enable symmetry-proof1; name this event ‘g0372’.

Definition: list-f-and (list) = if listp (list)

then if listp (cdr (list)) then f-and (car (list), list-f-and (cdr (list)))

else car (list) endif else nil endif

Theorem: formula-list-f-and (form-list (list, symbols) ∧ listp (list)) → formula (list-f-and (list), symbols)

Definition: list-f-and-member-proof (x, list)

= if listp (list)

then if listp (cdr (list))

then if x = car (list)

then tautconseq-proof (nil,

f-implies (f-and (x,

list-f-and (cdr (list))), x),

nil)

else tautconseq-proof (list (f-implies (list-f-and (cdr (list)),

x)), f-implies (list-f-and (list), x), list (list-f-and-member-proof (x,

cdr (list)))) endif

else tautconseq-proof (nil, f-implies (x, x), nil) endif else nil endif

Theorem: list-f-and-member-proof-proves (form-list (list, symbols) ∧ (x ∈ list) ∧ formula (x, symbols)) → proves (list-f-and-member-proof (x, list),

f-implies (list-f-and (list), x), given, defns, symbols)

Event: Enable list-f-and; name this event ‘g0508’.

Definition: add-hyp-proof (hyp, exp, pf ) = tautconseq-proof (list (exp), f-implies (hyp, exp), list (pf ))

Theorem: add-hyp-proof-proves (formula (hyp, symbols) ∧ proves (pf , exp, given, defns, symbols)) → proves (add-hyp-proof (hyp, exp, pf ),

f-implies (hyp, exp),

given, defns, symbols)

Event: Enable add-hyp-proof; name this event ‘g0509’.

Definition: list-f-equal (lista, listb) = if listp (lista) ∧ listp (listb)

then cons (f-equal (car (lista), car (listb)),

list-f-equal (cdr (lista), cdr (listb)))

else nil endif

Definition: flg-f-implies-equal (hyp, terma, termb, flg) = if flg ≃ 0 then f-implies (hyp, f-equal (terma, termb))

else dist-f-implies (hyp, list-f-equal (terma, termb)) endif

Definition: flg-proves (pf , exp, given, defns, symbols, flg) = if flg ≃ 0 then proves (pf , exp, given, defns, symbols)

else proves-list (pf , exp, given, defns, symbols) endif

Definition: term-list (terms, symbols) = if listp (terms)

then termp (car (terms), 0, symbols) ∧ term-list (cdr (terms), symbols) else t endif

Definition: flg-termp (term, flg, symbols) = if flg ≃ 0 then termp (term, 0, symbols)

else term-list (term, symbols) endif

Theorem: termp-term-list termp (exp, 1, symbols) → term-list (exp, symbols)

Theorem: pairequals-reduc pairequals (vars1 , vars2 , exp) = list-implies (list-f-equal (vars1 , vars2 ), exp)

Theorem: formula-list-implies1 formula (list-implies (list, exp), symbols) = (form-list (list, symbols) ∧ formula (exp, symbols))

Theorem: form-list-f-equal (term-list (terms1 , symbols) ∧ term-list (terms2 , symbols)) → form-list (list-f-equal (terms1 , terms2 ), symbols)

Definition: symmetry-proof (a, b) = iff-join-proof (f-equal (a, b),

f-equal (b, a),

symmetry-proof1 (a, b), symmetry-proof1 (b, a))

Theorem: symmetry-theorem formula (f-equal (a, b), symbols) → proves (symmetry-proof (a, b),

f-iff (f-equal (a, b), f-equal (b, a)), given, defns, symbols)

Event: Enable symmetry-proof; name this event ‘g0373’.

Definition: commute-equal-proof (x, y, pf ) = detach-proof (f-equal (x, y), f-equal (y, x), pf , symmetry-proof1 (x, y))

Theorem: commute-equal-proof-proves (proves (pf , f-equal (x, y), given, defns, symbols) ∧ (concl = f-equal (y, x))) → proves (commute-equal-proof (x, y, pf ), concl, given, defns, symbols)

Event: Enable commute-equal-proof; name this event ‘g0370’.

Definition: list-commute-equal-proof (lista, listb, pflist) = if listp (lista) ∧ listp (listb)

then cons (commute-equal-proof (car (lista), car (listb), car (pflist)),

list-commute-equal-proof (cdr (lista), cdr (listb), cdr (pflist)))

else nil endif

Theorem: list-commute-equal-proof-proves proves-list (pflist, list-f-equal (lista, listb), given, defns, symbols) → proves-list (list-commute-equal-proof (lista, listb, pflist),

list-f-equal (listb, lista), given, defns, symbols)

Event: Enable list-commute-equal-proof; name this event ‘g0371’.

Definition: forall-over-implies-proof (x, a, b) = tautconseq-proof (list (f-implies (forsome (x, a),

f-implies (∀ x f-implies (a, b),

forsome (x, b)))),

f-implies (∀ x f-implies (a, b),

f-implies (forsome (x, a), forsome (x, b))),

list (forsome-intro-proof (x, a, f-implies (∀ x f-implies (a, b),

forsome (x, b)),

tautconseq-proof (list (f-implies (∀ x f-implies (a,

b),

f-implies (a,

b)),

f-implies (b,

forsome (x,

b))),

f-implies (a,

f-implies (∀ x f-implies (a,

b),

forsome (x,

b))),

list (all-elim-proof (x,

f-implies (a,

b)),

e-intro-proof (x, b))))))

Theorem: forall-over-implies-proof-proves (variable (x) ∧ formula (a, symbols) ∧ formula (b, symbols)) → proves (forall-over-implies-proof (x, a, b),

f-implies (∀ x f-implies (a, b),

f-implies (forsome (x, a), forsome (x, b))),

given, defns, symbols)

Event: Enable forall-over-implies-proof; name this event ‘g0910’.

Definition: forall-over-iff-proof (x, a, b) = tautconseq-proof (list (f-implies (forsome (x, a),

f-implies (∀ x f-iff (a, b), forsome (x, b))),

f-implies (forsome (x, b),

f-implies (∀ x f-iff (a, b), forsome (x, a)))),

f-implies (∀ x f-iff (a, b),

f-iff (forsome (x, a), forsome (x, b))),

list (forsome-intro-proof (x, a, f-implies (∀ x f-iff (a, b),

forsome (x, b)),

tautconseq-proof (list (f-implies (∀ x f-iff (a,

b), f-iff (a,

b)),

f-implies (b,

forsome (x,

b))),

f-implies (a,

f-implies (∀ x f-iff (a,

b), forsome (x,

b))),

list (all-elim-proof (x,

f-iff (a,

b)),

e-intro-proof (x,

b)))),

forsome-intro-proof (x, b, f-implies (∀ x f-iff (a, b),

forsome (x, a)),

tautconseq-proof (list (f-implies (∀ x f-iff (a,

b), f-iff (a,

b)),

f-implies (a,

forsome (x,

a))),

f-implies (b,

f-implies (∀ x f-iff (a,

b), forsome (x,

a))),

list (all-elim-proof (x,

f-iff (a,

b)),

e-intro-proof (x, a))))))

Theorem: forall-over-iff-proof-proves (variable (x) ∧ formula (a, symbols) ∧ formula (b, symbols)) → proves (forall-over-iff-proof (x, a, b), f-implies (∀ x f-iff (a, b), f-iff (forsome (x, a), forsome (x, b))), given, defns, symbols)

Event: Enable forall-over-iff-proof; name this event ‘g0911’.

Definition: elim-free-terms (x, list) = if listp (list)

then if x ∈ collect-free (car (list), 0) then elim-free-terms (x, cdr (list)) else cons (car (list), elim-free-terms (x, cdr (list))) endif

else nil endif

Theorem: subset-elim-free-terms subset (elim-free-terms (x, list), list)

Theorem: not-free-elim-free-terms x ∉ collect-free (elim-free-terms (x, list), 1)

Event: Disable list-f-and; name this event ‘g0912’.

Theorem: collect-free-list-f-and (x ∈ collect-free (list-f-and (list), 0)) = (x ∈ collect-free (list, 1))

Theorem: formula-f-and formula (f-and (x, y), symbols) = (formula (x, symbols) ∧ formula (y, symbols))

Theorem: covering-f-and covering (f-and (x, y), var, 0) = append (covering (x, var, 0), covering (y, var, 0))

Theorem: collect-free-f-and collect-free (f-and (y, z), 0) = append (collect-free (y, 0), collect-free (z, 0))

Theorem: subst-f-and subst (f-and (x, y), var, term, 0) = f-and (subst (x, var, term, 0), subst (y, var, term, 0))

Theorem: parallel-subst-f-and parallel-subst (f-and (x, y), vars, terms, 0) = f-and (parallel-subst (x, vars, terms, 0), parallel-subst (y, vars, terms, 0))

Theorem: eval-f-and eval (f-and (x, y), alist) = (eval (x, alist) ∧ eval (y, alist))

Event: Enable f-and; name this event ‘g0384’.

Definition: subset-list-f-and-proof (list1 , list2 ) = if listp (list2 )

then if listp (cdr (list2 ))

then tautconseq-proof (list (f-implies (list-f-and (list1 ),

car (list2 )), f-implies (list-f-and (list1 ),

list-f-and (cdr (list2 )))),

f-implies (list-f-and (list1 ),

list-f-and (list2 )), list (list-f-and-member-proof (car (list2 ),

list1 ),

subset-list-f-and-proof (list1 ,

cdr (list2 ))))

else list-f-and-member-proof (car (list2 ), list1 ) endif else nil endif

Theorem: subset-list-f-and-proof-proves (form-list (list1 , symbols) ∧ form-list (list2 , symbols) ∧ listp (list1 ) ∧ listp (list2 ) ∧ subset (list2 , list1 )) → proves (subset-list-f-and-proof (list1 , list2 ),

f-implies (list-f-and (list1 ), list-f-and (list2 )), given, defns, symbols)

Definition: list-f-implies (x, y) = if listp (x) ∧ listp (y)

then cons (f-implies (car (x), car (y)), list-f-implies (cdr (x), cdr (y))) else nil endif

Definition: implies-implies-proof (x, y, u, v, pf1 , pf2 ) = tautconseq-proof (list (f-implies (u, x), f-implies (y, v)),

f-implies (f-implies (x, y), f-implies (u, v)), list (pf1 , pf2 ))

Theorem: implies-implies-proof-proves (proves (pf1 , f-implies (u, x), given, defns, symbols) ∧ proves (pf2 , f-implies (y, v), given, defns, symbols)) → proves (implies-implies-proof (x, y, u, v, pf1 , pf2 ),

f-implies (f-implies (x, y), f-implies (u, v)), given, defns, symbols)

Event: Enable implies-implies-proof; name this event ‘g0876’.

Definition: list-implies-implies-proof (x, y, z, pflist) = if listp (x) ∧ listp (y)

then implies-implies-proof (car (y), list-implies (cdr (y), z), car (x), list-implies (cdr (x), z), car (pflist), list-implies-implies-proof (cdr (x),

cdr (y), z, cdr (pflist)))

else tautconseq-proof (nil, f-implies (z, z), nil) endif

Theorem: list-implies-implies-proof-proves ((length (x) = length (y)) ∧ formula (z, symbols) ∧ proves-list (pflist, list-f-implies (x, y), given, defns, symbols)) → proves (list-implies-implies-proof (x, y, z, pflist),

f-implies (list-implies (y, z), list-implies (x, z)), given, defns, symbols)

Event: Enable list-implies-implies-proof; name this event ‘g0877’.

Definition: list-symmetry-proof1 (x, y) = if listp (x) ∧ listp (y)

then cons (symmetry-proof1 (car (x), car (y)),

list-symmetry-proof1 (cdr (x), cdr (y)))

else nil endif

Theorem: list-symmetry-proof1-proves (term-list (x, symbols) ∧ term-list (y, symbols)) → proves-list (list-symmetry-proof1 (x, y),

list-f-implies (list-f-equal (x, y), list-f-equal (y, x)), given, defns, symbols)

Event: Enable list-symmetry-proof1; name this event ‘g0878’.

Definition: imp-iff-not-proof (x, y, z, pf ) = tautconseq-proof (list (f-implies (x, f-iff (y, z))),

f-implies (x, f-iff (f-not (y), f-not (z))),

list (pf ))

Theorem: imp-iff-not-proof-proves proves (pf , f-implies (x, f-iff (y, z)), given, defns, symbols) → proves (imp-iff-not-proof (x, y, z, pf ),

f-implies (x, f-iff (f-not (y), f-not (z))),

given, defns, symbols)

Event: Enable imp-iff-not-proof; name this event ‘g0879’.

Definition: imp-iff-or-proof (x, y1 , z1 , y2 , z2 , pf1 , pf2 ) = tautconseq-proof (list (f-implies (x, f-iff (y1 , z1 )),

f-implies (x, f-iff (y2 , z2 ))), f-implies (x, f-iff (f-or (y1 , y2 ), f-or (z1 , z2 ))), list (pf1 , pf2 ))

Theorem: imp-iff-or-proof-proves (proves (pf1 , f-implies (x, f-iff (y1 , z1 )), given, defns, symbols) ∧ proves (pf2 , f-implies (x, f-iff (y2 , z2 )), given, defns, symbols)) → proves (imp-iff-or-proof (x, y1 , z1 , y2 , z2 , pf1 , pf2 ),

f-implies (x, f-iff (f-or (y1 , y2 ), f-or (z1 , z2 ))), given, defns, symbols)

Event: Enable imp-iff-or-proof; name this event ‘g0880’.

Definition: make-chain (a, b, list) = if listp (list)

then cons (f-implies (a, car (list)), make-chain (car (list), b, cdr (list)))

else list (f-implies (a, b)) endif

Definition: chain-proof (a, b, list, pflist) = if listp (list)

then trans-implies-proof (a, car (list), b, car (pflist), chain-proof (car (list), b, cdr (list), cdr (pflist)))

else car (pflist) endif

;;;;;;;The chain rule below is a frequently used rule of inference.
;;;;;;;It asserts that "A -> B" is provable if there is a chain of provable
;;;;;;;implications leading from "A" to "B".

Theorem: chain-rule proves-list (pflist, make-chain (a, b, list), given, defns, symbols) → proves (chain-proof (a, b, list, pflist),

f-implies (a, b), given, defns, symbols)

Event: Enable chain-proof; name this event ‘g0396’.

Definition: make-iff-chain (a, b, list) = if listp (list)

then cons (f-iff (a, car (list)), make-iff-chain (car (list), b, cdr (list)))

else list (f-iff (a, b)) endif

Definition: chain-iff-proof (a, b, list, pflist) = if listp (list)

then trans-f-iff-proof (a, car (list), b, car (pflist), chain-iff-proof (car (list),

b,

cdr (list), cdr (pflist)))

else car (pflist) endif

;;;;;;;The chain rule form "<->".

Theorem: chain-iff-proof-proves proves-list (pflist, make-iff-chain (a, b, list), given, defns, symbols) → proves (chain-iff-proof (a, b, list, pflist),

f-iff (a, b), given, defns, symbols)

Event: Enable chain-iff-proof; name this event ‘g0386’.

Definition: imp-iff-forsome-proof (x, y, z, var, pf ) = chain-proof (x,

f-iff (forsome (var, y), forsome (var, z)), list (∀ var f-iff (y, z)), list (forall-intro-proof (x, f-iff (y, z), var, pf ), forall-over-iff-proof (var, y, z)))

Theorem: imp-iff-forsome-proof-proves (variable (var) ∧ (var ∉ collect-free (x, 0)) ∧ proves (pf , f-implies (x, f-iff (y, z)), given, defns, symbols)) → proves (imp-iff-forsome-proof (x, y, z, var, pf ),

f-implies (x, f-iff (forsome (var, y), forsome (var, z))), given, defns, symbols)

Event: Enable imp-iff-forsome-proof; name this event ‘g0881’.

Definition: dist-f-implies-symmetry-proof (x, list1 , list2 , pflist) = if listp (list1 ) ∧ listp (list2 )

then cons (chain-proof (x, f-equal (car (list2 ), car (list1 )), list (f-equal (car (list1 ), car (list2 ))), list (car (pflist),

symmetry-proof1 (car (list1 ), car (list2 )))),

dist-f-implies-symmetry-proof (x, cdr (list1 ), cdr (list2 ), cdr (pflist)))

else nil endif

Theorem: dist-f-implies-symmetry-proof-proves proves-list (pflist,

dist-f-implies (x, list-f-equal (list1 , list2 )), given, defns, symbols)

→ proves-list (dist-f-implies-symmetry-proof (x, list1 , list2 , pflist), dist-f-implies (x, list-f-equal (list2 , list1 )), given, defns, symbols)

Event: Enable dist-f-implies-symmetry-proof; name this event ‘g0882’.

Definition: imp-iff-implies-proof (x, y, z, pf1 , pf2 ) = tautconseq-proof (list (f-implies (x, f-implies (y, z)),

f-implies (x, f-implies (z, y))), f-implies (x, f-iff (y, z)), list (pf1 , pf2 ))

Theorem: imp-iff-implies-proof-proves (proves (pf1 , f-implies (x, f-implies (y, z)), given, defns, symbols) ∧ proves (pf2 , f-implies (x, f-implies (z, y)), given, defns, symbols)) → proves (imp-iff-implies-proof (x, y, z, pf1 , pf2 ),

f-implies (x, f-iff (y, z)), given, defns, symbols)

Event: Enable imp-iff-implies-proof; name this event ‘g0883’.

;;;;;;;TERM-EQUAL-PROOF is the proof-constructor for the equality theorem
;;;;;;;for terms.

Definition: term-equal-proof (terma, termb, list, flg) = if flg ≃ 0

then if terma = termb

then add-hyp-proof (list-f-and (list), f-equal (terma, terma), ident-axiom-proof (terma))

elseif f-equal (terma, termb) ∈ list then list-f-and-member-proof (f-equal (terma, termb), list) elseif f-equal (termb, terma) ∈ list then chain-proof (list-f-and (list),

f-equal (terma, termb), list (f-equal (termb, terma)), list (list-f-and-member-proof (f-equal (termb,

terma), list),

symmetry-proof1 (termb, terma)))

elseif listp (terma) ∧ listp (termb) then elim-args-proof (list-f-and (list),

list-f-equal (cdr (terma), cdr (termb)), f-equal (terma, termb), term-equal-proof (cdr (terma),

cdr (termb), list, 1),

add-hyp-proof (list-f-and (list),

list-implies (list-f-equal (cdr (terma),

cdr (termb)),

f-equal (terma,

termb)),

equal-axiom1-proof (car (terma), cdr (terma), cdr (termb))))

else nil endif elseif listp (terma) ∧ listp (termb) then cons (term-equal-proof (car (terma), car (termb), list, 0),

term-equal-proof (cdr (terma), cdr (termb), list, 1))

else nil endif

;;;;;;;TERM-EQUAL checks if TERMA and TERMB are identical modulo the list of
;;;;;;;equalities in LIST.

Definition: term-equal (terma, termb, list, flg)

= if flg ≃ 0

then if terma = termb then t elseif f-equal (terma, termb) ∈ list then t elseif f-equal (termb, terma) ∈ list then t elseif listp (terma) ∧ listp (termb) then (car (terma) = car (termb))

∧ term-equal (cdr (terma), cdr (termb), list, 1) else f endif

elseif listp (terma) ∧ listp (termb)

then term-equal (car (terma), car (termb), list, 0)

∧ term-equal (cdr (terma), cdr (termb), list, 1) else terma = termb endif

;;;;;;;The equality theorem for terms:  If "a" and "b" are identical
;;;;;;;modulo the equalities "x1 = y1",..., "xn = yn", etc., then
;;;;;;;it is provable that, "((x1=y1) ^... ^(xn=yn))->(a=b)".

Theorem: term-equal-proof-proves (flg-termp (terma, flg, symbols) ∧ flg-termp (termb, flg, symbols) ∧ listp (list) ∧ form-list (list, symbols) ∧ term-equal (terma, termb, list, flg)) → flg-proves (term-equal-proof (terma, termb, list, flg),

flg-f-implies-equal (list-f-and (list), terma, termb, flg), given, defns, symbols, flg)

Event: Enable term-equal-proof; name this event ‘g0364’.

Theorem: term-equal-proof-proves1 (termp (terma, 0, symbols) ∧ termp (termb, 0, symbols) ∧ listp (list) ∧ form-list (list, symbols) ∧ term-equal (terma, termb, list, 0)) → proves (term-equal-proof (terma, termb, list, 0),

f-implies (list-f-and (list), f-equal (terma, termb)), given, defns, symbols)

Theorem: term-equal-proof-proves2 (term-list (terma, symbols) ∧ term-list (termb, symbols) ∧ listp (list) ∧ form-list (list, symbols) ∧ term-equal (terma, termb, list, 1) ∧ (concl = dist-f-implies (list-f-and (list), list-f-equal (terma, termb)))) → proves-list (term-equal-proof (terma, termb, list, 1),

concl, given, defns, symbols)

Event: Enable term-equal-proof-proves; name this event ‘g0887’.

;;;;;;;FORM-EQUAL is used in the equality theorem for formulas.
;;;;;;;It checks that FORMA and FORMB are identical modulo the equalities in LIST.

Definition: form-equal (forma, formb, list) = if forma = formb then t

elseif f-notp (forma) ∧ f-notp (formb)

then form-equal (arg (forma), arg (formb), list)

elseif f-orp (forma) ∧ f-orp (formb)

then form-equal (arg1 (forma), arg1 (formb), list)

∧ form-equal (arg2 (forma), arg2 (formb), list) elseif forsomep (forma) ∧ forsomep (formb) then (bind (forma) = bind (formb))

∧ listp (elim-free-terms (bind (forma), list)) ∧ form-equal (body (forma),

body (formb),

elim-free-terms (bind (forma), list))

elseif listp (forma) ∧ listp (formb) then (car (forma) = car (formb))

∧ term-equal (cdr (forma), cdr (formb), list, 1) else f endif

;;;;;;;FORM-EQUAL-PROOF is the corresponding proof-constructor.

Definition: form-equal-proof (forma, formb, list) = if forma = formb

then add-hyp-proof (list-f-and (list), f-iff (forma, formb),

eqn-form-proof (forma, formb, nil, nil))

elseif f-notp (forma) ∧ f-notp (formb) then imp-iff-not-proof (list-f-and (list),

arg (forma), arg (formb), form-equal-proof (arg (forma), arg (formb), list))

elseif f-orp (forma) ∧ f-orp (formb) then imp-iff-or-proof (list-f-and (list),

arg1 (forma), arg1 (formb), arg2 (forma), arg2 (formb), form-equal-proof (arg1 (forma), arg1 (formb), list), form-equal-proof (arg2 (forma), arg2 (formb), list))

elseif forsomep (forma) ∧ forsomep (formb) then chain-proof (list-f-and (list),

f-iff (forma, formb),

list (list-f-and (elim-free-terms (bind (forma), list))), list (subset-list-f-and-proof (list,

elim-free-terms (bind (forma),

list)),

imp-iff-forsome-proof (list-f-and (elim-free-terms (bind (forma),

list)),

body (forma), body (formb), bind (forma), form-equal-proof (body (forma),

body (formb),

elim-free-terms (bind (forma),

list)))))

else imp-iff-implies-proof (list-f-and (list), forma, formb, elim-args-proof (list-f-and (list),

list-f-equal (cdr (forma),

cdr (formb)),

f-implies (forma,

formb), term-equal-proof (cdr (forma),

cdr (formb), list, 1),

add-hyp-proof (list-f-and (list), list-implies (list-f-equal (cdr (forma),

cdr (formb)),

f-implies (forma,

formb)),

equal-axiom2-proof (car (forma), cdr (forma), cdr (formb)))),

elim-args-proof (list-f-and (list),

list-f-equal (cdr (formb),

cdr (forma)),

f-implies (formb,

forma),

dist-f-implies-symmetry-proof (list-f-and (list), cdr (forma), cdr (formb), term-equal-proof (cdr (forma),

cdr (formb), list, 1)),

add-hyp-proof (list-f-and (list),

list-implies (list-f-equal (cdr (formb),

cdr (forma)),

f-implies (formb,

forma)),

equal-axiom2-proof (car (forma), cdr (formb), cdr (forma))))) endif

Theorem: form-list-elim-free-terms form-list (list, symbols) → form-list (elim-free-terms (x, list), symbols)

;;;;;;;The equality theorem for formulas:  If "A" is identical to "B" modulo
;;;;;;;the equalities "x1=y1", ..., "xn=yn", etc., then it is provable that
;;;;;;; "((x1=y1) ^... ^(xn=yn)) -> (A <-> B)".

Theorem: form-equal-proof-proves (formula (forma, symbols) ∧ formula (formb, symbols) ∧ form-equal (forma, formb, list) ∧ listp (list) ∧ form-list (list, symbols)) → proves (form-equal-proof (forma, formb, list),

f-implies (list-f-and (list), f-iff (forma, formb)), given, defns, symbols)

Event: Enable form-equal-proof; name this event ‘g0893’.

Theorem: get-list-f-equal (exp ≠ getpf (exp, vars, terms)) → (f-equal (exp, getpf (exp, vars, terms)) ∈ list-f-equal (vars, terms))

Theorem: getsub-getpf (x ∈ N) → (getsub (x, y, z) = getpf (x, y, z))

Theorem: term-equal-parallel-subst termp (exp, flg, symbols) → term-equal (exp,

parallel-subst (exp, vars, terms, flg), list-f-equal (vars, terms), flg)

Theorem: delete-delete del (x, del (y, z)) = del (y, del (x, z))

Theorem: del-pairs-del-pairs del-pairs (x, del (y, vars), del-pairs (y, vars, terms)) = del-pairs (y, del (x, vars), del-pairs (x, vars, terms))

Theorem: not-free-del-pairs-parallel-subst (x ∉ collect-free (exp, flg)) → (parallel-subst (exp, del (x, vars), del-pairs (x, vars, terms), flg)

= parallel-subst (exp, vars, terms, flg))

Event: Disable f-equal; name this event ‘g0894’.

Theorem: collect-free-f-equal (x ∈ collect-free (f-equal (y, z), 0)) = ((x ∈ collect-free (y, 0)) ∨ (x ∈ collect-free (z, 0)))

Event: Enable f-equal; name this event ‘g0895’.

Theorem: del-pairs-elim-free (variable (x) ∧ var-list (vars, length (vars)) ∧ (x ∉ collect-free (terms, 1))) → (list-f-equal (del (x, vars), del-pairs (x, vars, terms))

= elim-free-terms (x, list-f-equal (vars, terms)))

Theorem: var-list-del var-list (vars, length (vars)) → var-list (del (x, vars), length (del (x, vars)))

Theorem: append-nil-one (y ≠ nil) → (append (x, y) ≠ nil)

Theorem: append-nil-two (append (x, nil) ≠ nil) → (append (x, y) ≠ nil)

Theorem: del-pairs-collect-free (collect-free (terms, 1) = nil) → (collect-free (del-pairs (x, vars, terms), 1) = nil)

Theorem: nlistp-term-equal ((x ≠ y) ∧ (list ≃ nil)) → (¬ term-equal (x, y, list, flg))

Theorem: nlistp-form-equal ((x ≠ y) ∧ (list ≃ nil)) → (¬ form-equal (x, y, list))

Theorem: form-equal-parallel-subst (var-list (vars, length (vars)) ∧ formula (exp, symbols) ∧ (collect-free (terms, 1) = nil)) → form-equal (exp,

parallel-subst (exp, vars, terms, 0), list-f-equal (vars, terms))

Theorem: term-equal-subst (variable (var) ∧ termp (exp, flg, symbols)) → term-equal (exp, subst (exp, var, term, flg), list (f-equal (var, term)), flg)

Theorem: form-equal-subst (variable (var) ∧ formula (exp, symbols) ∧ free-for (exp, var, term, 0)) → form-equal (exp, subst (exp, var, term, 0), list (f-equal (var, term)))

Theorem: symb-equals symb (sym, symbols) = (memb (sym, symbols) ∨ (sym = p (0, 2)))

Theorem: index-not-equal ((x ∈ N) ∧ (x ≠ 0)) → (p (x, y) ≠ p (0, 2))

Theorem: fn-p-not-equal fn (x, y) ≠ p (0, 2)

Theorem: memb-fn memb (fn (x, y), symbols) = (fn (x, y) ∈ symbols)

Theorem: memb-p memb (p (x, y), symbols) = (p (x, y) ∈ symbols)

;;;;;;;The next section contains results that follow from the Z2 set axioms.

Theorem: formula-isin formula (isin (x, y), symbols) = (memb (p (1, 2), symbols) ∧ termp (x, 0, symbols) ∧ termp (y, 0, symbols))

Theorem: equal-axiom2-isin (termp (list (x, y, u, v), 1, symbols) ∧ (p (1, 2) ∈ symbols)) → proves (equal-axiom2-proof (p (1, 2), list (x, y), list (u, v)),

f-implies (f-equal (x, u),

f-implies (f-equal (y, v),

f-implies (isin (x, y), isin (u, v)))),

given, defns, symbols)

Theorem: collect-free-isin collect-free (isin (y, z), 0) = collect-free (list (y, z), 1)

Theorem: covering-isin covering (isin (x, y), z, 0) = covering (list (x, y), z, 1)

Theorem: subst-isin subst (isin (x, y), var, term, 0) = isin (subst (x, var, term, 0), subst (y, var, term, 0))

Theorem: parallel-subst-isin parallel-subst (isin (x, y), vars, terms, 0) = isin (parallel-subst (x, vars, terms, 0), parallel-subst (y, vars, terms, 0))

Event: Enable isin; name this event ‘g0381’.

Definition: mk-bnd (list, n) = ((1 + n) + find-hi-index (collect-free (list, 1)))

Theorem: lessp-mk-bnd find-hi-index (collect-free (list, 1)) < mk-bnd (list, n)

Theorem: mk-bnd-nequal (fix (m) ≠ fix (n)) → (mk-bnd (list, m) ≠ mk-bnd (list, n))

Event: Enable mk-bnd; name this event ‘g0612’.

Theorem: mk-bnd-not-free1 mk-bnd (list (x), n) ∉ collect-free (x, 0)

Theorem: mk-bnd-not-free2 (mk-bnd (list (x, y), n) ∉ collect-free (x, 0)) ∧ (mk-bnd (list (x, y), n) ∉ collect-free (y, 0))

Theorem: mk-bnd-not-free3 (mk-bnd (list (x, y, z), n) ∉ collect-free (x, 0)) ∧ (mk-bnd (list (x, y, z), n) ∉ collect-free (y, 0)) ∧ (mk-bnd (list (x, y, z), n) ∉ collect-free (z, 0))

;;;;;;;The next few rules are usable versions of the set-theory axioms.

Definition: ext-axiom-eq-elim1-proof (terma, termb, termc, pf ) = tautconseq-proof (list (ext-axiom (mk-bnd (list (terma, termb), 0),

terma, termb),

f-implies (∀ mk-bnd, (list terma termb), 0 f-iff (isin (mk-bnd (list (terma,

termb), 0),

terma), isin (mk-bnd (list (terma,

termb), 0),

termb)),

f-iff (isin (termc, terma),

isin (termc, termb))),

isin (termc, terma)), f-implies (f-equal (terma, termb), isin (termc, termb)), list (ext-axiom-proof (mk-bnd (list (terma, termb), 0), terma, termb),

subst-thm-b-proof (f-iff (isin (mk-bnd (list (terma,

termb), 0),

terma), isin (mk-bnd (list (terma,

termb), 0),

termb)), list (mk-bnd (list (terma, termb), 0)),

list (termc)),

pf ))

Theorem: nil-intersect-del nil-intersect (x, del (y, z)) → nil-intersect (del (y, x), z)

Theorem: not-free-parallel-subst nil-intersect (vars, collect-free (exp, flg)) → (parallel-subst (exp, vars, terms, flg) = exp)

Theorem: parallel-subst-f-iff parallel-subst (f-iff (x, y), vars, terms, 0) = f-iff (parallel-subst (x, vars, terms, 0), parallel-subst (y, vars, terms, 0))

;;;;;;;One case of the extensionality axiom: "(c in a)"|- "(a=b)->(c in b)".

Theorem: ext-axiom-eq-elim1 (termp (termb, 0, symbols) ∧ (p (1, 2) ∈ symbols) ∧ proves (pf , isin (termc, terma), given, defns, symbols)) → proves (ext-axiom-eq-elim1-proof (terma, termb, termc, pf ),

f-implies (f-equal (terma, termb), isin (termc, termb)), given, defns, symbols)

Definition: ext-axiom-eq-elim2-proof (terma, termb, termc, pf ) = tautconseq-proof (list (ext-axiom (mk-bnd (list (terma, termb), 0),

terma, termb),

f-implies (∀ mk-bnd, (list terma termb), 0 f-iff (isin (mk-bnd (list (terma,

termb), 0),

terma), isin (mk-bnd (list (terma,

termb), 0),

termb)),

f-iff (isin (termc, terma),

isin (termc, termb))),

isin (termc, termb)), f-implies (f-equal (terma, termb), isin (termc, terma)), list (ext-axiom-proof (mk-bnd (list (terma, termb), 0), terma, termb),

subst-thm-b-proof (f-iff (isin (mk-bnd (list (terma,

termb), 0),

terma), isin (mk-bnd (list (terma,

termb), 0),

termb)), list (mk-bnd (list (terma, termb), 0)),

list (termc)),

pf ))

;;;;;;;Second case of the extensionality axiom: "(c in b)" |- "(a=b)->(c in a)".

Theorem: ext-axiom-eq-elim2 (termp (terma, 0, symbols) ∧ (p (1, 2) ∈ symbols) ∧ proves (pf , isin (termc, termb), given, defns, symbols)) → proves (ext-axiom-eq-elim2-proof (terma, termb, termc, pf ),

f-implies (f-equal (terma, termb), isin (termc, terma)), given, defns, symbols)

Event: Enable ext-axiom-eq-elim1-proof; name this event ‘g0631’.

Event: Enable ext-axiom-eq-elim2-proof; name this event ‘g0632’.

Event: Enable f-iff-mp-proof2; name this event ‘g0633’.

Definition: ext-axiom-eq-intro-proof (x, terma, termb, pf ) = f-iff-mp-proof2 (f-equal (terma, termb),

∀ x f-iff (isin (x, terma), isin (x, termb)), ext-axiom-proof (x, terma, termb), generalise-proof (x,

f-iff (isin (x, terma), isin (x, termb)), pf ))

;;;;;;;Third case of ext. axiom:  "(x in a) <-> (x in b)" |- "(a=b)".

Theorem: ext-axiom-eql-intro (variable (x) ∧ (x ∉ collect-free (list (terma, termb), 1)) ∧ proves (pf , f-iff (isin (x, terma), isin (x, termb)), given, defns, symbols)) → proves (ext-axiom-eq-intro-proof (x, terma, termb, pf ),

given, defns, symbols)

f-equal (terma, termb), Event: Enable ext-axiom-eq-intro-proof; name this event ‘g0634’.

Theorem: symb-reduc (sym ∈ symbols) → symb (sym, symbols)

Event: Enable symb; name this event ‘g0635’.

Theorem: equal-axiom1-z-pair (termp (list (x, y, u, v), 1, symbols) ∧ (fn (1, 2) ∈ symbols)) → proves (equal-axiom1-proof (fn (1, 2), list (x, y), list (u, v)),

f-implies (f-equal (x, u),

f-implies (f-equal (y, v),

f-equal (z-pair (x, y), z-pair (u, v)))),

given, defns, symbols)

Theorem: equal-axiom1-z-union (termp (list (x, y, u, v), 1, symbols) ∧ (fn (2, 2) ∈ symbols)) → proves (equal-axiom1-proof (fn (2, 2), list (x, y), list (u, v)),

f-implies (f-equal (x, u),

f-implies (f-equal (y, v),

f-equal (z-union (x, y), z-union (u, v)))),

given, defns, symbols)

Theorem: collect-free-z-pair collect-free (z-pair (y, z), 0) = collect-free (list (y, z), 1)

Theorem: covering-z-pair covering (z-pair (x, y), var, 0) = covering (list (x, y), var, 1)

Theorem: subst-z-pair subst (z-pair (x, y), var, term, 0) = z-pair (subst (x, var, term, 0), subst (y, var, term, 0))

Theorem: parallel-subst-z-pair parallel-subst (z-pair (x, y), vars, terms, 0) = z-pair (parallel-subst (x, vars, terms, 0), parallel-subst (y, vars, terms, 0))

Theorem: termp-z-pair termp (z-pair (x, y), 0, symbols) = ((fn (1, 2) ∈ symbols)

∧ termp (x, 0, symbols) ∧ termp (y, 0, symbols))

Theorem: term-equal-z-pair (term-equal (x, u, list, 0) ∧ term-equal (y, v, list, 0)) → term-equal (z-pair (x, y), z-pair (u, v), list, 0)

Theorem: term-equal-z-union (term-equal (x, u, list, 0) ∧ term-equal (y, v, list, 0)) → term-equal (z-union (x, y), z-union (u, v), list, 0)

Event: Enable z-pair; name this event ‘g0387’.

Theorem: termp-z-union termp (z-union (x, y), 0, symbols) = ((fn (2, 2) ∈ symbols)

∧ termp (x, 0, symbols) ∧ termp (y, 0, symbols))

Theorem: collect-free-z-union collect-free (z-union (y, z), 0) = collect-free (list (y, z), 1)

Theorem: covering-z-union covering (z-union (x, y), var, 0) = covering (list (x, y), var, 1)

Theorem: subst-z-union subst (z-union (x, y), var, term, 0) = z-union (subst (x, var, term, 0), subst (y, var, term, 0))

Theorem: parallel-subst-z-union parallel-subst (z-union (x, y), vars, terms, 0) = z-union (parallel-subst (x, vars, terms, 0),

parallel-subst (y, vars, terms, 0))

Event: Enable z-union; name this event ‘g0388’.

Definition: z-pair-elim-proof (x, terma, termb, exp, pf1 , pf2 ) = tautconseq-proof (list (f-iff (isin (x, z-pair (terma, termb)),

f-or (f-equal (x, terma), f-equal (x, termb))), f-implies (f-equal (x, terma), exp), f-implies (f-equal (x, termb), exp)), f-implies (isin (x, z-pair (terma, termb)), exp), list (pair-axiom-proof (x, terma, termb), pf1 , pf2 ))

;;;;;;;Pair-elimination:  if |-"(x = a)->exp" and |-"(x=b)->exp",
;;;;;;;then |-"(x in {a,b}) -> exp".

Theorem: z-pair-elim (subset (list (p (1, 2), fn (1, 2)), symbols) ∧ proves (pf1 , f-implies (f-equal (x, terma), exp), given, defns, symbols) ∧ proves (pf2 , f-implies (f-equal (x, termb), exp), given, defns, symbols)) → proves (z-pair-elim-proof (x, terma, termb, exp, pf1 , pf2 ),

f-implies (isin (x, z-pair (terma, termb)), exp), given, defns, symbols)

Event: Enable z-pair-elim-proof; name this event ‘g0643’.

Definition: isin-pair1-proof (terma, termb) = f-iff-mp-proof2 (isin (terma, z-pair (terma, termb)),

f-or (f-equal (terma, terma), f-equal (terma, termb)), pair-axiom-proof (terma, terma, termb), rt-expan-proof (f-equal (terma, terma),

f-equal (terma, termb), ident-axiom-proof (terma)))

;;;;;;; |-"(x in {x, y})".

Theorem: isin-pair1-proof-proves formula (isin (terma, z-pair (terma, termb)), symbols) → proves (isin-pair1-proof (terma, termb),

isin (terma, z-pair (terma, termb)),

given, defns, symbols)

Event: Enable isin-pair1-proof; name this event ‘g0391’.

Definition: isin-pair2-proof (terma, termb) = f-iff-mp-proof2 (isin (termb, z-pair (terma, termb)),

f-or (f-equal (termb, terma), f-equal (termb, termb)), pair-axiom-proof (termb, terma, termb), expan-proof (f-equal (termb, terma),

f-equal (termb, termb), ident-axiom-proof (termb)))

;;;;;;; |- "(y in {x,y})".

Theorem: isin-pair2-proof-proves formula (isin (termb, z-pair (terma, termb)), symbols) → proves (isin-pair2-proof (terma, termb),

isin (termb, z-pair (terma, termb)), given, defns, symbols)

Event: Enable isin-pair2-proof; name this event ‘g0392’.

Definition: z-sing (x) = z-pair (x, x)

Definition: isin-sing-proof (x, y) = chain-iff-proof (isin (y, z-sing (x)),

f-equal (y, x),

list (f-or (f-equal (y, x), f-equal (y, x))), list (pair-axiom-proof (y, x, x), tautconseq-proof (nil,

f-iff (f-or (f-equal (y, x),

f-equal (y, x)), f-equal (y, x)),

nil)))

;;;;;;; |- "(y in {x}) <-> (y=x)".

Theorem: isin-sing formula (f-iff (isin (y, z-sing (x)), f-equal (y, x)), symbols) → proves (isin-sing-proof (x, y),

f-iff (isin (y, z-sing (x)), f-equal (y, x)), given, defns, symbols)

Event: Enable isin-sing-proof; name this event ‘g0913’.

Theorem: termp-z-sing termp (z-sing (x), 0, symbols) = ((fn (1, 2) ∈ symbols) ∧ termp (x, 0, symbols))

Theorem: collect-free-z-sing collect-free (z-sing (y), 0) = collect-free (list (y, y), 1)

Theorem: covering-z-sing covering (z-sing (x), var, 0) = covering (list (x, x), var, 1)

Theorem: subst-z-sing subst (z-sing (x), var, term, 0) = z-sing (subst (x, var, term, 0))

Theorem: parallel-subst-z-sing parallel-subst (z-sing (x), vars, terms, 0) = z-sing (parallel-subst (x, vars, terms, 0))

Theorem: term-equal-z-sing term-equal (x, y, list, 0) → term-equal (z-sing (x), z-sing (y), list, 0)

Event: Enable z-sing; name this event ‘g0389’.

Definition: isin-sing1-proof (x) = f-iff-mp-proof2 (isin (x, z-sing (x)),

f-equal (x, x),

isin-sing-proof (x, x), ident-axiom-proof (x))

;;;;;;; |- "(x in {x})".

Theorem: isin-sing1-proof-proves formula (isin (term, z-sing (term)), symbols) → proves (isin-sing1-proof (term),

isin (term, z-sing (term)), given, defns, symbols)

Event: Enable isin-sing1-proof; name this event ‘g0393’.

Definition: del-forsome-proof (x, exp) = iff-join-proof (forsome (x, exp),

exp,

forsome-intro-proof (x, exp, exp, prop-axiom-proof (exp)), subst-thm-a-proof (exp, list (x), list (x)))

;;;;;;; If "x" not free in "exp", then |- "(forsome x exp) <-> exp".

Theorem: del-forsome-proof-proves (variable (x) ∧ formula (exp, symbols) ∧ (x ∉ collect-free (exp, 0))) → proves (del-forsome-proof (x, exp),

f-iff (forsome (x, exp), exp),

given, defns, symbols)

Event: Enable del-forsome-proof; name this event ‘g0597’.

Definition: del-forall-proof (x, exp) = iff-join-proof (∀ x exp,

exp,

subst-thm-b-proof (exp, list (x), list (x)),

forall-intro-proof (exp, exp, x, prop-axiom-proof (exp)))

;;;;;;; If "x" not free in "exp", then |- "(forall x exp) <-> exp".

Theorem: del-forall-proof-proves (variable (x) ∧ formula (exp, symbols) ∧ (x ∉ collect-free (exp, 0))) → proves (del-forall-proof (x, exp), f-iff (∀ x exp, exp), given, defns, symbols)

Event: Enable del-forall-proof; name this event ‘g0599’.

Definition: sing-sing-equal-proof (x, y) = chain-proof (f-equal (z-sing (x), z-sing (y)),

f-equal (x, y),

list (isin (x, z-sing (y))),

list (ext-axiom-eq-elim1-proof (z-sing (x), z-sing (y), x, isin-sing1-proof (x)),

iff-split-proof1 (isin (x, z-sing (y)), f-equal (x, y), isin-sing-proof (y, x))))

;;;;;;; |- "({x}={y}) -> (x=y)".

Theorem: sing-sing-equal-proof-proves (termp (list (x, y), 1, symbols) ∧ subset (list (p (1, 2), fn (1, 2)), symbols)) → proves (sing-sing-equal-proof (x, y),

f-implies (f-equal (z-sing (x), z-sing (y)), f-equal (x, y)), given, defns, symbols)

Event: Enable sing-sing-equal-proof; name this event ‘g0652’.

Definition: sing-pair-equal-proof1 (x, u, v) = chain-proof (f-equal (z-sing (x), z-pair (u, v)),

f-equal (x, u),

list (isin (u, z-sing (x)), f-equal (u, x)), list (ext-axiom-eq-elim2-proof (z-sing (x),

z-pair (u, v),

u,

isin-pair1-proof (u, v)),

iff-split-proof1 (isin (u, z-sing (x)), f-equal (u, x), isin-sing-proof (x, u)),

symmetry-proof1 (u, x)))

;;;;;;; |- "({x}={u,v}) -> (x=u)".

Theorem: sing-pair-equal-proof1-proves (termp (list (x, u, v), 1, symbols) ∧ subset (list (p (1, 2), fn (1, 2)), symbols)) → proves (sing-pair-equal-proof1 (x, u, v),

f-implies (f-equal (z-sing (x), z-pair (u, v)), f-equal (x, u)), given, defns, symbols)

Event: Enable sing-pair-equal-proof1; name this event ‘g0653’.

Definition: sing-pair-equal-proof2 (x, u, v) = chain-proof (f-equal (z-sing (x), z-pair (u, v)),

f-equal (x, v),

list (isin (v, z-sing (x)), f-equal (v, x)), list (ext-axiom-eq-elim2-proof (z-sing (x),

z-pair (u, v),

v,

isin-pair2-proof (u, v)),

iff-split-proof1 (isin (v, z-sing (x)), f-equal (v, x), isin-sing-proof (x, v)),

symmetry-proof1 (v, x)))

;;;;;;; |-"({x}={u,v}) -> (x=v)".

Theorem: sing-pair-equal-proof-proves (termp (list (x, u, v), 1, symbols) ∧ subset (list (p (1, 2), fn (1, 2)), symbols)) → proves (sing-pair-equal-proof2 (x, u, v),

f-implies (f-equal (z-sing (x), z-pair (u, v)), f-equal (x, v)), given, defns, symbols)

Event: Enable sing-pair-equal-proof2; name this event ‘g0654’.

Definition: z-opair (x, y) = z-pair (z-sing (x), z-pair (x, y))

Theorem: termp-z-opair termp (z-opair (x, y), 0, symbols) = ((fn (1, 2) ∈ symbols)

∧ termp (x, 0, symbols) ∧ termp (y, 0, symbols))

Theorem: term-equal-z-opair ((f-equal (x, u) ∈ list) ∧ (f-equal (y, v) ∈ list)) → term-equal (z-opair (x, y), z-opair (u, v), list, 0)

Definition: z-car-unique-proof (x, y, u, v) = chain-proof (f-equal (z-opair (x, y), z-opair (u, v)),

f-equal (x, u),

list (isin (z-sing (x), z-opair (u, v))),

list (ext-axiom-eq-elim1-proof (z-opair (x, y), z-opair (u, v), z-sing (x), isin-pair1-proof (z-sing (x),

z-pair (x, y))),

z-pair-elim-proof (z-sing (x), z-sing (u), z-pair (u, v), f-equal (x, u), sing-sing-equal-proof (x, u), sing-pair-equal-proof1 (x, u, v))))

;;;;;;; |- "(<x y>=<u v>)-> (x=u)".

Theorem: z-car-unique-proof-proves (termp (list (x, y, u, v), 1, symbols) ∧ subset (list (p (1, 2), fn (1, 2)), symbols))

→ proves (z-car-unique-proof (x, y, u, v), f-implies (f-equal (z-opair (x, y), z-opair (u, v)), f-equal (x, u)), given, defns, symbols)

Event: Enable z-car-unique-proof; name this event ‘g0656’.

Definition: z-cdr-unique-step-proof (x, y, u, v) = chain-proof (f-equal (z-opair (x, y), z-opair (u, v)),

f-or (f-equal (y, u), f-equal (y, v)), list (isin (z-pair (x, y), z-opair (u, v))), list (ext-axiom-eq-elim1-proof (z-opair (x, y),

z-opair (u, v), z-pair (x, y), isin-pair2-proof (z-sing (x),

z-pair (x, y))),

z-pair-elim-proof (z-pair (x, y), z-sing (u), z-pair (u, v), f-or (f-equal (y, u), f-equal (y, v)), tautconseq-proof (list (f-implies (f-equal (z-pair (x,

y), z-sing (u)),

f-equal (y,

u))),

f-implies (f-equal (z-pair (x,

y), z-sing (u)),

f-or (f-equal (y,

u), f-equal (y,

v))),

list (chain-proof (f-equal (z-pair (x,

y), z-sing (u)),

f-equal (y,

u), list (f-equal (z-sing (u),

z-pair (x,

y)),

f-equal (u, y)), list (symmetry-proof1 (z-pair (x,

y), z-sing (u)),

sing-pair-equal-proof2 (u, x, y),

symmetry-proof1 (u,

y))))),

chain-proof (f-equal (z-pair (x, y),

z-pair (u, v)), f-or (f-equal (y, u),

f-equal (y, v)), list (isin (y,

z-pair (u, v))), list (ext-axiom-eq-elim1-proof (z-pair (x,

y), z-pair (u,

v), y, isin-pair2-proof (x,

y)),

iff-split-proof1 (isin (y,

z-pair (u,

v)),

f-or (f-equal (y,

u), f-equal (y,

v)),

pair-axiom-proof (y, u, v)))))))

;;;;;;; |- "(<x y>=<u v>) -> ((y=u) v (y=v))".

Theorem: z-cdr-unique-step (termp (list (x, y, u, v), 1, symbols) ∧ subset (list (p (1, 2), fn (1, 2)), symbols)) → proves (z-cdr-unique-step-proof (x, y, u, v),

f-implies (f-equal (z-opair (x, y), z-opair (u, v)),

f-or (f-equal (y, u), f-equal (y, v))),

given, defns, symbols)

Event: Enable z-cdr-unique-step-proof; name this event ‘g0657’.

Definition: trans-equal-proof1 (x, y, z) = tautconseq-proof (list (list-implies (list (f-equal (y, x),

f-equal (z, z), f-equal (y, z)),

f-equal (x, z)),

f-equal (z, z)), list-implies (list (f-equal (y, x), f-equal (y, z)),

f-equal (x, z)),

list (equal-axiom2-proof (p (0, 2), list (y, z), list (x, z)), ident-axiom-proof (z)))

;;;;;;; |-"(y = x) -> ((y = z) -> (x = z))".

Theorem: trans-equal-proof-proves (termp (x, 0, symbols) ∧ termp (y, 0, symbols) ∧ termp (z, 0, symbols)) → proves (trans-equal-proof1 (x, y, z),

f-implies (f-equal (y, x), f-implies (f-equal (y, z), f-equal (x, z))), given, defns, symbols)

Event: Enable trans-equal-proof1; name this event ‘g0362’.

Theorem: termp-covering termp (exp, flg, symbols) → (covering (exp, var, flg) = nil)

Theorem: atomp-covering atomp (exp, symbols) → (covering (exp, var, 0) = nil)

Theorem: collect-free-z-opair collect-free (z-opair (y, z), 0) = collect-free (list (z-sing (y), z-pair (y, z)), 1)

Event: Enable z-opair; name this event ‘g0366’.

Definition: trans-equal-proof2 (x, y, z) = tautconseq-proof (list (f-implies (f-equal (x, y), f-equal (y, x)),

f-implies (f-equal (z, y), f-equal (y, z)), f-implies (f-equal (y, x),

f-implies (f-equal (y, z), f-equal (x, z)))),

f-implies (f-equal (x, y), f-implies (f-equal (z, y), f-equal (x, z))), list (symmetry-proof1 (x, y), symmetry-proof1 (z, y), trans-equal-proof1 (x, y, z)))

;;;;;;; |- "(x = y) -> ((z = y) -> (x = z))".

Theorem: trans-equal-proof2-proves (termp (x, 0, symbols) ∧ termp (y, 0, symbols) ∧ termp (z, 0, symbols)) → proves (trans-equal-proof2 (x, y, z),

f-implies (f-equal (x, y), f-implies (f-equal (z, y), f-equal (x, z))), given, defns, symbols)

Event: Enable trans-equal-proof2; name this event ‘g0367’.

Definition: trans-equal-proof3 (x, y, z) = tautconseq-proof (list (f-implies (f-equal (y, z),

f-implies (f-equal (x, y), f-equal (x, z)))),

f-implies (f-equal (x, y),

f-implies (f-equal (y, z), f-equal (x, z))),

list (detach-proof (f-equal (x, x),

f-implies (f-equal (y, z),

f-implies (f-equal (x, y),

f-equal (x, z))),

ident-axiom-proof (x),

equal-axiom2-proof (p (0, 2), list (x, y), list (x, z)))))

;;;;;;; |- "(x = y) -> ((y = z) -> (x = z))".

Theorem: trans-equal-proof3-proves (termp (x, 0, symbols) ∧ termp (y, 0, symbols) ∧ termp (z, 0, symbols)) → proves (trans-equal-proof3 (x, y, z),

f-implies (f-equal (x, y), f-implies (f-equal (y, z), f-equal (x, z))), given, defns, symbols)

Event: Enable trans-equal-proof3; name this event ‘g0736’.

Definition: z-cdr-unique-proof (x, u, y, v) = tautconseq-proof (list (f-implies (f-equal (z-opair (x, u), z-opair (y, v)),

f-or (f-equal (u, y), f-equal (u, v))),

f-implies (f-equal (z-opair (x, u), z-opair (y, v)),

f-or (f-equal (v, x), f-equal (v, u))),

f-implies (f-equal (z-opair (x, u), z-opair (y, v)),

f-equal (x, y)),

f-implies (f-equal (v, u), f-equal (u, v)), f-implies (f-equal (u, y),

f-implies (f-equal (x, y), f-equal (u, x))),

f-implies (f-equal (u, x),

f-implies (f-equal (v, x), f-equal (u, v)))),

f-implies (f-equal (z-opair (x, u), z-opair (y, v)),

f-equal (u, v)),

list (z-cdr-unique-step-proof (x, u, y, v),

chain-proof (f-equal (z-opair (x, u), z-opair (y, v)), f-or (f-equal (v, x), f-equal (v, u)), list (f-equal (z-opair (y, v),

z-opair (x, u))), list (symmetry-proof1 (z-opair (x, u),

z-opair (y, v)),

z-cdr-unique-step-proof (y, v, x, u))),

z-car-unique-proof (x, u, y, v), symmetry-proof1 (v, u), trans-equal-proof2 (u, y, x), trans-equal-proof2 (u, x, v)))

;;;;;;; |- "(<x u>=<u v>) -> (u = v)".

Theorem: z-cdr-unique-proof-proves (termp (x, 0, symbols) ∧ termp (u, 0, symbols) ∧ termp (y, 0, symbols) ∧ termp (v, 0, symbols) ∧ (p (1, 2) ∈ symbols) ∧ (fn (1, 2) ∈ symbols)) → proves (z-cdr-unique-proof (x, u, y, v),

f-implies (f-equal (z-opair (x, u), z-opair (y, v)), f-equal (u, v)), given, defns, symbols)

Event: Enable z-cdr-unique-proof; name this event ‘g0369’.

;;;;;;;The next definition introduces the "if" connective which
;;;;;;;plays an important role in the proofs to follow.
;;;;;;;Def.: "(if A B C)" =  "((A ^B) v ((not A) ^C))".

Definition: f-if (x, y, z) = f-or (f-and (x, y), f-and (f-not (x), z))

Definition: f-if-intro-step-proof1 (x, y, z) = tautconseq-proof (nil, f-implies (x, f-implies (y, f-if (x, y, z))), nil)

;;;;;;; |- "(A -> (B -> (if A B C)))".

Theorem: f-if-intro-step1 (formula (x, symbols) ∧ formula (y, symbols) ∧ formula (z, symbols)) → proves (f-if-intro-step-proof1 (x, y, z),

f-implies (x, f-implies (y, f-if (x, y, z))), given, defns, symbols)

Definition: f-if-intro-step-proof2 (x, y, z) = tautconseq-proof (nil, f-implies (f-not (x), f-implies (z, f-if (x, y, z))), nil)

;;;;;;; |- "((not A) -> (C -> (if A B C)))".

Theorem: f-if-intro-step2 (formula (x, symbols) ∧ formula (y, symbols) ∧ formula (z, symbols)) → proves (f-if-intro-step-proof2 (x, y, z),

f-implies (f-not (x), f-implies (z, f-if (x, y, z))), given, defns, symbols)

Event: Enable f-if-intro-step-proof1; name this event ‘g0663’.

Event: Enable f-if-intro-step-proof2; name this event ‘g0664’.

Definition: f-if-intro-proof1 (x, y, z, pfx, pfy) = tautconseq-proof (list (x, y), f-if (x, y, z), list (pfx, pfy))

;;;;;;; If |- "A" and |- "B", then |- "(if A B C)".

Theorem: f-if-intro-proof1-proves (formula (x, symbols) ∧ formula (y, symbols) ∧ formula (z, symbols) ∧ proves (pfx, x, given, defns, symbols) ∧ proves (pfy, y, given, defns, symbols)) → proves (f-if-intro-proof1 (x, y, z, pfx, pfy),

f-if (x, y, z), given, defns, symbols)

Event: Enable f-if-intro-proof1; name this event ‘g0902’.

Definition: f-if-intro-proof2 (x, y, z, pfnx, pfz) = tautconseq-proof (list (f-not (x), z), f-if (x, y, z), list (pfnx, pfz))

;;;;;;; If |- "(not A)" and |- "C", then |- "(if A B C)".

Theorem: f-if-intro-proof2-proves (formula (x, symbols) ∧ formula (y, symbols) ∧ formula (z, symbols) ∧ proves (pfnx, f-not (x), given, defns, symbols) ∧ proves (pfz, z, given, defns, symbols)) → proves (f-if-intro-proof2 (x, y, z, pfnx, pfz),

f-if (x, y, z), given, defns, symbols)

Event: Enable f-if-intro-proof2; name this event ‘g0903’.

Definition: f-if-elim-proof1 (x, y, z, pfx) = tautconseq-proof (list (x), f-implies (f-if (x, y, z), y), list (pfx))

;;;;;;; If |- "A", then |- "((if A B C) -> C)".

Theorem: f-if-elim-proof1-proves (formula (x, symbols)

∧ formula (y, symbols) ∧ formula (z, symbols) ∧ proves (pfx, x, given, defns, symbols)) → proves (f-if-elim-proof1 (x, y, z, pfx),

f-implies (f-if (x, y, z), y), given, defns, symbols)

Event: Enable f-if-elim-proof1; name this event ‘g0904’.

Definition: f-if-elim-proof2 (x, y, z, pfnx) = tautconseq-proof (list (f-not (x)), f-implies (f-if (x, y, z), z), list (pfnx))

;;;;;;; If |-"(not A)", then |-"((if A B C) -> C)".

Theorem: f-if-elim-proof2-proves (formula (x, symbols) ∧ formula (y, symbols) ∧ formula (z, symbols) ∧ proves (pfnx, f-not (x), given, defns, symbols)) → proves (f-if-elim-proof2 (x, y, z, pfnx),

f-implies (f-if (x, y, z), z), given, defns, symbols)

Event: Enable f-if-elim-proof2; name this event ‘g0905’.

Theorem: formula-f-if formula (f-if (x, y, z), symbols) = (formula (x, symbols) ∧ formula (y, symbols) ∧ formula (z, symbols))

Theorem: collect-free-f-if collect-free (f-if (x, y, z), 0) = collect-free (f-or (f-and (x, y), f-and (f-not (x), z)), 0)

Theorem: subst-f-if subst (f-if (x, y, z), var, term, 0) = f-if (subst (x, var, term, 0), subst (y, var, term, 0), subst (z, var, term, 0))

Theorem: parallel-subst-f-if parallel-subst (f-if (x, y, z), vars, terms, 0)

= f-if (parallel-subst (x, vars, terms, 0), parallel-subst (y, vars, terms, 0), parallel-subst (z, vars, terms, 0))

Theorem: covering-f-if covering (f-if (x, y, z), var, 0) = append (append (covering (x, var, 0), covering (y, var, 0)),

append (covering (x, var, 0), covering (z, var, 0)))

Theorem: eval-f-if eval (f-if (x, y, z), alist) = if eval (x, alist) then eval (y, alist)

else eval (z, alist) endif

Event: Enable f-if; name this event ‘g0909’.

Definition: case-split-proof (x, y, pf1 , pf2 ) = tautconseq-proof (list (f-implies (x, y), f-implies (f-not (x), y)),

y,

list (pf1 , pf2 ))

;;;;;;;If |- "(A -> B)" and |- "((not A) -> B)", then |- "B".

Theorem: case-split-proof-proves (proves (pf1 , f-implies (x, y), given, defns, symbols) ∧ proves (pf2 , f-implies (f-not (x), y), given, defns, symbols)) → proves (case-split-proof (x, y, pf1 , pf2 ), y, given, defns, symbols)

Event: Enable case-split-proof; name this event ‘g0601’.

Theorem: termp-phi termp (phi, 0, symbols) = (fn (0, 0) ∈ symbols)

Theorem: collect-free-phi collect-free (phi, 0) = nil

Theorem: covering-phi covering (phi, var, 0) = nil

Theorem: subst-phi subst (phi, var, term, 0) = phi

Theorem: parallel-subst-phi parallel-subst (phi, vars, terms, 0) = phi Event: Enable phi; name this event ‘g0668’.

Theorem: proves-list-nil proves-list (nil, nil, given, defns, symbols)

Definition: forsome-distrib-or-proof1 (x, a, b) = forsome-intro-proof (x,

f-or (a, b),

f-or (forsome (x, a), forsome (x, b)),

tautconseq-proof (list (f-implies (a, forsome (x, a)),

f-implies (b, forsome (x, b))), f-implies (f-or (a, b),

f-or (forsome (x, a),

forsome (x, b))),

list (e-intro-proof (x, a), e-intro-proof (x, b))))

;;;;;;; |- "((forsome x (A v B)) -> ((forsome x A) v (forsome x B)))".

Theorem: forsome-distrib-or-proof-proves1 (variable (x) ∧ formula (a, symbols) ∧ formula (b, symbols)) → proves (forsome-distrib-or-proof1 (x, a, b),

f-implies (forsome (x, f-or (a, b)), f-or (forsome (x, a), forsome (x, b))), given, defns, symbols)

Definition: forsome-distrib-step-proof (x, a, b) = forsome-intro-proof (x,

b,

forsome (x, f-or (a, b)),

chain-proof (b, forsome (x, f-or (a, b)), list (f-or (a, b)), list (tautconseq-proof (nil,

f-implies (b,

f-or (a,

b)),

nil),

e-intro-proof (x, f-or (a, b)))))

;;;;;;; |- "(forsome x B) -> (forsome x (A v B))".

Theorem: forsome-distrib-step-proof-proves (variable (x) ∧ formula (a, symbols) ∧ formula (b, symbols)) → proves (forsome-distrib-step-proof (x, a, b),

f-implies (forsome (x, b), forsome (x, f-or (a, b))),

given, defns, symbols)

Event: Enable forsome-distrib-or-proof1; name this event ‘g0669’.

Event: Enable forsome-distrib-step-proof; name this event ‘g0670’.

Definition: forsome-distrib-or-proof2 (x, a, b) = tautconseq-proof (list (f-implies (forsome (x, a), forsome (x, f-or (a, b))),

f-implies (forsome (x, b), forsome (x, f-or (a, b)))), f-implies (f-or (forsome (x, a), forsome (x, b)), forsome (x, f-or (a, b))),

list (forsome-intro-proof (x, a, forsome (x, f-or (a, b)), chain-proof (a,

forsome (x,

f-or (a,

b)),

list (f-or (a, b)),

list (tautconseq-proof (nil,

f-implies (a,

f-or (a,

b)),

nil),

e-intro-proof (x,

f-or (a,

b))))),

forsome-distrib-step-proof (x, a, b)))

;;;;;;; |- "(((forsome x A) v (forsome x B)) -> (forsome x (A v B)))".

Theorem: forsome-distrib-or-proof-proves2 (variable (x) ∧ formula (a, symbols) ∧ formula (b, symbols)) → proves (forsome-distrib-or-proof2 (x, a, b),

f-implies (f-or (forsome (x, a), forsome (x, b)), forsome (x, f-or (a, b))), given, defns,

symbols)

Definition: forall-distrib-or-proof (x, a, b) = tautconseq-proof (list (f-implies (∀ x a, ∀ x f-or (a, b)),

f-implies (∀ x b, ∀ x f-or (a, b))), f-implies (f-or (∀ x a, ∀ x b), ∀ x f-or (a, b)), list (forall-intro-proof (∀ x a,

f-or (a, b),

x,

tautconseq-proof (list (f-implies (∀ x a,

a)),

f-implies (∀ x a,

f-or (a,

b)),

list (all-elim-proof (x,

a)))),

forall-intro-proof (∀ x b, f-or (a, b), x, tautconseq-proof (list (f-implies (∀ x b,

b)),

f-implies (∀ x b,

f-or (a,

b)),

list (all-elim-proof (x, b))))))

Theorem: proves-list-reduc proves-list (cons (pf1 , pf2 ), cons (exp1 , exp2 ), given, defns, symbols) = (proves (pf1 , exp1 , given, defns, symbols)

∧ proves-list (pf2 , exp2 , given, defns, symbols))

;;;;;;; |-"((forall x A) v (forall x B)) -> (forall x (A v B))".

Theorem: forall-distrib-or (variable (x) ∧ formula (a, symbols) ∧ formula (b, symbols)) → proves (forall-distrib-or-proof (x, a, b),

f-implies (f-or (∀ x a, ∀ x b), ∀ x f-or (a, b)), given, defns, symbols)

Event: Enable forall-distrib-or-proof; name this event ‘g0672’.

Event: Disable forall; name this event ‘g0673’.

Definition: forsome-forall-proof (x, a) = tautconseq-proof (list (f-iff (forsome (x, f-not (f-not (a))), forsome (x, a))),

f-iff (f-not (forsome (x, a)), ∀ x f-not (a)), list (eqn-form-proof (forsome (x, a),

forsome (x, f-not (f-not (a))), list (f-iff (f-not (f-not (a)), a)), list (tautconseq-proof (nil,

f-iff (f-not (f-not (a)),

a), nil)))))

;;;;;;; |- "(not (forsome x A)) <-> (forall x (not A))".

Theorem: forsome-forall (variable (x) ∧ formula (a, symbols)) → proves (forsome-forall-proof (x, a),

f-iff (f-not (forsome (x, a)), ∀ x f-not (a)), given, defns, symbols)

Definition: forall-forsome-proof (x, a) = tautconseq-proof (nil, f-iff (f-not (∀ x a), forsome (x, f-not (a))), nil)

;;;;;;; |- "(not (forall x A)) <-> (forsome x (not A))".

Theorem: forall-forsome (variable (x) ∧ formula (a, symbols)) → proves (forall-forsome-proof (x, a),

f-iff (f-not (∀ x a), forsome (x, f-not (a))), given, defns, symbols)

Event: Enable forsome-forall-proof; name this event ‘g0674’.

Event: Enable forall-forsome-proof; name this event ‘g0675’.

Event: Enable forsome-distrib-or-proof2; name this event ‘g0593’.

Event: Enable forall; name this event ‘g0676’.

Definition: forsome-distrib-and-proof (x, a, b) = chain-proof (f-and (a, forsome (x, b)),

forsome (x, f-and (a, b)), list (f-not (f-or (f-not (a), f-not (forsome (x, b)))),

f-not (f-or (forsome (x, f-not (a)), f-not (forsome (x, b)))), f-not (f-implies (forsome (x, b), forsome (x, f-not (a)))), f-not (∀ x f-implies (b, f-not (a))), forsome (x, f-not (f-implies (b, f-not (a))))),

list (tautconseq-proof (nil,

f-implies (f-and (a, forsome (x, b)), f-not (f-or (f-not (a),

f-not (forsome (x,

b))))),

nil),

iff-split-proof1 (f-not (f-or (f-not (a),

f-not (forsome (x, b)))),

f-not (f-or (forsome (x, f-not (a)),

f-not (forsome (x, b)))),

eqn-form-proof (f-not (f-or (forsome (x,

f-not (a)), f-not (forsome (x,

b)))),

f-not (f-or (f-not (a),

f-not (forsome (x,

b)))),

list (f-iff (f-not (a),

forsome (x,

f-not (a)))),

list (iff-commute-proof (forsome (x,

f-not (a)), f-not (a), del-forsome-proof (x,

f-not (a)))))),

tautconseq-proof (nil,

f-implies (f-not (f-or (forsome (x,

f-not (a)), f-not (forsome (x,

b)))),

f-not (f-implies (forsome (x, b), forsome (x,

f-not (a))))),

nil),

contra-pos-proof1 (∀ x f-implies (b, f-not (a)),

f-implies (forsome (x, b),

forsome (x, f-not (a))),

forall-over-implies-proof (x, b, f-not (a))),

iff-split-proof1 (f-not (∀ x f-implies (b, f-not (a))),

forsome (x,

f-not (f-implies (b, f-not (a)))), forall-forsome-proof (x,

f-implies (b,

f-not (a)))),

iff-split-proof1 (forsome (x,

f-not (f-implies (b, f-not (a)))), forsome (x, f-and (a, b)), eqn-form-proof (forsome (x, f-and (a, b)),

forsome (x,

f-not (f-implies (b,

f-not (a)))),

list (f-iff (f-not (f-implies (b,

f-not (a))),

f-and (a, b))), list (tautconseq-proof (nil,

f-iff (f-not (f-implies (b,

f-not (a))),

f-and (a,

b)),

nil))))))

;;;;;;; If "x" not free in "A", then |- "(A ^(forsome x B)) -> (forsome x (A ^B))".

Theorem: forsome-distrib-and-proof-proves (variable (x) ∧ formula (a, symbols) ∧ formula (b, symbols) ∧ (x ∉ collect-free (a, 0))) → proves (forsome-distrib-and-proof (x, a, b),

f-implies (f-and (a, forsome (x, b)), forsome (x, f-and (a, b))), given, defns, symbols)

Event: Enable forsome-distrib-and-proof; name this event ‘g0681’.

Event: Enable forsome-distrib-or-proof2; name this event ‘g0683’.

Definition: forsome-f-if-proof (var, x, y, z) = chain-proof (f-if (x, forsome (var, y), forsome (var, z)),

forsome (var, f-if (x, y, z)),

list (f-or (forsome (var, f-and (x, y)),

forsome (var, f-and (f-not (x), z)))), list (tautconseq-proof (list (f-implies (f-and (x,

forsome (var, y)), forsome (var,

f-and (x, y))),

f-implies (f-and (f-not (x),

forsome (var, z)), forsome (var,

f-and (f-not (x), z)))),

f-implies (f-if (x, forsome (var, y), forsome (var, z)),

f-or (forsome (var,

f-and (x, y)), forsome (var,

f-and (f-not (x), z)))),

list (forsome-distrib-and-proof (var, x, y),

forsome-distrib-and-proof (var, f-not (x), z))),

forsome-distrib-or-proof2 (var, f-and (x, y), f-and (f-not (x), z))))

;;;;;;; If "v" not free in "A", then
;;;;;;; |-"(if A (forsome v B) (forsome v C)) -> (forsome v (if A B C))".
;;;;;;;This important rule justifies definition by cases using the "if" connective.

Theorem: forsome-f-if-proof-proves (variable (var)

∧ formula (x, symbols) ∧ formula (y, symbols) ∧ formula (z, symbols) ∧ (var ∉ collect-free (x, 0))) → proves (forsome-f-if-proof (var, x, y, z),

f-implies (f-if (x, forsome (var, y), forsome (var, z)), forsome (var, f-if (x, y, z))),

given, defns, symbols)

Event: Enable forsome-f-if-proof; name this event ‘g0684’.

Definition: unique-f-if-proof (test, left1 , left2 , right1 , right2 , exp, pf1 , pf2 ) = tautconseq-proof (list (f-implies (f-and (left1 , left2 ), exp),

f-implies (f-and (right1 , right2 ), exp)), f-implies (f-and (f-if (test, left1 , right1 ),

f-if (test, left2 , right2 )), exp),

list (pf1 , pf2 ))

;;;;;;;If |-"(B1 ^B2) -> P" and |-"(C1 ^C2) -> P", then
;;;;;;; |- "(((if A B1 C1) ^(if A B2 C2)) -> P)".
;;;;;;;This lemma justifies the uniqueness part of the admissibility of a
;;;;;;;definition by cases using the "if" connective.

Theorem: unique-f-if-proof-proves (formula (test, symbols) ∧ proves (pf1 , f-implies (f-and (left1 , left2 ), exp), given, defns, symbols) ∧ proves (pf2 , f-implies (f-and (right1 , right2 ), exp), given, defns, symbols)) → proves (unique-f-if-proof (test, left1 , left2 , right1 , right2 , exp, pf1 , pf2 ),

f-implies (f-and (f-if (test, left1 , right1 ),

f-if (test, left2 , right2 )), exp),

given, defns, symbols)

Event: Enable unique-f-if-proof; name this event ‘g0603’.

Definition: forsome-f-if-case-proof (var, x, y, z, pf1 , pf2 ) = tautconseq-proof (list (f-implies (x, forsome (var, y)), f-implies (f-not (x), forsome (var, z)), f-implies (f-if (x, forsome (var, y), forsome (var, z)), forsome (var, f-if (x, y, z)))),

forsome (var, f-if (x, y, z)),

list (pf1 , pf2 , forsome-f-if-proof (var, x, y, z)))

;;;;;;;If |- "(A -> (forsome v B))" and |-"((not A) -> (forsome v C))",
;;;;;;;then |- "(forsome v (if A B C))".

Theorem: forsome-f-if-case-proof-proves (variable (var) ∧ formula (x, symbols) ∧ formula (y, symbols) ∧ formula (z, symbols) ∧ (var ∉ collect-free (x, 0)) ∧ proves (pf1 , f-implies (x, forsome (var, y)), given, defns, symbols) ∧ proves (pf2 , f-implies (f-not (x), forsome (var, z)), given, defns, symbols)) → proves (forsome-f-if-case-proof (var, x, y, z, pf1 , pf2 ),

forsome (var, f-if (x, y, z)), given, defns, symbols)

Event: Enable forsome-f-if-case-proof; name this event ‘g0687’.

Definition: exis-fun-intro-proof (var, term) = detach-proof (f-equal (term, term),

forsome (var, f-equal (var, term)),

ident-axiom-proof (term),

subst-thm-a-proof (f-equal (var, term), list (var), list (term)))

Theorem: parallel-subst-f-equal parallel-subst (f-equal (a, b), vars, terms, 0) = f-equal (parallel-subst (a, vars, terms, 0),

parallel-subst (b, vars, terms, 0))

Theorem: f-equal-col-free collect-free (f-equal (x, y), 0) = collect-free (list (x, y), 1)

Theorem: covering-f-equal covering (f-equal (x, y), var, 0) = covering (list (x, y), var, 1)

;;;;;;; |- "(forsome v (v = t))", "v" not free in "t".

Theorem: exis-fun-intro-proof-proves (variable (var) ∧ termp (term, 0, symbols) ∧ (var ∉ collect-free (term, 0))) → proves (exis-fun-intro-proof (var, term),

forsome (var, f-equal (var, term)),

given, defns, symbols)

Event: Enable exis-fun-intro-proof; name this event ‘g0690’.

Theorem: subset-append-reduc subset (append (x, y), z) = (subset (x, z) ∧ subset (y, z))

Definition: z-succ-hyps (defns, symbols) = ((assoc (fn (3, 1), defns) = f-equal (z-succ (0), z-union (z-sing (0), 0)))

∧ subset (list (fn (2, 2), fn (1, 2)), rest-of (fn (3, 1), symbols)))

Definition: unique-fun-intro-proof (var1 , var2 , term) = tautconseq-proof (list (f-implies (f-equal (var1 , term),

f-implies (f-equal (var2 , term),

f-equal (var1 , var2 )))),

f-implies (f-and (f-equal (var1 , term),

f-equal (var2 , term)), f-equal (var1 , var2 )), list (trans-equal-proof2 (var1 , term, var2 )))

;;;;;;; |- "((v1 = t) ^(v2 = t)) -> (v1 = v2)".

Theorem: unique-fun-intro-proof-proves termp (list (var1 , var2 , term), 1, symbols) → proves (unique-fun-intro-proof (var1 , var2 , term),

f-implies (f-and (f-equal (var1 , term), f-equal (var2 , term)),

f-equal (var1 , var2 )),

given, defns, symbols)

Event: Enable unique-fun-intro-proof; name this event ‘g0604’.

Event: Enable rest-of; name this event ‘g0702’.

Definition: z-succ-defn-proof (term) = subst-rule-proof (f-equal (z-succ (0), z-union (z-sing (0), 0)),

                  0,

term,

fun-defn-proof (fn (3, 1), list (0),

                               1,
                               2,

f-equal (1, z-union (z-sing (0), 0)), exis-fun-intro-proof (1,

z-union (z-sing (0), 0)),

unique-fun-intro-proof (1,

                                                  2,

z-union (z-sing (0), 0))))

;;;;;;;The definition of the successor operation: |- "(S t) = ({t} U t)".

Theorem: z-succ-defn (z-succ-hyps (defns, symbols) ∧ termp (term, 0, symbols) ∧ subset (list (fn (3, 1), fn (2, 2), fn (1, 2), p (1, 2), fn (0, 0)), symbols)) → proves (z-succ-defn-proof (term),

f-equal (z-succ (term), z-union (z-sing (term), term)), given, defns, symbols)

Event: Enable z-succ-defn-proof; name this event ‘g0407’.

Event: Enable z-succ-hyps; name this event ‘g0677’.

Theorem: termp-z-succ termp (z-succ (x), 0, symbols) = ((fn (3, 1) ∈ symbols) ∧ termp (x, 0, symbols))

Theorem: subst-z-succ subst (z-succ (x), var, term, 0) = z-succ (subst (x, var, term, 0))

Theorem: parallel-subst-z-succ parallel-subst (z-succ (x), vars, terms, 0) = z-succ (parallel-subst (x, vars, terms, 0))

Theorem: covering-z-succ covering (z-succ (x), var, 0) = covering (list (x), var, 1)

Theorem: z-succ-col-free collect-free (z-succ (x), 0) = collect-free (list (x), 1)

Theorem: equal-axiom1-z-succ ((fn (3, 1) ∈ symbols) ∧ termp (list (x, y), 1, symbols)) → proves (equal-axiom1-proof (fn (3, 1), list (x), list (y)),

f-implies (f-equal (x, y), f-equal (z-succ (x), z-succ (y))), given, defns, symbols)

Event: Enable z-succ; name this event ‘g0408’.

Definition: ext-axiom-eq-detach-proof (terma, termb, termc, pf ) = detach-proof (f-equal (terma, termb),

f-iff (isin (termc, terma), isin (termc, termb)), pf , chain-proof (f-equal (terma, termb),

f-iff (isin (termc, terma), isin (termc, termb)),

list (∀ mk-bnd, (list terma termb), 0 f-iff (isin (mk-bnd (list (terma,

termb), 0),

terma), isin (mk-bnd (list (terma,

termb), 0),

termb))),

list (iff-split-proof1 (f-equal (terma, termb),

∀ mk-bnd, (list terma termb), 0 f-iff (isin (mk-bnd (list (terma,

termb), 0),

terma), isin (mk-bnd (list (terma,

termb), 0),

termb)),

ext-axiom-proof (mk-bnd (list (terma,

termb), 0),

terma,

termb)),

subst-thm-b-proof (f-iff (isin (mk-bnd (list (terma,

termb), 0),

terma), isin (mk-bnd (list (terma,

termb), 0),

termb)), list (mk-bnd (list (terma,

termb), 0)),

list (termc)))))

;;;;;;; If |-"(a = b)", then |-"(c in a) <-> (c in b)".

Theorem: ext-axiom-eq-detach (termp (list (terma, termb, termc), 1, symbols) ∧ proves (pf , f-equal (terma, termb), given, defns, symbols) ∧ (p (1, 2) ∈ symbols)) → proves (ext-axiom-eq-detach-proof (terma, termb, termc, pf ),

f-iff (isin (termc, terma), isin (termc, termb)), given, defns, symbols)

Event: Enable ext-axiom-eq-detach-proof; name this event ‘g0704’.

Definition: in-z-succ-proof (x, y) = chain-iff-proof (isin (y, z-succ (x)),

f-or (f-equal (y, x), isin (y, x)), list (isin (y, z-union (z-sing (x), x)),

f-or (isin (y, z-sing (x)), isin (y, x))), list (ext-axiom-eq-detach-proof (z-succ (x),

z-union (z-sing (x), x), y, z-succ-defn-proof (x)),

union-axiom-proof (y, z-sing (x), x),

eqn-form-proof (f-or (f-equal (y, x), isin (y, x)), f-or (isin (y, z-sing (x)), isin (y, x)), list (f-iff (isin (y, z-sing (x)),

f-equal (y, x))), list (isin-sing-proof (x, y)))))

;;;;;;; |-"(y in (S x)) <-> ((y = x) v (y in x))".

Theorem: in-z-succ-proof-proves (z-succ-hyps (defns, symbols) ∧ subset (list (fn (3, 1), fn (2, 2), fn (1, 2), p (1, 2), fn (0, 0)), symbols) ∧ termp (list (x, y), 1, symbols)) → proves (in-z-succ-proof (x, y),

f-iff (isin (y, z-succ (x)), f-or (f-equal (y, x), isin (y, x))), given, defns, symbols)

Event: Enable in-z-succ-proof; name this event ‘g0705’.

Definition: x-in-z-succ-x-proof (x) = f-iff-mp-proof2 (isin (x, z-succ (x)),

f-or (f-equal (x, x), isin (x, x)), in-z-succ-proof (x, x), rt-expan-proof (f-equal (x, x),

isin (x, x),

ident-axiom-proof (x)))

;;;;;;; |-"(x in (S x))".

Theorem: x-in-z-succ-x (z-succ-hyps (defns, symbols) ∧ subset (list (fn (3, 1), fn (2, 2), fn (1, 2), p (1, 2), fn (0, 0)), symbols) ∧ termp (x, 0, symbols)) → proves (x-in-z-succ-x-proof (x), isin (x, z-succ (x)), given, defns, symbols)

Event: Enable x-in-z-succ-x-proof; name this event ‘g0707’.

Definition: z-succ-equal-step-proof (x, y) = chain-proof (f-equal (z-succ (x), z-succ (y)),

f-or (f-equal (x, y), isin (x, y)),

list (isin (x, z-succ (y))),

list (ext-axiom-eq-elim1-proof (z-succ (x), z-succ (y), x, x-in-z-succ-x-proof (x)),

iff-split-proof1 (isin (x, z-succ (y)), f-or (f-equal (x, y), isin (x, y)), in-z-succ-proof (y, x))))

;;;;;;; |- "((S x)=(S y)) -> ((x = y) v (x in y))".

Theorem: z-succ-equal-step (z-succ-hyps (defns, symbols) ∧ subset (list (fn (3, 1), fn (2, 2), fn (1, 2), p (1, 2), fn (0, 0)), symbols) ∧ termp (list (x, y), 1, symbols)) → proves (z-succ-equal-step-proof (x, y),

f-implies (f-equal (z-succ (x), z-succ (y)),

f-or (f-equal (x, y), isin (x, y))),

given, defns, symbols)

Event: Enable z-succ-equal-step-proof; name this event ‘g0708’.

Definition: equal-z-succ-proof (x, y) = tautconseq-proof (list (f-implies (f-equal (z-succ (x), z-succ (y)),

f-or (f-equal (x, y), isin (x, y))),

f-implies (f-equal (z-succ (x), z-succ (y)),

f-equal (z-succ (y), z-succ (x))),

f-implies (f-equal (z-succ (y), z-succ (x)),

f-or (f-equal (y, x), isin (y, x))),

f-implies (f-equal (y, x), f-equal (x, y))), f-implies (f-equal (z-succ (x), z-succ (y)), f-or (f-equal (x, y),

f-and (isin (x, y), isin (y, x)))),

list (z-succ-equal-step-proof (x, y), symmetry-proof1 (z-succ (x), z-succ (y)), z-succ-equal-step-proof (y, x), symmetry-proof1 (y, x)))

;;;;;;; |- "((S x)=(S y)) -> ((x = y) v ((x in y) ^(y in x)))".

Theorem: equal-z-succ-proof-proves (z-succ-hyps (defns, symbols) ∧ subset (list (fn (3, 1), fn (2, 2), fn (1, 2), p (1, 2), fn (0, 0)), symbols) ∧ termp (x, 0, symbols) ∧ termp (y, 0, symbols)) → proves (equal-z-succ-proof (x, y),

f-implies (f-equal (z-succ (x), z-succ (y)),

f-or (f-equal (x, y), f-and (isin (x, y), isin (y, x)))),

given, defns, symbols)

Event: Enable equal-z-succ-proof; name this event ‘g0709’.

;;;;;;;The next series of defns and lemmas deal with the definition of "(I x)".
;;;;;;;"(I x)" holds of "x" iff "x" is transitive and linearly ordered by "in".
;;;;;;;"(Trans x)" iff "(forall y (forall z ((y in x) -> ((z in y) -> (z in x)))))".
;;;;;;;"x" is linearly ordered by "in" (i.e., "(Trich x)") iff
;;;;;;;"(forall y (forall z (((y in x) ^(z in x)) -> ((y = z) v ((y in z) v (z in y))))))"
;;;;;;;Z-TRANS generates the transitivity assertion.

Definition: z-trans1 (x, u, v) = f-implies (f-and (isin (u, x), isin (v, u)), isin (v, x))

Definition: z-trans (x, y, z) = ∀ y ∀ z z-trans1 (x, y, z)

Definition: z-trans-instance-proof (x, y, z, y1 , z1 ) = subst-thm-b-proof (z-trans1 (x, y, z), list (y, z), list (y1 , z1 ))

Theorem: z-trans-instance-proof-proves (termp (list (x, y1 , z1 ), 1, symbols) ∧ var-set (list (y, z), 2) ∧ nil-intersect (list (y, z), collect-free (x, 0)) ∧ (p (1, 2) ∈ symbols) ∧ (concl = f-implies (z-trans (x, y, z), z-trans1 (x, y1 , z1 )))) → proves (z-trans-instance-proof (x, y, z, y1 , z1 ), concl, given, defns, symbols)

Event: Enable z-trans-instance-proof; name this event ‘g0710’.

Theorem: formula-z-trans formula (z-trans (x, y, z), symbols) = ((p (1, 2) ∈ symbols) ∧ termp (list (x, y, z), 1, symbols))

Theorem: collect-free-z-trans (var-list (list (y, z), 2) ∧ nil-intersect (list (y, z), collect-free (x, 0))) → ((var ∈ collect-free (z-trans (x, y, z), 0))

= (var ∈ collect-free (x, 0)))

Event: Enable z-trans; name this event ‘g0715’.

Definition: in-z-trans-proof (x, v1 , v2 , y, z) = tautconseq-proof (list (f-implies (z-trans (x, v1 , v2 ), z-trans1 (x, y, z)),

f-implies (z-trans (y, v1 , v2 ), z-trans1 (y, x, z))), f-implies (f-and (f-and (z-trans (x, v1 , v2 ),

z-trans (y, v1 , v2 )), f-and (isin (x, y), isin (y, x))),

f-iff (isin (z, x), isin (z, y))), list (z-trans-instance-proof (x, v1 , v2 , y, z), z-trans-instance-proof (y, v1 , v2 , x, z)))

;;;;;;; |- "((Trans x) ^(Trans y) ^(x in y) ^(y in x)) -> ((z in x) <-> (z in y))".

Theorem: in-z-trans-proof-proves (termp (list (x, y, z), 1, symbols) ∧ var-set (list (v1 , v2 ), 2) ∧ nil-intersect (list (v1 , v2 ), collect-free (list (x, y), 1)) ∧ (p (1, 2) ∈ symbols)) → proves (in-z-trans-proof (x, v1 , v2 , y, z),

f-implies (f-and (f-and (z-trans (x, v1 , v2 ), z-trans (y, v1 , v2 )), f-and (isin (x, y), isin (y, x))),

f-iff (isin (z, x), isin (z, y))),

given, defns, symbols)

Event: Enable in-z-trans-proof; name this event ‘g0718’.

Definition: z-trans-equal-proof1 (x, y, v1 , v2 ) = chain-proof (f-and (f-and (z-trans (x, v1 , v2 ), z-trans (y, v1 , v2 )),

f-and (isin (x, y), isin (y, x))), f-equal (x, y), list (∀ v1 f-iff (isin (v1 , x), isin (v1 , y))), list (forall-intro-proof (f-and (f-and (z-trans (x, v1 , v2 ),

z-trans (y, v1 , v2 )), f-and (isin (x, y), isin (y, x))),

f-iff (isin (v1 , x), isin (v1 , y)),

v1 ,

in-z-trans-proof (x, v1 , v2 , y, v1 )),

iff-split-proof2 (f-equal (x, y), ∀ v1 f-iff (isin (v1 , x), isin (v1 , y)), ext-axiom-proof (v1 , x, y))))

;;;;;;; |- "((Trans x) ^(Trans y) ^(x in y) ^(y in x)) -> (x = y)".

Theorem: z-trans-equal-proof1-proves (termp (list (x, y), 1, symbols) ∧ var-set (list (v1 , v2 ), 2)

∧ nil-intersect (list (v1 , v2 ), collect-free (list (x, y), 1)) ∧ (p (1, 2) ∈ symbols)) → proves (z-trans-equal-proof1 (x, y, v1 , v2 ),

f-implies (f-and (f-and (z-trans (x, v1 , v2 ), z-trans (y, v1 , v2 )),

f-and (isin (x, y), isin (y, x))), f-equal (x, y)),

given, defns, symbols)

Event: Enable z-trans-equal-proof1; name this event ‘g0719’.

Definition: z-succ-equal-proof (x, y, v1 , v2 ) = tautconseq-proof (list (f-implies (f-equal (z-succ (x), z-succ (y)),

f-or (f-equal (x, y),

f-and (isin (x, y), isin (y, x)))),

f-implies (f-and (f-and (z-trans (x, v1 , v2 ),

z-trans (y, v1 , v2 )), f-and (isin (x, y), isin (y, x))),

f-equal (x, y))),

f-implies (z-trans (x, v1 , v2 ),

f-implies (z-trans (y, v1 , v2 ),

f-implies (f-equal (z-succ (x),

z-succ (y)), f-equal (x, y)))),

list (equal-z-succ-proof (x, y), z-trans-equal-proof1 (x, y, v1 , v2 )))

;;;;;;; |- "((Trans x) -> ((Trans y) -> (((S x)=(S y)) -> (x = y))))".

Theorem: z-succ-equal-proof-proves (termp (list (x, y), 1, symbols) ∧ var-set (list (v1 , v2 ), 2) ∧ nil-intersect (list (v1 , v2 ), collect-free (list (x, y), 1)) ∧ subset (list (fn (3, 1), fn (2, 2), fn (1, 2), p (1, 2), fn (0, 0)), symbols) ∧ z-succ-hyps (defns, symbols)) → proves (z-succ-equal-proof (x, y, v1 , v2 ),

f-implies (z-trans (x, v1 , v2 ),

f-implies (z-trans (y, v1 , v2 ),

f-implies (f-equal (z-succ (x), z-succ (y)), f-equal (x, y)))),

given, defns, symbols)

Event: Enable z-succ-equal-proof; name this event ‘g0720’.

Event: Enable z-trans-equal-proof1-proves; name this event ‘g0721’.

Event: Enable in-z-trans-proof-proves; name this event ‘g0722’.

;;;;;;;NUMERAL returns the set-theoretic ordinal corresponding to a Lisp natural number.
;;;;;;;The numeral for X will be represented as "|X|".

Definition: numeral (x) = if x ≃ 0 then phi

else z-succ (numeral (x − 1)) endif

Theorem: termp-numeral ((fn (0, 0) ∈ symbols) ∧ (fn (3, 1) ∈ symbols)) → termp (numeral (x), 0, symbols)

Theorem: collect-free-numeral collect-free (numeral (x), 0) = nil

Definition: chain-or-proof (a, b, c, d, pf1 , pf2 , pf3 ) = tautconseq-proof (list (f-implies (a, f-or (b, c)),

f-implies (b, d), f-implies (c, d)),

f-implies (a, d), list (pf1 , pf2 , pf3 ))

;;;;;;; If |- "(A -> (B v C))",  |- "(B -> D)", and |- "(C -> D)", then |- "(A -> D)".

Theorem: chain-or-proof-proves (proves (pf1 , f-implies (a, f-or (b, c)), given, defns, symbols) ∧ proves (pf2 , f-implies (b, d), given, defns, symbols) ∧ proves (pf3 , f-implies (c, d), given, defns, symbols)) → proves (chain-or-proof (a, b, c, d, pf1 , pf2 , pf3 ),

f-implies (a, d), given, defns, symbols)

Event: Enable chain-or-proof; name this event ‘g0605’.

Definition: z-trans-numeral-proof (x, y, z) = if x ≃ 0

then tautconseq-proof (list (f-not (isin (y, phi))),

f-implies (f-and (isin (y, phi), isin (z, y)),

isin (z, phi)),

list (null-axiom-proof (y)))

else chain-proof (f-and (isin (y, numeral (x)), isin (z, y)), isin (z, numeral (x)), list (f-and (f-or (f-equal (y, numeral (x − 1)),

isin (y, numeral (x − 1))), isin (z, y)), isin (z, numeral (x − 1))),

list (tautconseq-proof (list (f-implies (isin (y,

z-succ (numeral (x − 1))), f-or (f-equal (y,

numeral (x − 1)), isin (y,

numeral (x − 1))))),

f-implies (f-and (isin (y,

z-succ (numeral (x − 1))), isin (z, y)), f-and (f-or (f-equal (y,

numeral (x − 1)), isin (y,

numeral (x − 1))),

isin (z, y))),

list (iff-split-proof1 (isin (y,

z-succ (numeral (x − 1))), f-or (f-equal (y,

numeral (x − 1)), isin (y,

numeral (x − 1))), in-z-succ-proof (numeral (x − 1), y)))),

tautconseq-proof (list (f-implies (f-equal (y,

numeral (x − 1)), f-implies (isin (z,

y), isin (z,

numeral (x − 1)))),

f-implies (f-and (isin (y,

numeral (x − 1)), isin (z,

y)),

isin (z,

numeral (x − 1)))),

f-implies (f-and (f-or (f-equal (y,

numeral (x − 1)), isin (y,

numeral (x − 1))),

isin (z, y)), isin (z,

numeral (x − 1))),

list (detach-proof (f-equal (z,

z), f-implies (f-equal (y,

numeral (x − 1)), f-implies (isin (z,

y), isin (z,

numeral (x − 1)))),

ident-axiom-proof (z), equal-axiom2-proof (p (1,

2), list (z, y), list (z,

numeral (x − 1)))),

z-trans-numeral-proof (x − 1, y, z))),

tautconseq-proof (list (f-implies (f-or (f-equal (z,

numeral (x − 1)), isin (z,

numeral (x − 1))),

isin (z,

z-succ (numeral (x − 1))))),

f-implies (isin (z,

numeral (x − 1)), isin (z,

z-succ (numeral (x − 1)))),

list (iff-split-proof2 (isin (z,

z-succ (numeral (x − 1))), f-or (f-equal (z,

numeral (x − 1)), isin (z,

numeral (x − 1))), in-z-succ-proof (numeral (x − 1),

z)))))) endif

;;;;;;; |- "((y in |X|) ^(z in y)) -> (z in |X|)".

Theorem: z-trans-numeral-proof-proves (z-succ-hyps (defns, symbols) ∧ subset (list (fn (3, 1), fn (2, 2), fn (1, 2), p (1, 2), fn (0, 0)), symbols) ∧ termp (list (y, z), 1, symbols)) → proves (z-trans-numeral-proof (x, y, z),

f-implies (f-and (isin (y, numeral (x)), isin (z, y)),

isin (z, numeral (x))),

given, defns, symbols)

Event: Enable z-trans-numeral-proof; name this event ‘g0723’.

Theorem: form-equal-proof-proves1 (formula (forma, symbols) ∧ formula (formb, symbols) ∧ form-equal (forma, formb, list) ∧ listp (list) ∧ form-list (list, symbols) ∧ (concl = f-implies (list-f-and (list), f-iff (forma, formb)))) → proves (form-equal-proof (forma, formb, list), concl, given, defns, symbols)

Event: Enable form-equal-proof-proves; name this event ‘g0724’.

Theorem: termp-del-pairs termp (x, 1, symbols) → termp (del-pairs (y, vars, x), 1, symbols)

Theorem: length-parallel-subst length (parallel-subst (exp, vars, terms, 1)) = length (exp)

Theorem: termp-parallel-subst (termp (term, flg, symbols) ∧ termp (terms, 1, symbols)) → termp (parallel-subst (term, vars, terms, flg), flg, symbols)

Theorem: formula-parallel-subst (formula (exp, symbols) ∧ termp (terms, 1, symbols)) → formula (parallel-subst (exp, vars, terms, 0), symbols)

Theorem: form-equal-parallel-subst-again (var-list (vars, length (vars)) ∧ formula (exp, symbols) ∧ (collect-free (terms, 1) = nil) ∧ (list = list-f-equal (vars, terms))) → form-equal (exp, parallel-subst (exp, vars, terms, 0), list)

Event: Enable form-equal-parallel-subst; name this event ‘g0729’.

Event: Enable form-equal; name this event ‘g0730’.

Definition: in-z-succ-proof1 (x, y) = iff-split-proof1 (isin (y, z-succ (x)),

f-or (f-equal (y, x), isin (y, x)), in-z-succ-proof (x, y))

Definition: z-trich1 (x, y, z) = f-implies (f-and (isin (y, x), isin (z, x)),

f-or (f-equal (y, z), f-or (isin (y, z), isin (z, y))))

Definition: ext-case1-proof (terma, termb, termc, x) = chain-proof (f-equal (terma, termb),

f-iff (isin (termc, terma), isin (termc, termb)), list (∀ x f-iff (isin (x, terma), isin (x, termb))), list (iff-split-proof1 (f-equal (terma, termb),

∀ x f-iff (isin (x, terma),

isin (x, termb)), ext-axiom-proof (x, terma, termb)),

subst-thm-b-proof (f-iff (isin (x, terma), isin (x, termb)), list (x), list (termc))))

;;;;;;; |- "(a=b) -> ((c in a) <-> (c in b))".

Theorem: ext-case1 (variable (x) ∧ (x ∉ collect-free (terma, 0)) ∧ (x ∉ collect-free (termb, 0)) ∧ formula (f-implies (f-equal (terma, termb),

f-iff (isin (termc, terma), isin (termc, termb))),

symbols))

→ proves (ext-case1-proof (terma, termb, termc, x),

f-implies (f-equal (terma, termb),

f-iff (isin (termc, terma), isin (termc, termb))),

given, defns, symbols)

Event: Enable ext-case1-proof; name this event ‘g0914’.

Definition: ext-case-proof (terma, termb, termc) = ext-case1-proof (terma, termb, termc, mk-bnd (list (terma, termb), 0))

Theorem: ext-axiom-case formula (f-implies (f-equal (terma, termb),

f-iff (isin (termc, terma), isin (termc, termb))),

symbols) → proves (ext-case-proof (terma, termb, termc),

f-implies (f-equal (terma, termb),

f-iff (isin (termc, terma), isin (termc, termb))),

given, defns, symbols)

Event: Enable ext-case-proof; name this event ‘g0915’.

Definition: ext-subcase-proof2 (x, y, z) = tautconseq-proof (list (f-implies (f-equal (x, y),

f-iff (isin (z, x), isin (z, y)))),

f-implies (f-equal (x, y),

f-implies (isin (z, y), isin (z, x))),

list (ext-case-proof (x, y, z)))

;;;;;;; |-"(a=b) -> ((c in a) -> (c in b))".

Theorem: ext-subcase-proof2-proves ((p (1, 2) ∈ symbols) ∧ termp (list (x, y, z), 1, symbols)) → proves (ext-subcase-proof2 (x, y, z),

f-implies (f-equal (x, y), f-implies (isin (z, y), isin (z, x))), given, defns, symbols)

Event: Enable ext-subcase-proof2; name this event ‘g0737’.

Definition: z-trich-numeral-proof (x, y, z) = if x ≃ 0

then tautconseq-proof (list (f-not (isin (y, phi))), z-trich1 (phi, y, z), list (null-axiom-proof (y)))

else chain-or-proof (f-and (isin (y, z-succ (numeral (x − 1))),

isin (z, z-succ (numeral (x − 1)))), f-and (f-equal (y, numeral (x − 1)),

f-equal (z, numeral (x − 1))), f-or (f-and (f-equal (y, numeral (x − 1)),

isin (z, numeral (x − 1))), f-or (f-and (f-equal (z, numeral (x − 1)),

isin (y, numeral (x − 1))), f-and (isin (y, numeral (x − 1)),

isin (z, numeral (x − 1))))),

f-or (f-equal (y, z), f-or (isin (y, z), isin (z, y))), tautconseq-proof (list (f-implies (isin (y,

z-succ (numeral (x − 1))), f-or (f-equal (y,

numeral (x − 1)), isin (y,

numeral (x − 1)))),

f-implies (isin (z,

z-succ (numeral (x − 1))), f-or (f-equal (z,

numeral (x − 1)), isin (z,

numeral (x − 1))))),

f-implies (f-and (isin (y,

z-succ (numeral (x − 1))), isin (z,

z-succ (numeral (x − 1)))),

f-or (f-and (f-equal (y,

numeral (x − 1)), f-equal (z,

numeral (x − 1))),

f-or (f-and (f-equal (y,

numeral (x − 1)), isin (z,

numeral (x − 1))), f-or (f-and (f-equal (z,

numeral (x − 1)), isin (y,

numeral (x − 1))),

f-and (isin (y,

numeral (x − 1)), isin (z,

numeral (x − 1))))))),

list (in-z-succ-proof1 (numeral (x − 1),

y),

in-z-succ-proof1 (numeral (x − 1),

z))),

tautconseq-proof (list (f-implies (f-equal (y,

numeral (x − 1)), f-implies (f-equal (z,

numeral (x − 1)), f-equal (y,

z)))),

f-implies (f-and (f-equal (y,

numeral (x − 1)), f-equal (z,

numeral (x − 1))),

f-or (f-equal (y, z),

f-or (isin (y,

z), isin (z,

y)))),

list (trans-equal-proof2 (y, numeral (x − 1), z))),

tautconseq-proof (list (f-implies (f-equal (y,

numeral (x − 1)), f-implies (isin (z,

numeral (x − 1)), isin (z,

y))),

f-implies (f-equal (z,

numeral (x − 1)), f-implies (isin (y,

numeral (x − 1)), isin (y,

z))),

f-implies (f-and (isin (y, numeral (x − 1)), isin (z,

numeral (x − 1))),

f-or (f-equal (y,

z), f-or (isin (y,

z), isin (z,

y))))),

f-implies (f-or (f-and (f-equal (y,

numeral (x − 1)), isin (z,

numeral (x − 1))),

f-or (f-and (f-equal (z,

numeral (x − 1)), isin (y,

numeral (x − 1))),

f-and (isin (y,

numeral (x − 1)), isin (z,

numeral (x − 1))))),

f-or (f-equal (y, z),

f-or (isin (y,

z), isin (z,

y)))),

list (ext-subcase-proof2 (y, numeral (x − 1), z),

ext-subcase-proof2 (z, numeral (x − 1), y),

z-trich-numeral-proof (x − 1, y, z)))) endif

;;;;;;; |- "((y in |X|) ^(z in |X|)) -> ((y = z) ^((y in z) v (z in y)))".

Theorem: z-trich-numeral-proof-proves (termp (list (y, z), 1, symbols) ∧ subset (list (fn (3, 1), fn (2, 2), fn (1, 2), p (1, 2), fn (0, 0)), symbols) ∧ z-succ-hyps (defns, symbols)) → proves (z-trich-numeral-proof (x, y, z),

f-implies (f-and (isin (y, numeral (x)), isin (z, numeral (x))), f-or (f-equal (y, z), f-or (isin (y, z), isin (z, y)))), Event: Enable z-trich-numeral-proof; name this event ‘g0738’.

Definition: ind-axiom-case-proof (form, x, pfbase, pfind) = tautconseq-proof (list (subst (form, x, phi, 0),

∀ x f-implies (f-and (z-int (x), form),

subst (form, x, z-succ (x), 0)),

ind-axiom (form, x),

f-implies (∀ x f-implies (z-int (x), form),

f-implies (z-int (x), form))),

f-implies (z-int (x), form), list (pfbase,

generalise-proof (x,

f-implies (f-and (z-int (x), form), subst (form, x, z-succ (x), 0)),

pfind),

ind-axiom-proof (form, x),

all-elim-proof (x, f-implies (z-int (x), form))))

;;;;;;; If |- "A[|0|]" and |- "((I x) ^A[x]) -> A[(S x)]", then
;;;;;;; |- "(I x) -> A[x]".

Theorem: ind-axiom-case (variable (x) ∧ subset (list (fn (3, 1), fn (0, 0)), symbols) ∧ formula (f-implies (z-int (x), form), symbols) ∧ proves (pfbase, subst (form, x, phi, 0), given, defns, symbols) ∧ proves (pfind,

f-implies (f-and (z-int (x), form), subst (form, x, z-succ (x), 0)), given, defns, symbols))

→ proves (ind-axiom-case-proof (form, x, pfbase, pfind), f-implies (z-int (x), form), given, defns, symbols)

Event: Enable ind-axiom-case-proof; name this event ‘g0422’.

Theorem: atomp-z-int atomp (z-int (x), symbols) = ((p (2, 1) ∈ symbols) ∧ termp (x, 0, symbols))

Theorem: formula-z-int formula (z-int (x), symbols) = ((p (2, 1) ∈ symbols) ∧ termp (x, 0, symbols))

Definition: phi-in-int-proof (x) = ind-axiom-case-proof (f-or (f-equal (phi, x), isin (phi, x)),

x,

rt-expan-proof (f-equal (phi, phi), isin (phi, phi), ident-axiom-proof (phi)),

tautconseq-proof (list (f-implies (f-or (f-equal (phi,

x), isin (phi, x)),

isin (phi,

z-succ (x)))),

f-implies (f-and (z-int (x),

f-or (f-equal (phi,

x), isin (phi, x))),

f-or (f-equal (phi,

z-succ (x)), isin (phi,

z-succ (x)))),

list (iff-split-proof2 (isin (phi,

z-succ (x)), f-or (f-equal (phi,

x), isin (phi, x)), in-z-succ-proof (x,

phi)))))

;;;;;;; |- "(I x) -> ((|0| = x) v (|0| in x))".  This is the only proof
;;;;;;;in this sequence of events in which the induction axiom schema of Z2 is employed.

Theorem: phi-in-int-proof-proves (variable (x) ∧ z-succ-hyps (defns, symbols)

∧ subset (list (fn (3, 1), fn (2, 2), fn (1, 2), p (1, 2), fn (0, 0)), symbols) ∧ (p (2, 1) ∈ symbols) ∧ (concl = f-implies (z-int (x), f-or (f-equal (phi, x), isin (phi, x))))) → proves (phi-in-int-proof (x), concl, given, defns, symbols)

Event: Enable phi-in-int-proof; name this event ‘g0426’.

Definition: ext-not-equal-proof (x, y, d, pfx, pfy) = tautconseq-proof (list (f-implies (f-equal (x, y), isin (d, x)),

f-not (isin (d, x))), f-not (f-equal (x, y)), list (ext-axiom-eq-elim2-proof (x, y, d, pfy), pfx))

;;;;;;; If |-"(not (d in x))" and |- "(d in y)", then |-"(not (x = y))".

Theorem: ext-not-equal-proof-proves (termp (x, 0, symbols) ∧ termp (y, 0, symbols) ∧ termp (d, 0, symbols) ∧ (p (1, 2) ∈ symbols) ∧ proves (pfx, f-not (isin (d, x)), given, defns, symbols) ∧ proves (pfy, isin (d, y), given, defns, symbols)) → proves (ext-not-equal-proof (x, y, d, pfx, pfy),

f-not (f-equal (x, y)), given, defns, symbols)

Event: Enable ext-not-equal-proof; name this event ‘g0427’.

Event: Disable z-opair; name this event ‘g0428’.

Definition: phi-not-in-opair-proof (u, v) = and-join-proof (f-not (f-equal (phi, z-opair (u, v))),

f-not (isin (phi, z-opair (u, v))), ext-not-equal-proof (phi,

z-opair (u, v), z-sing (u), null-axiom-proof (z-sing (u)), isin-pair1-proof (z-sing (u),

z-pair (u, v))), tautconseq-proof (list (f-implies (isin (phi, z-opair (u, v)),

f-or (f-equal (phi,

z-sing (u)), f-equal (phi,

z-pair (u,

v)))),

f-not (f-equal (phi, z-sing (u))), f-not (f-equal (phi, z-pair (u, v)))),

f-not (isin (phi, z-opair (u, v))), list (iff-split-proof1 (isin (phi,

z-opair (u,

v)),

f-or (f-equal (phi,

z-sing (u)), f-equal (phi,

z-pair (u,

v))),

pair-axiom-proof (phi, z-sing (u), z-pair (u,

v))),

ext-not-equal-proof (phi, z-sing (u), u, null-axiom-proof (u), isin-sing1-proof (u)),

ext-not-equal-proof (phi, z-pair (u, v), u, null-axiom-proof (u), isin-pair1-proof (u,

v)))))

;;;;;;; |- "((not (|0| in <u, v>)) ^(not (|0| in <u, v>)))".

Theorem: phi-not-in-opair-proof-proves (subset (list (fn (0, 0), p (1, 2), fn (1, 2)), symbols) ∧ termp (u, 0, symbols) ∧ termp (v, 0, symbols) ∧ (concl = f-and (f-not (f-equal (phi, z-opair (u, v))),

f-not (isin (phi, z-opair (u, v))))))

→ proves (phi-not-in-opair-proof (u, v), concl, given, defns, symbols)

Event: Enable phi-not-in-opair-proof; name this event ‘g0429’.

Event: Enable z-opair; name this event ‘g0430’.

Definition: not-int-opair-proof (u, v, x) = tautconseq-proof (list (f-implies (z-int (z-opair (u, v)),

f-or (f-equal (phi, z-opair (u, v)), isin (phi, z-opair (u, v)))),

f-and (f-not (f-equal (phi, z-opair (u, v))), f-not (isin (phi, z-opair (u, v))))),

f-not (z-int (z-opair (u, v))),

list (subst-rule-proof (f-implies (z-int (x),

f-or (f-equal (phi, x), isin (phi, x))),

x,

z-opair (u, v),

phi-in-int-proof (x)),

phi-not-in-opair-proof (u, v)))

;;;;;;; |- "(not (I <u v>))".

Theorem: not-int-opair-proof-proves (variable (x) ∧ z-succ-hyps (defns, symbols) ∧ subset (list (fn (3, 1), fn (2, 2), fn (1, 2), p (1, 2), fn (0, 0)), symbols) ∧ (p (2, 1) ∈ symbols) ∧ termp (u, 0, symbols) ∧ termp (v, 0, symbols)) → proves (not-int-opair-proof (u, v, x),

f-not (z-int (z-opair (u, v))), given, defns, symbols)

Event: Enable not-int-opair-proof; name this event ‘g0868’.

Definition: z-trich (x, v1 , v2 ) = ∀ v1 ∀ v2 z-trich1 (x, v1 , v2 )

Definition: z-int-defn (x, y, z) = f-and (z-trans (x, y, z), z-trich (x, y, z))

Event: Enable pred-defn-proof; name this event ‘g0609’.

Theorem: subst-f-iff subst (f-iff (x, y), var, term, 0) = f-iff (subst (x, var, term, 0), subst (y, var, term, 0))

Event: Disable z-trans; name this event ‘g0872’.

Theorem: subset-del variable (x) → (subset (del (x, y), z) = subset (y, cons (x, z)))

Definition: z-int-defn-proof (term) = subst-rule-proof (f-iff (z-int (0), z-int-defn (0, 1, 2)),

                  0,

term,

pred-defn-proof (p (2, 1), list (0), z-int-defn (0, 1, 2)))

Event: Enable not-member-varlist; name this event ‘g0613’.

Definition: z-int-hyps (defns, symbols) = ((p (1, 2) ∈ rest-of (p (2, 1), symbols))

∧ (assoc (p (2, 1), defns) = z-int-defn (0, 1, 2)))

Theorem: z-int-defn-proof-proves (termp (term, 0, symbols) ∧ subset (list (p (1, 2), p (2, 1)), symbols) ∧ z-int-hyps (defns, symbols) ∧ nil-intersect (list (1, 2), collect-free (term, 0))) → proves (z-int-defn-proof (term),

f-iff (z-int (term), f-and (z-trans (term, 1, 2), z-trich (term, 1, 2))), given, defns, symbols)

Event: Enable z-int-defn-proof; name this event ‘g0639’.

Theorem: covering-numeral covering (numeral (x), var, 0) = nil

Definition: z-int-numeral-proof (x) = f-iff-mp-proof2 (z-int (numeral (x)),

f-and (z-trans (numeral (x), 1, 2),

z-trich (numeral (x), 1, 2)), z-int-defn-proof (numeral (x)), and-join-proof (z-trans (numeral (x), 1, 2),

z-trich (numeral (x), 1, 2), generalise-proof (1,

∀ 2 z-trans1 (numeral (x),

                                                       1,

2),

generalise-proof (2,

z-trans1 (numeral (x),

                                                                  1,

2), z-trans-numeral-proof (x,

                                                                             1,

2))),

generalise-proof (1,

∀ 2 z-trich1 (numeral (x),

                                                      1,

2),

generalise-proof (2,

z-trich1 (numeral (x),

                                                                 1,

2), z-trich-numeral-proof (x,

                                                                             1,

2)))))

Event: Enable z-int-defn; name this event ‘g0744’.

Event: Enable z-int-hyps; name this event ‘g0614’.

;;;;;;; |- "(I |X|)".  At this point we are overloading our notation.  Though |X|
;;;;;;;appears in quotes, it denotes the numeral which is the result of
;;;;;;;evaluating |X| for the given X.  So the metatheorem is that "(I |X|)" is
;;;;;;;a Z2 theorem for any X.

Theorem: z-int-numeral-proof-proves (z-succ-hyps (defns, symbols) ∧ subset (list (fn (3, 1), fn (2, 2), fn (1, 2), p (2, 1), p (1, 2), fn (0, 0)),

symbols)

∧ z-int-hyps (defns, symbols)) → proves (z-int-numeral-proof (x), z-int (numeral (x)), given, defns, symbols)

Event: Enable z-int-numeral-proof; name this event ‘g0906’.

Theorem: covering-z-int covering (z-int (x), var, 0) = covering (list (x), var, 1)

Theorem: collect-z-int collect-free (z-int (x), 0) = collect-free (list (x), 1)

Theorem: subst-z-int subst (z-int (x), var, term, 0) = z-int (subst (x, var, term, 0))

Theorem: parallel-subst-z-int parallel-subst (z-int (x), var, term, 0) = z-int (parallel-subst (x, var, term, 0))

Event: Enable z-int; name this event ‘g0907’.

Definition: z-car (x) = list (fn (4, 1), x)

Definition: z-cdr (x) = list (fn (5, 1), x)

Event: Disable z-opair; name this event ‘g0628’.

Theorem: covering-z-opair covering (z-opair (x, y), var, 0) = covering (list (z-sing (x), z-pair (x, y)), var, 1)

Theorem: subst-z-opair subst (z-opair (x, y), var, term, 0) = z-opair (subst (x, var, term, 0), subst (y, var, term, 0))

Theorem: parallel-subst-z-opair parallel-subst (z-opair (x, y), vars, terms, 0) = z-opair (parallel-subst (x, vars, terms, 0),

parallel-subst (y, vars, terms, 0))

Event: Enable z-opair; name this event ‘g0608’.

Definition: z-car-unique-step1-proof (x, y, y1 , z, z1 ) = tautconseq-proof (list (f-implies (f-equal (x, z-opair (y, z)),

f-implies (f-equal (x, z-opair (y1 , z1 )), f-equal (z-opair (y, z),

z-opair (y1 , z1 )))),

f-implies (f-equal (z-opair (y, z), z-opair (y1 , z1 )),

f-equal (y, y1 ))),

f-implies (f-equal (x, z-opair (y, z)),

f-implies (f-equal (x, z-opair (y1 , z1 )), f-equal (y, y1 ))), list (trans-equal-proof1 (z-opair (y, z),

x,

z-opair (y1 , z1 )),

z-car-unique-proof (y, z, y1 , z1 )))

;;;;;;; |- "(x = <y, z>) -> ((x = <y1, z1>) -> (y = y1))".

Theorem: z-car-unique-step1-proof-proves (termp (list (x, y, y1 , z, z1 ), 1, symbols) ∧ subset (list (p (1, 2), fn (1, 2)), symbols)) → proves (z-car-unique-step1-proof (x, y, y1 , z, z1 ),

f-implies (f-equal (x, z-opair (y, z)),

f-implies (f-equal (x, z-opair (y1 , z1 )), f-equal (y, y1 ))),

given, defns, symbols)

Event: Enable z-car-unique-step1-proof; name this event ‘g0630’.

Definition: z-car-unique-step2-proof (x, y, y1 , z, z1 ) = forsome-intro-proof (z,

f-equal (x, z-opair (y, z)),

f-implies (forsome (z1 , f-equal (x, z-opair (y1 , z1 ))),

f-equal (y, y1 )), chain-proof (f-equal (x, z-opair (y, z)),

f-implies (forsome (z1 ,

f-equal (x,

z-opair (y1 ,

z1 ))),

f-equal (y, y1 )),

list (∀ z1 f-implies (f-equal (x,

z-opair (y1 ,

z1 )),

f-equal (y, y1 )),

f-implies (forsome (z1 ,

f-equal (x,

z-opair (y1 ,

z1 ))),

forsome (z1 ,

f-equal (y, y1 )))),

list (forall-intro-proof (f-equal (x,

z-opair (y, z)), f-implies (f-equal (x,

z-opair (y1 ,

z1 )),

f-equal (y,

y1 )),

z1 , z-car-unique-step1-proof (x,

y, y1 , z, z1 )),

forall-over-implies-proof (z1 ,

f-equal (x,

z-opair (y1 ,

z1 )),

f-equal (y,

y1 )),

tautconseq-proof (list (f-implies (forsome (z1 ,

f-equal (y,

y1 )),

f-equal (y,

y1 ))),

f-implies (f-implies (forsome (z1 ,

f-equal (x,

z-opair (y1 ,

z1 ))),

forsome (z1 ,

f-equal (y,

y1 ))),

f-implies (forsome (z1 ,

f-equal (x,

z-opair (y1 ,

z1 ))),

f-equal (y,

y1 ))),

list (forsome-intro-proof (z1 ,

f-equal (y,

y1 ), f-equal (y,

y1 ), prop-axiom-proof (f-equal (y,

y1 ))))))))

Theorem: z-car-unique-step2-proof-proves (var-set (list (y, y1 , z, z1 ), 4) ∧ termp (x, 0, symbols) ∧ nil-intersect (list (z, z1 ), collect-free (x, 0)) ∧ subset (list (p (1, 2), fn (1, 2)), symbols)) → proves (z-car-unique-step2-proof (x, y, y1 , z, z1 ),

f-implies (forsome (z, f-equal (x, z-opair (y, z))),

f-implies (forsome (z1 , f-equal (x, z-opair (y1 , z1 ))),

f-equal (y, y1 ))),

given, defns, symbols)

Event: Enable z-car-unique-step2-proof; name this event ‘g0637’.

Theorem: subst-subst ((y ∉ collect-free (exp, flg)) ∧ free-for (exp, x, y, flg) ∧ variable (x) ∧ variable (y)) → (subst (subst (exp, x, y, flg), y, x, flg) = exp)

Theorem: not-free-subst (x ∉ collect-free (term, 0)) → (x ∉ collect-free (subst (exp, x, term, flg), flg))

Definition: rename-bndvar-proof (x, y, exp) = forsome-intro-proof (x,

subst (subst (exp, x, y, 0), y, x, 0), forsome (y, subst (exp, x, y, 0)), subst-axiom-proof (subst (exp, x, y, 0), y, x))

Theorem: rename-bndvar-proof-proves ((y ∉ collect-free (exp, 0)) ∧ free-for (exp, x, y, 0) ∧ formula (exp, symbols) ∧ var-set (list (x, y), 2) ∧ (exp-inst = subst (exp, x, y, 0))) → proves (rename-bndvar-proof (x, y, exp),

f-implies (forsome (x, exp), forsome (y, exp-inst)), given, defns, symbols)

Event: Enable rename-bndvar-proof; name this event ‘g0640’.

Definition: z-car-uniqueness-case-proof (x, y, y1 , z, z1 ) = tautconseq-proof (list (f-implies (forsome (z, f-equal (x, z-opair (y1 , z))),

forsome (z1 , f-equal (x, z-opair (y1 , z1 )))),

f-implies (forsome (z, f-equal (x, z-opair (y, z))),

f-implies (forsome (z1 ,

f-equal (x,

z-opair (y1 ,

z1 ))),

f-equal (y, y1 )))),

f-implies (f-and (forsome (z, f-equal (x, z-opair (y, z))),

forsome (z, f-equal (x, z-opair (y1 , z)))), f-equal (y, y1 )),

list (rename-bndvar-proof (z, z1 , f-equal (x, z-opair (y1 , z))),

z-car-unique-step2-proof (x, y, y1 , z, z1 )))

Theorem: z-car-uniqueness-case-proof-proves (var-set (list (y, y1 , z, z1 ), 4) ∧ nil-intersect (list (z, z1 ), collect-free (x, 0)) ∧ termp (x, 0, symbols) ∧ subset (list (p (1, 2), fn (1, 2)), symbols)) → proves (z-car-uniqueness-case-proof (x, y, y1 , z, z1 ),

f-implies (f-and (forsome (z, f-equal (x, z-opair (y, z))),

forsome (z, f-equal (x, z-opair (y1 , z)))), f-equal (y, y1 )),

given, defns, symbols)

Event: Enable z-car-uniqueness-case-proof; name this event ‘g0645’.

;;;;;;;The definition of the Z2 analogue of CAR.

Definition: z-car-defn (x, y, y1 , z) = f-if (forsome (y1 , forsome (z, f-equal (x, z-opair (y1 , z)))),

forsome (z, f-equal (x, z-opair (y, z))), f-equal (y, phi))

;;;;;;;The existence part of the admissibility proof of "(Z-car x)".

Definition: z-car-exis-proof (x, y, z) = forsome-f-if-case-proof (y,

forsome (y, forsome (z, f-equal (x, z-opair (y, z)))), forsome (z, f-equal (x, z-opair (y, z))), f-equal (y, phi), prop-axiom-proof (forsome (y,

forsome (z,

f-equal (x,

z-opair (y,

z))))),

tautconseq-proof (list (forsome (y,

f-equal (y, phi))),

f-implies (f-not (forsome (y,

forsome (z,

f-equal (x,

z-opair (y,

z))))),

forsome (y,

f-equal (y,

phi))),

list (exis-fun-intro-proof (y, phi))))

Theorem: z-car-exis-proof-proves (var-set (list (y, z), 2) ∧ subset (list (fn (0, 0), fn (1, 2)), symbols) ∧ termp (x, 0, symbols) ∧ (concl = forsome (y, z-car-defn (x, y, y, z)))) → proves (z-car-exis-proof (x, y, z), concl, given, defns, symbols)

Event: Enable z-car-exis-proof; name this event ‘g0646’.

;;;;;;;The uniqueness part of the admissibility proof of "(Z-car x)".

Definition: z-car-uniqueness-proof (x, y, y1 , z, z1 ) = unique-f-if-proof (forsome (y, forsome (z, f-equal (x, z-opair (y, z)))),

forsome (z, f-equal (x, z-opair (y, z))), forsome (z, f-equal (x, z-opair (y1 , z))), f-equal (y, phi), f-equal (y1 , phi), f-equal (y, y1 ), z-car-uniqueness-case-proof (x, y, y1 , z, z1 ), unique-fun-intro-proof (y, y1 , phi))

Definition: z-car-defn-proof (term) = subst-rule-proof (z-car-defn (0, z-car (0), 1, 2),

                  0,

term,

fun-defn-proof (fn (4, 1), list (0),

                               1,
                               3,

z-car-defn (0, 1, 1, 2), z-car-exis-proof (0, 1, 2), z-car-uniqueness-proof (0, 1, 3, 2, 4)))

Event: Enable not-member-delete-equals; name this event ‘g0648’.

Theorem: covering-forsome variable (x) → (covering (forsome (x, y), var, 0)

= if memb (var, collect-free (forsome (x, y), 0)) then cons (x, covering (y, var, 0)) else nil endif)

Definition: z-car-hyps (defns, symbols) = (subset (list (p (1, 2), fn (1, 2), fn (0, 0)), rest-of (fn (4, 1), symbols))

∧ (assoc (fn (4, 1), defns) = z-car-defn (0, z-car (0), 1, 2)))

;;;;;;;The admissibility of "(Z-car x)".

Theorem: z-car-defn-proof-proves (subset (list (fn (4, 1), p (1, 2), fn (1, 2), fn (0, 0)), symbols) ∧ z-car-hyps (defns, symbols) ∧ termp (term, 0, symbols) ∧ (collect-free (term, 0) = nil) ∧ (concl = z-car-defn (term, z-car (term), 1, 2))) → proves (z-car-defn-proof (term), concl, given, defns, symbols)

Event: Enable z-car-defn-proof; name this event ‘g0649’.

Event: Enable z-car-hyps; name this event ‘g0678’.

Definition: z-cdr-unique-step1-proof (x, y, y1 , z, z1 )

= tautconseq-proof (list (f-implies (f-equal (x, z-opair (y, z)),

f-implies (f-equal (x, z-opair (y1 , z1 )), f-equal (z-opair (y, z),

z-opair (y1 , z1 )))),

f-implies (f-equal (z-opair (y, z), z-opair (y1 , z1 )),

f-equal (z, z1 ))),

f-implies (f-equal (x, z-opair (y, z)),

f-implies (f-equal (x, z-opair (y1 , z1 )), f-equal (z, z1 ))),

list (trans-equal-proof1 (z-opair (y, z), x, z-opair (y1 , z1 )),

z-cdr-unique-proof (y, z, y1 , z1 )))

Theorem: z-cdr-unique-step1-proof-proves (termp (list (x, y, y1 , z, z1 ), 1, symbols) ∧ subset (list (p (1, 2), fn (1, 2)), symbols)) → proves (z-cdr-unique-step1-proof (x, y, y1 , z, z1 ),

f-implies (f-equal (x, z-opair (y, z)),

f-implies (f-equal (x, z-opair (y1 , z1 )), f-equal (z, z1 ))),

given, defns, symbols)

Event: Enable z-cdr-unique-step1-proof; name this event ‘g0647’.

Definition: z-cdr-unique-step2-proof (x, y, y1 , z, z1 ) = forsome-intro-proof (y,

f-equal (x, z-opair (y, z)),

f-implies (forsome (y1 , f-equal (x, z-opair (y1 , z1 ))),

f-equal (z, z1 )), chain-proof (f-equal (x, z-opair (y, z)),

f-implies (forsome (y1 ,

f-equal (x,

z-opair (y1 ,

z1 ))),

f-equal (z, z1 )),

list (∀ y1 f-implies (f-equal (x,

z-opair (y1 ,

z1 )),

f-equal (z, z1 )),

f-implies (forsome (y1 , f-equal (x, z-opair (y1 ,

z1 ))),

forsome (y1 ,

f-equal (z, z1 )))),

list (forall-intro-proof (f-equal (x,

z-opair (y,

z)),

f-implies (f-equal (x,

z-opair (y1 ,

z1 )),

f-equal (z,

z1 )),

y1 , z-cdr-unique-step1-proof (x,

y, y1 , z, z1 )),

forall-over-implies-proof (y1 ,

f-equal (x,

z-opair (y1 ,

z1 )),

f-equal (z,

z1 )),

tautconseq-proof (list (f-implies (forsome (y1 ,

f-equal (z,

z1 )),

f-equal (z,

z1 ))),

f-implies (f-implies (forsome (y1 ,

f-equal (x,

z-opair (y1 ,

z1 ))),

forsome (y1 ,

f-equal (z,

z1 ))),

f-implies (forsome (y1 ,

f-equal (x,

z-opair (y1 ,

z1 ))),

f-equal (z,

z1 ))),

list (forsome-intro-proof (y1 , f-equal (z,

z1 ), f-equal (z,

z1 ), prop-axiom-proof (f-equal (z,

z1 ))))))))

Theorem: z-cdr-unique-step2-proof-proves (var-set (list (y, y1 , z, z1 ), 4) ∧ termp (x, 0, symbols) ∧ nil-intersect (list (y, y1 ), collect-free (x, 0)) ∧ subset (list (p (1, 2), fn (1, 2)), symbols)) → proves (z-cdr-unique-step2-proof (x, y, y1 , z, z1 ),

f-implies (forsome (y, f-equal (x, z-opair (y, z))),

f-implies (forsome (y1 , f-equal (x, z-opair (y1 , z1 ))),

f-equal (z, z1 ))),

given, defns, symbols)

Event: Enable z-cdr-unique-step2-proof; name this event ‘g0650’.

Definition: z-cdr-uniqueness-case-proof (x, y, y1 , z, z1 ) = tautconseq-proof (list (f-implies (forsome (y, f-equal (x, z-opair (y, z1 ))),

forsome (y1 , f-equal (x, z-opair (y1 , z1 )))),

f-implies (forsome (y, f-equal (x, z-opair (y, z))),

f-implies (forsome (y1 ,

f-equal (x,

z-opair (y1 ,

z1 ))),

f-equal (z, z1 )))),

f-implies (f-and (forsome (y, f-equal (x, z-opair (y, z))),

forsome (y, f-equal (x, z-opair (y, z1 )))), f-equal (z, z1 )),

list (rename-bndvar-proof (y, y1 , f-equal (x, z-opair (y, z1 ))),

z-cdr-unique-step2-proof (x, y, y1 , z, z1 )))

Theorem: z-cdr-uniqueness-case-proof-proves (var-set (list (y, y1 , z, z1 ), 4) ∧ nil-intersect (list (y, y1 ), collect-free (x, 0)) ∧ termp (x, 0, symbols) ∧ subset (list (p (1, 2), fn (1, 2)), symbols))

→ proves (z-cdr-uniqueness-case-proof (x, y, y1 , z, z1 ),

f-implies (f-and (forsome (y, f-equal (x, z-opair (y, z))),

forsome (y, f-equal (x, z-opair (y, z1 )))), f-equal (z, z1 )),

given, defns, symbols)

;;;;;;;The definition of the Z2 analogue of CDR, "(Z-cdr x)".

Definition: z-cdr-defn (x, z, y1 , z1 ) = f-if (forsome (z1 , forsome (y1 , f-equal (x, z-opair (y1 , z1 )))),

forsome (y1 , f-equal (x, z-opair (y1 , z))), f-equal (z, phi))

;;;;;;;The existence part of the admissibility of "(Z-cdr x)".

Definition: z-cdr-exis-proof (x, y, z) = forsome-f-if-case-proof (z,

forsome (z, forsome (y, f-equal (x, z-opair (y, z)))), forsome (y, f-equal (x, z-opair (y, z))), f-equal (z, phi), prop-axiom-proof (forsome (z,

forsome (y,

f-equal (x,

z-opair (y,

z))))),

tautconseq-proof (list (forsome (z,

f-equal (z, phi))),

f-implies (f-not (forsome (z,

forsome (y,

f-equal (x,

z-opair (y,

z))))),

forsome (z,

f-equal (z,

phi))),

list (exis-fun-intro-proof (z, phi))))

Theorem: z-cdr-exis-proof-proves (var-set (list (y, z), 2) ∧ subset (list (fn (0, 0), fn (1, 2)), symbols)

∧ termp (x, 0, symbols)) → proves (z-cdr-exis-proof (x, y, z),

forsome (z, z-cdr-defn (x, z, y, z)), given, defns, symbols)

Event: Enable z-cdr-exis-proof; name this event ‘g0651’.

;;;;;;;The uniqueness part of the admissibility of "(Z-cdr x)".

Definition: z-cdr-uniqueness-proof (x, y, y1 , z, z1 ) = unique-f-if-proof (forsome (z, forsome (y, f-equal (x, z-opair (y, z)))),

forsome (y, f-equal (x, z-opair (y, z))), forsome (y, f-equal (x, z-opair (y, z1 ))), f-equal (z, phi), f-equal (z1 , phi), f-equal (z, z1 ), z-cdr-uniqueness-case-proof (x, y, y1 , z, z1 ), unique-fun-intro-proof (z, z1 , phi))

Definition: z-cdr-defn-proof (term) = subst-rule-proof (z-cdr-defn (0, z-cdr (0), 1, 2),

                  0,

term,

fun-defn-proof (fn (5, 1), list (0),

                               2,
                               4,

z-cdr-defn (0, 2, 1, 2), z-cdr-exis-proof (0, 1, 2), z-cdr-uniqueness-proof (0, 1, 3, 2, 4)))

Definition: z-cdr-hyps (defns, symbols) = (subset (list (p (1, 2), fn (1, 2), fn (0, 0)), rest-of (fn (5, 1), symbols))

∧ (assoc (fn (5, 1), defns) = z-cdr-defn (0, z-cdr (0), 1, 2)))

;;;;;;;The admissibility of "(Z-cdr x)".

Theorem: z-cdr-defn-proof-proves (subset (list (fn (5, 1), p (1, 2), fn (1, 2), fn (0, 0)), symbols) ∧ z-cdr-hyps (defns, symbols)

∧ termp (term, 0, symbols) ∧ (collect-free (term, 0) = nil) ∧ (concl = z-cdr-defn (term, z-cdr (term), 1, 2))) → proves (z-cdr-defn-proof (term), concl, given, defns, symbols)

Event: Enable z-cdr-hyps; name this event ‘g0679’.

Event: Enable z-cdr-defn-proof; name this event ‘g0655’.

Definition: list-num-nequal-proof (n, u, v) = tautconseq-proof (list (f-implies (f-equal (numeral (n), z-opair (u, v)),

f-implies (z-int (numeral (n)),

z-int (z-opair (u, v)))),

z-int (numeral (n)),

f-not (z-int (z-opair (u, v)))), f-not (f-equal (numeral (n), z-opair (u, v))), list (equal-axiom2-proof (p (2, 1),

list (numeral (n)), list (z-opair (u, v))),

z-int-numeral-proof (n),

not-int-opair-proof (u, v, 0)))

Event: Disable z-int; name this event ‘g0659’.

Theorem: equal-axiom2-z-int (termp (list (x, y), 1, symbols) ∧ (p (2, 1) ∈ symbols)) → proves (equal-axiom2-proof (p (2, 1), list (x), list (y)),

f-implies (f-equal (x, y), f-implies (z-int (x), z-int (y))), given, defns, symbols)

Event: Enable z-int; name this event ‘g0660’.

;;;;;;;An important metatheorem: |- "(not (|N| = <u v>))".

Theorem: list-num-nequal-proof-proves (z-succ-hyps (defns, symbols) ∧ subset (list (fn (3, 1), fn (2, 2), fn (1, 2), p (1, 2), fn (0, 0)), symbols) ∧ (p (2, 1) ∈ symbols) ∧ z-int-hyps (defns, symbols) ∧ termp (list (u, v), 1, symbols)

∧ (concl = f-not (f-equal (numeral (n), z-opair (u, v))))) → proves (list-num-nequal-proof (n, u, v), concl, given, defns, symbols)

Event: Enable list-num-nequal-proof; name this event ‘g0658’.

;;;;;;;The Goedel-encoding.  It takes Lisp data-structures built from numbers using
;;;;;;;CONS to sets in Z2 which are formed from numerals using ordered pairing.
;;;;;;;We represent the encoding of X as <X>.

Definition: ncode (x) = if listp (x) then z-opair (ncode (car (x)), ncode (cdr (x)))

else numeral (x) endif

Theorem: termp-ncode ((fn (3, 1) ∈ symbols) ∧ (fn (1, 2) ∈ symbols) ∧ (fn (0, 0) ∈ symbols)) → termp (ncode (x), 0, symbols)

Theorem: collect-free-ncode collect-free (ncode (x), 0) = nil

Definition: ncode-equal (x, y) = if listp (x)

then if listp (y)

then ncode-equal (car (x), car (y)) ∧ ncode-equal (cdr (x), cdr (y)) else f endif elseif listp (y) then f elseif x ≃ 0 then y ≃ 0 elseif y ≃ 0 then f else ncode-equal (x − 1, y − 1) endif

Event: Enable z-trans; name this event ‘g0756’.

Event: Enable z-trich; name this event ‘g0757’.

Definition: ncode-nequal-step-proof (x1 , y1 , x, y, pf1 , pf2 ) = detach-proof (f-not (f-equal (x1 , y1 )),

f-not (f-equal (x, y)),

pf1 ,

contra-pos-proof1 (f-equal (x, y), f-equal (x1 , y1 ), pf2 ))

Definition: z-trans2 (x) = z-trans (x, 1, 2)

Definition: z-trich2 (x) = z-trich (x, 1, 2)

Definition: ncode-nequal-proof (x, y) = if listp (x)

then if listp (y)

then if ¬ ncode-equal (car (x), car (y))

then ncode-nequal-step-proof (ncode (car (x)), ncode (car (y)), ncode (x), ncode (y), ncode-nequal-proof (car (x),

car (y)),

z-car-unique-proof (ncode (car (x)), ncode (cdr (x)), ncode (car (y)), ncode (cdr (y))))

else ncode-nequal-step-proof (ncode (cdr (x)), ncode (cdr (y)), ncode (x), ncode (y), ncode-nequal-proof (cdr (x),

cdr (y)),

z-cdr-unique-proof (ncode (car (x)), ncode (cdr (x)), ncode (car (y)), ncode (cdr (y)))) endif

else ncode-nequal-step-proof (ncode (y), ncode (x), ncode (x), ncode (y), list-num-nequal-proof (y,

ncode (car (x)), ncode (cdr (x))),

symmetry-proof1 (ncode (x),

ncode (y))) endif

elseif listp (y) then list-num-nequal-proof (x, ncode (car (y)), ncode (cdr (y))) elseif x ≃ 0 then ext-not-equal-proof (ncode (x),

ncode (y), ncode (y − 1), null-axiom-proof (ncode (y − 1)), x-in-z-succ-x-proof (ncode (y − 1))) elseif y ≃ 0 then ncode-nequal-step-proof (ncode (y),

ncode (x), ncode (x), ncode (y), ext-not-equal-proof (ncode (y),

ncode (x), ncode (x − 1), null-axiom-proof (ncode (x − 1)), x-in-z-succ-x-proof (ncode (x − 1))),

symmetry-proof1 (ncode (x), ncode (y)))

else tautconseq-proof (list (z-trans2 (ncode (x − 1)), z-trans2 (ncode (y − 1)), f-implies (z-trans2 (ncode (x − 1)),

f-implies (z-trans2 (ncode (y − 1)),

f-implies (f-equal (ncode (x),

ncode (y)), f-equal (ncode (x − 1),

ncode (y − 1))))),

f-not (f-equal (ncode (x − 1),

ncode (y − 1)))),

f-not (f-equal (ncode (x), ncode (y))), list (tautconseq-proof (list (z-int (ncode (x − 1)),

f-iff (z-int (ncode (x − 1)),

f-and (z-trans2 (ncode (x − 1)),

z-trich2 (ncode (x − 1))))),

z-trans2 (ncode (x − 1)),

list (z-int-numeral-proof (x − 1),

z-int-defn-proof (ncode (x − 1)))),

tautconseq-proof (list (z-int (ncode (y − 1)),

f-iff (z-int (ncode (y − 1)),

f-and (z-trans2 (ncode (y − 1)),

z-trich2 (ncode (y − 1))))),

z-trans2 (ncode (y − 1)),

list (z-int-numeral-proof (y − 1),

z-int-defn-proof (ncode (y − 1)))),

z-succ-equal-proof (ncode (x − 1), ncode (y − 1),

                1,

2),

ncode-nequal-proof (x − 1, y − 1))) endif

;;;;;;;A crucial metatheorem: If X is different from Y, then |- "(not (<X>=<Y>))".

Theorem: ncode-nequal-proof-proves (subset (list (fn (3, 1), p (2, 1), p (1, 2), fn (2, 2), fn (1, 2), fn (0, 0)), symbols) ∧ z-succ-hyps (defns, symbols) ∧ z-int-hyps (defns, symbols) ∧ (¬ ncode-equal (x, y))) → proves (ncode-nequal-proof (x, y),

f-not (f-equal (ncode (x), ncode (y))), given, defns, symbols)

Event: Enable ncode-nequal-proof; name this event ‘g0758’.

Theorem: ncode-nequal-proof-proves-again (subset (list (fn (3, 1), p (2, 1), p (1, 2), fn (2, 2), fn (1, 2), fn (0, 0)), symbols) ∧ z-succ-hyps (defns, symbols) ∧ z-int-hyps (defns, symbols) ∧ (¬ ncode-equal (x, y)) ∧ (concl = f-not (f-equal (ncode (x), ncode (y))))) → proves (ncode-nequal-proof (x, y), concl, given, defns, symbols)

Event: Enable ncode-nequal-proof-proves; name this event ‘g0760’.

;;;;;;;What we would like to do next is to demonstrate the admissibility of
;;;;;;;Z2 analogues of several Lisp functions which are used to define the Lisp
;;;;;;;interpreter.  These include the primitive Lisp functions like LISTP, CAR, CDR,
;;;;;;;CONS, ZEROP, NUMBERP, ADD1, SUB1, and EQUAL.  The definitions of these Z2
;;;;;;;functions involve the use of the logical-if connective.  For example, the
;;;;;;;definition of the analogue of CAR, "(Z-car x)", is
;;;;;;;         "(if (forsome y (forsome z (x = <y, z>)))
;;;;;;;           then (forsome z (x = <(Z-car x), z>))
;;;;;;;           else ((Z-car x) = |0|))".
;;;;;;;The definition of the analogue of LISTP, "(Z-listp x)", is
;;;;;;;         "(if (forsome y (forsome z (x = <y, z>)))
;;;;;;;           then ((Z-car x) = |1|)
;;;;;;;           else ((Z-car x) = |0|))".
;;;;;;;Since we will be proving a number of metatheorem regarding the logical-if
;;;;;;;connective, it is convenient to have a representation for such expressions
;;;;;;;which is easily manipulated without having to expand the abbreviation "(if A B C)".
;;;;;;;The shell Z-IF is used to represent if-trees.

Event: Add the shell z-if , with recognizer function symbol z-ifp and 3 accessors: z-test, with type restriction (none-of) and default value zero; z-left, with type restriction (none-of) and default value zero; z-right, with type restriction (none-of) and default value zero.

;;;;;;;TERM-Z-IF checks if every test position of the if-tree EXP is a formula,
;;;;;;;and every leaf expression is a term in which VAR does not occur free.
;;;;;;;We will call such an if-tree a `term-if-tree'.  This is useful in representing
;;;;;;;a definition by cases where each case has the form "((f x) = exp)".
;;;;;;;The term-if-tree corresponding to the definition of "(Z-listp x)" is
;;;;;;;(Z-IF "(forsome y (forsome z (x = <y, z>)))"  |1|  |0|).

Definition: term-z-if (exp, var, symbols) = if z-ifp (exp)

then formula (z-test (exp), symbols)

∧ (var ∉ collect-free (z-test (exp), 0)) ∧ term-z-if (z-left (exp), var, symbols) ∧ term-z-if (z-right (exp), var, symbols)

else termp (exp, 0, symbols) ∧ (var ∉ collect-free (exp, 0)) endif

;;;;;;;MAKE-TERM-Z-IF makes an formula out of the term-if-tree by replacing each occurrence
;;;;;;;of Z-IF by the logical-if connective, and returning "(var = exp)" for each
;;;;;;;leaf term "exp".  Thus MAKE-TERM-Z-IF applied to the term-if-tree for "Z-listp"
;;;;;;;with the variable "value" for VAR returns the definition for "Z-listp".

Definition: make-term-z-if (var, exp) = if z-ifp (exp)

then f-if (z-test (exp), make-term-z-if (var, z-left (exp)), make-term-z-if (var, z-right (exp)))

else f-equal (var, exp) endif

Definition: term-z-if-exis-proof (var, exp) = if z-ifp (exp)

then forsome-f-if-case-proof (var, z-test (exp), make-term-z-if (var, z-left (exp)), make-term-z-if (var, z-right (exp)), tautconseq-proof (list (forsome (var,

make-term-z-if (var,

z-left (exp)))),

f-implies (z-test (exp),

forsome (var,

make-term-z-if (var,

z-left (exp)))),

list (term-z-if-exis-proof (var, z-left (exp)))), tautconseq-proof (list (forsome (var,

make-term-z-if (var,

z-right (exp)))),

f-implies (f-not (z-test (exp)), forsome (var,

make-term-z-if (var,

z-right (exp)))),

list (term-z-if-exis-proof (var,

z-right (exp)))))

else exis-fun-intro-proof (var, exp) endif

Theorem: formula-make-term-z-if (term-z-if (exp, var, symbols) ∧ variable (var)) → formula (make-term-z-if (var, exp), symbols)

;;;;;;;Many of the functions are defined as formulas constructed from
;;;;;;;term-if-trees generated by the Z-IF shell.  The lemma below is used to
;;;;;;;carry out the existence part of the admissibility of such definitions.
;;;;;;;The crucial part in the proof of this lemma is the observation that
;;;;;;;if "value" is not free in TEST, then from
;;;;;;; "(if TEST (forsome value EXPL) (forsome value EXPR))",
;;;;;;;we can derive "(forsome value (if TEST EXPL EXPR))".

Theorem: term-z-if-exis-proof-proves (variable (var) ∧ term-z-if (exp, var, symbols)) → proves (term-z-if-exis-proof (var, exp),

forsome (var, make-term-z-if (var, exp)), given, defns, symbols)

Event: Enable term-z-if-exis-proof; name this event ‘g0761’.

Theorem: term-z-if-exis-proof-proves1 (variable (var) ∧ term-z-if (exp, var, symbols) ∧ (concl = forsome (var, make-term-z-if (var, exp)))) → proves (term-z-if-exis-proof (var, exp), concl, given, defns, symbols)

Event: Enable term-z-if-exis-proof-proves; name this event ‘g0762’.

;;;;;;;We would now like to show for example that the definition of "Z-listp"
;;;;;;;does in fact make it the Z2 analogue of the Lisp function LISTP.
;;;;;;;That is |- "((Z-listp <X>) = <(BOOL-FIX (LISTP X))>)",

;;;;;;;where BOOL-FIX converts F to 0, and T to 1.  Again, we overload the notation
;;;;;;;by permitting Lisp functions within quotes to denote their values.
;;;;;;;The predicate PROVES-Z-IF
;;;;;;;requires careful explanation.  Its first argument PF-TREE is a proof-tree
;;;;;;;that mimics the structure of the if-tree EXP.  A proof-tree is of the
;;;;;;;form:  <<cond proof1 proof2> proof-tree-left proof-tree-right>.
;;;;;;;PROVES-Z-IF checks that when EXP is of the form (Z-IF test left right),
;;;;;;;then if cond is T, proof1 is a proof of test, and proof-tree-left is
;;;;;;;the proof-tree corresponding to left; and if cond is F, then proof2 is
;;;;;;;a proof of the negation of test, and proof-tree-right is the proof-tree
;;;;;;;corresponding to right.  In the base case, PROVES-Z-IF checks that PF-TREE
;;;;;;;is a proof of "(EXP = VAL)".  Once this has been checked, we can later evaluate
;;;;;;;the term-if-tree in terms of the values of the leaf nodes by constructing the
;;;;;;;appropriate proof-tree.

Definition: proves-z-if (pf-tree, exp, var, val, given, defns, symbols) = if z-ifp (exp)

then if caar (pf-tree)

then proves (cadar (pf-tree), z-test (exp), given, defns, symbols)

∧ proves-z-if (cadr (pf-tree), z-left (exp), var, val, given, defns, symbols)

else proves (caddar (pf-tree), f-not (z-test (exp)), given, defns, symbols)

∧ proves-z-if (caddr (pf-tree), z-right (exp), var, val, given, defns, symbols) endif else proves (pf-tree, f-equal (exp, val), given, defns, symbols) endif

Definition: z-if-eval-proof (pf-tree, exp, var, val) = if z-ifp (exp) then if caar (pf-tree)

then chain-proof (make-term-z-if (var, exp), f-equal (var, val), list (make-term-z-if (var, z-left (exp))), list (f-if-elim-proof1 (z-test (exp),

make-term-z-if (var,

z-left (exp)),

make-term-z-if (var,

z-right (exp)),

cadar (pf-tree)),

z-if-eval-proof (cadr (pf-tree), z-left (exp), var, val)))

else chain-proof (make-term-z-if (var, exp), f-equal (var, val), list (make-term-z-if (var, z-right (exp))), list (f-if-elim-proof2 (z-test (exp),

make-term-z-if (var,

z-left (exp)),

make-term-z-if (var,

z-right (exp)),

caddar (pf-tree)),

z-if-eval-proof (caddr (pf-tree), z-right (exp), var, val))) endif

else detach-proof (f-equal (exp, val), f-implies (f-equal (var, exp), f-equal (var, val)), pf-tree, detach-proof (f-equal (var, var),

f-implies (f-equal (exp, val),

f-implies (f-equal (var,

exp), f-equal (var,

val))),

ident-axiom-proof (var), equal-axiom2-proof (p (0, 2),

list (var, exp),

list (var, val)))) endif

Theorem: formula-make-term-z-if-again (term-z-if (exp, var, symbols) ∧ termp (var, 0, symbols)) → formula (make-term-z-if (var, exp), symbols)

;;;;;;;If each leaf term "exp" in EXP has VAL
;;;;;;;as its value (this is checked by PROVES-Z-IF), then the if-expression
;;;;;;;which has "(var = exp)" for each leaf term "exp" in EXP can be proved
;;;;;;;to imply "(var = VAL)".

Theorem: z-if-eval-proof-proves (term-z-if (exp, var, symbols) ∧ termp (list (var, val), 1, symbols) ∧ proves-z-if (pf-tree, exp, var, val, given, defns, symbols)) → proves (z-if-eval-proof (pf-tree, exp, var, val),

f-implies (make-term-z-if (var, exp), f-equal (var, val)), given, defns, symbols)

Event: Enable z-if-eval-proof; name this event ‘g0765’.

Definition: z-if-eval-proof1 (pf-tree, exp, var, val, pf ) = detach-proof (make-term-z-if (var, exp),

f-equal (var, val),

pf ,

z-if-eval-proof (pf-tree, exp, var, val))

Theorem: z-if-eval-proof-proves1 (term-z-if (exp, var, symbols) ∧ termp (list (var, val), 1, symbols) ∧ proves-z-if (pf-tree, exp, var, val, given, defns, symbols) ∧ proves (pf , make-term-z-if (var, exp), given, defns, symbols)) → proves (z-if-eval-proof1 (pf-tree, exp, var, val, pf ),

f-equal (var, val),

given, defns, symbols)

Event: Enable z-if-eval-proof1; name this event ‘g0766’.

Definition: stack-and-implies (exp, hyps) = if listp (hyps) then f-implies (list-f-and (hyps), exp)

else exp endif

Definition: form-z-if-exis-step-proof (test, left, right, var, tests, pf1 , pf2 )

= tautconseq-proof (list (stack-and-implies (forsome (var, left),

cons (test, tests)),

stack-and-implies (forsome (var, right),

cons (f-not (test), tests)),

f-implies (f-if (test, forsome (var, left), forsome (var, right)),

forsome (var, f-if (test, left, right)))),

stack-and-implies (forsome (var, f-if (test, left, right)),

tests),

list (pf1 , pf2 , forsome-f-if-proof (var, test, left, right)))

;;;;;;;In the definitions which use term-if-trees, the existence and uniqueness of the
;;;;;;;object being defined follows from that of the leaf terms.  There are other
;;;;;;;definitions where the leaf nodes of the if-trees are formulas (a `form-if-tree'),
;;;;;;;and the existence/uniqueness of the defined object in each leaf node case requires
;;;;;;;the conjunction of the tests leading up to it.  The definition of "(Z-car x)",
;;;;;;;               "(if (forsome y (forsome z (x = <y z>)))
;;;;;;;                 then (forsome z (x = <(Z-car x), z>))
;;;;;;;                 else ((Z-car x) = |0|))".
;;;;;;;is a good example of this.  The lemma below combines the
;;;;;;;existence proofs in each of the left/right cases to form the existence proof
;;;;;;;for the if-subtree rooted at the corresponding test node.

Theorem: form-z-if-exis-step-proof-proves (variable (var) ∧ (var ∉ collect-free (test, 0)) ∧ proves (pf1 ,

stack-and-implies (forsome (var, left), cons (test, tests)), given, defns, symbols)

∧ proves (pf2 , stack-and-implies (forsome (var, right), cons (f-not (test), tests)), given, defns, symbols)

∧ (concl = stack-and-implies (forsome (var, f-if (test, left, right)),

tests)))

→ proves (form-z-if-exis-step-proof (test, left, right, var, tests, pf1 , pf2 ), concl, given, defns, symbols)

Event: Enable form-z-if-exis-step-proof; name this event ‘g0769’.

;;;;;;;FORM-Z-IF checks if EXP is a form-if-tree.

Definition: form-z-if (exp, symbols) = if z-ifp (exp)

then formula (z-test (exp), symbols) ∧ form-z-if (z-left (exp), symbols) ∧ form-z-if (z-right (exp), symbols)

else formula (exp, symbols) endif

;;;;;;;MAKE-FORM-Z-IF returns the if-expression represented by the form-if-tree EXP.

Definition: make-form-z-if (exp) = if z-ifp (exp)

then f-if (z-test (exp), make-form-z-if (z-left (exp)), make-form-z-if (z-right (exp)))

else exp endif

;;;;;;;PROVES-FORM-Z-IF-EXIS checks that for every leaf formula in the form-if-tree EXP,
;;;;;;;PF-TREE contains a corresponding proof that the conjunction of the tests leading
;;;;;;;to that leaf node "exp" implies "(forsome var exp)".

Definition: proves-form-z-if-exis (pf-tree, exp, var, tests, given, defns, symbols) = if z-ifp (exp)

then (var ∉ collect-free (z-test (exp), 0))

∧ proves-form-z-if-exis (car (pf-tree), z-left (exp), var, cons (z-test (exp), tests), given, defns, symbols)

∧ proves-form-z-if-exis (cadr (pf-tree), z-right (exp), var, cons (f-not (z-test (exp)), tests), given, defns, symbols) else proves (pf-tree,

stack-and-implies (forsome (var, exp), tests), given, defns, symbols) endif

Definition: form-z-if-exis-proof (pf-tree, exp, var, tests) = if z-ifp (exp)

then form-z-if-exis-step-proof (z-test (exp), make-form-z-if (z-left (exp)), make-form-z-if (z-right (exp)), var, tests, form-z-if-exis-proof (car (pf-tree),

z-left (exp),

var,

cons (z-test (exp), tests)),

form-z-if-exis-proof (cadr (pf-tree), z-right (exp), var, cons (f-not (z-test (exp)),

tests)))

else pf-tree endif

Theorem: formula-make-form form-z-if (exp, symbols) → formula (make-form-z-if (exp), symbols)

;;;;;;;The lemma below demonstrates that the existence proofs for the leaf nodes
;;;;;;;can be combined to give the existence proof for the if-expression represented
;;;;;;;by the form-if-tree EXP.

Theorem: form-z-if-exis-proof-proves (form-z-if (exp, symbols) ∧ variable (var) ∧ proves-form-z-if-exis (pf-tree, exp, var, tests, given, defns, symbols)) → proves (form-z-if-exis-proof (pf-tree, exp, var, tests),

stack-and-implies (forsome (var, make-form-z-if (exp)), tests), given, defns, symbols)

Event: Enable form-z-if-exis-proof; name this event ‘g0770’.

Theorem: form-z-if-exis-proof-proves1 (form-z-if (exp, symbols) ∧ variable (var) ∧ proves-form-z-if-exis (pf-tree, exp, var, tests, given, defns, symbols) ∧ (concl = stack-and-implies (forsome (var, make-form-z-if (exp)), tests))) → proves (form-z-if-exis-proof (pf-tree, exp, var, tests),

concl, given, defns, symbols)

Event: Enable form-z-if-exis-proof-proves; name this event ‘g0784’.

;;;;;;;Next we show how definitions represented by form-if-trees are evaluated.
;;;;;;;PROVES-FORM-Z-IF-EVAL is the form-if-tree analogue of PROVES-Z-IF.
;;;;;;;The only difference is that in the base case, PROVES-FORM-Z-IF-EVAL
;;;;;;;checks if PF-TREE is a proof of "(EXP -> (LHS = VAL))".

Definition: proves-form-z-if-eval (pf-tree, exp, lhs, val, given, defns, symbols) = if z-ifp (exp)

then if caar (pf-tree)

then proves (cadar (pf-tree), z-test (exp), given, defns, symbols)

∧ proves-form-z-if-eval (cadr (pf-tree), z-left (exp), lhs, val, given, defns, symbols)

else proves (caddar (pf-tree), f-not (z-test (exp)), given, defns, symbols)

∧ proves-form-z-if-eval (caddr (pf-tree), z-right (exp), lhs, val, given, defns, symbols) endif

else proves (pf-tree, f-implies (exp, f-equal (lhs, val)), given, defns, symbols) endif

Definition: form-z-if-eval-proof (pf-tree, exp, lhs, val) = if z-ifp (exp)

then if caar (pf-tree)

then chain-proof (make-form-z-if (exp), f-equal (lhs, val), list (make-form-z-if (z-left (exp))), list (f-if-elim-proof1 (z-test (exp),

make-form-z-if (z-left (exp)), make-form-z-if (z-right (exp)), cadar (pf-tree)),

form-z-if-eval-proof (cadr (pf-tree), z-left (exp), lhs, val)))

else chain-proof (make-form-z-if (exp), f-equal (lhs, val), list (make-form-z-if (z-right (exp))), list (f-if-elim-proof2 (z-test (exp),

make-form-z-if (z-left (exp)), make-form-z-if (z-right (exp)), caddar (pf-tree)),

form-z-if-eval-proof (caddr (pf-tree), z-right (exp), lhs, val))) endif

else pf-tree endif

Theorem: form-z-if-eval-proof-proves (form-z-if (exp, symbols) ∧ termp (list (lhs, val), 1, symbols) ∧ proves-form-z-if-eval (pf-tree, exp, lhs, val, given, defns, symbols)) → proves (form-z-if-eval-proof (pf-tree, exp, lhs, val),

f-implies (make-form-z-if (exp), f-equal (lhs, val)), given, defns, symbols)

Event: Enable form-z-if-eval-proof; name this event ‘g0785’.

Definition: form-z-if-eval-proof1 (pf-tree, exp, lhs, val, pf ) = detach-proof (make-form-z-if (exp),

f-equal (lhs, val),

pf ,

form-z-if-eval-proof (pf-tree, exp, lhs, val))

;;;;;;;Now we can show that if we have a proof-tree satisfying PROVES-FORM-Z-IF-EVAL,
;;;;;;;then we can prove that the function can be evaluated as desired, e.g.,
;;;;;;;we can show that "((Z-car <X>) = <(CAR X)>)".

Theorem: form-z-if-eval-proof-proves1 (form-z-if (exp, symbols) ∧ termp (list (lhs, val), 1, symbols) ∧ proves-form-z-if-eval (pf-tree, exp, lhs, val, given, defns, symbols) ∧ proves (pf , make-form-z-if (exp), given, defns, symbols)) → proves (form-z-if-eval-proof1 (pf-tree, exp, lhs, val, pf ),

f-equal (lhs, val), given, defns, symbols)

Event: Enable form-z-if-eval-proof1; name this event ‘g0786’.

Theorem: nlistp-nil-intersect (y ≃ nil) → nil-intersect (x, y)

Theorem: not-free-free-for (collect-free (term, 0) ≃ nil) → free-for (exp, var, term, flg)

Theorem: listp-append listp (append (x, y)) = (listp (x) ∨ listp (y))

Event: Enable free-for; name this event ‘g0666’.

Theorem: not-free-for-list (collect-free (termlist, 1) ≃ nil) → free-for-list (exp, varlist, termlist)

Event: Enable free-for-list; name this event ‘g0671’.

Event: Enable listp-append; name this event ‘g0680’.

Definition: listp-cond-proof1 (x, y)

= detach-proof (f-equal (z-opair (x, y), z-opair (x, y)),

forsome (1,

forsome (2, f-equal (z-opair (x, y), z-opair (1, 2)))), ident-axiom-proof (z-opair (x, y)), subst-thm-a-proof (f-equal (z-opair (x, y), z-opair (1, 2)),

list (1, 2), list (x, y)))

Theorem: listp-cond-proof1-proves (subset (list (fn (3, 1), fn (2, 2), fn (1, 2), p (2, 1), p (1, 2), fn (0, 0)), symbols) ∧ z-int-hyps (defns, symbols) ∧ z-succ-hyps (defns, symbols) ∧ termp (list (x, y), 1, symbols) ∧ (collect-free (x, 0) = nil) ∧ (collect-free (y, 0) = nil)) → proves (listp-cond-proof1 (x, y),

forsome (1, forsome (2, f-equal (z-opair (x, y), z-opair (1, 2)))), given, defns, symbols)

Event: Enable listp-cond-proof1; name this event ‘g0685’.

Definition: numeral-not-listp-proof (n, x, y, u, v) = f-iff-mp-proof2 (f-not (forsome (x,

forsome (y,

f-equal (numeral (n), z-opair (u, v))))),

∀ x f-not (forsome (y, f-equal (numeral (n), z-opair (u, v)))), forsome-forall-proof (x,

forsome (y,

f-equal (numeral (n),

z-opair (u, v)))),

generalise-proof (x,

f-not (forsome (y,

f-equal (numeral (n),

z-opair (u, v)))),

f-iff-mp-proof2 (f-not (forsome (y,

f-equal (numeral (n),

z-opair (u,

v)))),

∀ y f-not (f-equal (numeral (n),

z-opair (u, v))), forsome-forall-proof (y,

f-equal (numeral (n),

z-opair (u,

v))),

generalise-proof (y,

f-not (f-equal (numeral (n),

z-opair (u,

v))),

list-num-nequal-proof (n, u, v)))))

;;;;;;;No numeral is an ordered pair.

Theorem: numeral-not-listp-proof-proves (z-succ-hyps (defns, symbols) ∧ subset (list (fn (3, 1), fn (2, 2), fn (1, 2), p (2, 1), p (1, 2), fn (0, 0)),

symbols)

∧ z-int-hyps (defns, symbols) ∧ var-list (list (x, y, u, v), 4) ∧ (n-bar = numeral (n))) → proves (numeral-not-listp-proof (n, x, y, u, v),

f-not (forsome (x, forsome (y, f-equal (n-bar, z-opair (u, v))))), given, defns, symbols)

Event: Enable numeral-not-listp-proof; name this event ‘g0693’.

Definition: z-car-ncode-proof (x) = form-z-if-eval-proof1 (list (list (listp (x),

listp-cond-proof1 (ncode (car (x)),

ncode (cdr (x))),

numeral-not-listp-proof (x, 1, 2, 1, 2)), forsome-intro-proof (2,

f-equal (z-opair (ncode (car (x)),

ncode (cdr (x))), z-opair (z-car (ncode (x)), 2)),

f-equal (z-car (ncode (x)),

ncode (car (x))), chain-proof (f-equal (z-opair (ncode (car (x)),

ncode (cdr (x))), z-opair (z-car (ncode (x)), 2)),

f-equal (z-car (ncode (x)),

ncode (car (x))), list (f-equal (ncode (car (x)),

z-car (ncode (x)))), list (z-car-unique-proof (ncode (car (x)),

ncode (cdr (x)), z-car (ncode (x)), 2),

symmetry-proof1 (ncode (car (x)),

z-car (ncode (x)))))),

prop-axiom-proof (f-equal (z-car (ncode (x)),

phi))),

z-if (forsome (1,

forsome (2,

f-equal (ncode (x),

z-opair (1, 2)))),

forsome (2,

f-equal (ncode (x),

z-opair (z-car (ncode (x)), 2))),

f-equal (z-car (ncode (x)), phi)), z-car (ncode (x)), ncode (car (x)), z-car-defn-proof (ncode (x)))

;;;;;;;FORM-Z-IF-EVAL-PROOF-PROVES1 is used to prove that "(Z-car x)" is
;;;;;;;the Z2 analogue of CAR, in the lemma below.

Theorem: z-car-ncode-proof-proves (z-succ-hyps (defns, symbols) ∧ subset (list (fn (4, 1),

fn (3, 1), fn (2, 2), fn (1, 2), p (2, 1), p (1, 2), fn (0, 0)),

symbols)

∧ z-int-hyps (defns, symbols) ∧ z-car-hyps (defns, symbols) ∧ (concl = f-equal (z-car (ncode (x)), ncode (car (x))))) → proves (z-car-ncode-proof (x), concl, given, defns, symbols)

Event: Enable z-car-ncode-proof; name this event ‘g0691’.

Definition: listp-cond-proof2 (x, y) = detach-proof (f-equal (z-opair (x, y), z-opair (x, y)),

forsome (2,

forsome (1, f-equal (z-opair (x, y), z-opair (1, 2)))), ident-axiom-proof (z-opair (x, y)), subst-thm-a-proof (f-equal (z-opair (x, y), z-opair (1, 2)),

list (2, 1), list (y, x)))

Theorem: listp-cond-proof2-proves (subset (list (fn (3, 1), fn (2, 2), fn (1, 2), p (2, 1), p (1, 2), fn (0, 0)), symbols) ∧ z-int-hyps (defns, symbols) ∧ z-succ-hyps (defns, symbols) ∧ termp (list (x, y), 1, symbols) ∧ (collect-free (x, 0) = nil) ∧ (collect-free (y, 0) = nil)) → proves (listp-cond-proof2 (x, y),

forsome (2, forsome (1, f-equal (z-opair (x, y), z-opair (1, 2)))), given, defns, symbols)

Event: Enable listp-cond-proof2; name this event ‘g0692’.

Definition: z-cdr-ncode-proof (x) = form-z-if-eval-proof1 (list (list (listp (x),

listp-cond-proof2 (ncode (car (x)),

ncode (cdr (x))),

numeral-not-listp-proof (x, 2, 1, 1, 2)), forsome-intro-proof (1,

f-equal (z-opair (ncode (car (x)),

ncode (cdr (x))), z-opair (1,

z-cdr (ncode (x)))),

f-equal (z-cdr (ncode (x)),

ncode (cdr (x))), chain-proof (f-equal (z-opair (ncode (car (x)),

ncode (cdr (x))), z-opair (1,

z-cdr (ncode (x)))),

f-equal (z-cdr (ncode (x)), ncode (cdr (x))), list (f-equal (ncode (cdr (x)),

z-cdr (ncode (x)))), list (z-cdr-unique-proof (ncode (car (x)),

ncode (cdr (x)),

                                                          1,

z-cdr (ncode (x))),

symmetry-proof1 (ncode (cdr (x)),

z-cdr (ncode (x)))))),

prop-axiom-proof (f-equal (z-cdr (ncode (x)),

phi))),

z-if (forsome (2,

forsome (1,

f-equal (ncode (x),

z-opair (1, 2)))),

forsome (1,

f-equal (ncode (x),

z-opair (1, z-cdr (ncode (x))))),

f-equal (z-cdr (ncode (x)), phi)), z-cdr (ncode (x)), ncode (cdr (x)), z-cdr-defn-proof (ncode (x)))

;;;;;;;"(Z-cdr x)" is the Z2 analogue of CDR.

Theorem: z-cdr-ncode-proof-proves (z-succ-hyps (defns, symbols) ∧ subset (list (fn (5, 1),

fn (3, 1), fn (2, 2), fn (1, 2), p (2, 1), p (1, 2), fn (0, 0)),

symbols)

∧ z-int-hyps (defns, symbols) ∧ z-cdr-hyps (defns, symbols) ∧ (concl = f-equal (z-cdr (ncode (x)), ncode (cdr (x))))) → proves (z-cdr-ncode-proof (x), concl, given, defns, symbols)

Event: Enable z-cdr-ncode-proof; name this event ‘g0694’.

Theorem: col-free-z-car collect-free (z-car (x), 0) = collect-free (list (x), 1)

Theorem: covering-z-car covering (z-car (x), var, 0) = covering (list (x), var, 1)

Theorem: subst-z-car subst (z-car (x), var, term, 0) = z-car (subst (x, var, term, 0))

Theorem: parallel-subst-z-car parallel-subst (z-car (x), vars, terms, 0) = z-car (parallel-subst (x, vars, terms, 0))

Theorem: termp-z-car termp (z-car (x), 0, symbols) = ((fn (4, 1) ∈ symbols) ∧ termp (x, 0, symbols))

Event: Enable z-car; name this event ‘g0696’.

Theorem: col-free-z-cdr collect-free (z-cdr (x), 0) = collect-free (list (x), 1)

Theorem: covering-z-cdr covering (z-cdr (x), var, 0) = covering (list (x), var, 1)

Theorem: subst-z-cdr subst (z-cdr (x), var, term, 0) = z-cdr (subst (x, var, term, 0))

Theorem: parallel-subst-z-cdr parallel-subst (z-cdr (x), vars, terms, 0) = z-cdr (parallel-subst (x, vars, terms, 0))

Theorem: termp-z-cdr termp (z-cdr (x), 0, symbols) = ((fn (5, 1) ∈ symbols) ∧ termp (x, 0, symbols))

Event: Enable z-cdr; name this event ‘g0697’.

Definition: term-z-if-unique-proof (x, y, exp) = if z-ifp (exp)

then unique-f-if-proof (z-test (exp), make-term-z-if (x, z-left (exp)), make-term-z-if (y, z-left (exp)), make-term-z-if (x, z-right (exp)), make-term-z-if (y, z-right (exp)), f-equal (x, y), term-z-if-unique-proof (x, y, z-left (exp)), term-z-if-unique-proof (x, y, z-right (exp)))

else unique-fun-intro-proof (x, y, exp) endif

;;;;;;;The uniqueness part of the admissibility proofs for definitions constructed
;;;;;;;by term-if-trees follows from the uniqueness proofs of the leaf nodes.
;;;;;;;The lemma below proves that any definition constructed by a term-if-tree
;;;;;;;automatically has the uniqueness property, since terms represent unique values.

Theorem: term-z-if-unique-proof-proves (term-z-if (exp, x, symbols) ∧ term-z-if (exp, y, symbols) ∧ var-list (list (x, y), 2)) → proves (term-z-if-unique-proof (x, y, exp),

f-implies (f-and (make-term-z-if (x, exp), make-term-z-if (y, exp)),

f-equal (x, y)),

given, defns, symbols)

Event: Enable term-z-if-unique-proof; name this event ‘g0695’.

Theorem: term-z-if-unique-proof-proves1 (term-z-if (exp, x, symbols) ∧ term-z-if (exp, y, symbols) ∧ var-list (list (x, y), 2) ∧ (concl = f-implies (f-and (make-term-z-if (x, exp),

make-term-z-if (y, exp)), f-equal (x, y))))

→ proves (term-z-if-unique-proof (x, y, exp), concl, given, defns, symbols)

Definition: z-listp-exis-proof (x, y, z) = term-z-if-exis-proof (y,

z-if (forsome (y,

forsome (z, f-equal (x, z-opair (y, z)))), z-succ (phi), phi))

Definition: z-listp-unique-proof (x, y, y1 , z) = term-z-if-unique-proof (y,

y1 ,

z-if (forsome (y,

forsome (z, f-equal (x, z-opair (y, z)))), z-succ (phi), phi))

;;;;;;;The definition for "(Z-listp x)".

Definition: z-listp-defn (x, y, y1 , z1 ) = f-if (forsome (y1 , forsome (z1 , f-equal (x, z-opair (y1 , z1 )))),

f-equal (y, z-succ (phi)), f-equal (y, phi))

Definition: bool-fix (x) = if x then 1

else 0 endif

;;;;;;;The expression representing "(Z-listp x)".

Definition: z-listp (x) = list (fn (6, 1), x)

;;;;;;;The admissibility proof for "(Z-listp x)".

Definition: z-listp-defn-proof (term) = subst-rule-proof (z-listp-defn (0, z-listp (0), 1, 2),

                  0,

term,

fun-defn-proof (fn (6, 1), list (0),

                               1,
                               3,

z-listp-defn (0, 1, 1, 2), z-listp-exis-proof (0, 1, 2), z-listp-unique-proof (0, 1, 3, 2)))

;;;;;;;DEFNS must contain the definition of "Z-listp" associated with the
;;;;;;;function symbol for "Z-listp" and the functions used to define
;;;;;;;"Z-listp" must follow "Z-listp" in SYMBOLS.

Definition: z-listp-hyps (defns, symbols) = ((assoc (fn (6, 1), defns) = z-listp-defn (0, z-listp (0), 1, 2))

∧ subset (list (fn (3, 1), fn (1, 2), fn (0, 0)), rest-of (fn (6, 1), symbols)))

Event: Disable free-for; name this event ‘g0699’.

;;;;;;;The definition for "Z-listp" is proved to be admissible in the lemma below.

Theorem: z-listp-defn-proof-proves (subset (list (fn (6, 1), fn (3, 1), fn (1, 2), fn (0, 0)), symbols) ∧ z-listp-hyps (defns, symbols) ∧ termp (term, 0, symbols) ∧ (collect-free (term, 0) = nil) ∧ (concl = z-listp-defn (term, z-listp (term), 1, 2))) → proves (z-listp-defn-proof (term), concl, given, defns, symbols)

Event: Enable z-listp-defn-proof; name this event ‘g0703’.

Event: Enable z-listp-hyps; name this event ‘g0706’.

Definition: z-listp-ncode-proof (x) = z-if-eval-proof1 (list (list (listp (x),

listp-cond-proof1 (ncode (car (x)),

ncode (cdr (x))),

numeral-not-listp-proof (x, 1, 2, 1, 2)), ident-axiom-proof (z-succ (phi)), ident-axiom-proof (phi)),

z-if (forsome (1,

forsome (2,

f-equal (ncode (x), z-opair (1, 2)))),

z-succ (phi), phi), z-listp (ncode (x)), ncode (bool-fix (listp (x))), z-listp-defn-proof (ncode (x)))

;;;;;;;|- "((Z-listp <X>) = <(BOOL-FIX (LISTP X))>)".

Theorem: z-listp-ncode-proof-proves (subset (list (fn (6, 1), fn (3, 1), p (2, 1), p (1, 2), fn (2, 2), fn (1, 2), fn (0, 0)),

symbols) ∧ z-succ-hyps (defns, symbols) ∧ z-int-hyps (defns, symbols) ∧ z-listp-hyps (defns, symbols) ∧ (concl = f-equal (z-listp (ncode (x)), ncode (bool-fix (listp (x)))))) → proves (z-listp-ncode-proof (x), concl, given, defns, symbols)

Event: Enable z-listp-ncode-proof; name this event ‘g0711’.

;;;;;;;A similar sequence of events for "(Z-add1 x)", the Z2 analogue of ADD1.

Definition: z-add1-exis-proof (x, y, z) = term-z-if-exis-proof (y,

z-if (forsome (y,

forsome (z, f-equal (x, z-opair (y, z)))), z-succ (phi), z-succ (x)))

Definition: z-add1-unique-proof (x, y, y1 , z) = term-z-if-unique-proof (y,

y1 ,

z-if (forsome (y,

forsome (z, f-equal (x, z-opair (y, z)))), z-succ (phi), z-succ (x)))

Definition: z-add1-defn (x, y, y1 , z1 ) = f-if (forsome (y1 , forsome (z1 , f-equal (x, z-opair (y1 , z1 )))),

f-equal (y, z-succ (phi)), f-equal (y, z-succ (x)))

Definition: z-add1 (x) = list (fn (7, 1), x)

Definition: z-add1-defn-proof (term) = subst-rule-proof (z-add1-defn (0, z-add1 (0), 1, 2),

                  0,

term,

fun-defn-proof (fn (7, 1), list (0),

                               1,
                               3,

z-add1-defn (0, 1, 1, 2), z-add1-exis-proof (0, 1, 2), z-add1-unique-proof (0, 1, 3, 2)))

Definition: z-add1-hyps (defns, symbols) = ((assoc (fn (7, 1), defns) = z-add1-defn (0, z-add1 (0), 1, 2))

∧ subset (list (fn (3, 1), fn (1, 2), fn (0, 0)), rest-of (fn (7, 1), symbols)))

Theorem: z-add1-defn-proof-proves (subset (list (fn (7, 1), fn (3, 1), fn (1, 2), fn (0, 0)), symbols) ∧ z-add1-hyps (defns, symbols) ∧ termp (term, 0, symbols) ∧ (collect-free (term, 0) = nil) ∧ (concl = z-add1-defn (term, z-add1 (term), 1, 2))) → proves (z-add1-defn-proof (term), concl, given, defns, symbols)

Event: Enable z-add1-defn-proof; name this event ‘g0712’.

Event: Enable z-add1-hyps; name this event ‘g0713’.

Definition: z-add1-ncode-proof (x) = z-if-eval-proof1 (list (list (listp (x),

listp-cond-proof1 (ncode (car (x)),

ncode (cdr (x))),

numeral-not-listp-proof (x, 1, 2, 1, 2)), ident-axiom-proof (z-succ (phi)), ident-axiom-proof (z-succ (ncode (x)))),

z-if (forsome (1,

forsome (2,

f-equal (ncode (x), z-opair (1, 2)))),

z-succ (phi),

z-succ (ncode (x))), z-add1 (ncode (x)), ncode (1 + x), z-add1-defn-proof (ncode (x)))

Theorem: z-add1-ncode-proof-proves (subset (list (fn (7, 1), fn (3, 1), p (2, 1), p (1, 2), fn (2, 2), fn (1, 2), fn (0, 0)),

symbols) ∧ z-succ-hyps (defns, symbols) ∧ z-int-hyps (defns, symbols) ∧ z-add1-hyps (defns, symbols) ∧ (concl = f-equal (z-add1 (ncode (x)), ncode (1 + x)))) → proves (z-add1-ncode-proof (x), concl, given, defns, symbols)

Event: Enable z-add1-ncode-proof; name this event ‘g0714’.

;;;;;;;The sequence of events introducing "(Z-numberp x)", the Z2 analogue of NUMBERP.

Definition: z-numberp-defn (x, y) = f-if (z-int (x), f-equal (y, z-succ (phi)), f-equal (y, phi))

Definition: z-numberp-exis-proof (x, y) = term-z-if-exis-proof (y, z-if (z-int (x), z-succ (phi), phi))

Definition: z-numberp-unique-proof (x, y, y1 ) = term-z-if-unique-proof (y, y1 , z-if (z-int (x), z-succ (phi), phi))

Definition: z-numberp (x) = list (fn (8, 1), x)

Definition: z-numberp-defn-proof (term) = subst-rule-proof (z-numberp-defn (0, z-numberp (0)),

                  0,

term,

fun-defn-proof (fn (8, 1), list (0),

                               1,
                               2,

z-numberp-defn (0, 1), z-numberp-exis-proof (0, 1), z-numberp-unique-proof (0, 1, 2)))

Definition: z-numberp-hyps (defns, symbols) = ((assoc (fn (8, 1), defns) = z-numberp-defn (0, z-numberp (0)))

∧ subset (list (fn (3, 1), p (2, 1), fn (0, 0)), rest-of (fn (8, 1), symbols)))

Event: Disable z-int; name this event ‘g0716’.

Theorem: collect-free-z-int collect-free (z-int (x), 0) = collect-free (list (x), 1)

Event: Enable z-int; name this event ‘g0717’.

Theorem: z-numberp-defn-proof-proves (subset (list (fn (8, 1), fn (3, 1), p (2, 1), fn (0, 0)), symbols) ∧ z-numberp-hyps (defns, symbols) ∧ termp (term, 0, symbols) ∧ (collect-free (term, 0) = nil) ∧ (concl = z-numberp-defn (term, z-numberp (term)))) → proves (z-numberp-defn-proof (term), concl, given, defns, symbols)

Event: Enable z-numberp-defn-proof; name this event ‘g0725’.

Event: Enable z-numberp-hyps; name this event ‘g0726’.

Definition: z-numberp-ncode-proof (x) = z-if-eval-proof1 (list (list (¬ listp (x),

z-int-numeral-proof (x),

not-int-opair-proof (ncode (car (x)), ncode (cdr (x)), 0)),

ident-axiom-proof (z-succ (phi)), ident-axiom-proof (phi)),

z-if (z-int (ncode (x)), z-succ (phi), phi), z-numberp (ncode (x)), ncode (bool-fix (¬ listp (x))), z-numberp-defn-proof (ncode (x)))

Theorem: z-int-numeral-proof-proves-again (z-succ-hyps (defns, symbols) ∧ subset (list (fn (3, 1), fn (2, 2), fn (1, 2), p (1, 2), fn (0, 0)), symbols) ∧ (p (2, 1) ∈ symbols) ∧ z-int-hyps (defns, symbols) ∧ (x-bar = numeral (x))) → proves (z-int-numeral-proof (x), z-int (x-bar), given, defns, symbols)

Event: Enable z-int-numeral-proof-proves; name this event ‘g0727’.

Theorem: z-numberp-ncode-proof-proves (subset (list (fn (8, 1), fn (3, 1), p (2, 1), p (1, 2), fn (2, 2), fn (1, 2), fn (0, 0)),

symbols) ∧ z-succ-hyps (defns, symbols) ∧ z-numberp-hyps (defns, symbols) ∧ z-int-hyps (defns, symbols) ∧ (concl = f-equal (z-numberp (ncode (x)), ncode (bool-fix (¬ listp (x)))))) → proves (z-numberp-ncode-proof (x), concl, given, defns, symbols)

Event: Enable z-numberp-ncode-proof; name this event ‘g0728’.

;;;;;;;Sequence of events introducing "(Z-zerop x)", the Z2 analogue of ZEROP.

Definition: z-zerop-exis-proof (x, y)

= term-z-if-exis-proof (y,

z-if (z-int (x), z-if (f-equal (x, phi), z-succ (phi), phi), z-succ (phi)))

Definition: z-zerop-unique-proof (x, y, y1 ) = term-z-if-unique-proof (y,

y1 ,

z-if (z-int (x), z-if (f-equal (x, phi), z-succ (phi), phi), z-succ (phi)))

Definition: z-zerop-defn (x, y) = f-if (z-int (x),

f-if (f-equal (x, phi), f-equal (y, z-succ (phi)), f-equal (y, phi)), f-equal (y, z-succ (phi)))

Definition: z-zerop (x) = list (fn (9, 1), x)

Definition: z-zerop-defn-proof (term) = subst-rule-proof (z-zerop-defn (0, z-zerop (0)),

                  0,

term,

fun-defn-proof (fn (9, 1), list (0),

                               1,
                               2,

z-zerop-defn (0, 1), z-zerop-exis-proof (0, 1), z-zerop-unique-proof (0, 1, 2)))

Definition: z-zerop-hyps (defns, symbols) = ((assoc (fn (9, 1), defns) = z-zerop-defn (0, z-zerop (0)))

∧ subset (list (fn (3, 1), p (2, 1), fn (0, 0)), rest-of (fn (9, 1), symbols)))

Theorem: z-zerop-defn-proof-proves (subset (list (fn (9, 1), fn (3, 1), p (2, 1), fn (0, 0)), symbols) ∧ z-zerop-hyps (defns, symbols) ∧ termp (term, 0, symbols) ∧ (collect-free (term, 0) = nil) ∧ (concl = z-zerop-defn (term, z-zerop (term)))) → proves (z-zerop-defn-proof (term), concl, given, defns, symbols)

Event: Enable z-zerop-defn-proof; name this event ‘g0763’.

Event: Enable z-zerop-hyps; name this event ‘g0764’.

Definition: z-zerop-ncode-proof (x) = z-if-eval-proof1 (list (list (¬ listp (x),

z-int-numeral-proof (x),

not-int-opair-proof (ncode (car (x)), ncode (cdr (x)), 0)),

list (list (x ≃ 0, ident-axiom-proof (phi), ncode-nequal-proof (x, 0)), ident-axiom-proof (z-succ (phi)), ident-axiom-proof (phi)), ident-axiom-proof (z-succ (phi))),

z-if (z-int (ncode (x)), z-if (f-equal (ncode (x), phi), z-succ (phi), phi), z-succ (phi)), z-zerop (ncode (x)), ncode (bool-fix (x ≃ 0)), z-zerop-defn-proof (ncode (x)))

Theorem: z-zerop-ncode-proof-proves (subset (list (fn (9, 1), fn (3, 1), p (2, 1), p (1, 2), fn (2, 2), fn (1, 2), fn (0, 0)),

symbols) ∧ z-succ-hyps (defns, symbols) ∧ z-zerop-hyps (defns, symbols) ∧ z-int-hyps (defns, symbols) ∧ (concl = f-equal (z-zerop (ncode (x)), ncode (bool-fix (x ≃ 0))))) → proves (z-zerop-ncode-proof (x), concl, given, defns, symbols)

Event: Enable z-zerop-ncode-proof; name this event ‘g0767’.

Definition: form-z-if-unique-proves (x, y, exp, pftree, given, defns, symbols) = if z-ifp (exp)

then (x ∉ collect-free (z-test (exp), 0)) ∧ (y ∉ collect-free (z-test (exp), 0)) ∧ form-z-if-unique-proves (x,

y,

z-left (exp), car (pftree), given, defns, symbols)

∧ form-z-if-unique-proves (x, y, z-right (exp), cdr (pftree), given, defns, symbols)

else proves (pftree, f-implies (f-and (exp, subst (exp, x, y, 0)), f-equal (x, y)), given, defns, symbols) endif

Definition: form-z-if-unique-proof (x, y, exp, pftree) = if z-ifp (exp)

then unique-f-if-proof (z-test (exp), make-form-z-if (z-left (exp)), subst (make-form-z-if (z-left (exp)), x, y, 0), make-form-z-if (z-right (exp)), subst (make-form-z-if (z-right (exp)), x, y, 0), f-equal (x, y), form-z-if-unique-proof (x,

y,

z-left (exp), car (pftree)),

form-z-if-unique-proof (x, y, z-right (exp), cdr (pftree)))

else pftree endif

Theorem: form-z-if-unique-proof-proves (form-z-if (exp, symbols) ∧ var-list (list (x, y), 2) ∧ form-z-if-unique-proves (x, y, exp, pftree, given, defns, symbols)) → proves (form-z-if-unique-proof (x, y, exp, pftree),

f-implies (f-and (make-form-z-if (exp),

subst (make-form-z-if (exp), x, y, 0)), f-equal (x, y)), Event: Enable form-z-if-eval-proof; name this event ‘g0700’.

Theorem: form-z-if-unique-proof-proves1 (form-z-if (exp, symbols) ∧ var-list (list (x, y), 2) ∧ form-z-if-unique-proves (x, y, exp, pftree, given, defns, symbols) ∧ (concl = f-implies (f-and (make-form-z-if (exp),

subst (make-form-z-if (exp), x, y, 0)), f-equal (x, y))))

→ proves (form-z-if-unique-proof (x, y, exp, pftree), concl, given, defns, symbols)

Event: Enable form-z-if-unique-proof-proves; name this event ‘g0701’.

Definition: trans-not-equal-proof (x, y, z, pf1 , pf2 ) = tautconseq-proof (list (f-implies (f-equal (y, x),

f-implies (f-equal (y, z), f-equal (x, z))),

f-not (f-equal (x, z)), f-equal (y, z)), f-not (f-equal (y, x)), list (trans-equal-proof1 (x, y, z), pf1 , pf2 ))

Theorem: trans-not-equal-proof-proves (proves (pf1 , f-not (f-equal (x, z)), given, defns, symbols) ∧ proves (pf2 , f-equal (y, z), given, defns, symbols)) → proves (trans-not-equal-proof (x, y, z, pf1 , pf2 ),

f-not (f-equal (y, x)), given, defns, symbols)

Event: Enable trans-not-equal-proof; name this event ‘g0840’.

Definition: flip-equals-proof (x, y, pf ) = detach-proof (f-equal (x, y), f-equal (y, x), pf , symmetry-proof1 (x, y))

Theorem: flip-equals-proof-proves proves (pf , f-equal (x, y), given, defns, symbols) → proves (flip-equals-proof (x, y, pf ), f-equal (y, x), given, defns, symbols)

Event: Enable flip-equals-proof; name this event ‘g0841’.

Definition: rename-forall-proof (x, y, exp) = forall-intro-proof (∀ x exp,

subst (exp, x, y, 0),

y,

subst-thm-b-proof (exp, list (x), list (y)))

Event: Disable free-for-list; name this event ‘g0731’.

Theorem: parallel-subst-subst-case parallel-subst (exp, list (x), list (term), flg) = subst (exp, x, term, flg)

Theorem: rename-forall-proof-proves ((y ∉ collect-free (exp, 0)) ∧ formula (exp, symbols) ∧ free-for (exp, x, y, 0) ∧ var-set (list (x, y), 2) ∧ (exp-inst = subst (exp, x, y, 0))) → proves (rename-forall-proof (x, y, exp),

f-implies (∀ x exp, ∀ y exp-inst), given, defns, symbols)

Event: Enable free-for-list; name this event ‘g0732’.

Event: Enable parallel-subst-subst-case; name this event ‘g0733’.

Event: Enable form-z-if-unique-proof; name this event ‘g0734’.

;;;;;;;Sequence of events introducing "(Z-sub1 x)", the Z2 analogue of SUB1.

Definition: z-sub1 (x) = list (fn (10, 1), x)

Definition: z-sub1-defn (x, y, z) = f-if (z-int (x), f-if (forsome (z, f-and (z-int (z), f-equal (z-succ (z), x))),

f-and (z-int (y), f-equal (z-succ (y), x)), f-equal (y, phi)),

f-equal (y, phi))

Definition: z-sub1-expr (x, y, z) = z-if (z-int (x),

z-if (forsome (z, f-and (z-int (z), f-equal (z-succ (z), x))), f-and (z-int (y), f-equal (z-succ (y), x)), f-equal (y, phi)),

f-equal (y, phi))

Definition: z-sub1-exis-proof (x, y) = form-z-if-exis-proof (list (list (tautconseq-proof (nil,

f-implies (f-and (forsome (y,

f-and (z-int (y),

f-equal (z-succ (y), x))),

z-int (x)), forsome (y,

f-and (z-int (y),

f-equal (z-succ (y), x)))),

nil),

tautconseq-proof (list (forsome (y,

f-equal (y,

phi))),

f-implies (f-and (f-not (forsome (y,

f-and (z-int (y),

f-equal (z-succ (y), x)))),

z-int (x)), forsome (y,

f-equal (y,

phi))),

list (exis-fun-intro-proof (y,

phi)))),

tautconseq-proof (list (forsome (y,

f-equal (y, phi))),

f-implies (f-not (z-int (x)), forsome (y,

f-equal (y,

phi))),

list (exis-fun-intro-proof (y,

phi)))),

z-sub1-expr (x, y, y), y, nil)

Definition: z-int-z-succ-equal-proof (x, y) = tautconseq-proof (list (f-implies (z-int (x),

f-and (z-trans2 (x), z-trich2 (x))),

f-implies (z-int (y),

f-and (z-trans2 (y), z-trich2 (y))),

f-implies (z-trans2 (x),

f-implies (z-trans2 (y),

f-implies (f-equal (z-succ (x),

z-succ (y)), f-equal (x, y))))),

f-implies (z-int (x),

f-implies (z-int (y),

f-implies (f-equal (z-succ (x),

z-succ (y)), f-equal (x, y)))),

list (iff-split-proof1 (z-int (x), f-and (z-trans2 (x), z-trich2 (x)), z-int-defn-proof (x)),

iff-split-proof1 (z-int (y), f-and (z-trans2 (y), z-trich2 (y)), z-int-defn-proof (y)),

z-succ-equal-proof (x, y, 1, 2)))

Theorem: z-int-z-succ-equal-proof-proves (termp (x, 0, symbols) ∧ termp (y, 0, symbols) ∧ z-int-hyps (defns, symbols) ∧ z-succ-hyps (defns, symbols) ∧ subset (list (p (2, 1), p (1, 2), fn (3, 1), fn (2, 2), fn (1, 2), fn (0, 0)),

symbols)

∧ nil-intersect (list (1, 2), collect-free (list (x, y), 1))) → proves (z-int-z-succ-equal-proof (x, y),

f-implies (z-int (x),

f-implies (z-int (y),

f-implies (f-equal (z-succ (x), z-succ (y)), f-equal (x, y)))), Event: Enable z-int-z-succ-equal-proof; name this event ‘g0739’.

Definition: z-sub1-unique-proof (x, y, y1 ) = form-z-if-unique-proof (y,

y1 ,

z-sub1-expr (x, y, y),

cons (cons (tautconseq-proof (list (f-implies (f-equal (z-succ (y),

x), f-implies (f-equal (z-succ (y1 ),

x), f-equal (z-succ (y),

z-succ (y1 )))),

f-implies (z-int (y),

f-implies (z-int (y1 ),

f-implies (f-equal (z-succ (y),

z-succ (y1 )), f-equal (y,

y1 ))))),

f-implies (f-and (f-and (z-int (y),

f-equal (z-succ (y), x)),

f-and (z-int (y1 ),

f-equal (z-succ (y1 ), x))),

f-equal (y,

y1 )),

list (trans-equal-proof2 (z-succ (y), x, z-succ (y1 )),

z-int-z-succ-equal-proof (y,

y1 ))),

unique-fun-intro-proof (y, y1 , phi)), unique-fun-intro-proof (y, y1 , phi)))

Definition: z-sub1-defn-proof (term) = subst-rule-proof (z-sub1-defn (0, z-sub1 (0), 3),

                  0,

term, fun-defn-proof (fn (10, 1),

list (0),

                               3,
                               4,

z-sub1-defn (0, 3, 3), z-sub1-exis-proof (0, 3), z-sub1-unique-proof (0, 3, 4)))

Definition: z-sub1-hyps (defns, symbols) = ((assoc (fn (10, 1), defns) = z-sub1-defn (0, z-sub1 (0), 3))

∧ z-int-hyps (defns, rest-of (fn (10, 1), symbols)) ∧ z-succ-hyps (defns, rest-of (fn (10, 1), symbols)) ∧ subset (list (fn (3, 1), p (2, 1), p (1, 2), fn (2, 2), fn (1, 2), fn (0, 0)),

rest-of (fn (10, 1), symbols)))

Theorem: z-sub1-defn-proof-proves (subset (list (fn (10, 1), fn (3, 1), p (2, 1), fn (0, 0)), symbols) ∧ z-sub1-hyps (defns, symbols) ∧ termp (term, 0, symbols) ∧ nil-intersect (list (3, 4), collect-free (term, 0)) ∧ (concl = z-sub1-defn (term, z-sub1 (term), 3))) → proves (z-sub1-defn-proof (term), concl, given, defns, symbols)

Event: Enable z-sub1-defn-proof; name this event ‘g0787’.

Event: Enable z-sub1-hyps; name this event ‘g0788’.

Definition: enable-nzerop-proof (x, y) = detach-proof (f-and (z-int (ncode (x − 1)),

f-equal (z-succ (ncode (x − 1)), z-succ (ncode (x − 1)))), forsome (y,

f-and (z-int (y),

f-equal (z-succ (y), z-succ (ncode (x − 1))))),

and-join-proof (z-int (ncode (x − 1)),

f-equal (z-succ (ncode (x − 1)),

z-succ (ncode (x − 1))), z-int-numeral-proof (x − 1), ident-axiom-proof (z-succ (ncode (x − 1)))),

subst-thm-a-proof (f-and (z-int (y),

f-equal (z-succ (y),

z-succ (ncode (x − 1)))),

list (y),

list (ncode (x − 1))))

Theorem: enable-nzerop-proof-proves ((x ≄ 0) ∧ subset (list (fn (3, 1), p (2, 1), p (1, 2), fn (2, 2), fn (1, 2), fn (0, 0)),

symbols)

∧ z-int-hyps (defns, symbols) ∧ z-succ-hyps (defns, symbols) ∧ variable (y) ∧ (concl = forsome (y, f-and (z-int (y), f-equal (z-succ (y), ncode (x)))))) → proves (enable-nzerop-proof (x, y), concl, given, defns, symbols)

Event: Enable enable-nzerop-proof; name this event ‘g0790’.

Definition: disable-nzerop-proof (x, y) = f-iff-mp-proof2 (f-not (forsome (y,

f-and (z-int (y),

f-equal (z-succ (y), ncode (x))))),

∀ y f-not (f-and (z-int (y), f-equal (z-succ (y), ncode (x)))), forsome-forall-proof (y,

f-and (z-int (y),

f-equal (z-succ (y), ncode (x)))),

generalise-proof (y,

f-not (f-and (z-int (y),

f-equal (z-succ (y),

ncode (x)))), tautconseq-proof (list (f-implies (f-equal (z-succ (y),

phi), f-equal (phi,

z-succ (y))),

f-not (f-equal (phi,

z-succ (y)))),

f-not (f-and (z-int (y),

f-equal (z-succ (y), phi))),

list (symmetry-proof1 (z-succ (y),

phi),

ext-not-equal-proof (phi, z-succ (y), y, null-axiom-proof (y), x-in-z-succ-x-proof (y))))))

Theorem: disable-nzerop-proof-proves ((¬ listp (x)) ∧ (x ≃ 0) ∧ subset (list (fn (3, 1), p (2, 1), p (1, 2), fn (2, 2), fn (1, 2), fn (0, 0)),

symbols)

∧ z-int-hyps (defns, symbols) ∧ z-succ-hyps (defns, symbols) ∧ variable (y) ∧ (concl = f-not (forsome (y,

f-and (z-int (y), f-equal (z-succ (y), ncode (x)))))))

→ proves (disable-nzerop-proof (x, y), concl, given, defns, symbols)

Event: Enable disable-nzerop-proof; name this event ‘g0791’.

Definition: nzerop-z-sub1-ncode-proof (x) = tautconseq-proof (list (z-int (ncode (x − 1)),

f-implies (z-int (z-sub1 (ncode (x))),

f-implies (z-int (ncode (x − 1)),

f-implies (f-equal (z-succ (z-sub1 (ncode (x))),

z-succ (ncode (x − 1))), f-equal (z-sub1 (ncode (x)),

ncode (x − 1)))))),

f-implies (f-and (z-int (z-sub1 (ncode (x))),

f-equal (z-succ (z-sub1 (ncode (x))),

z-succ (ncode (x − 1)))),

f-equal (z-sub1 (ncode (x)), ncode (x − 1))),

list (z-int-numeral-proof (x − 1),

z-int-z-succ-equal-proof (z-sub1 (ncode (x)), ncode (x − 1))))

Definition: z-sub1-ncode-proof (x) = form-z-if-eval-proof1 (list (list (x ≃ nil,

z-int-numeral-proof (x),

not-int-opair-proof (ncode (car (x)), ncode (cdr (x)), 0)),

list (list (x ≄ 0, enable-nzerop-proof (x, 3), disable-nzerop-proof (x, 3)),

nzerop-z-sub1-ncode-proof (x), tautconseq-proof (nil,

f-implies (f-equal (z-sub1 (ncode (x)),

phi), f-equal (z-sub1 (ncode (x)), phi)),

nil)),

tautconseq-proof (nil,

f-implies (f-equal (z-sub1 (ncode (x)), phi),

f-equal (z-sub1 (ncode (x)), phi)),

nil)), z-sub1-expr (ncode (x), z-sub1 (ncode (x)), 3), z-sub1 (ncode (x)), ncode (x − 1), z-sub1-defn-proof (ncode (x)))

Theorem: z-sub1-ncode-proof-proves (subset (list (fn (10, 1), fn (3, 1), p (2, 1), p (1, 2), fn (2, 2), fn (1, 2), fn (0, 0)),

symbols) ∧ z-succ-hyps (defns, symbols) ∧ z-sub1-hyps (defns, symbols) ∧ z-int-hyps (defns, symbols) ∧ (concl = f-equal (z-sub1 (ncode (x)), ncode (x − 1)))) → proves (z-sub1-ncode-proof (x), concl, given, defns, symbols)

Event: Enable z-sub1-ncode-proof; name this event ‘g0793’.

;;;;;;;Sequence of events introducing "(Z-equal x y)", the Z2 analogue of EQUAL.

Definition: z-equal (x, y) = list (fn (11, 2), x, y)

Definition: z-equal-defn (x, y, z) = f-if (f-equal (x, y), f-equal (z, z-succ (phi)), f-equal (z, phi))

Definition: z-equal-defn-proof (x, y) = instance-proof (z-equal-defn (0, 1, z-equal (0, 1)),

list (0, 1), list (x, y), fun-defn-proof (fn (11, 2),

list (0, 1),

                             2,
                             3,

z-equal-defn (0, 1, 2), term-z-if-exis-proof (2,

z-if (f-equal (0, 1), z-succ (phi), phi)),

term-z-if-unique-proof (2,

                                                 3,

z-if (f-equal (0,

1), z-succ (phi), phi))))

Definition: z-equal-hyps (defns, symbols) = ((assoc (fn (11, 2), defns) = z-equal-defn (0, 1, z-equal (0, 1)))

∧ subset (list (fn (3, 1), fn (0, 0)), rest-of (fn (11, 2), symbols)))

Event: Disable free-for-list; name this event ‘g0740’.

Theorem: z-equal-defn-proof-proves (subset (list (fn (11, 2), fn (3, 1), fn (0, 0)), symbols) ∧ z-equal-hyps (defns, symbols) ∧ termp (list (x, y), 1, symbols) ∧ (concl = z-equal-defn (x, y, z-equal (x, y)))) → proves (z-equal-defn-proof (x, y), concl, given, defns, symbols)

Event: Enable z-equal-defn-proof; name this event ‘g0794’.

Event: Enable z-equal-hyps; name this event ‘g0795’.

Theorem: ncode-equal-ncode-equal ncode-equal (x, y) → (ncode (y) = ncode (x))

Definition: z-equal-ncode-proof (x, y) = z-if-eval-proof1 (list (list (ncode-equal (x, y),

ident-axiom-proof (ncode (x)), ncode-nequal-proof (x, y)), ident-axiom-proof (z-succ (phi)), ident-axiom-proof (phi)),

z-if (f-equal (ncode (x), ncode (y)), z-succ (phi), phi), z-equal (ncode (x), ncode (y)), ncode (bool-fix (ncode-equal (x, y))), z-equal-defn-proof (ncode (x), ncode (y)))

Theorem: z-equal-ncode-proof-proves (subset (list (fn (11, 2), p (2, 1), p (1, 2), fn (3, 1), fn (2, 2), fn (1, 2), fn (0, 0)),

symbols) ∧ z-int-hyps (defns, symbols) ∧ z-succ-hyps (defns, symbols) ∧ z-equal-hyps (defns, symbols) ∧ (concl = f-equal (z-equal (ncode (x), ncode (y)),

ncode (bool-fix (ncode-equal (x, y))))))

→ proves (z-equal-ncode-proof (x, y), concl, given, defns, symbols)

Event: Enable z-equal-ncode-proof; name this event ‘g0796’.

;;;;;;;Sequence of events introducing "(Z-cons x y)", the Z2 analogue of CONS.

Definition: z-cons (x, y) = list (fn (12, 2), x, y)

Definition: z-cons-defn (x, y, z) = f-equal (z, z-opair (x, y))

Definition: z-cons-defn-proof (x, y) = instance-proof (z-cons-defn (0, 1, z-cons (0, 1)),

list (0, 1), list (x, y), fun-defn-proof (fn (12, 2),

list (0, 1),

                             2,
                             3,

z-cons-defn (0, 1, 2),

exis-fun-intro-proof (2, z-opair (0, 1)), unique-fun-intro-proof (2,

                                                 3,

z-opair (0, 1))))

Definition: z-cons-hyps (defns, symbols) = ((assoc (fn (12, 2), defns) = z-cons-defn (0, 1, z-cons (0, 1)))

∧ (fn (1, 2) ∈ rest-of (fn (12, 2), symbols)))

Theorem: z-cons-defn-proof-proves (subset (list (fn (12, 2), fn (1, 2)), symbols) ∧ z-cons-hyps (defns, symbols) ∧ termp (list (x, y), 1, symbols) ∧ (collect-free (x, 0) = nil) ∧ (collect-free (y, 0) = nil) ∧ (concl = z-cons-defn (x, y, z-cons (x, y)))) → proves (z-cons-defn-proof (x, y), concl, given, defns, symbols)

Event: Enable z-cons-defn-proof; name this event ‘g0800’.

Event: Enable z-cons-hyps; name this event ‘g0801’.

Event: Enable z-cons-defn-proof; name this event ‘g0741’.

Event: Enable z-cons-hyps; name this event ‘g0742’.

Theorem: nzerop-ncode-equal ((x ≄ 0) ∨ (y ≄ 0)) → (ncode-equal (x, y) = (x = y))

Definition: list-and-join-proof (explist, pflist) = if listp (explist)

then if listp (cdr (explist))

then and-join-proof (car (explist), list-f-and (cdr (explist)), car (pflist), list-and-join-proof (cdr (explist), cdr (pflist)))

else car (pflist) endif else pflist endif

Theorem: list-and-join-proof-proves (listp (explist) ∧ proves-list (pflist, explist, given, defns, symbols)) → proves (list-and-join-proof (explist, pflist),

list-f-and (explist), given, defns, symbols)

Event: Enable list-and-join-proof; name this event ‘g0804’.

Definition: compose-proof (fn, val, args, vals, pflist, pf ) = list-detach-proof (list-f-equal (list (cons (fn, args),

cons (fn, vals), cons (fn, args)),

list (cons (fn, args), val, cons (fn, vals))),

f-equal (cons (fn, args), val),

list (ident-axiom-proof (cons (fn, args)), pf , list-detach-proof (list-f-equal (args, vals), f-equal (cons (fn, args),

cons (fn, vals)), pflist, equal-axiom1-proof (fn,

args, vals))),

equal-axiom2-proof (p (0, 2), list (cons (fn, args), cons (fn, vals)), list (cons (fn, args), val)))

;;;;;;;So far we have seen how to introduce functions defined by cases.  Another
;;;;;;;important way of defining functions is by composition, i.e., "(f x1 ... xn)"
;;;;;;;can be defined as "(g (h1 x1...xn) ... (hn x1...xn))".  (It is worth noting
;;;;;;;that it is exactly because we make heavy use of function composition that
;;;;;;;we introduced function symbols corresponding to the Lisp primitives.
;;;;;;;When we were working with the predicates representing the definitions,
;;;;;;;composition was extremely tedious to simulate.)  We can of course
;;;;;;;combine definition by cases and by composition.  The remaining important
;;;;;;;mode of definition is recursion, and we will see how this is carried out, later.
;;;;;;;The lemma below asserts that if |- "(arg1=val1)", . . ., |- "(argn=valn)",
;;;;;;;and |- "((f val1 ... valn) = val)", then |- "((f arg1 ... argn) = val)".

Theorem: compose-proof-proves (function (fn) ∧ symb (fn, symbols) ∧ termp (args, 1, symbols) ∧ termp (vals, 1, symbols) ∧ termp (val, 0, symbols) ∧ (length (args) = degree (fn)) ∧ (length (vals) = degree (fn)) ∧ proves-list (pflist, list-f-equal (args, vals), given, defns, symbols) ∧ proves (pf , f-equal (cons (fn, vals), val), given, defns, symbols) ∧ (concl = f-equal (cons (fn, args), val))) → proves (compose-proof (fn, val, args, vals, pflist, pf ),

concl, given, defns, symbols)

Event: Enable compose-proof; name this event ‘g0805’.

;;;;;;;Perhaps the most commonly used composition is the iterated use of CAR/CDR.
;;;;;;;The function CAR-CDR recurses down LIST and if (CAR LIST) is 1, it applies
;;;;;;;CAR to the result of (CAR-CDR X (CDR LIST)).  Otherwise, it returns
;;;;;;;(CDR (CAR-CDR X (CDR LIST))).

Definition: car-cdr (x, list) = if listp (list)

then if car (list) = 1 then car (car-cdr (x, cdr (list))) else cdr (car-cdr (x, cdr (list))) endif

else x endif

;;;;;;;Z-CAR-CDR composes "Z-car" and "Z-cdr" in a manner similar to CAR-CDR.

Definition: z-car-cdr (x, list) = if listp (list)

then if car (list) = 1 then z-car (z-car-cdr (x, cdr (list))) else z-cdr (z-car-cdr (x, cdr (list))) endif

else x endif

Theorem: termp-z-car-cdr (subset (list (fn (5, 1), fn (4, 1)), symbols) ∧ termp (x, 0, symbols)) → termp (z-car-cdr (x, list), 0, symbols)

Definition: z-car-cdr-proof (x, list) = if listp (list)

then if car (list) = 1

then compose-proof (fn (4, 1), ncode (car-cdr (x, list)), list (z-car-cdr (ncode (x), cdr (list))), list (ncode (car-cdr (x, cdr (list)))), list (z-car-cdr-proof (x, cdr (list))), z-car-ncode-proof (car-cdr (x, cdr (list))))

else compose-proof (fn (5, 1), ncode (car-cdr (x, list)), list (z-car-cdr (ncode (x), cdr (list))), list (ncode (car-cdr (x, cdr (list)))), list (z-car-cdr-proof (x, cdr (list))), z-cdr-ncode-proof (car-cdr (x, cdr (list)))) endif

else ident-axiom-proof (ncode (x)) endif

Event: Disable z-car; name this event ‘g0806’.

Event: Disable z-cdr; name this event ‘g0807’.

;;;;;;;Z-CAR-CDR is the Z2 analogue of CAR-CDR.

Theorem: z-car-cdr-proof-proves (subset (list (fn (5, 1),

fn (4, 1), fn (3, 1), fn (2, 2), p (2, 1), fn (1, 2), p (1, 2), fn (0, 0)),

symbols) ∧ z-car-hyps (defns, symbols) ∧ z-cdr-hyps (defns, symbols) ∧ z-succ-hyps (defns, symbols) ∧ z-int-hyps (defns, symbols) ∧ (concl = f-equal (z-car-cdr (ncode (x), list), ncode (car-cdr (x, list))))) → proves (z-car-cdr-proof (x, list), concl, given, defns, symbols)

Event: Enable z-car-cdr-proof; name this event ‘g0808’.

Definition: compose-car-proof (fn, val, arg, pfval) = compose-proof (fn,

val,

list (z-car (ncode (arg))), list (ncode (car (arg))), list (z-car-ncode-proof (arg)), pfval)

Theorem: compose-car-proof-proves (function (fn) ∧ symb (fn, symbols) ∧ (degree (fn) = 1) ∧ termp (val, 0, symbols) ∧ z-succ-hyps (defns, symbols) ∧ subset (list (fn (4, 1), fn (3, 1), fn (2, 2), fn (1, 2), p (1, 2), fn (0, 0)),

symbols)

∧ (p (2, 1) ∈ symbols) ∧ z-int-hyps (defns, symbols) ∧ z-car-hyps (defns, symbols) ∧ proves (pfval,

f-equal (list (fn, ncode (car (arg))), val), given, defns, symbols)

∧ (concl = f-equal (list (fn, z-car (ncode (arg))), val))) → proves (compose-car-proof (fn, val, arg, pfval), concl, given, defns, symbols)

Event: Enable compose-car-proof; name this event ‘g0821’.

Definition: compose-car-cadr-proof (fn, val, arg, pfval) = compose-proof (fn,

val,

list (z-car (ncode (arg)), z-car (z-cdr (ncode (arg)))), list (ncode (car (arg)), ncode (cadr (arg))), list (z-car-ncode-proof (arg),

z-car-cdr-proof (arg, list (1, 2))), pfval)

Theorem: compose-car-cadr-proof-proves (function (fn) ∧ symb (fn, symbols) ∧ (degree (fn) = 2) ∧ termp (val, 0, symbols) ∧ z-succ-hyps (defns, symbols) ∧ subset (list (fn (5, 1),

fn (4, 1), fn (3, 1), fn (2, 2), fn (1, 2), p (1, 2), fn (0, 0)),

symbols)

∧ (p (2, 1) ∈ symbols) ∧ z-int-hyps (defns, symbols) ∧ z-car-hyps (defns, symbols) ∧ z-cdr-hyps (defns, symbols) ∧ proves (pfval,

f-equal (list (fn, ncode (car (arg)), ncode (cadr (arg))), val), given, defns, symbols)

∧ (concl = f-equal (list (fn, z-car (ncode (arg)), z-car (z-cdr (ncode (arg)))),

val)))

→ proves (compose-car-cadr-proof (fn, val, arg, pfval), concl, Event: Enable compose-car-cadr-proof; name this event ‘g0822’.

;;;;;;;Next we would like to define the Z2 analogue of APPLY-SUBR, the part
;;;;;;;of the Lisp interpreter that evaluates the Lisp primitives.  This is
;;;;;;;done in three parts to make the proof manageable.  In the first part
;;;;;;;we represent APPLY-SUBR1 which evaluates LISTP, CONS, CAR, and CDR.
;;;;;;;These operations are represented by the symbols 6, 7, 8, and 9, respectively,
;;;;;;;to the Lisp interpreter.  APPLY-SUBR1 is represented by "(Z-apply-subr1 f args)".

Definition: z-apply-subr1 (fn, args) = list (fn (13, 2), fn, args)

Definition: z-apply-subr1-defn (fn, args, y) = f-if (f-equal (fn, ncode (6)),

f-equal (y, z-listp (z-car (args))), f-if (f-equal (fn, ncode (7)),

f-equal (y, z-cons (z-car (args), z-car (z-cdr (args)))), f-if (f-equal (fn, ncode (8)),

f-equal (y, z-car (z-car (args))), f-equal (y, z-cdr (z-car (args))))))

Definition: z-apply-subr1-exis-proof (fn, args, y) = term-z-if-exis-proof (y,

z-if (f-equal (fn, ncode (6)), z-listp (z-car (args)), z-if (f-equal (fn, ncode (7)),

z-cons (z-car (args), z-car (z-cdr (args))), z-if (f-equal (fn, ncode (8)), z-car (z-car (args)), z-cdr (z-car (args))))))

Definition: z-apply-subr1-unique-proof (y, y1 , fn, args) = term-z-if-unique-proof (y,

y1 ,

z-if (f-equal (fn, ncode (6)), z-listp (z-car (args)), z-if (f-equal (fn, ncode (7)), z-cons (z-car (args),

z-car (z-cdr (args))), z-if (f-equal (fn, ncode (8)), z-car (z-car (args)), z-cdr (z-car (args))))))

Definition: z-apply-subr1-defn-proof (fn, args) = instance-proof (z-apply-subr1-defn (0, 1, z-apply-subr1 (0, 1)),

list (0, 1), list (fn, args), fun-defn-proof (fn (13, 2),

list (0, 1),

            2,
            3,

z-apply-subr1-defn (0, 1, 2), z-apply-subr1-exis-proof (0, 1, 2), z-apply-subr1-unique-proof (2, 3, 0, 1)))

Definition: z-apply-subr1-hyps (defns, symbols) = ((assoc (fn (13, 2), defns)

= z-apply-subr1-defn (0, 1, z-apply-subr1 (0, 1))) ∧ subset (list (fn (0, 0),

fn (3, 1), fn (4, 1), fn (5, 1), fn (6, 1), fn (7, 1), fn (8, 1), fn (9, 1), fn (10, 1), fn (11, 2), fn (12, 2)),

rest-of (fn (13, 2), symbols)))

Theorem: z-apply-subr1-defn-proof-proves (subset (list (fn (13, 2),

fn (12, 2), fn (0, 0), fn (3, 1), fn (4, 1), fn (5, 1), fn (6, 1), fn (7, 1), fn (8, 1), fn (9, 1), fn (10, 1), fn (11, 2)),

symbols) ∧ z-apply-subr1-hyps (defns, symbols) ∧ termp (list (x, y), 1, symbols) ∧ (concl = z-apply-subr1-defn (x, y, z-apply-subr1 (x, y)))) → proves (z-apply-subr1-defn-proof (x, y), concl, given, defns, symbols)

Event: Enable z-apply-subr1-defn-proof; name this event ‘g0810’.

Event: Enable z-apply-subr1-hyps; name this event ‘g0811’.

;;;;;;;APPLY-SUBR2 evaluates the Lisp primitives ZEROP, ADD1, SUB1, and those
;;;;;;;evaluated by APPLY-SUBR1.  It is represented by "(Z-apply-subr2 f args)".

Definition: z-apply-subr2 (fn, args) = list (fn (14, 2), fn, args)

Definition: z-apply-subr2-defn (fn, args, y) = f-if (f-equal (fn, ncode (3)),

f-equal (y, z-zerop (z-car (args))), f-if (f-equal (fn, ncode (4)),

f-equal (y, z-add1 (z-car (args))), f-if (f-equal (fn, ncode (5)),

f-equal (y, z-sub1 (z-car (args))),

f-equal (y, z-apply-subr1 (fn, args)))))

Definition: z-apply-subr2-exis-proof (fn, args, y) = term-z-if-exis-proof (y,

z-if (f-equal (fn, ncode (3)), z-zerop (z-car (args)), z-if (f-equal (fn, ncode (4)), z-add1 (z-car (args)), z-if (f-equal (fn, ncode (5)), z-sub1 (z-car (args)), z-apply-subr1 (fn, args)))))

Definition: z-apply-subr2-unique-proof (fn, args, y, y1 ) = term-z-if-unique-proof (y,

y1 ,

z-if (f-equal (fn, ncode (3)), z-zerop (z-car (args)), z-if (f-equal (fn, ncode (4)), z-add1 (z-car (args)), z-if (f-equal (fn, ncode (5)), z-sub1 (z-car (args)), z-apply-subr1 (fn, args)))))

Definition: z-apply-subr2-defn-proof (fn, args) = instance-proof (z-apply-subr2-defn (0, 1, z-apply-subr2 (0, 1)),

list (0, 1), list (fn, args), fun-defn-proof (fn (14, 2),

list (0, 1),

            2,
            3,

z-apply-subr2-defn (0, 1, 2), z-apply-subr2-exis-proof (0, 1, 2), z-apply-subr2-unique-proof (0, 1, 2, 3)))

Definition: z-apply-subr2-hyps (defns, symbols) = ((assoc (fn (14, 2), defns)

= z-apply-subr2-defn (0, 1, z-apply-subr2 (0, 1))) ∧ subset (list (fn (0, 0),

fn (3, 1), fn (4, 1), fn (5, 1), fn (6, 1), fn (7, 1), fn (8, 1), fn (9, 1), fn (10, 1), fn (11, 2), fn (12, 2), fn (13, 2)),

rest-of (fn (14, 2), symbols)))

Theorem: z-apply-subr2-defn-proof-proves (subset (list (fn (14, 2),

fn (13, 2), fn (12, 2), fn (0, 0), fn (3, 1), fn (4, 1), fn (5, 1), fn (6, 1), fn (7, 1), fn (8, 1), fn (9, 1), fn (10, 1), fn (11, 2)),

symbols) ∧ z-apply-subr2-hyps (defns, symbols) ∧ termp (list (x, y), 1, symbols) ∧ (concl = z-apply-subr2-defn (x, y, z-apply-subr2 (x, y)))) → proves (z-apply-subr2-defn-proof (x, y), concl, given, defns, symbols)

Event: Enable z-apply-subr2-defn-proof; name this event ‘g0812’.

Event: Enable z-apply-subr2-hyps; name this event ‘g0813’.

;;;;;;;Finally, APPLY-SUBR evaluates the Lisp primitives EQUAL, NUMBERP,
;;;;;;;and those evaluated by APPLY-SUBR2.  It is represented by
;;;;;;;"(Z-apply-subr f args)".

Definition: z-apply-subr (fn, args) = list (fn (15, 2), fn, args)

Definition: z-apply-subr-defn (fn, args, y) = f-if (f-equal (fn, ncode (1)),

f-equal (y, z-equal (z-car (args), z-car (z-cdr (args)))), f-if (f-equal (fn, ncode (2)),

f-equal (y, z-numberp (z-car (args))), f-equal (y, z-apply-subr2 (fn, args))))

Definition: z-apply-subr-exis-proof (fn, args, y) = term-z-if-exis-proof (y,

z-if (f-equal (fn, ncode (1)), z-equal (z-car (args), z-car (z-cdr (args))), z-if (f-equal (fn, ncode (2)),

z-numberp (z-car (args)), z-apply-subr2 (fn, args))))

Definition: z-apply-subr-unique-proof (fn, args, y, y1 ) = term-z-if-unique-proof (y,

y1 , z-if (f-equal (fn, ncode (1)),

z-equal (z-car (args), z-car (z-cdr (args))), z-if (f-equal (fn, ncode (2)),

z-numberp (z-car (args)), z-apply-subr2 (fn, args))))

Definition: z-apply-subr-defn-proof (fn, args) = instance-proof (z-apply-subr-defn (0, 1, z-apply-subr (0, 1)),

list (0, 1), list (fn, args), fun-defn-proof (fn (15, 2),

list (0, 1),

            2,
            3,

z-apply-subr-defn (0, 1, 2), z-apply-subr-exis-proof (0, 1, 2), z-apply-subr-unique-proof (0, 1, 2, 3)))

Definition: z-apply-subr-hyps (defns, symbols) = ((assoc (fn (15, 2), defns)

= z-apply-subr-defn (0, 1, z-apply-subr (0, 1))) ∧ subset (list (fn (0, 0),

fn (3, 1), fn (4, 1), fn (5, 1), fn (6, 1), fn (7, 1), fn (8, 1), fn (9, 1), fn (10, 1), fn (11, 2), fn (12, 2), fn (13, 2), fn (14, 2)),

rest-of (fn (15, 2), symbols)))

Theorem: z-apply-subr-defn-proof-proves (subset (list (fn (15, 2),

fn (14, 2), fn (13, 2), fn (12, 2), fn (0, 0), fn (3, 1), fn (4, 1), fn (5, 1), fn (6, 1), fn (7, 1), fn (8, 1), fn (9, 1), fn (10, 1), fn (11, 2)),

symbols) ∧ z-apply-subr-hyps (defns, symbols) ∧ termp (list (x, y), 1, symbols) ∧ (concl = z-apply-subr-defn (x, y, z-apply-subr (x, y)))) → proves (z-apply-subr-defn-proof (x, y), concl, given, defns, symbols)

Event: Enable z-apply-subr-defn-proof; name this event ‘g0814’.

Event: Enable z-apply-subr-hyps; name this event ‘g0815’.

Definition: apply-subr1 (fn, args) = if fn = 6 then bool-fix (listp (car (args)))

elseif fn = 7 then cons (car (args), cadr (args)) elseif fn = 8 then car (car (args)) else cdr (car (args)) endif

Definition: z-apply-subr1-ncode-proof (fn, args) = z-if-eval-proof1 (list (list (fn = 6,

ident-axiom-proof (ncode (6)), ncode-nequal-proof (fn, 6)),

compose-car-proof (fn (6, 1), ncode (bool-fix (listp (car (args)))), args, z-listp-ncode-proof (car (args))),

list (list (fn = 7, ident-axiom-proof (ncode (7)), ncode-nequal-proof (fn, 7)), compose-car-cadr-proof (fn (12, 2),

ncode (cons (car (args),

cadr (args))),

args,

z-cons-defn-proof (ncode (car (args)), ncode (cadr (args)))), list (list (fn = 8,

ident-axiom-proof (ncode (8)), ncode-nequal-proof (fn, 8)),

compose-car-proof (fn (4, 1), ncode (car (car (args))), args, z-car-ncode-proof (car (args))),

compose-car-proof (fn (5, 1), ncode (cdr (car (args))), args, z-cdr-ncode-proof (car (args)))))),

z-if (f-equal (ncode (fn), ncode (6)), z-listp (z-car (ncode (args))), z-if (f-equal (ncode (fn), ncode (7)), z-cons (z-car (ncode (args)),

z-car (z-cdr (ncode (args)))), z-if (f-equal (ncode (fn), ncode (8)), z-car (z-car (ncode (args))), z-cdr (z-car (ncode (args)))))),

z-apply-subr1 (ncode (fn), ncode (args)),

ncode (apply-subr1 (fn, args)),

z-apply-subr1-defn-proof (ncode (fn), ncode (args)))

Theorem: z-apply-subr1-ncode-proof-proves-step (subset (list (fn (13, 2),

fn (12, 2), fn (0, 0), fn (3, 1), fn (4, 1), fn (5, 1), fn (6, 1), fn (7, 1), fn (8, 1), fn (9, 1), fn (10, 1), fn (11, 2), fn (1, 2), fn (2, 2), p (2, 1), p (1, 2)),

symbols) ∧ z-apply-subr-hyps (defns, symbols) ∧ z-int-hyps (defns, symbols) ∧ z-apply-subr1-hyps (defns, symbols)

∧ z-succ-hyps (defns, symbols) ∧ z-car-hyps (defns, symbols) ∧ z-cdr-hyps (defns, symbols) ∧ z-cons-hyps (defns, symbols) ∧ z-listp-hyps (defns, symbols) ∧ (concl = f-equal (z-apply-subr1 (ncode (fn), ncode (args)),

ncode (apply-subr1 (fn, args)))))

→ proves (z-apply-subr1-ncode-proof (fn, args), concl, given, defns, symbols)

Event: Enable z-apply-subr1-ncode-proof; name this event ‘g0820’.

Event: Enable apply-subr1; name this event ‘g0825’.

Event: Enable sub1; name this event ‘g0826’.

Definition: apply-subr2 (fn, args) = if fn = 3 then bool-fix (car (args) ≃ 0)

elseif fn = 4 then 1 + car (args) elseif fn = 5 then car (args) − 1 else apply-subr1 (fn, args) endif

Definition: z-apply-subr2-ncode-proof (fn, args) = z-if-eval-proof1 (list (list (fn = 3,

ident-axiom-proof (ncode (3)), ncode-nequal-proof (fn, 3)),

compose-car-proof (fn (9, 1), ncode (bool-fix (car (args) ≃ 0)), args, z-zerop-ncode-proof (car (args))),

list (list (fn = 4, ident-axiom-proof (ncode (4)), ncode-nequal-proof (fn, 4)),

compose-car-proof (fn (7, 1), ncode (1 + car (args)), args, z-add1-ncode-proof (car (args))),

list (list (fn = 5, ident-axiom-proof (ncode (5)), ncode-nequal-proof (fn, 5)),

compose-car-proof (fn (10, 1), ncode (car (args) − 1), args, z-sub1-ncode-proof (car (args))),

z-apply-subr1-ncode-proof (fn, args)))),

z-if (f-equal (ncode (fn), ncode (3)), z-zerop (z-car (ncode (args))), z-if (f-equal (ncode (fn), ncode (4)), z-add1 (z-car (ncode (args))), z-if (f-equal (ncode (fn), ncode (5)), z-sub1 (z-car (ncode (args))), z-apply-subr1 (ncode (fn), ncode (args))))),

z-apply-subr2 (ncode (fn), ncode (args)),

ncode (apply-subr2 (fn, args)),

z-apply-subr2-defn-proof (ncode (fn), ncode (args)))

Theorem: z-apply-subr2-ncode-proof-proves-step (subset (list (fn (14, 2),

fn (13, 2), fn (12, 2), fn (0, 0), fn (3, 1), fn (4, 1), fn (5, 1), fn (6, 1), fn (7, 1), fn (8, 1), fn (9, 1), fn (10, 1), fn (11, 2), fn (1, 2), fn (2, 2), p (2, 1), p (1, 2)),

symbols) ∧ z-apply-subr-hyps (defns, symbols) ∧ z-apply-subr2-hyps (defns, symbols) ∧ z-int-hyps (defns, symbols) ∧ z-apply-subr1-hyps (defns, symbols) ∧ z-succ-hyps (defns, symbols) ∧ z-car-hyps (defns, symbols) ∧ z-cdr-hyps (defns, symbols) ∧ z-cons-hyps (defns, symbols) ∧ z-listp-hyps (defns, symbols) ∧ z-add1-hyps (defns, symbols) ∧ z-sub1-hyps (defns, symbols)

∧ z-zerop-hyps (defns, symbols) ∧ (concl = f-equal (z-apply-subr2 (ncode (fn), ncode (args)),

ncode (apply-subr2 (fn, args)))))

→ proves (z-apply-subr2-ncode-proof (fn, args), concl, given, defns, symbols)

Event: Enable z-apply-subr2-ncode-proof; name this event ‘g0827’.

Event: Enable apply-subr2; name this event ‘g0828’.

Definition: apply-subr (fn, args) = if fn = 1 then bool-fix (ncode-equal (car (args), cadr (args)))

elseif fn = 2 then bool-fix (¬ listp (car (args)))

else apply-subr2 (fn, args) endif

Definition: z-apply-subr-ncode-proof (fn, args) = z-if-eval-proof1 (list (list (fn = 1,

ident-axiom-proof (ncode (1)), ncode-nequal-proof (fn, 1)), compose-car-cadr-proof (fn (11, 2),

ncode (bool-fix (ncode-equal (car (args),

cadr (args)))),

args,

z-equal-ncode-proof (car (args),

cadr (args))),

list (list (fn = 2, ident-axiom-proof (ncode (2)), ncode-nequal-proof (fn, 2)),

compose-car-proof (fn (8, 1), ncode (bool-fix (¬ listp (car (args)))), args, z-numberp-ncode-proof (car (args))),

z-apply-subr2-ncode-proof (fn, args))), z-if (f-equal (ncode (fn), ncode (1)), z-equal (z-car (ncode (args)),

z-car (z-cdr (ncode (args)))), z-if (f-equal (ncode (fn), ncode (2)),

z-numberp (z-car (ncode (args))),

z-apply-subr2 (ncode (fn), ncode (args)))), z-apply-subr (ncode (fn), ncode (args)), ncode (apply-subr (fn, args)), z-apply-subr-defn-proof (ncode (fn), ncode (args)))

Definition: z-apply-subr-all-hyps (given, defns, symbols) = (z-apply-subr-hyps (defns, symbols)

∧ z-apply-subr2-hyps (defns, symbols) ∧ z-int-hyps (defns, symbols) ∧ z-apply-subr1-hyps (defns, symbols) ∧ z-succ-hyps (defns, symbols) ∧ z-car-hyps (defns, symbols) ∧ z-cdr-hyps (defns, symbols) ∧ z-cons-hyps (defns, symbols) ∧ z-listp-hyps (defns, symbols) ∧ z-add1-hyps (defns, symbols) ∧ z-sub1-hyps (defns, symbols) ∧ z-zerop-hyps (defns, symbols) ∧ z-equal-hyps (defns, symbols) ∧ z-numberp-hyps (defns, symbols))

Theorem: z-apply-subr-ncode-proof-proves (subset (list (fn (15, 2),

fn (14, 2), fn (13, 2), fn (12, 2), fn (0, 0), fn (3, 1), fn (4, 1), fn (5, 1), fn (6, 1), fn (7, 1), fn (8, 1), fn (9, 1), fn (10, 1), fn (11, 2), fn (1, 2), fn (2, 2), p (2, 1), p (1, 2)),

symbols) ∧ z-apply-subr-all-hyps (given, defns, symbols) ∧ (concl = f-equal (z-apply-subr (ncode (fn), ncode (args)),

ncode (apply-subr (fn, args)))))

→ proves (z-apply-subr-ncode-proof (fn, args), concl, given, defns, symbols)

Event: Enable z-apply-subr-ncode-proof; name this event ‘g0829’.

Event: Enable apply-subr; name this event ‘g0830’.

;;;;;;;Thus far we have shown how we can derive Z2 analogues of the Lisp primitives
;;;;;;;and the function APPLY-SUBR.  These functions will be used in demonstrating
;;;;;;;the representability of the Lisp interpreter.  A major obstacle that has
;;;;;;;to be overcome is the representability (in Z2) of recursively defined Lisp functions.
;;;;;;;These will be represented by specifying the partial graph (the set of value/argument
;;;;;;;ordered pairs used in the computation of the value of the function at
;;;;;;;a specific argument).  This partial graph will first be constructed as a
;;;;;;;list of pairs for the computation of the Lisp function and then translated
;;;;;;;into the corresponding set.  The specification of the partial graph in Z2 will be
;;;;;;;shown to hold of this translation.  It will also be shown that any set
;;;;;;;satisfying the specification.
;;;;;;;The function GRAPH-TRANS below translates a list into the corresponding set
;;;;;;;so that the list (X1 . (X2 . ... (Xn . NIL))) is converted to the set
;;;;;;; "{<X1>, <X2>, ..., <Xn>}".  The translation of list X will be represented as [X].

Definition: graph-trans (x) = if listp (x) then z-union (z-sing (ncode (car (x))), graph-trans (cdr (x)))

else phi endif

Definition: in-graph-proof (x, graph) = if listp (graph)

then if x = car (graph)

then f-iff-mp-proof2 (isin (ncode (x),

z-union (z-sing (ncode (x)),

graph-trans (cdr (graph)))),

f-or (isin (ncode (x), z-sing (ncode (x))),

isin (ncode (x), graph-trans (cdr (graph)))), union-axiom-proof (ncode (x),

z-sing (ncode (x)),

graph-trans (cdr (graph))),

rt-expan-proof (isin (ncode (x),

z-sing (ncode (x))), isin (ncode (x),

graph-trans (cdr (graph))), isin-sing1-proof (ncode (x))))

else f-iff-mp-proof2 (isin (ncode (x),

z-union (z-sing (ncode (car (graph))),

graph-trans (cdr (graph)))),

f-or (isin (ncode (x), z-sing (ncode (car (graph)))), isin (ncode (x),

graph-trans (cdr (graph)))),

union-axiom-proof (ncode (x), z-sing (ncode (car (graph))), graph-trans (cdr (graph))),

expan-proof (isin (ncode (x),

z-sing (ncode (car (graph)))), isin (ncode (x),

graph-trans (cdr (graph))), in-graph-proof (x,

cdr (graph)))) endif

else nil endif

Theorem: termp-graph-trans ((fn (0, 0) ∈ symbols) ∧ (fn (3, 1) ∈ symbols) ∧ (fn (1, 2) ∈ symbols) ∧ (fn (2, 2) ∈ symbols)) → termp (graph-trans (x), 0, symbols)

;;;;;;;If X is in GRAPH, then |- "(<X> in [GRAPH])".

Theorem: in-graph-proof-proves ((fn (0, 0) ∈ symbols) ∧ (fn (3, 1) ∈ symbols) ∧ (fn (1, 2) ∈ symbols) ∧ (fn (2, 2) ∈ symbols) ∧ (p (1, 2) ∈ symbols) ∧ (x ∈ graph) ∧ (x-bar = ncode (x)) ∧ (trace = graph-trans (graph))) → proves (in-graph-proof (x, graph), isin (x-bar, trace), given, defns, symbols)

Event: Enable in-graph-proof; name this event ‘g0831’.

Definition: opair-equal-proof (x, y, u, v) = tautconseq-proof (list (f-implies (f-equal (x, u),

f-implies (f-equal (y, v),

f-equal (z-pair (x, y),

z-pair (u, v)))),

f-implies (f-equal (x, u),

f-implies (f-equal (x, u), f-equal (z-sing (x), z-sing (u)))), f-implies (f-equal (z-sing (x), z-sing (u)),

f-implies (f-equal (z-pair (x, y),

z-pair (u, v)), f-equal (z-opair (x, y),

z-opair (u, v))))),

f-implies (f-equal (x, u),

f-implies (f-equal (y, v),

f-equal (z-opair (x, y),

z-opair (u, v)))),

list (equal-axiom1-proof (fn (1, 2), list (x, y), list (u, v)), equal-axiom1-proof (fn (1, 2), list (x, x), list (u, u)), equal-axiom1-proof (fn (1, 2),

list (z-sing (x), z-pair (x, y)), list (z-sing (u), z-pair (u, v)))))

Event: Disable z-opair; name this event ‘g0832’.

Event: Disable z-sing; name this event ‘g0833’.

Theorem: opair-equal-proof-proves ((fn (1, 2) ∈ symbols) ∧ termp (x, 0, symbols) ∧ termp (y, 0, symbols) ∧ termp (u, 0, symbols) ∧ termp (v, 0, symbols)) → proves (opair-equal-proof (x, y, u, v),

f-implies (f-equal (x, u),

f-implies (f-equal (y, v),

f-equal (z-opair (x, y), z-opair (u, v)))),

given, defns, symbols)

Event: Enable z-sing; name this event ‘g0834’.

Event: Enable z-opair; name this event ‘g0835’.

Event: Enable opair-equal-proof; name this event ‘g0836’.

Definition: in-graph-trans-proof (x, y, z) = tautconseq-proof (list (f-iff (isin (x, graph-trans (cons (y, z))), f-or (isin (x, z-sing (ncode (y))), isin (x, graph-trans (z)))),

f-iff (isin (x, z-sing (ncode (y))), f-equal (x, ncode (y)))), f-iff (isin (x, graph-trans (cons (y, z))), f-or (f-equal (x, ncode (y)),

isin (x, graph-trans (z)))),

list (union-axiom-proof (x, z-sing (ncode (y)), graph-trans (z)),

isin-sing-proof (ncode (y), x)))

Definition: isin-graph-trans-proof (x, y) = f-iff-mp-proof2 (isin (ncode (x), graph-trans (cons (x, y))),

f-or (f-equal (ncode (x), ncode (x)),

isin (ncode (x), graph-trans (y))), in-graph-trans-proof (ncode (x), x, y), rt-expan-proof (f-equal (ncode (x), ncode (x)),

isin (ncode (x), graph-trans (y)), ident-axiom-proof (ncode (x))))

Definition: graph-trans-merge-proof (x, y, exp1 , exp2 , pf1 , pf2 ) = tautconseq-proof (list (f-iff (isin (exp1 , graph-trans (cons (x, y))),

f-or (f-equal (exp1 , ncode (x)),

isin (exp1 , graph-trans (y)))),

f-implies (f-equal (exp1 , ncode (x)), exp2 ), f-implies (isin (exp1 , graph-trans (y)), exp2 )), f-implies (isin (exp1 , graph-trans (cons (x, y))), exp2 ), list (in-graph-trans-proof (exp1 , x, y), pf1 , pf2 ))

;;;;;;; |- "((x in [(CONS Y Z)]) <-> ((x = <Y>) v (x in [Z])))".

Theorem: in-graph-trans-proof-proves (subset (list (p (1, 2), fn (0, 0), fn (1, 2), fn (2, 2), fn (3, 1)), symbols) ∧ termp (x, 0, symbols) ∧ (y-bar = ncode (y)) ∧ (z-bar = graph-trans (z))) → proves (in-graph-trans-proof (x, y, z),

f-iff (isin (x, graph-trans (cons (y, z))),

f-or (f-equal (x, y-bar), isin (x, z-bar))), given, defns, symbols)

Event: Enable in-graph-trans-proof; name this event ‘g0488’.

;;;;;;; |- "(<X> in [(CONS X Y)])".

Theorem: isin-graph-trans-proof-proves ((x-bar = ncode (x)) ∧ subset (list (p (1, 2), fn (0, 0), fn (1, 2), fn (2, 2), fn (3, 1)), symbols)) → proves (isin-graph-trans-proof (x, y),

isin (x-bar, graph-trans (cons (x, y))),

given, defns, symbols)

;;;;;;; If |- "((a = <X>) -> B)", and |- "((a in [Y]) -> B)", then |- "((a in [CONS X Y]) -> B)".
;;;;;;;This lemma is really important because we prove that every member of the
;;;;;;;partial graph satisfies the specification, by induction on the list from which
;;;;;;;the graph is constructed.  This lemma permits the case-split required to carry
;;;;;;;out such an induction.  This will be clarified later.

Theorem: graph-trans-merge (subset (list (p (1, 2), fn (0, 0), fn (1, 2), fn (2, 2), fn (3, 1)), symbols) ∧ termp (exp1 , 0, symbols) ∧ formula (exp2 , symbols) ∧ proves (pf1 ,

f-implies (f-equal (exp1 , ncode (x)), exp2 ), given, defns, symbols)

∧ proves (pf2 , f-implies (isin (exp1 , graph-trans (y)), exp2 ), given, defns, symbols))

→ proves (graph-trans-merge-proof (x, y, exp1 , exp2 , pf1 , pf2 ), f-implies (isin (exp1 , graph-trans (cons (x, y))), exp2 ), given, defns, symbols)

Event: Enable isin-graph-trans-proof; name this event ‘g0490’.

Event: Enable graph-trans-merge-proof; name this event ‘g0491’.

Theorem: nlistp-graph-trans (x ≃ nil) → (graph-trans (x) = phi)

Theorem: collect-free-graph-trans collect-free (graph-trans (x), 0) = nil

Event: Enable graph-trans; name this event ‘g0459’.

Definition: in-graph-step-proof (exp, x, y, pf ) = f-iff-mp-proof2 (isin (exp, graph-trans (cons (x, y))),

f-or (f-equal (exp, ncode (x)), isin (exp, graph-trans (y))), in-graph-trans-proof (exp, x, y), expan-proof (f-equal (exp, ncode (x)),

isin (exp, graph-trans (y)), pf ))

;;;;;;; If |- "(exp in [Y])", then |- "(exp in [(CONS X Y)])".

Theorem: in-graph-step-proof-proves (subset (list (p (1, 2), fn (0, 0), fn (1, 2), fn (2, 2), fn (3, 1)), symbols) ∧ termp (exp, 0, symbols) ∧ proves (pf , isin (exp, graph-trans (y)), given, defns, symbols) ∧ (trace = graph-trans (cons (x, y)))) → proves (in-graph-step-proof (exp, x, y, pf ),

isin (exp, trace), given, defns, symbols)

Event: Enable in-graph-step-proof; name this event ‘g0837’.

;;;;;;;Z-LIST converts a list of the form (X1. (... (Xn . NIL))) to <<X1>, ..., <Xn>>.

Definition: z-list (exp) = if listp (exp)

then if listp (cdr (exp)) then z-opair (car (exp), z-list (cdr (exp)))

else car (exp) endif else nil endif

Theorem: termp-z-list ((fn (1, 2) ∈ symbols) ∧ listp (list) ∧ termp (list, 1, symbols)) → termp (z-list (list), 0, symbols)

Definition: z-list-equal-proof (list1 , list2 , pf ) = if listp (list1 ) ∧ listp (list2 )

then if listp (cdr (list1 )) ∧ listp (cdr (list2 ))

then and-join-proof (f-equal (car (list1 ), car (list2 )),

list-f-and (list-f-equal (cdr (list1 ),

cdr (list2 ))),

detach-proof (f-equal (z-list (list1 ),

z-list (list2 )), f-equal (car (list1 ), car (list2 )), pf , z-car-unique-proof (car (list1 ),

z-list (cdr (list1 )), car (list2 ), z-list (cdr (list2 )))),

z-list-equal-proof (cdr (list1 ), cdr (list2 ), detach-proof (f-equal (z-list (list1 ),

z-list (list2 )), f-equal (z-list (cdr (list1 )),

z-list (cdr (list2 ))), pf , z-cdr-unique-proof (car (list1 ),

z-list (cdr (list1 )), car (list2 ), z-list (cdr (list2 ))))))

else pf endif else nil endif

Definition: len-equal (x, y) = if listp (x) ∧ listp (y) then len-equal (cdr (x), cdr (y))

else (x ≃ nil) ∧ (y ≃ nil) endif

Theorem: z-list-equal-proof-proves (subset (list (p (1, 2), fn (1, 2)), symbols) ∧ termp (list1 , 1, symbols) ∧ termp (list2 , 1, symbols) ∧ listp (list1 ) ∧ listp (list2 ) ∧ len-equal (list1 , list2 ) ∧ proves (pf , f-equal (z-list (list1 ), z-list (list2 )), given, defns, symbols)) → proves (z-list-equal-proof (list1 , list2 , pf ),

list-f-and (list-f-equal (list1 , list2 )), Event: Enable z-list-equal-proof; name this event ‘g0838’.

;;;;;;;PROVES-FORM-Z-IF-OK is similar to PROVES-Z-IF except that in the base case,
;;;;;;;it merely checks if PFTREE is a proof of EXP.

Definition: proves-form-z-if-ok (pftree, exp, given, defns, symbols) = if z-ifp (exp)

then if caar (pftree)

then proves (cadar (pftree), z-test (exp), given, defns, symbols)

∧ proves-form-z-if-ok (cadr (pftree), z-left (exp), given, defns, symbols)

else proves (caddar (pftree), f-not (z-test (exp)), given, defns, symbols)

∧ proves-form-z-if-ok (caddr (pftree), z-right (exp), given, defns, symbols) endif

else proves (pftree, exp, given, defns, symbols) endif

Definition: form-z-if-ok-proof (pftree, exp) = if z-ifp (exp)

then if caar (pftree)

then f-if-intro-proof1 (z-test (exp), make-form-z-if (z-left (exp)), make-form-z-if (z-right (exp)), cadar (pftree), form-z-if-ok-proof (cadr (pftree),

z-left (exp)))

else f-if-intro-proof2 (z-test (exp), make-form-z-if (z-left (exp)), make-form-z-if (z-right (exp)), caddar (pftree), form-z-if-ok-proof (caddr (pftree),

z-right (exp))) endif

else pftree endif

;;;;;;;From a proof-tree containing proofs of each of the test nodes of an form-if-tree
;;;;;;;and the leaf node that they lead upto, we can construct a proof of the entire
;;;;;;;if-expression represented by the form-if-tree.

Theorem: form-z-if-ok-proof-proves (form-z-if (exp, symbols) ∧ proves-form-z-if-ok (pftree, exp, given, defns, symbols) ∧ (concl = make-form-z-if (exp))) → proves (form-z-if-ok-proof (pftree, exp), concl, given, defns, symbols)

Event: Enable form-z-if-ok-proof; name this event ‘g0839’.

Definition: equal-z-list-proof (x, y, pflist) = if listp (x) ∧ listp (y)

then if listp (cdr (x)) ∧ listp (cdr (y))

then list-detach-proof (list (f-equal (car (x), car (y)),

f-equal (z-list (cdr (x)),

z-list (cdr (y)))),

f-equal (z-list (x), z-list (y)), list (car (pflist),

equal-z-list-proof (cdr (x), cdr (y), cdr (pflist))),

opair-equal-proof (car (x), z-list (cdr (x)), car (y), z-list (cdr (y))))

else car (pflist) endif else nil endif

Theorem: equal-z-list-proof-proves ((fn (1, 2) ∈ symbols) ∧ termp (x, 1, symbols) ∧ termp (y, 1, symbols) ∧ listp (x) ∧ listp (y) ∧ len-equal (x, y) ∧ proves-list (pflist, list-f-equal (x, y), given, defns, symbols))

→ proves (equal-z-list-proof (x, y, pflist), f-equal (z-list (x), z-list (y)), given, defns, symbols)

Event: Enable equal-z-list-proof; name this event ‘g0842’.

Theorem: equal-z-list-proof-proves1 ((fn (1, 2) ∈ symbols) ∧ termp (x, 1, symbols) ∧ termp (y, 1, symbols) ∧ listp (x) ∧ listp (y) ∧ len-equal (x, y) ∧ proves-list (pflist, list-f-equal (x, y), given, defns, symbols) ∧ (concl = f-equal (z-list (x), z-list (y)))) → proves (equal-z-list-proof (x, y, pflist), concl, given, defns, symbols)

Event: Enable equal-z-list-proof-proves; name this event ‘g0843’.

Theorem: nlistp-ncode (x ≃ nil) → (ncode (x) = numeral (x))

Definition: flip-not-equals-proof (x, y, pf ) = detach-proof (f-not (f-equal (x, y)),

f-not (f-equal (y, x)),

pf ,

contra-pos-proof1 (f-equal (y, x), f-equal (x, y), symmetry-proof1 (y, x)))

Theorem: term-list-var-list var-list (vars, length (vars)) → term-list (vars, symbols)

Definition: form-equal-case-proof (vars, terms, exp, pf ) = tautconseq-proof (list (parallel-subst (exp, vars, terms, 0),

f-implies (list-f-and (list-f-equal (vars, terms)),

f-iff (exp,

parallel-subst (exp, vars, terms,

0)))),

f-implies (list-f-and (list-f-equal (vars, terms)), exp), list (pf ,

form-equal-proof (exp,

parallel-subst (exp, vars, terms, 0), list-f-equal (vars, terms))))

Theorem: term-list-termp term-list (terms, symbols) → termp (terms, 1, symbols)

;;;;;;;If |- "[a1/x1, ..., an/xn]A", then |- "(((x1=a1) ^... ^(xn=an)) -> A)".

Theorem: form-equal-case-proof-proves (formula (exp, symbols) ∧ proves (pf , parallel-subst (exp, vars, terms, 0), given, defns, symbols) ∧ var-list (vars, length (vars)) ∧ term-list (terms, symbols) ∧ listp (list-f-equal (vars, terms)) ∧ (collect-free (terms, 1) = nil) ∧ (concl = f-implies (list-f-and (list-f-equal (vars, terms)), exp))) → proves (form-equal-case-proof (vars, terms, exp, pf ),

concl, given, defns, symbols)

Event: Enable form-equal-case-proof; name this event ‘g0931’.

Definition: z-list-equal-imp-proof (x, y) = if listp (x) ∧ listp (y)

then if listp (cdr (x)) ∧ listp (cdr (y))

then tautconseq-proof (list (f-implies (f-equal (z-list (x), z-list (y)),

f-equal (car (x), car (y))),

f-implies (f-equal (z-list (x), z-list (y)),

list-f-and (list-f-equal (cdr (x),

cdr (y))))),

f-implies (f-equal (z-list (x), z-list (y)),

list-f-and (list-f-equal (x, y))),

list (z-car-unique-proof (car (x), z-list (cdr (x)), car (y), z-list (cdr (y))),

chain-proof (f-equal (z-list (x),

z-list (y)), list-f-and (list-f-equal (cdr (x),

cdr (y))),

list (f-equal (z-list (cdr (x)),

z-list (cdr (y)))),

list (z-cdr-unique-proof (car (x), z-list (cdr (x)), car (y), z-list (cdr (y))),

z-list-equal-imp-proof (cdr (x),

cdr (y))))))

else tautconseq-proof (nil,

f-implies (f-equal (car (x), car (y)),

f-equal (car (x), car (y))),

nil) endif

else nil endif

Theorem: termp-car-cdr (listp (x) ∧ termp (x, 1, symbols)) → (termp (car (x), 0, symbols) ∧ termp (cdr (x), 1, symbols))

Theorem: z-list-equal-imp-proof-proves (subset (list (p (1, 2), fn (1, 2)), symbols) ∧ termp (list1 , 1, symbols) ∧ termp (list2 , 1, symbols) ∧ listp (list1 ) ∧ listp (list2 ) ∧ len-equal (list1 , list2 )) → proves (z-list-equal-imp-proof (list1 , list2 ),

f-implies (f-equal (z-list (list1 ), z-list (list2 )),

list-f-and (list-f-equal (list1 , list2 ))),

given, defns, symbols)

Event: Enable z-list-equal-imp-proof; name this event ‘g0845’.

Theorem: z-list-equal-imp-proof-proves1 (subset (list (p (1, 2), fn (1, 2)), symbols) ∧ termp (list1 , 1, symbols) ∧ termp (list2 , 1, symbols)

∧ listp (list1 ) ∧ listp (list2 ) ∧ len-equal (list1 , list2 ) ∧ (concl = f-implies (f-equal (z-list (list1 ), z-list (list2 )),

list-f-and (list-f-equal (list1 , list2 )))))

→ proves (z-list-equal-imp-proof (list1 , list2 ), concl, given, defns, symbols)

Event: Enable z-list-equal-imp-proof-proves; name this event ‘g0846’.

Definition: equal-isin-proof (x, y, z, pf1 , pf2 ) = list-detach-proof (list (f-equal (x, y), f-equal (z, z), isin (x, z)),

isin (y, z),

list (pf1 , ident-axiom-proof (z), pf2 ),

equal-axiom2-proof (p (1, 2), list (x, z), list (y, z)))

;;;;;;;If |- "(x = y)", and |- "(x in z)", then |- "(y in z)".

Theorem: equal-isin-proof-proves (proves (pf1 , f-equal (x, y), given, defns, symbols) ∧ proves (pf2 , isin (x, z), given, defns, symbols)) → proves (equal-isin-proof (x, y, z, pf1 , pf2 ), isin (y, z), given, defns, symbols)

;;;;;;;As it turns out, in order to represent the Lisp interpreter in Z2, we only need
;;;;;;;represent two recursive functions, the function GET below, and the Lisp interpreter
;;;;;;;EV itself.  The Lisp interpreter is a Lisp function which evaluates quoted
;;;;;;;Lisp objects which represent pure-Lisp expressions.  These e-expressions are
;;;;;;;either e-variables (represented by numbers) or e-function symbols (also represented
;;;;;;;by numbers) applied to a list of e-expressions.  The interpreter takes as
;;;;;;;its arguments: the e-expression to be evaluated, the bindings of values to the
;;;;;;;e-variables, and the bindings of definitions to the defined e-function symbols.
;;;;;;;Since e-variables are numbers, their bindings are stored in a list so that the
;;;;;;;binding of the variable N is the N+1th element in the list.  GET does exactly
;;;;;;;this by returning the X+1th element in the list Y.

Definition: get (x, y) = if x ≃ 0 then car (y)

else get (x − 1, cdr (y)) endif

;;;;;;;We said earlier that the partial graph corresponding to a computation is first
;;;;;;;constructed as a list of value/argument pairs which is then translated into the
;;;;;;;corresponding set.  GET-GRAPH constructs this list of value/argument pairs
;;;;;;;corresponding to the computation of (GET X Y).

Definition: get-graph (x, y) = if x ≃ 0 then list (cons (get (x, y), cons (x, y)))

else cons (cons (get (x, y), cons (x, y)), get-graph (x − 1, cdr (y))) endif

Theorem: member-get-graph cons (get (x, y), cons (x, y)) ∈ get-graph (x, y)

Theorem: in-graph-cdr-get-graph (x ≄ 0) → (cons (get (x, y), cons (x − 1, cdr (y))) ∈ get-graph (x, y))

Definition: a-get-defn-part-ok-proof1 (x, y) = form-z-if-ok-proof (list (list (x ≃ 0,

z-zerop-ncode-proof (x),

trans-not-equal-proof (ncode (1), z-zerop (ncode (x)), ncode (0), ncode-nequal-proof (1,

0),

z-zerop-ncode-proof (x))),

flip-equals-proof (z-car (ncode (y)), ncode (get (x, y)), z-car-ncode-proof (y)),

equal-isin-proof (z-list (list (ncode (get (x, y)), ncode (x − 1), ncode (cdr (y)))),

z-list (list (ncode (get (x, y)), z-sub1 (ncode (x)), z-cdr (ncode (y)))),

graph-trans (get-graph (x, y)),

equal-z-list-proof (list (ncode (get (x,

y)),

ncode (x − 1), ncode (cdr (y))),

list (ncode (get (x,

y)),

z-sub1 (ncode (x)), z-cdr (ncode (y))),

list (ident-axiom-proof (ncode (get (x,

y))),

flip-equals-proof (z-sub1 (ncode (x)), ncode (x − 1), z-sub1-ncode-proof (x)),

flip-equals-proof (z-cdr (ncode (y)), ncode (cdr (y)), z-cdr-ncode-proof (y)))),

in-graph-proof (cons (get (x, y),

cons (x − 1,

cdr (y))),

get-graph (x, y)))),

z-if (f-equal (z-zerop (ncode (x)), ncode (1)), f-equal (ncode (get (x, y)), z-car (ncode (y))), isin (z-opair (ncode (get (x, y)),

z-opair (z-sub1 (ncode (x)),

z-cdr (ncode (y)))),

graph-trans (get-graph (x, y)))))

;;;;;;;At this point we present the Z2 formula which represents the Lisp function GET.
;;;;;;;The formula representing the assertion (GET X Y) = VAL asserts the existence
;;;;;;;of a partial graph "trace" to which the tuple <<VAL>, <X>, <Y>> belongs, such
;;;;;;;that all of its members satisfy the Z2 analogue of the definition of GET.
;;;;;;;More formally,
;;;;;;;     "(forsome trace ((<val, x, y> in trace)
;;;;;;;                      ^
;;;;;;;                      (forall v1, x1, y1
;;;;;;;                        ((<v1, x1, y1> in trace)
;;;;;;;                         ->
;;;;;;;                         (if ((Z-zerop x1) = <1>)
;;;;;;;                          then (v1 = (Z-car y1))
;;;;;;;                          else (<v1, (Z-sub1 x1), (Z-cdr y1)> in trace))))))".
;;;;;;;
;;;;;;;Notice how in the second part where we specify that each 3-tuple "<v1,x1,y1>"
;;;;;;;in "trace" satisfies the Z2 analogue of the definition of GET, the analogue of
;;;;;;;the recursive call (GET (SUB1 X)(CDR Y)) is the membership check
;;;;;;;"(<v1, (Z-sub1 x1), (Z-cdr y1)> in trace)".  A-GET-DEFN-PART below constructs
;;;;;;;the definition (second) part of the above formula.

Definition: a-get-defn-part (x, y, val, trace) = f-if (f-equal (z-zerop (x), ncode (1)),

f-equal (val, z-car (y)),

isin (z-list (list (val, z-sub1 (x), z-cdr (y))), trace))

;;;;;;;Next we wish to show that the partial graph given by (GET-GRAPH X Y)
;;;;;;;satisfies the formula above.  By this we show that the representing formula
;;;;;;;is `OK'.  This is done in many steps.  One part
;;;;;;;of this is to show that each element of this partial graph satisfies the
;;;;;;;A-GET-DEFN-PART.  This will be done by induction.  The first part is
;;;;;;;to show that "<<(GET X Y)>, <X>, <Y>>" satisfies the definition part

;;;;;;;with (GRAPH-TRANS (GET-GRAPH X Y)) for "trace".  This is carried out below.

Theorem: a-get-defn-part-ok-proof1-proves (subset (list (fn (10, 1),

fn (9, 1), fn (5, 1), fn (4, 1), fn (3, 1), fn (2, 2), fn (1, 2), p (1, 2), p (2, 1), fn (0, 0)),

symbols) ∧ z-succ-hyps (defns, symbols) ∧ z-sub1-hyps (defns, symbols) ∧ z-car-hyps (defns, symbols) ∧ z-cdr-hyps (defns, symbols) ∧ z-zerop-hyps (defns, symbols) ∧ z-int-hyps (defns, symbols) ∧ (concl = a-get-defn-part (ncode (x),

ncode (y),

ncode (get (x, y)),

graph-trans (get-graph (x, y)))))

→ proves (a-get-defn-part-ok-proof1 (x, y), concl, given, defns, symbols)

Event: Enable a-get-defn-part-ok-proof1; name this event ‘g0847’.

Definition: in-graph-cdr-proof (x, y, graph) = tautconseq-proof (list (f-implies (f-or (f-equal (x, ncode (y)),

isin (x, graph-trans (graph))), isin (x, graph-trans (cons (y, graph))))),

f-implies (isin (x, graph-trans (graph)),

isin (x, graph-trans (cons (y, graph)))),

list (iff-split-proof2 (isin (x,

graph-trans (cons (y, graph))), f-or (f-equal (x, ncode (y)),

isin (x, graph-trans (graph))), in-graph-trans-proof (x, y, graph))))

;;;;;;; |- "((x in [GRAPH]) -> (x in [(CONS Y GRAPH)]))".

Theorem: in-graph-cdr-proof-proves (subset (list (p (1, 2), fn (3, 1), fn (2, 2), fn (1, 2), fn (0, 0)), symbols) ∧ termp (x, 0, symbols)) → proves (in-graph-cdr-proof (x, y, graph),

f-implies (isin (x, graph-trans (graph)),

isin (x, graph-trans (cons (y, graph)))),

given, defns, symbols)

Event: Enable in-graph-cdr-proof; name this event ‘g0850’.

Definition: a-get-defn-part-step-proof (y, u, v, v1 , pf ) = tautconseq-proof (list (f-implies (v, v1 )),

f-implies (f-if (y, u, v), f-if (y, u, v1 )), list (pf ))

;;;;;;;If |- "(C -> C1)", then |- "((if A then B else C) -> (if A then B else C1))".

Theorem: a-get-defn-part-step-proof-proves (formula (f-if (y, u, v), symbols) ∧ formula (v1 , symbols) ∧ proves (pf , f-implies (v, v1 ), given, defns, symbols)) → proves (a-get-defn-part-step-proof (y, u, v, v1 , pf ),

f-implies (f-if (y, u, v), f-if (y, u, v1 )), given, defns, symbols)

Event: Enable a-get-defn-part-step-proof; name this event ‘g0851’.

Definition: inst-formals-proof (formals, actuals, exp, pf ) = chain-proof (f-equal (z-list (formals), z-list (actuals)),

exp,

list (list-f-and (list-f-equal (formals, actuals))), list (z-list-equal-imp-proof (formals, actuals),

form-equal-case-proof (formals, actuals, exp, pf )))

Definition: a-get-defn-ok-proof (x1 , y1 , val1 , x, y) = if x ≃ 0

then graph-trans-merge-proof (cons (get (x, y), cons (x, y)), nil, z-list (list (val1 , x1 , y1 )), a-get-defn-part (x1 ,

y1 , val1 , graph-trans (get-graph (x,

y))),

inst-formals-proof (list (val1 , x1 , y1 ),

list (ncode (get (x, y)), ncode (x), ncode (y)), a-get-defn-part (x1 ,

y1 , val1 , graph-trans (get-graph (x,

y))),

a-get-defn-part-ok-proof1 (x,

y)),

tautconseq-proof (list (f-not (isin (z-list (list (val1 , x1 , y1 )),

phi))),

f-implies (isin (z-list (list (val1 , x1 , y1 )),

phi), a-get-defn-part (x1 ,

y1 , val1 , graph-trans (get-graph (x,

y)))),

list (null-axiom-proof (z-list (list (val1 , x1 , y1 ))))))

else graph-trans-merge-proof (cons (get (x, y), cons (x, y)), get-graph (x − 1, cdr (y)), z-list (list (val1 , x1 , y1 )), a-get-defn-part (x1 ,

y1 , val1 , graph-trans (get-graph (x,

y))),

inst-formals-proof (list (val1 , x1 , y1 ),

list (ncode (get (x, y)), ncode (x), ncode (y)),

a-get-defn-part (x1 , y1 , val1 , graph-trans (get-graph (x,

y))),

a-get-defn-part-ok-proof1 (x,

y)),

chain-proof (isin (z-list (list (val1 , x1 , y1 )),

graph-trans (get-graph (x − 1,

cdr (y)))),

a-get-defn-part (x1 , y1 , val1 , graph-trans (get-graph (x,

y))),

list (a-get-defn-part (x1 , y1 , val1 , graph-trans (get-graph (x − 1,

cdr (y))))),

list (a-get-defn-ok-proof (x1 , y1 , val1 , x − 1, cdr (y)),

a-get-defn-part-step-proof (f-equal (z-zerop (x1 ),

ncode (1)), f-equal (val1 ,

z-car (y1 )), isin (z-list (list (val1 ,

z-sub1 (x1 ), z-cdr (y1 ))), graph-trans (get-graph (x − 1,

cdr (y)))),

isin (z-list (list (val1 , z-sub1 (x1 ), z-cdr (y1 ))),

graph-trans (get-graph (x,

y))),

in-graph-cdr-proof (z-list (list (val1 , z-sub1 (x1 ), z-cdr (y1 ))),

cons (get (x,

y), cons (x,

y)),

get-graph (x − 1, cdr (y))))))) endif

;;;;;;;In the lemma below, we carry out the induction to prove that every element of
;;;;;;;the partial graph satisfies the analogue of the definition of GET, i.e.,
;;;;;;; |- "((<v1,x1,y1> in [(GET-GRAPH X Y)]) -> (A-GET-DEFN-PART x1 y1 v1 [(GET-GRAPH X Y)]))".

Theorem: a-get-defn-ok-proof-proves (subset (list (fn (10, 1),

fn (9, 1), fn (5, 1), fn (4, 1), fn (3, 1), fn (2, 2), fn (1, 2), p (1, 2), p (2, 1), fn (0, 0)),

symbols) ∧ z-succ-hyps (defns, symbols) ∧ z-sub1-hyps (defns, symbols) ∧ z-zerop-hyps (defns, symbols) ∧ z-car-hyps (defns, symbols) ∧ z-cdr-hyps (defns, symbols) ∧ z-int-hyps (defns, symbols) ∧ var-set (list (val1 , x1 , y1 ), 3)) → proves (a-get-defn-ok-proof (x1 , y1 , val1 , x, y),

f-implies (isin (z-list (list (val1 , x1 , y1 )),

graph-trans (get-graph (x, y))), a-get-defn-part (x1 ,

y1 , val1 , graph-trans (get-graph (x, y)))),

given, defns, symbols)

Event: Enable a-get-defn-ok-proof; name this event ‘g0852’.

Definition: list-gen-proof (vars, exp, pf ) = if listp (vars)

then generalise-proof (car (vars), list-all-quantify (cdr (vars), exp), list-gen-proof (cdr (vars), exp, pf ))

else pf endif

Theorem: list-gen-proof-proves (var-list (vars, length (vars)) ∧ proves (pf , exp, given, defns, symbols)) → proves (list-gen-proof (vars, exp, pf ),

list-all-quantify (vars, exp), given, defns, symbols)

Event: Enable list-gen-proof; name this event ‘g0853’.

Event: Enable a-get-defn-part; name this event ‘g0854’.

;;;;;;;A-GET combines the first and second parts of the specification of "trace".

Definition: a-get (x, y, val, x1 , y1 , val1 , trace) = f-and (isin (z-opair (val, z-opair (x, y)), trace),

list-all-quantify (list (x1 , y1 , val1 ),

f-implies (isin (z-list (list (val1 , x1 , y1 )), trace), a-get-defn-part (x1 , y1 , val1 , trace))))

Definition: a-get-ok-proof1 (x, y, x1 , y1 , val1 ) = and-join-proof (isin (ncode (cons (get (x, y), cons (x, y))),

graph-trans (get-graph (x, y))), list-all-quantify (list (x1 , y1 , val1 ),

f-implies (isin (z-list (list (val1 , x1 , y1 )), graph-trans (get-graph (x,

y))),

a-get-defn-part (x1 , y1 , val1 , graph-trans (get-graph (x,

y))))), in-graph-proof (cons (get (x, y), cons (x, y)), get-graph (x, y)), list-gen-proof (list (x1 , y1 , val1 ),

f-implies (isin (z-list (list (val1 , x1 , y1 )),

graph-trans (get-graph (x,

y))),

a-get-defn-part (x1 , y1 , val1 , graph-trans (get-graph (x,

y)))),

a-get-defn-ok-proof (x1 , y1 , val1 , x, y)))

;;;;;;;Finally we show that
;;;;;;;|- "[<X>/x, <Y>/y, <(GET X Y)>/val, [(GET-GRAPH X Y)]/trace]A-get".
;;;;;;;This completes the first part of the representability proof for GET.
;;;;;;;The second part involves showing that any "trace" satisfying the
;;;;;;;specification A-GET must encode only evaluations of GET.  By this we
;;;;;;;show that the representing formula is `GOOD'.

Theorem: a-get-ok-proof-proves (subset (list (fn (10, 1),

fn (9, 1), fn (5, 1), fn (4, 1), fn (3, 1), fn (2, 2), fn (1, 2), p (1, 2), p (2, 1), fn (0, 0)),

symbols) ∧ z-succ-hyps (defns, symbols) ∧ z-zerop-hyps (defns, symbols) ∧ z-sub1-hyps (defns, symbols) ∧ z-car-hyps (defns, symbols) ∧ z-cdr-hyps (defns, symbols) ∧ z-int-hyps (defns, symbols) ∧ var-set (list (val1 , x1 , y1 ), 3) ∧ (x-bar = ncode (x)) ∧ (y-bar = ncode (y)) ∧ (val-bar = ncode (get (x, y))) ∧ (trace = graph-trans (get-graph (x, y)))) → proves (a-get-ok-proof1 (x, y, x1 , y1 , val1 ),

a-get (x-bar, y-bar, val-bar, x1 , y1 , val1 , trace), Event: Enable a-get-ok-proof1; name this event ‘g0856’.

Event: Disable a-get-defn-part; name this event ‘g0857’.

Definition: equal-isin-imp-proof (x, y, z, pf ) = list-detach-proof (list (f-equal (x, y), f-equal (z, z)),

f-implies (isin (x, z), isin (y, z)), list (pf , ident-axiom-proof (z)), equal-axiom2-proof (p (1, 2), list (x, z), list (y, z)))

Theorem: form-z-if-eval-proof-proves-again (form-z-if (exp, symbols) ∧ termp (list (lhs, val), 1, symbols) ∧ proves-form-z-if-eval (pf-tree, exp, lhs, val, given, defns, symbols) ∧ (form = make-form-z-if (exp))) → proves (form-z-if-eval-proof (pf-tree, exp, lhs, val),

f-implies (form, f-equal (lhs, val)), given, defns, symbols)

Event: Enable form-z-if-eval-proof-proves; name this event ‘g0858’.

;;;;;;;PROVES-REC-FORM-Z-IF-EVAL is similar to PROVES-Z-IF, except that
;;;;;;;in the base case it checks if PF-TREE is a proof of "(EXP -> CONCL)".

Definition: proves-rec-form-z-if-eval (pf-tree, exp, concl, given, defns, symbols) = if z-ifp (exp)

then if caar (pf-tree)

then proves (cadar (pf-tree), z-test (exp), given, defns, symbols)

∧ proves-rec-form-z-if-eval (cadr (pf-tree), z-left (exp), concl, given, defns, symbols)

else proves (caddar (pf-tree), f-not (z-test (exp)), given, defns, symbols)

∧ proves-rec-form-z-if-eval (caddr (pf-tree), z-right (exp), concl, given, defns, symbols) endif

else proves (pf-tree, f-implies (exp, concl), given, defns, symbols) endif

Definition: rec-form-z-if-eval-proof (pf-tree, exp, concl) = if z-ifp (exp)

then if caar (pf-tree)

then chain-proof (make-form-z-if (exp), concl, list (make-form-z-if (z-left (exp))), list (f-if-elim-proof1 (z-test (exp),

make-form-z-if (z-left (exp)), make-form-z-if (z-right (exp)), cadar (pf-tree)),

rec-form-z-if-eval-proof (cadr (pf-tree), z-left (exp), concl)))

else chain-proof (make-form-z-if (exp), concl, list (make-form-z-if (z-right (exp))), list (f-if-elim-proof2 (z-test (exp),

make-form-z-if (z-left (exp)), make-form-z-if (z-right (exp)), caddar (pf-tree)),

rec-form-z-if-eval-proof (caddr (pf-tree), z-right (exp), concl))) endif

else pf-tree endif

;;;;;;;The lemma below proves that if each of the leaf nodes of an form-if-tree
;;;;;;;implies a certain conclusion CONCL, then the if-expression represented by
;;;;;;;the if-tree implies CONCL.

Theorem: rec-form-z-if-eval-proof-proves (form-z-if (exp, symbols) ∧ proves-rec-form-z-if-eval (pf-tree, exp, concl, given, defns, symbols))

→ proves (rec-form-z-if-eval-proof (pf-tree, exp, concl), f-implies (make-form-z-if (exp), concl), given, defns, symbols)

Event: Enable rec-form-z-if-eval-proof; name this event ‘g0743’.

Theorem: rec-form-z-if-eval-proof-proves-again (form-z-if (exp, symbols) ∧ proves-rec-form-z-if-eval (pf-tree, exp, concl, given, defns, symbols) ∧ (form = make-form-z-if (exp))) → proves (rec-form-z-if-eval-proof (pf-tree, exp, concl),

f-implies (form, concl), given, defns, symbols)

Event: Enable rec-form-z-if-eval-proof-proves; name this event ‘g0745’.

Theorem: termp-if termp (if x then y

else z endif, flg, symbols)

= if x then termp (y, flg, symbols)

else termp (z, flg, symbols) endif

Definition: a-get-defn-part-good-proof1 (x, y, val, trace, exp, pf ) = rec-form-z-if-eval-proof (list (list (x ≃ 0,

z-zerop-ncode-proof (x),

trans-not-equal-proof (ncode (1), z-zerop (ncode (x)), ncode (0), ncode-nequal-proof (1,

0),

z-zerop-ncode-proof (x))),

trans-implies-proof (f-equal (val,

z-car (ncode (y))), f-equal (val,

ncode (car (y))), f-implies (exp,

f-equal (val,

ncode (car (y)))),

list-detach-proof (list (f-equal (val,

val), f-equal (z-car (ncode (y)),

ncode (car (y)))),

f-implies (f-equal (val,

z-car (ncode (y))), f-equal (val,

ncode (car (y)))),

list (ident-axiom-proof (val), z-car-ncode-proof (y)),

equal-axiom2-proof (p (0,

2), list (val,

z-car (ncode (y))), list (val,

ncode (car (y))))),

tautconseq-proof (nil,

f-implies (f-equal (val,

ncode (car (y))), f-implies (exp,

f-equal (val,

ncode (car (y))))),

nil)),

trans-implies-proof (isin (z-list (list (val, z-sub1 (ncode (x)), z-cdr (ncode (y)))),

trace), isin (z-list (list (val,

ncode (x − 1), ncode (cdr (y)))),

trace), f-implies (exp,

f-equal (val,

ncode (get (x,

y)))),

equal-isin-imp-proof (z-list (list (val, z-sub1 (ncode (x)), z-cdr (ncode (y)))),

z-list (list (val, ncode (x − 1), ncode (cdr (y)))),

trace,

equal-z-list-proof (list (val, z-sub1 (ncode (x)), z-cdr (ncode (y))),

list (val, ncode (x − 1), ncode (cdr (y))), list (ident-axiom-proof (val), z-sub1-ncode-proof (x), z-cdr-ncode-proof (y)))),

pf )),

z-if (f-equal (z-zerop (ncode (x)), ncode (1)), f-equal (val, z-car (ncode (y))), isin (z-opair (val,

z-opair (z-sub1 (ncode (x)),

z-cdr (ncode (y)))),

trace)), f-implies (exp, f-equal (val, ncode (get (x, y)))))

;;;;;;;The second part involves showing that A-GET is `GOOD', i.e., that
;;;;;;;any "trace" satisfying A-GET encodes a computation of GET.
;;;;;;;The proof is somewhat tricky but the essential idea is this:
;;;;;;;we want to prove "A-get(<X>, <Y>, val, trace) -> (val = <(GET X Y)>)".
;;;;;;;We start with the left-hand side of this implication, it implies that
;;;;;;; "(<<X>, <Y>, val> in trace)" and hence by the second part of "A-get"
;;;;;;;that "<<X>, <Y>, val>" satisfies the analogue of the definition of GET.
;;;;;;;If (ZEROP X), then "((Z-zerop <X>) = <1>)" and hence "(val = (Z-car <Y>))"
;;;;;;;which by the lemma about "Z-car" is "(val = <(CAR Y)>)" which is the
;;;;;;;desired conclusion.  In the case when (ZEROP X) is F, we have
;;;;;;;"(A-get(<X>, <Y>, val, trace) -> (<val, (Z-sub1 <X>), (Z-cdr <Y>)> in trace))"
;;;;;;;(call it [1]), the r.h.s. of which is "(<val, <(SUB1 X)>, <(CDR Y)>> in trace)"
;;;;;;;By the induction hypothesis,
;;;;;;;"(A-get(<(SUB1 X)>, <(CDR Y)>, val, trace) -> (val = <(GET (SUB1 X)(CDR Y))>))" [2].
;;;;;;;But "A-get(<X>, <Y>, val, trace)" and  "(<val, <(SUB1 X)>, <(CDR Y)>> in trace)" imply
;;;;;;;"A-get(<(SUB1 X)>, <(CDR Y)>, val, trace)".  By [1], [2], and the definition of GET,
;;;;;;;we have the desired conclusion.  The lemma below is one portion of the argument
;;;;;;;above where we prove
;;;;;;; |- "(A-get-defn-part(<X>, <Y>, val, trace) -> (EXP -> (val = <(GET X Y)>)))",
;;;;;;;provided when (ZEROP X) is F,
;;;;;;; |- "((<val, <(SUB1 X)>, <(CDR Y)>> in trace) -> (EXP -> (val = <(GET X Y)>)))".
;;;;;;;

Theorem: a-get-defn-part-good-proof1-proves (subset (list (fn (10, 1),

fn (9, 1), fn (5, 1), fn (4, 1), fn (3, 1), fn (2, 2), fn (1, 2), p (1, 2), p (2, 1), fn (0, 0)),

symbols) ∧ z-succ-hyps (defns, symbols) ∧ z-zerop-hyps (defns, symbols) ∧ z-sub1-hyps (defns, symbols) ∧ z-car-hyps (defns, symbols) ∧ z-cdr-hyps (defns, symbols) ∧ z-int-hyps (defns, symbols) ∧ termp (val, 0, symbols) ∧ termp (trace, 0, symbols) ∧ formula (exp, symbols) ∧ (val-bar = ncode (get (x, y))) ∧ (form = a-get-defn-part (ncode (x), ncode (y), val, trace)) ∧ if x ≃ 0 then t

else proves (pf ,

f-implies (isin (z-list (list (val, ncode (x − 1), ncode (cdr (y)))),

trace), f-implies (exp, f-equal (val, val-bar))),

given, defns, symbols) endif)

→ proves (a-get-defn-part-good-proof1 (x, y, val, trace, exp, pf ), f-implies (form, f-implies (exp, f-equal (val, val-bar))), given, defns, symbols)

Event: Enable a-get-defn-part-good-proof1; name this event ‘g0615’.

Definition: good-frame1-proof (a, b, c) = tautconseq-proof (nil,

f-iff (f-implies (f-and (a, b), c),

f-implies (b, f-implies (a, c))), nil)

Theorem: good-frame1-proof-proves (formula (a, symbols) ∧ formula (b, symbols) ∧ formula (c, symbols)) → proves (good-frame1-proof (a, b, c),

f-iff (f-implies (f-and (a, b), c), f-implies (b, f-implies (a, c))), given, defns, symbols)

Event: Enable good-frame1-proof; name this event ‘g0746’.

Definition: a-get-reduc-proof (x, y, val, x1 , y1 , val1 , trace) = f-iff-mp-proof2 (f-implies (a-get (x, y, val, x1 , y1 , val1 , trace),

a-get-defn-part (x, y, val, trace)),

f-implies (list-all-quantify (list (x1 , y1 , val1 ),

f-implies (isin (z-list (list (val1 , x1 , y1 )),

trace), a-get-defn-part (x1 ,

y1 , val1 , trace))),

f-implies (isin (z-list (list (val, x, y)), trace),

a-get-defn-part (x, y, val, trace))),

good-frame1-proof (isin (z-list (list (val, x, y)), trace),

list-all-quantify (list (x1 , y1 , val1 ),

f-implies (isin (z-list (list (val1 , x1 , y1 )),

trace), a-get-defn-part (x1 ,

y1 , val1 , trace))),

a-get-defn-part (x, y, val, trace)),

subst-thm-b-proof (f-implies (isin (z-list (list (val1 , x1 , y1 )),

trace), a-get-defn-part (x1 ,

y1 , val1 , trace)), list (x1 , y1 , val1 ), list (x, y, val)))

;;;;;;; |- "(A-get(x, y, val, trace) -> A-get-defn-part(x, y, val, trace))".

Theorem: a-get-reduc-proof-proves (subset (list (fn (10, 1),

fn (9, 1), fn (5, 1), fn (4, 1), fn (3, 1), fn (2, 2), fn (1, 2), p (1, 2), p (2, 1), fn (0, 0)),

symbols) ∧ termp (x, 0, symbols) ∧ termp (y, 0, symbols) ∧ termp (val, 0, symbols) ∧ var-set (list (x1 , y1 , val1 , trace), 4) ∧ (concl = f-implies (a-get (x, y, val, x1 , y1 , val1 , trace),

a-get-defn-part (x, y, val, trace))))

→ proves (a-get-reduc-proof (x, y, val, x1 , y1 , val1 , trace), concl, given, defns, symbols)

Event: Enable a-get-reduc-proof; name this event ‘g0644’.

Definition: good-frame2-proof (a, b, c, d, pf1 , pf2 ) = tautconseq-proof (list (f-implies (f-and (a, b), c),

f-implies (c, f-implies (b, d))), f-implies (f-and (a, b), d), list (pf1 , pf2 ))

Theorem: good-frame2-proof-proves (formula (a, symbols) ∧ formula (b, symbols) ∧ formula (c, symbols) ∧ formula (d, symbols) ∧ proves (pf1 , f-implies (f-and (a, b), c), given, defns, symbols)

∧ proves (pf2 , f-implies (c, f-implies (b, d)), given, defns, symbols)) → proves (good-frame2-proof (a, b, c, d, pf1 , pf2 ),

f-implies (f-and (a, b), d), given, defns, symbols)

Event: Enable good-frame2-proof; name this event ‘g0747’.

Definition: good-frame3-proof (a, b, c, pf ) = tautconseq-proof (list (f-implies (f-and (a, b), c)),

f-implies (a, f-implies (b, c)), list (pf ))

Theorem: good-frame3-proof-proves proves (pf , f-implies (f-and (a, b), c), given, defns, symbols) → proves (good-frame3-proof (a, b, c, pf ),

f-implies (a, f-implies (b, c)), given, defns, symbols)

Event: Enable good-frame3-proof; name this event ‘g0748’.

Definition: a-get-good-proof (x, y, val, x1 , y1 , val1 , trace) = if x ≃ 0

then good-frame2-proof (isin (z-list (list (val, ncode (x), ncode (y))), trace),

list-all-quantify (list (x1 , y1 , val1 ),

f-implies (isin (z-list (list (val1 , x1 , y1 )),

trace), a-get-defn-part (x1 ,

y1 , val1 , trace))),

a-get-defn-part (ncode (x), ncode (y), val, trace), f-equal (val, ncode (get (x, y))), a-get-reduc-proof (ncode (x),

ncode (y), val, x1 , y1 , val1 , trace),

a-get-defn-part-good-proof1 (x, y, val, trace, list-all-quantify (list (x1 ,

y1 , val1 ),

f-implies (isin (z-list (list (val1 , x1 , y1 )),

trace), a-get-defn-part (x1 ,

y1 , val1 , trace))),

nil))

else good-frame2-proof (isin (z-list (list (val, ncode (x), ncode (y))),

trace), list-all-quantify (list (x1 , y1 , val1 ),

f-implies (isin (z-list (list (val1 , x1 , y1 )),

trace), a-get-defn-part (x1 ,

y1 , val1 , trace))),

a-get-defn-part (ncode (x), ncode (y), val, trace),

f-equal (val, ncode (get (x, y))), a-get-reduc-proof (ncode (x),

ncode (y), val, x1 , y1 , val1 , trace),

a-get-defn-part-good-proof1 (x, y, val, trace, list-all-quantify (list (x1 ,

y1 , val1 ),

f-implies (isin (z-list (list (val1 , x1 , y1 )),

trace), a-get-defn-part (x1 ,

y1 , val1 , trace))),

good-frame3-proof (isin (z-list (list (val, ncode (x − 1), ncode (cdr (y)))),

trace), list-all-quantify (list (x1 ,

y1 ,

val1 ), f-implies (isin (z-list (list (val1 ,

x1 , y1 )),

trace), a-get-defn-part (x1 ,

y1 , val1 , trace))),

f-equal (val,

ncode (get (x,

y))),

a-get-good-proof (x − 1, cdr (y), val, x1 , y1 , val1 , trace)))) endif

;;;;;;;The desired `GOOD' part:
;;;;;;; |- "(A-get(<X>, <Y>, val, trace) -> (val = <(GET X Y)>))".

Theorem: a-get-good-proof-proves (subset (list (fn (10, 1), fn (9, 1), fn (5, 1), fn (4, 1), fn (3, 1), fn (2, 2), fn (1, 2), p (1, 2), p (2, 1), fn (0, 0)),

symbols) ∧ z-succ-hyps (defns, symbols) ∧ z-zerop-hyps (defns, symbols) ∧ z-sub1-hyps (defns, symbols) ∧ z-car-hyps (defns, symbols) ∧ z-cdr-hyps (defns, symbols) ∧ z-int-hyps (defns, symbols) ∧ termp (val, 0, symbols) ∧ var-set (list (x1 , y1 , val1 , trace), 4)) → proves (a-get-good-proof (x, y, val, x1 , y1 , val1 , trace),

f-implies (a-get (ncode (x), ncode (y), val, x1 , y1 , val1 , trace),

f-equal (val, ncode (get (x, y)))),

given, defns, symbols)

Event: Enable a-get-good-proof; name this event ‘g0749’.

Event: Enable ncode; name this event ‘g0750’.

;;;;;;;SUBRP is a function used in the Lisp interpreter which checks if a given
;;;;;;;e-function symbol, i.e., a function symbol in an expression to be interpreted
;;;;;;;by the Lisp interpreter.  The events below introduce the Z2 analogue of this
;;;;;;;function.

Definition: z-subrp (fn) = list (fn (16, 1), fn)

Definition: z-subrp-defn (fn, y) = f-if (f-equal (fn, ncode (1)),

f-equal (y, ncode (1)), f-if (f-equal (fn, ncode (2)), f-equal (y, ncode (1)), f-if (f-equal (fn, ncode (3)), f-equal (y, ncode (1)), f-if (f-equal (fn, ncode (4)), f-equal (y, ncode (1)), f-if (f-equal (fn, ncode (5)), f-equal (y, ncode (1)), f-if (f-equal (fn, ncode (6)), f-equal (y, ncode (1)), f-if (f-equal (fn, ncode (7)), f-equal (y, ncode (1)), f-if (f-equal (fn, ncode (8)), f-equal (y, ncode (1)), f-if (f-equal (fn, ncode (9)), f-equal (y, ncode (1)), f-equal (y, phi))))))))))

Definition: z-subrp-expr (fn) = z-if (f-equal (fn, ncode (1)),

ncode (1),

z-if (f-equal (fn, ncode (2)), ncode (1), z-if (f-equal (fn, ncode (3)),

ncode (1),

z-if (f-equal (fn, ncode (4)), ncode (1), z-if (f-equal (fn, ncode (5)),

ncode (1),

z-if (f-equal (fn, ncode (6)), ncode (1), z-if (f-equal (fn, ncode (7)),

ncode (1),

z-if (f-equal (fn, ncode (8)), ncode (1), z-if (f-equal (fn, ncode (9)),

ncode (1), phi)))))))))

Definition: z-subrp-exis-proof (fn, y) = term-z-if-exis-proof (y, z-subrp-expr (fn))

Definition: z-subrp-unique-proof (fn, y, y1 ) = term-z-if-unique-proof (y, y1 , z-subrp-expr (fn))

Definition: z-subrp-defn-proof (fn)

= instance-proof (z-subrp-defn (0, z-subrp (0)), list (0), list (fn), fun-defn-proof (fn (16, 1),

list (0),

                             1,
                             2,

z-subrp-defn (0, 1), z-subrp-exis-proof (0, 1), z-subrp-unique-proof (0, 1, 2)))

Definition: z-subrp-hyps (defns, symbols) = ((assoc (fn (16, 1), defns) = z-subrp-defn (0, z-subrp (0)))

∧ subset (list (fn (3, 1), fn (1, 2), fn (0, 0)), rest-of (fn (16, 1), symbols)))

Theorem: z-subrp-defn-proof-proves (subset (list (fn (16, 1), fn (0, 0), fn (3, 1), fn (1, 2)), symbols) ∧ z-subrp-hyps (defns, symbols) ∧ termp (x, 0, symbols) ∧ (concl = z-subrp-defn (x, z-subrp (x)))) → proves (z-subrp-defn-proof (x), concl, given, defns, symbols)

Event: Enable z-subrp-defn-proof; name this event ‘g0751’.

Event: Enable z-subrp-hyps; name this event ‘g0752’.

Definition: subrp (fn) = ((fn = 1)

∨ (fn = 2)

∨ (fn = 3)
∨ (fn = 4)
∨ (fn = 5)
∨ (fn = 6)
∨ (fn = 7)
∨ (fn = 8)
∨ (fn = 9))

(DEFN
 Z-SUBRP-NCODE-PROOF
 (FN)

(Z-IF-EVAL-PROOF1
(LIST
 (LIST (EQUAL FN 1) (IDENT-AXIOM-PROOF (NCODE 1)) (NCODE-NEQUAL-PROOF FN 1))
 (IDENT-AXIOM-PROOF (NCODE 1))
 (LIST (LIST (EQUAL FN 2) (IDENT-AXIOM-PROOF (NCODE 2)) (NCODE-NEQUAL-PROOF FN 2))
       (IDENT-AXIOM-PROOF (NCODE 1))
       (LIST (LIST (EQUAL FN 3) (IDENT-AXIOM-PROOF (NCODE 3)) (NCODE-NEQUAL-PROOF FN 3))
             (IDENT-AXIOM-PROOF (NCODE 1))
             (LIST (LIST (EQUAL FN 4)
                         (IDENT-AXIOM-PROOF (NCODE 4))
                         (NCODE-NEQUAL-PROOF FN 4))
                   (IDENT-AXIOM-PROOF (NCODE 1))
                   (LIST (LIST (EQUAL FN 5)
                               (IDENT-AXIOM-PROOF (NCODE 5))
                               (NCODE-NEQUAL-PROOF FN 5))
                         (IDENT-AXIOM-PROOF (NCODE 1))
                         (LIST (LIST (EQUAL FN 6)
                                     (IDENT-AXIOM-PROOF (NCODE 6))
                                     (NCODE-NEQUAL-PROOF FN 6))
                               (IDENT-AXIOM-PROOF (NCODE 1))
                               (LIST (LIST (EQUAL FN 7)
                                           (IDENT-AXIOM-PROOF (NCODE 7))
                                           (NCODE-NEQUAL-PROOF FN 7))
                                     (IDENT-AXIOM-PROOF (NCODE 1))
                                     (LIST (LIST (EQUAL FN 8)
                                                 (IDENT-AXIOM-PROOF (NCODE 8))
                                                 (NCODE-NEQUAL-PROOF FN 8))
                                           (IDENT-AXIOM-PROOF (NCODE 1))
                                           (LIST (LIST (EQUAL FN 9)
                                                       (IDENT-AXIOM-PROOF (NCODE 9))
                                                       (NCODE-NEQUAL-PROOF FN 9))
                                                 (IDENT-AXIOM-PROOF (NCODE 1))
                                                 (IDENT-AXIOM-PROOF (PHI)))))))))))
(Z-SUBRP-EXPR (NCODE FN))
(Z-SUBRP (NCODE FN))
(NCODE (BOOL-FIX (SUBRP FN)))
(Z-SUBRP-DEFN-PROOF (NCODE FN))))

Theorem: z-subrp-ncode-proof-proves (subset (list (fn (16, 1), fn (0, 0), fn (3, 1), fn (1, 2), fn (2, 2), p (2, 1), p (1, 2)),

symbols) ∧ z-subrp-hyps (defns, symbols) ∧ z-int-hyps (defns, symbols) ∧ z-succ-hyps (defns, symbols)

∧ (concl = f-equal (z-subrp (ncode (fn)), ncode (bool-fix (subrp (fn)))))) → proves (z-subrp-ncode-proof (fn), concl, given, defns, symbols)

Event: Enable z-subrp-ncode-proof; name this event ‘g0753’.

Event: Enable subrp; name this event ‘g0754’.

Definition: eg-proof (exp, vars, terms, pf ) = detach-proof (parallel-subst (exp, vars, terms, 0),

list-exis-quantify (vars, exp),

pf ,

subst-thm-a-proof (exp, vars, terms))

;;;;;;; If |- "[a1/x1,..., an/xn]A", then |- "(forsome x1,...,xn A)".

Theorem: eg-proof-proves (formula (exp, symbols) ∧ termp (terms, 1, symbols) ∧ (length (vars) = length (terms)) ∧ var-set (vars, length (vars)) ∧ free-for-list (exp, vars, terms) ∧ proves (pf , parallel-subst (exp, vars, terms, 0), given, defns, symbols) ∧ (concl = list-exis-quantify (vars, exp))) → proves (eg-proof (exp, vars, terms, pf ), concl, given, defns, symbols)

Event: Enable eg-proof; name this event ‘g0479’.

Theorem: a-get-ok-proof-proves-again (subset (list (fn (10, 1),

fn (9, 1), fn (5, 1), fn (4, 1), fn (3, 1), fn (2, 2), fn (1, 2), p (1, 2), p (2, 1), fn (0, 0)),

symbols) ∧ z-succ-hyps (defns, symbols) ∧ z-zerop-hyps (defns, symbols) ∧ z-sub1-hyps (defns, symbols)

∧ z-car-hyps (defns, symbols) ∧ z-cdr-hyps (defns, symbols) ∧ z-int-hyps (defns, symbols) ∧ var-set (list (val1 , x1 , y1 ), 3) ∧ (concl = a-get (ncode (x),

ncode (y),

ncode (get (x, y)),

x1 , y1 , val1 , graph-trans (get-graph (x, y)))))

→ proves (a-get-ok-proof1 (x, y, x1 , y1 , val1 ), concl, given, defns, symbols)

Event: Enable a-get-ok-proof-proves; name this event ‘g0773’.

Definition: a-get1 (x, y, val, x1 , y1 , val1 , trace) = forsome (trace, a-get (x, y, val, x1 , y1 , val1 , trace))

Definition: a-get1-ok-proof (x, y, x1 , y1 , val1 , trace) = eg-proof (a-get (ncode (x), ncode (y), ncode (get (x, y)), x1 , y1 , val1 , trace),

list (trace),

list (graph-trans (get-graph (x, y))), a-get-ok-proof1 (x, y, x1 , y1 , val1 ))

Theorem: parallel-subst-ncode parallel-subst (ncode (x), vars, terms, 0) = ncode (x)

Theorem: subst-ncode subst (ncode (x), var, term, 0) = ncode (x)

Theorem: parallel-subst-graph-trans parallel-subst (graph-trans (x), vars, terms, 0) = graph-trans (x)

Theorem: subst-graph-trans subst (graph-trans (x), var, term, 0) = graph-trans (x)

Event: Enable not-free-parallel-subst; name this event ‘g0755’.

Event: Enable not-free-del-pairs-parallel-subst; name this event ‘g0759’.

Event: Enable parallel-subst-nil; name this event ‘g0768’.

Event: Enable parallel-subst-not-free-var; name this event ‘g0771’.

Event: Enable not-member-del-pairs; name this event ‘g0772’.

Theorem: free-for-nil (collect-free (term, 0) = nil) → free-for (exp, var, term, flg)

Definition: nil-list-collect-free (x) = if listp (x)

then (collect-free (car (x), 0) = nil)

∧ nil-list-collect-free (cdr (x)) else t endif

Theorem: free-for-list-nil-list nil-list-collect-free (terms) → free-for-list (exp, vars, terms)

Event: Enable free-for-list; name this event ‘g0774’.

Theorem: listp-parallel-subst listp (exp) → listp (parallel-subst (exp, vars, terms, flg))

Theorem: parallel-subst-z-list parallel-subst (z-list (list), vars, terms, 0) = z-list (parallel-subst (list, vars, terms, 1))

Event: Enable listp-parallel-subst; name this event ‘g0775’.

Theorem: a-get1-ok-proof-proves (subset (list (fn (10, 1),

fn (9, 1), fn (5, 1), fn (4, 1), fn (3, 1), fn (2, 2), fn (1, 2), p (1, 2), p (2, 1), fn (0, 0)),

symbols) ∧ z-succ-hyps (defns, symbols) ∧ z-zerop-hyps (defns, symbols) ∧ z-sub1-hyps (defns, symbols)

∧ z-car-hyps (defns, symbols) ∧ z-cdr-hyps (defns, symbols) ∧ z-int-hyps (defns, symbols) ∧ var-set (list (val1 , x1 , y1 , trace), 4) ∧ (concl = a-get1 (ncode (x), ncode (y), ncode (get (x, y)), x1 , y1 , val1 , trace))) → proves (a-get1-ok-proof (x, y, x1 , y1 , val1 , trace),

concl, given, defns, symbols)

Event: Enable a-get1-ok-proof; name this event ‘g0776’.

Theorem: a-get-good-proof-proves-again (subset (list (fn (10, 1),

fn (9, 1), fn (5, 1), fn (4, 1), fn (3, 1), fn (2, 2), fn (1, 2), p (1, 2), p (2, 1), fn (0, 0)),

symbols) ∧ z-succ-hyps (defns, symbols) ∧ z-zerop-hyps (defns, symbols) ∧ z-sub1-hyps (defns, symbols) ∧ z-car-hyps (defns, symbols) ∧ z-cdr-hyps (defns, symbols) ∧ z-int-hyps (defns, symbols) ∧ termp (val, 0, symbols) ∧ var-set (list (x1 , y1 , val1 , trace), 4) ∧ (concl = f-implies (a-get (ncode (x), ncode (y), val, x1 , y1 , val1 , trace),

f-equal (val, ncode (get (x, y))))))

→ proves (a-get-good-proof (x, y, val, x1 , y1 , val1 , trace), concl, given, defns, symbols)

Event: Enable a-get-good-proof-proves; name this event ‘g0777’.

Definition: a-get1-good-proof (x, y, val, x1 , y1 , val1 , trace) = forsome-intro-proof (trace,

body (a-get1 (ncode (x), ncode (y), val, x1 , y1 , val1 , trace)), f-equal (val, ncode (get (x, y))), a-get-good-proof (x, y, val, x1 , y1 , val1 , trace))

Theorem: a-get1-good-proof-proves (subset (list (fn (10, 1),

fn (9, 1), fn (5, 1), fn (4, 1), fn (3, 1), fn (2, 2), fn (1, 2), p (1, 2), p (2, 1), fn (0, 0)),

symbols) ∧ z-succ-hyps (defns, symbols) ∧ z-zerop-hyps (defns, symbols) ∧ z-sub1-hyps (defns, symbols) ∧ z-car-hyps (defns, symbols) ∧ z-cdr-hyps (defns, symbols) ∧ z-int-hyps (defns, symbols) ∧ termp (val, 0, symbols) ∧ (trace ∉ collect-free (val, 0)) ∧ var-set (list (x1 , y1 , val1 , trace), 4) ∧ (concl = f-implies (a-get1 (ncode (x), ncode (y), val, x1 , y1 , val1 , trace),

f-equal (val, ncode (get (x, y))))))

→ proves (a-get1-good-proof (x, y, val, x1 , y1 , val1 , trace), concl, given, defns, symbols)

Event: Enable a-get1-good-proof; name this event ‘g0778’.

;;;;;;;The next several pages cover the proof of the representability of the

;;;;;;;Lisp interpreter EV.  Apart from the e-expression to be evaluated,
;;;;;;;the e-variable bindings list, and the e-function symbol bindings list,
;;;;;;;the interpreter takes a counter N which is the maximum permissible
;;;;;;;depth of the evaluation stack.  If this bound is exceeded before the
;;;;;;;expression is fully evaluated, EV returns a bottom object (BTM).
;;;;;;;This object is added by as a shell by the command below.

Event: Add the shell btm, with recognizer function symbol btmp and no accessors.

Definition: equal-z-list-isin-proof (list1 , list2 , exp, pflist, pf ) = equal-isin-proof (z-list (list1 ),

z-list (list2 ),

exp,

equal-z-list-proof (list1 , list2 , pflist), pf )

Definition: equal-z-list-isin-imp-proof (list1 , list2 , exp, pflist) = equal-isin-imp-proof (z-list (list1 ),

z-list (list2 ),

exp,

equal-z-list-proof (list1 , list2 , pflist))

Theorem: ncode-cons ncode (cons (x, y)) = z-opair (ncode (x), ncode (y))

Event: Enable proves-is-formula-again; name this event ‘g0781’.

Event: Enable termp-term-list; name this event ‘g0782’.

Event: Enable term-list-var-list; name this event ‘g0783’.

Definition: ev-equal-z-list-proof (val, flg, exp, expr, va, fa, pf ) = equal-z-list-proof (list (val, ncode (flg), ncode (exp), ncode (va), ncode (fa)),

list (val, ncode (flg), expr, ncode (va), ncode (fa)), list (ident-axiom-proof (val),

ident-axiom-proof (ncode (flg)),

flip-equals-proof (expr, ncode (exp), pf ), ident-axiom-proof (ncode (va)), ident-axiom-proof (ncode (fa))))

Definition: ev-equal-z-list-isin-proof (val, flg, exp, expr, va, fa, trace, pf , in-pf ) = equal-z-list-isin-proof (list (val,

ncode (flg), ncode (exp), ncode (va), ncode (fa)),

list (val, ncode (flg), expr, ncode (va), ncode (fa)), trace, list (ident-axiom-proof (val),

ident-axiom-proof (ncode (flg)), flip-equals-proof (expr, ncode (exp), pf ), ident-axiom-proof (ncode (va)), ident-axiom-proof (ncode (fa))),

in-pf )

Theorem: ev-equal-z-list-proof-proves (subset (list (fn (0, 0), fn (1, 2), fn (2, 2), fn (3, 1)), symbols) ∧ termp (val, 0, symbols) ∧ proves (pf , f-equal (expr, ncode (exp)), given, defns, symbols) ∧ (concl = f-equal (z-list (list (val,

ncode (flg),

ncode (exp),

ncode (va),

ncode (fa))),

z-list (list (val, ncode (flg), expr, ncode (va), ncode (fa))))))

→ proves (ev-equal-z-list-proof (val, flg, exp, expr, va, fa, pf ), concl, given, defns, symbols)

Event: Enable ev-equal-z-list-proof; name this event ‘g0789’.

Theorem: ev-equal-z-list-isin-proof-proves (subset (list (p (1, 2), fn (0, 0), fn (1, 2), fn (2, 2), fn (3, 1)), symbols) ∧ termp (val, 0, symbols) ∧ termp (trace, 0, symbols) ∧ proves (in-pf ,

isin (z-list (list (val, ncode (flg), ncode (exp), ncode (va), ncode (fa))),

trace), given, defns, symbols)

∧ proves (pf , f-equal (expr, ncode (exp)), given, defns, symbols) ∧ (concl = isin (z-list (list (val, ncode (flg), expr, ncode (va), ncode (fa))),

trace)))

→ proves (ev-equal-z-list-isin-proof (val, flg, exp, expr, va, fa, trace, pf , in-pf ),

concl, given, defns, symbols)

Event: Enable ev-equal-z-list-isin-proof; name this event ‘g0792’.

;;;;;;;The skeleton of the representability proof for EV is similar to that of GET, but
;;;;;;;the details are enormously more complicated since EV is an extremely complicated
;;;;;;;function.  In the first `OK' part of the proof, we prove each section of EV to
;;;;;;;be `OK' separately.  Below, the part of EV which evaluates Lisp if-expressions
;;;;;;;is proved `OK'.

Definition: a-ev-defn-if1-ok-proof (exp, va, fa, val, test, trace, in-pf2 , in-pf3 ) = form-z-if-ok-proof (list (list (ncode-equal (test, 0),

ident-axiom-proof (ncode (test)), ncode-nequal-proof (test, 0)),

ev-equal-z-list-isin-proof (val,

                                            0,

cadddr (exp),

z-car-cdr (ncode (exp), list (1,

                                                        2,

2)),

va, fa, trace, z-car-cdr-proof (exp,

list (1,

                 2,
                 2,

2)),

in-pf2 ),

ev-equal-z-list-isin-proof (val,

0,

caddr (exp), z-car-cdr (ncode (exp),

list (1,

            2,

2)),

va, fa, trace, z-car-cdr-proof (exp,

list (1,

                 2,

2)),

in-pf3 )),

z-if (f-equal (ncode (test), ncode (0)),

isin (z-list (list (val, ncode (0), z-car-cdr (ncode (exp),

list (1, 2, 2, 2)),

ncode (va), ncode (fa))),

trace), isin (z-list (list (val,

ncode (0), z-car-cdr (ncode (exp),

list (1, 2, 2)),

ncode (va), ncode (fa))),

trace)))

Event: Enable termp-car-cdr; name this event ‘g0797’.

Theorem: a-ev-defn-if1-ok-proof-proves (subset (list (fn (5, 1),

fn (4, 1), fn (3, 1), fn (2, 2), fn (1, 2), p (1, 2), p (2, 1), fn (0, 0)),

symbols) ∧ z-succ-hyps (defns, symbols) ∧ z-car-hyps (defns, symbols) ∧ z-cdr-hyps (defns, symbols) ∧ z-int-hyps (defns, symbols) ∧ termp (trace, 0, symbols) ∧ if ncode-equal (test, 0)

then proves (in-pf2 ,

isin (z-list (list (ncode (val), ncode (0), ncode (cadddr (exp)), ncode (va), ncode (fa))),

trace), given, defns, symbols)

else proves (in-pf3 ,

isin (z-list (list (ncode (val), ncode (0), ncode (caddr (exp)), ncode (va), ncode (fa))),

trace), given, defns, symbols) endif

∧ (concl = f-if (f-equal (ncode (test), ncode (0)),

isin (z-list (list (ncode (val), ncode (0), z-car-cdr (ncode (exp),

list (1, 2, 2, 2)),

ncode (va), ncode (fa))),

trace), isin (z-list (list (ncode (val),

ncode (0), z-car-cdr (ncode (exp), list (1, 2, 2)), ncode (va), ncode (fa))),

trace))))

→ proves (a-ev-defn-if1-ok-proof (exp, va, fa, ncode (val), test, trace, in-pf2 , in-pf3 ),

concl, given, defns, symbols)

Event: Enable a-ev-defn-if1-ok-proof; name this event ‘g0798’.

Definition: a-ev-if-part (exp-bar, va-bar, fa-bar, val-bar, trace, rvar1 ) = forsome (rvar1 ,

f-and (isin (z-list (list (rvar1 , ncode (0), z-car (z-cdr (exp-bar)), va-bar, fa-bar)),

trace), f-if (f-equal (rvar1 , ncode (0)),

isin (z-list (list (val-bar, ncode (0), z-car-cdr (exp-bar, list (1, 2, 2, 2)), va-bar, fa-bar)),

trace), isin (z-list (list (val-bar,

ncode (0), z-car-cdr (exp-bar, list (1, 2, 2)), va-bar, fa-bar)),

trace))))

Definition: a-ev-defn-if-ok-proof (exp, va, fa, val, test, rvar1 , graph, in-pf1 , in-pf2 , in-pf3 ) = eg-proof (f-and (isin (z-list (list (rvar1 ,

ncode (0), z-car (z-cdr (ncode (exp))), ncode (va), ncode (fa))),

graph-trans (graph)), f-if (f-equal (rvar1 , ncode (0)),

isin (z-list (list (ncode (val), ncode (0), z-car-cdr (ncode (exp),

list (1, 2, 2, 2)),

ncode (va), ncode (fa))),

graph-trans (graph)), isin (z-list (list (ncode (val),

ncode (0), z-car-cdr (ncode (exp),

list (1, 2, 2)),

ncode (va), ncode (fa))),

graph-trans (graph)))),

list (rvar1 ), list (ncode (test)), and-join-proof (isin (z-list (list (ncode (test),

ncode (0),

z-car (z-cdr (ncode (exp))), ncode (va), ncode (fa))),

graph-trans (graph)), f-if (f-equal (ncode (test), ncode (0)),

isin (z-list (list (ncode (val), ncode (0), z-car-cdr (ncode (exp), list (1,

                   2,
                   2,

2)),

ncode (va), ncode (fa))),

graph-trans (graph)), isin (z-list (list (ncode (val),

ncode (0), z-car-cdr (ncode (exp),

list (1, 2, 2)),

ncode (va), ncode (fa))),

graph-trans (graph))), ev-equal-z-list-isin-proof (ncode (test),

0,

cadr (exp), z-car (z-cdr (ncode (exp))), va, fa, graph-trans (graph), z-car-cdr-proof (exp,

list (1,

2)),

in-pf1 ),

a-ev-defn-if1-ok-proof (exp, va, fa, ncode (val), test, graph-trans (graph), in-pf2 , in-pf3 )))

Theorem: a-ev-defn-if-ok-proof-proves (subset (list (fn (5, 1),

fn (4, 1), fn (3, 1), fn (2, 2), fn (1, 2), p (1, 2), p (2, 1), fn (0, 0)),

symbols) ∧ z-succ-hyps (defns, symbols) ∧ z-car-hyps (defns, symbols) ∧ z-cdr-hyps (defns, symbols) ∧ z-int-hyps (defns, symbols) ∧ variable (rvar1 ) ∧ proves (in-pf1 ,

isin (z-list (list (ncode (test), ncode (0), ncode (cadr (exp)), ncode (va), ncode (fa))),

graph-trans (graph)), given, defns, symbols)

∧ if ncode-equal (test, 0)

then proves (in-pf2 ,

isin (z-list (list (ncode (val), ncode (0), ncode (cadddr (exp)), ncode (va), ncode (fa))),

graph-trans (graph)), given, defns, symbols)

else proves (in-pf3 ,

isin (z-list (list (ncode (val), ncode (0), ncode (caddr (exp)), ncode (va), ncode (fa))),

graph-trans (graph)), given, defns, symbols) endif

∧ (concl = a-ev-if-part (ncode (exp), ncode (va), ncode (fa), ncode (val), graph-trans (graph), rvar1 )))

→ proves (a-ev-defn-if-ok-proof (exp, va, fa, val, test, rvar1 , graph, in-pf1 , in-pf2 , in-pf3 ),

concl, Event: Enable a-ev-defn-if-ok-proof; name this event ‘g0799’.

;;;;;;;The Z2 representation of the part of EV which evaluates Lisp primitives is proved
;;;;;;;`OK' below.

Definition: a-ev-subr-part (exp, va, fa, val, rvar, trace) = forsome (rvar,

f-and (isin (z-list (list (rvar, ncode (1), z-cdr (ncode (exp)), ncode (va), ncode (fa))),

trace), f-equal (val, z-apply-subr (z-car (ncode (exp)), rvar))))

Definition: a-ev-defn-subr-ok-proof (exp, va, fa, val, rval, rvar, graph, in-pf ) = eg-proof (f-and (isin (z-list (list (rvar,

ncode (1),

z-cdr (ncode (exp)), ncode (va), ncode (fa))),

graph-trans (graph)), f-equal (val, z-apply-subr (z-car (ncode (exp)), rvar))),

list (rvar),

list (ncode (rval)),

and-join-proof (isin (z-list (list (ncode (rval), ncode (1), z-cdr (ncode (exp)), ncode (va), ncode (fa))),

graph-trans (graph)), f-equal (val,

z-apply-subr (z-car (ncode (exp)),

ncode (rval))),

ev-equal-z-list-isin-proof (ncode (rval),

                                             1,

cdr (exp),

z-cdr (ncode (exp)), va, fa, graph-trans (graph), z-cdr-ncode-proof (exp), in-pf ),

flip-equals-proof (z-apply-subr (z-car (ncode (exp)),

ncode (rval)),

val,

compose-proof (fn (15, 2), val, list (z-car (ncode (exp)), ncode (rval)), list (ncode (car (exp)), ncode (rval)),

list (z-car-ncode-proof (exp),

ident-axiom-proof (ncode (rval))), z-apply-subr-ncode-proof (car (exp),

rval)))))

Theorem: a-ev-defn-subr-ok-proof-proves (subset (list (fn (15, 2),

fn (14, 2), fn (13, 2), fn (12, 2), fn (0, 0), fn (3, 1), fn (4, 1), fn (5, 1), fn (6, 1), fn (7, 1), fn (8, 1), fn (9, 1), fn (10, 1), fn (11, 2), fn (1, 2), fn (2, 2), p (2, 1), p (1, 2)),

symbols) ∧ z-apply-subr-all-hyps (given, defns, symbols) ∧ variable (rvar) ∧ proves (in-pf ,

isin (z-list (list (ncode (rval), ncode (1), ncode (cdr (exp)), ncode (va), ncode (fa))),

graph-trans (graph)), given, defns, symbols)

∧ (val = ncode (apply-subr (car (exp), rval))) ∧ (concl = a-ev-subr-part (exp, va, fa, val, rvar, graph-trans (graph)))) → proves (a-ev-defn-subr-ok-proof (exp, va, fa, val, rval, rvar, graph, in-pf ),

concl, given, defns, symbols)

Event: Enable a-ev-defn-subr-ok-proof; name this event ‘g0802’.

Event: Enable get; name this event ‘g0803’.

Event: Enable pairlist; name this event ‘g0809’.

Event: Enable not-free-covering; name this event ‘g0816’.

;;;;;;;The e-functions symbols 0 is used for the Lisp function IF, the symbols 1-9
;;;;;;;are used for the Lisp primitives, 10 is used for the QUOTE function.  The defined
;;;;;;;e-function symbols therefore start from 11.  Since the first definition in the
;;;;;;;function definition list corresponds to 11, we have to subtract 11 from the symbol
;;;;;;;before we apply GET to the definition list.  the function SUB1-N subtracts N
;;;;;;;from EXP.  It is represented in Z2 by an iterated application of Z-SUB1.

Definition: z-sub1-n (exp, n) = if n ≃ 0 then exp

else z-sub1 (z-sub1-n (exp, n − 1)) endif

Definition: sub1-n (exp, n) = if n ≃ 0 then exp

else sub1-n (exp, n − 1) − 1 endif

Definition: z-sub1-n-ncode-proof (exp, n, val, pf ) = if n ≃ 0 then pf else compose-proof (fn (10, 1),

ncode (sub1-n (val, n)), list (z-sub1-n (exp, n − 1)), list (ncode (sub1-n (val, n − 1))), list (z-sub1-n-ncode-proof (exp, n − 1, val, pf )), z-sub1-ncode-proof (sub1-n (val, n − 1))) endif

Theorem: term-z-sub1-n ((fn (10, 1) ∈ symbols) ∧ termp (exp, 0, symbols)) → termp (z-sub1-n (exp, n), 0, symbols)

Theorem: z-sub1-n-ncode-proof-proves (subset (list (fn (10, 1), fn (3, 1), p (2, 1), p (1, 2), fn (2, 2), fn (1, 2), fn (0, 0)),

symbols) ∧ z-succ-hyps (defns, symbols) ∧ z-sub1-hyps (defns, symbols) ∧ z-int-hyps (defns, symbols) ∧ proves (pf , f-equal (exp, ncode (val)), given, defns, symbols) ∧ (concl = f-equal (z-sub1-n (exp, n), ncode (sub1-n (val, n))))) → proves (z-sub1-n-ncode-proof (exp, n, val, pf ), concl, given, defns, symbols)

Event: Enable z-sub1-n-ncode-proof; name this event ‘g0817’.

Event: Enable sub1-n; name this event ‘g0818’.

;;;;;;;Next we prove the representation of that part of EV which evaluates defined Lisp
;;;;;;;functions, to be `OK'.

Definition: a-ev-fun-part (exp, va, fa, val, trace) = forsome (11,

list-all-quantify (list (15, 16),

f-and (isin (z-list (list (11, ncode (1), z-cdr (ncode (exp)), ncode (va), ncode (fa))),

trace), f-implies (a-get (z-sub1-n (z-car (ncode (exp)),

                                                    11),

ncode (fa),

                                           15,
                                           11,
                                           13,

        16),

isin (z-list (list (val, ncode (0),

               15,
               11,

ncode (fa))),

trace)))))

Theorem: formula-list-all-quantify (var-list (vars, length (vars)) ∧ formula (exp, symbols)) → formula (list-all-quantify (vars, exp), symbols)

Theorem: list-gen-proof-proves-again (var-list (vars, length (vars)) ∧ proves (pf , exp, given, defns, symbols) ∧ (concl = list-all-quantify (vars, exp))) → proves (list-gen-proof (vars, exp, pf ), concl, given, defns, symbols)

Definition: a-get-ev-reduc-proof (exp, fa, getval, n, x1 , y1 , val1 , tr1 ) = tautconseq-proof (list (f-implies (isin (z-list (list (getval,

z-sub1-n (z-car (ncode (exp)),

n),

ncode (fa))),

tr1 ), isin (z-list (list (getval,

ncode (sub1-n (car (exp),

n)),

ncode (fa))),

tr1 )),

f-implies (a-get (ncode (sub1-n (car (exp), n)), ncode (fa), getval, x1 , y1 , val1 , tr1 ),

f-equal (getval,

ncode (get (sub1-n (car (exp), n),

fa))))),

f-implies (a-get (z-sub1-n (z-car (ncode (exp)), n), ncode (fa), getval, x1 , y1 , val1 , tr1 ),

f-equal (getval,

ncode (get (sub1-n (car (exp), n), fa)))),

list (equal-z-list-isin-imp-proof (list (getval,

z-sub1-n (z-car (ncode (exp)),

n),

ncode (fa)), list (getval,

ncode (sub1-n (car (exp),

n)),

ncode (fa)), tr1 , list (ident-axiom-proof (getval),

z-sub1-n-ncode-proof (z-car (ncode (exp)), n, car (exp), z-car-ncode-proof (exp)),

ident-axiom-proof (ncode (fa)))),

a-get-good-proof (sub1-n (car (exp), n), fa, getval, x1 , y1 , val1 , tr1 )))

Definition: a-ev-defn-fun-ok-proof (exp, va, fa, val, rval, graph, in-pf1 , in-pf2 ) = eg-proof (list-all-quantify (list (15, 16),

f-and (isin (z-list (list (11, ncode (1), z-cdr (ncode (exp)), ncode (va), ncode (fa))),

graph-trans (graph)), f-implies (a-get (z-sub1-n (z-car (ncode (exp)),

    11),

ncode (fa),

15,
11,
13,
14,

isin (z-list (list (val, ncode (0),

         15,
         11,

ncode (fa))),

graph-trans (graph))))),

list (11), list (ncode (rval)), list-gen-proof (list (15, 16),

f-and (isin (z-list (list (ncode (rval), ncode (1), z-cdr (ncode (exp)), ncode (va), ncode (fa))),

graph-trans (graph)), f-implies (a-get (z-sub1-n (z-car (ncode (exp)),

        11),

ncode (fa),

15,
11,
13,
14,
16),

isin (z-list (list (val, ncode (0),

       15,

ncode (rval), ncode (fa))),

graph-trans (graph)))),

and-join-proof (isin (z-list (list (ncode (rval), ncode (1), z-cdr (ncode (exp)), ncode (va), ncode (fa))),

graph-trans (graph)), f-implies (a-get (z-sub1-n (z-car (ncode (exp)),

                11),

ncode (fa),

        15,
        11,
        13,
        14,
        16),

isin (z-list (list (val, ncode (0),

15,

ncode (rval), ncode (fa))),

graph-trans (graph))),

ev-equal-z-list-isin-proof (ncode (rval),

1,

cdr (exp), z-cdr (ncode (exp)), va, fa, graph-trans (graph), z-cdr-ncode-proof (exp), in-pf1 ),

chain-proof (a-get (z-sub1-n (z-car (ncode (exp)),

   11),

ncode (fa),

15,
11,
13,
14,
16),

isin (z-list (list (val, ncode (0),

  15,

ncode (rval), ncode (fa))),

graph-trans (graph)), list (f-equal (15,

ncode (get (sub1-n (car (exp),

                11),

fa)))),

list (a-get-ev-reduc-proof (exp, fa,

           15,
           11,
           11,
           13,
           14,
           16),

form-equal-case-proof (list (15),

list (ncode (get (sub1-n (car (exp),

                                11),

fa))),

isin (z-list (list (val, ncode (0),

                                                                       15,

ncode (rval), ncode (fa))),

graph-trans (graph)), in-pf2 ))))))

Theorem: parallel-subst-z-sub1-n parallel-subst (z-sub1-n (exp, n), vars, terms, 0) = z-sub1-n (parallel-subst (exp, vars, terms, 0), n)

Theorem: a-ev-defn-fun-ok-proof-proves (subset (list (fn (10, 1),

fn (9, 1), fn (5, 1), fn (4, 1), fn (3, 1), fn (2, 2), fn (1, 2), p (1, 2), p (2, 1), fn (0, 0)),

symbols) ∧ z-succ-hyps (defns, symbols) ∧ z-car-hyps (defns, symbols) ∧ z-cdr-hyps (defns, symbols) ∧ z-zerop-hyps (defns, symbols) ∧ z-sub1-hyps (defns, symbols) ∧ z-int-hyps (defns, symbols) ∧ proves (in-pf1 ,

isin (z-list (list (ncode (rval), ncode (1), ncode (cdr (exp)), ncode (va), ncode (fa))),

graph-trans (graph)), given, defns, symbols)

∧ proves (in-pf2 ,

isin (z-list (list (ncode (val), ncode (0), ncode (get (sub1-n (car (exp), 11), fa)), ncode (rval), ncode (fa))),

graph-trans (graph)), given, defns, symbols)

∧ (concl = a-ev-fun-part (exp, va, fa, ncode (val), graph-trans (graph)))) → proves (a-ev-defn-fun-ok-proof (exp,

va, fa, ncode (val), rval, graph, in-pf1 , in-pf2 ),

concl, given, defns, symbols)

Event: Enable a-ev-defn-fun-ok-proof; name this event ‘g0819’.

;;;;;;;Finally we prove the representation of the part of EV which evaluates lists
;;;;;;;of e-expressions to be `OK'.

Definition: a-ev-defn-list-ok-proof (exp,

va, fa, rval1 , rval2 , rvar1 , rvar2 , graph, in-pf1 , in-pf2 )

= eg-proof (f-and (isin (z-list (list (rvar1 , ncode (0), z-car (ncode (exp)), ncode (va), ncode (fa))),

graph-trans (graph)), f-and (isin (z-list (list (rvar2 , ncode (1), z-cdr (ncode (exp)), ncode (va), ncode (fa))),

graph-trans (graph)), f-equal (ncode (cons (rval1 , rval2 )),

z-opair (rvar1 , rvar2 )))),

list (rvar1 , rvar2 ), list (ncode (rval1 ), ncode (rval2 )), and-join-proof (isin (z-list (list (ncode (rval1 ),

ncode (0), z-car (ncode (exp)), ncode (va), ncode (fa))),

graph-trans (graph)), f-and (isin (z-list (list (ncode (rval2 ),

ncode (1), z-cdr (ncode (exp)), ncode (va), ncode (fa))),

graph-trans (graph)), f-equal (ncode (cons (rval1 , rval2 )),

z-opair (ncode (rval1 ),

ncode (rval2 )))),

ev-equal-z-list-isin-proof (ncode (rval1 ),

0,

car (exp), z-car (ncode (exp)), va, fa, graph-trans (graph), z-car-ncode-proof (exp), in-pf1 ),

and-join-proof (isin (z-list (list (ncode (rval2 ), ncode (1), z-cdr (ncode (exp)), ncode (va), ncode (fa))),

graph-trans (graph)), f-equal (ncode (cons (rval1 , rval2 )),

z-opair (ncode (rval1 ),

ncode (rval2 ))),

ev-equal-z-list-isin-proof (ncode (rval2 ),

             1,

cdr (exp), z-cdr (ncode (exp)), va, fa, graph-trans (graph), z-cdr-ncode-proof (exp), in-pf2 ),

ident-axiom-proof (z-opair (ncode (rval1 ), ncode (rval2 ))))))

Definition: a-ev-list-part (exp, va, fa, val, rvar1 , rvar2 , trace) = forsome (rvar1 ,

forsome (rvar2 ,

f-and (isin (z-list (list (rvar1 , ncode (0), z-car (ncode (exp)), ncode (va), ncode (fa))),

trace), f-and (isin (z-list (list (rvar2 ,

ncode (1), z-cdr (ncode (exp)), ncode (va), ncode (fa))),

trace), f-equal (val, z-opair (rvar1 , rvar2 ))))))

Theorem: a-ev-defn-list-ok-proof-proves (subset (list (fn (5, 1),

fn (4, 1), fn (3, 1), fn (2, 2), fn (1, 2), p (1, 2), p (2, 1), fn (0, 0)),

symbols) ∧ z-succ-hyps (defns, symbols) ∧ z-car-hyps (defns, symbols) ∧ z-cdr-hyps (defns, symbols) ∧ z-int-hyps (defns, symbols) ∧ var-set (list (rvar1 , rvar2 ), 2) ∧ proves (in-pf1 , isin (z-list (list (ncode (rval1 ),

ncode (0), ncode (car (exp)), ncode (va), ncode (fa))),

graph-trans (graph)), given, defns, symbols)

∧ proves (in-pf2 ,

isin (z-list (list (ncode (rval2 ), ncode (1), ncode (cdr (exp)), ncode (va), ncode (fa))),

graph-trans (graph)), given, defns, symbols)

∧ (concl = a-ev-list-part (exp, va, fa, ncode (cons (rval1 , rval2 )), rvar1 , rvar2 , graph-trans (graph))))

→ proves (a-ev-defn-list-ok-proof (exp, va, fa, rval1 , rval2 , rvar1 , rvar2 , graph, in-pf1 , in-pf2 ),

concl, given, defns, symbols)

Event: Enable a-ev-defn-list-ok-proof; name this event ‘g0823’.

;;;;;;;EV is defined below.  It takes a FLG to control the recursion, an e-expression EXP,

;;;;;;;an e-variable bindings list VA, a e-function symbols definition list FA, and a stack
;;;;;;;bound N.  If the FLG is 1, it is evaluating a list of e-expressions - if any of them
;;;;;;;evaluates to (BTM), the whole list evaluates to (BTM).  Otherwise, it returns the
;;;;;;;list of values.  If the FLG is not 1, then if EXP is not a list, it must be an
;;;;;;;e-variable and EV returns (GET EXP VA).  Otherwise, (CAR EXP) is an e-function
;;;;;;;symbol.  If the symbol is 0, then the e-expression is evaluated as a Lisp
;;;;;;;IF-expression.  If the symbol is 10, then the e-expression is evaluated as a
;;;;;;;Lisp QUOTE-expression.  If the symbol is between 1 and 9, then the appropriate
;;;;;;;Lisp primitive is applied to the recursively evaluated arguments.  In the remaining
;;;;;;;case, the e-function symbol is a defined one, and the corresponding definition is
;;;;;;;evaluated with a new e-variable-bindings list consisting of the recursively evaluated
;;;;;;;arguments.  Since there is no guarantee in the last case that the size of the
;;;;;;;definition is going to be smaller than the e-expression being evaluated, the counter
;;;;;;;N is decremented by one.  If either the counter is exhausted or one of the
;;;;;;;evaluated sub-expressions evaluates to (BTM), then EV returns (BTM).

Definition: ev (flg, exp, va, fa, n) = if flg = 1

then if listp (exp)

then if btmp (ev (0, car (exp), va, fa, n))

∨ btmp (ev (1, cdr (exp), va, fa, n)) then btm else cons (ev (0, car (exp), va, fa, n),

ev (1, cdr (exp), va, fa, n)) endif

else nil endif elseif listp (exp) then if car (exp) ≃ 0

then if btmp (ev (0, cadr (exp), va, fa, n)) then btm elseif ncode-equal (ev (0, cadr (exp), va, fa, n), 0) then ev (0, cadddr (exp), va, fa, n) else ev (0, caddr (exp), va, fa, n) endif

elseif car (exp) = 10 then cadr (exp)

elseif btmp (ev (1, cdr (exp), va, fa, n)) then btm elseif subrp (car (exp)) then apply-subr (car (exp), ev (1, cdr (exp), va, fa, n)) elseif n ≃ 0 then btm else ev (0,

get (sub1-n (car (exp), 11), fa), ev (1, cdr (exp), va, fa, n), fa, n − 1) endif

else get (exp, va) endif

Theorem: ev-if-reduc ((flg ≠ 1) ∧ listp (exp) ∧ (car (exp) ≃ 0) ∧ (¬ btmp (ev (flg, exp, va, fa, n)))) → (ev (flg, exp, va, fa, n)

= if ncode-equal (ev (0, cadr (exp), va, fa, n), 0)

then ev (0, cadddr (exp), va, fa, n) else ev (0, caddr (exp), va, fa, n) endif)

Theorem: ev-subr-reduc ((flg ≠ 1) ∧ listp (exp) ∧ (car (exp) ≄ 0) ∧ (car (exp) ≠ 10) ∧ subrp (car (exp)) ∧ (¬ btmp (ev (flg, exp, va, fa, n)))) → (ev (flg, exp, va, fa, n) = apply-subr (car (exp), ev (1, cdr (exp), va, fa, n)))

Theorem: ev-fun-reduc ((flg ≠ 1) ∧ listp (exp) ∧ (car (exp) ≄ 0) ∧ (car (exp) ≠ 10) ∧ (¬ subrp (car (exp))) ∧ (¬ btmp (ev (flg, exp, va, fa, n)))) → (ev (flg, exp, va, fa, n)

= ev (0, get (sub1-n (car (exp), 11), fa), ev (1, cdr (exp), va, fa, n), fa, n − 1))

Theorem: ev-list-reduc ((flg = 1) ∧ listp (exp) ∧ (¬ btmp (ev (flg, exp, va, fa, n)))) → (ev (flg, exp, va, fa, n)

= cons (ev (0, car (exp), va, fa, n), ev (1, cdr (exp), va, fa, n)))

;;;;;;;The list of value/argument pairs generated in a computation of EV is constructed
;;;;;;;by EV-GRAPH below.

Definition: ev-graph (flg, exp, va, fa, n) = if flg = 1

then if listp (exp) then cons (cons (ev (flg, exp, va, fa, n),

cons (flg, cons (exp, cons (va, fa)))), append (ev-graph (0, car (exp), va, fa, n),

ev-graph (1, cdr (exp), va, fa, n)))

else list (cons (ev (flg, exp, va, fa, n),

cons (flg, cons (exp, cons (va, fa))))) endif

elseif listp (exp) then if car (exp) ≃ 0

then if ncode-equal (ev (0, cadr (exp), va, fa, n), 0)

then cons (cons (ev (flg, exp, va, fa, n),

cons (flg, cons (exp, cons (va, fa)))), append (ev-graph (0, cadr (exp), va, fa, n),

ev-graph (0, cadddr (exp), va, fa, n)))

else cons (cons (ev (flg, exp, va, fa, n),

cons (flg, cons (exp, cons (va, fa)))), append (ev-graph (0, cadr (exp), va, fa, n),

ev-graph (0, caddr (exp), va, fa, n))) endif

elseif car (exp) = 10 then list (cons (ev (flg, exp, va, fa, n),

cons (flg, cons (exp, cons (va, fa)))))

elseif subrp (car (exp)) then cons (cons (ev (flg, exp, va, fa, n),

cons (flg, cons (exp, cons (va, fa)))), ev-graph (1, cdr (exp), va, fa, n))

elseif n ≃ 0 then list (cons (ev (flg, exp, va, fa, n),

cons (flg, cons (exp, cons (va, fa)))))

else cons (cons (ev (flg, exp, va, fa, n),

cons (flg, cons (exp, cons (va, fa)))), append (ev-graph (0,

get (sub1-n (car (exp), 11), fa), ev (1, cdr (exp), va, fa, n), fa, n − 1),

ev-graph (1, cdr (exp), va, fa, n))) endif

else list (cons (get (exp, va), cons (flg, cons (exp, cons (va, fa))))) endif

Theorem: member-ev-graph1 cons (ev (flg, exp, va, fa, n), cons (flg, cons (exp, cons (va, fa)))) ∈ ev-graph (flg, exp, va, fa, n)

Theorem: subr-member-graph ((flg ≠ 1) ∧ listp (exp) ∧ (car (exp) ≄ 0)

∧ (car (exp) ≠ 10) ∧ subrp (car (exp)) ∧ (x = cons (ev (1, cdr (exp), va, fa, n),

cons (1, cons (cdr (exp), cons (va, fa))))))

→ (x ∈ ev-graph (flg, exp, va, fa, n))

Theorem: fun-ev-graph ((flg ≠ 1) ∧ listp (exp) ∧ (car (exp) ≄ 0) ∧ (car (exp) ≠ 10) ∧ (¬ subrp (car (exp))) ∧ (¬ btmp (ev (flg, exp, va, fa, n)))) → (ev-graph (flg, exp, va, fa, n)

= cons (cons (ev (flg, exp, va, fa, n), cons (flg, cons (exp, cons (va, fa)))),

append (ev-graph (0, get (sub1-n (car (exp), 11), fa), ev (1, cdr (exp), va, fa, n), fa, n − 1),

ev-graph (1, cdr (exp), va, fa, n))))

Theorem: member-fun-graph ((flg ≠ 1) ∧ listp (exp) ∧ (car (exp) ≄ 0) ∧ (car (exp) ≠ 10) ∧ (¬ subrp (car (exp))) ∧ (x = cons (ev (1, cdr (exp), va, fa, n),

cons (1, cons (cdr (exp), cons (va, fa)))))

∧ (y = cons (ev (0, get (sub1-n (car (exp), 11), fa), ev (1, cdr (exp), va, fa, n), fa, n − 1),

cons (0,

cons (get (sub1-n (car (exp), 11), fa),

cons (ev (1, cdr (exp), va, fa, n), fa)))))

∧ (¬ btmp (ev (flg, exp, va, fa, n)))) → ((x ∈ ev-graph (flg, exp, va, fa, n))

∧ (y ∈ ev-graph (flg, exp, va, fa, n)))

Theorem: if-ev-graph1 ((flg ≠ 1) ∧ listp (exp)

∧ (car (exp) ≃ 0) ∧ ncode-equal (ev (0, cadr (exp), va, fa, n), 0)) → (ev-graph (flg, exp, va, fa, n)

= cons (cons (ev (flg, exp, va, fa, n), cons (flg, cons (exp, cons (va, fa)))),

append (ev-graph (0, cadr (exp), va, fa, n), ev-graph (0, cadddr (exp), va, fa, n))))

Theorem: if-ev-graph2 ((flg ≠ 1) ∧ listp (exp) ∧ (car (exp) ≃ 0) ∧ (¬ ncode-equal (ev (0, cadr (exp), va, fa, n), 0))) → (ev-graph (flg, exp, va, fa, n)

= cons (cons (ev (flg, exp, va, fa, n), cons (flg, cons (exp, cons (va, fa)))),

append (ev-graph (0, cadr (exp), va, fa, n), ev-graph (0, caddr (exp), va, fa, n))))

Theorem: member-if-graph1 ((flg ≠ 1) ∧ listp (exp) ∧ (car (exp) ≃ 0) ∧ ncode-equal (ev (0, cadr (exp), va, fa, n), 0) ∧ (x = cons (ev (0, cadr (exp), va, fa, n),

cons (0, cons (cadr (exp), cons (va, fa)))))

∧ (y = cons (ev (0, cadddr (exp), va, fa, n),

cons (0, cons (cadddr (exp), cons (va, fa))))))

→ ((x ∈ ev-graph (flg, exp, va, fa, n)) ∧ (y ∈ ev-graph (flg, exp, va, fa, n)))

Theorem: member-if-graph2 ((flg ≠ 1) ∧ listp (exp) ∧ (car (exp) ≃ 0) ∧ (¬ ncode-equal (ev (0, cadr (exp), va, fa, n), 0)) ∧ (x = cons (ev (0, cadr (exp), va, fa, n),

cons (0, cons (cadr (exp), cons (va, fa)))))

∧ (y = cons (ev (0, caddr (exp), va, fa, n),

cons (0, cons (caddr (exp), cons (va, fa))))))

→ ((x ∈ ev-graph (flg, exp, va, fa, n)) ∧ (y ∈ ev-graph (flg, exp, va, fa, n)))

Theorem: member-list-graph (listp (exp) ∧ (flg = 1) ∧ (x = cons (ev (0, car (exp), va, fa, n),

cons (0, cons (car (exp), cons (va, fa)))))

∧ (y = cons (ev (1, cdr (exp), va, fa, n),

cons (1, cons (cdr (exp), cons (va, fa))))))

→ ((x ∈ ev-graph (flg, exp, va, fa, n)) ∧ (y ∈ ev-graph (flg, exp, va, fa, n)))

Event: Enable fun-ev-graph; name this event ‘g0824’.

Event: Enable if-ev-graph1; name this event ‘g0844’.

Event: Enable if-ev-graph2; name this event ‘g0848’.

Event: Disable proves-is-formula-again; name this event ‘g0849’.

Event: Enable nlistp-ncode; name this event ‘g0855’.

;;;;;;;Below is the Z2 analogue of the definition of EV.

Definition: z-ev-defn-part (flg, exp, va, fa, val, trace) = z-if (f-equal (ncode (flg), ncode (1)),

z-if (f-equal (z-listp (ncode (exp)), ncode (1)), a-ev-list-part (exp, va, fa, val, 11, 12, trace), f-equal (val, ncode (nil))),

z-if (f-equal (z-listp (ncode (exp)), ncode (1)),

z-if (f-equal (z-zerop (z-car (ncode (exp))), ncode (1)),

a-ev-if-part (ncode (exp), ncode (va), ncode (fa), val, trace,

                         11),

z-if (f-equal (z-car (ncode (exp)), ncode (10)), f-equal (val, z-car-cdr (ncode (exp), list (1, 2))), z-if (f-equal (z-subrp (z-car (ncode (exp))), ncode (1)), a-ev-subr-part (exp, va, fa, val, 11, trace), a-ev-fun-part (exp, va, fa, val, trace)))),

a-get1 (ncode (exp), ncode (va), val, 11, 13, 14, 16)))

(DEFN
 A-EV-DEFN-PART-OK-PFTREE

(FLG EXP VA FA N)
(LIST
(LIST (EQUAL FLG 1) (IDENT-AXIOM-PROOF (NCODE 1)) (NCODE-NEQUAL-PROOF FLG 1))
(LIST (LIST (LISTP EXP)
(Z-LISTP-NCODE-PROOF EXP)
(TRANS-NOT-EQUAL-PROOF (NCODE 1)
    (Z-LISTP (NCODE EXP))
    (NCODE 0)
    (NCODE-NEQUAL-PROOF 1 0)
    (Z-LISTP-NCODE-PROOF EXP)))
(A-EV-DEFN-LIST-OK-PROOF EXP
VA
FA
(EV 0 (CAR EXP) VA FA N)
(EV 1 (CDR EXP) VA FA N)
11
12
(EV-GRAPH FLG EXP VA FA N)
(IN-GRAPH-PROOF (CONS (EV 0 (CAR EXP) VA FA N)
                      (CONS 0 (CONS (CAR EXP) (CONS VA FA))))
                (EV-GRAPH FLG EXP VA FA N))
(IN-GRAPH-PROOF (CONS (EV 1 (CDR EXP) VA FA N)
                      (CONS 1 (CONS (CDR EXP) (CONS VA FA))))
                (EV-GRAPH FLG EXP VA FA N)))
(IDENT-AXIOM-PROOF (NCODE NIL)))
(LIST
(LIST (LISTP EXP)
(Z-LISTP-NCODE-PROOF EXP)
(TRANS-NOT-EQUAL-PROOF (NCODE 1)
(Z-LISTP (NCODE EXP))
(NCODE 0)
(NCODE-NEQUAL-PROOF 1 0)
(Z-LISTP-NCODE-PROOF EXP)))
(LIST
(LIST (ZEROP (CAR EXP))
(COMPOSE-CAR-PROOF (FN 9 1) (NCODE 1) EXP (Z-ZEROP-NCODE-PROOF (CAR EXP)))
(TRANS-NOT-EQUAL-PROOF (NCODE 1)
(Z-ZEROP (Z-CAR (NCODE EXP)))
(NCODE 0)
(NCODE-NEQUAL-PROOF 1 0)
(COMPOSE-CAR-PROOF (FN 9 1)
                   (NCODE 0)
                   EXP
                   (Z-ZEROP-NCODE-PROOF (CAR EXP)))))

(A-EV-DEFN-IF-OK-PROOF EXP
VA
FA
(EV FLG EXP VA FA N)
(EV 0 (CADR EXP) VA FA N)
11
(EV-GRAPH FLG EXP VA FA N)
(IN-GRAPH-PROOF (CONS (EV 0 (CADR EXP) VA FA N)
                      (CONS 0 (CONS (CADR EXP) (CONS VA FA))))
                (EV-GRAPH FLG EXP VA FA N))
(IN-GRAPH-PROOF (CONS (EV 0 (CADDDR EXP) VA FA N)
                      (CONS 0 (CONS (CADDDR EXP) (CONS VA FA))))
                (EV-GRAPH FLG EXP VA FA N))
(IN-GRAPH-PROOF (CONS (EV 0 (CADDR EXP) VA FA N)
                      (CONS 0 (CONS (CADDR EXP) (CONS VA FA))))
                (EV-GRAPH FLG EXP VA FA N)))
(LIST
(LIST (EQUAL (CAR EXP) 10)
(Z-CAR-NCODE-PROOF EXP)
(TRANS-NOT-EQUAL-PROOF (NCODE 10)
       (Z-CAR (NCODE EXP))
       (NCODE (CAR EXP))
       (NCODE-NEQUAL-PROOF 10 (CAR EXP))
       (Z-CAR-NCODE-PROOF EXP)))
(FLIP-EQUALS-PROOF (Z-CAR-CDR (NCODE EXP) (LIST 1 2))
(NCODE (CADR EXP))
(Z-CAR-CDR-PROOF EXP (LIST 1 2)))
(LIST (LIST (SUBRP (CAR EXP))
(COMPOSE-CAR-PROOF (FN 16 1) (NCODE 1) EXP (Z-SUBRP-NCODE-PROOF (CAR EXP)))
(TRANS-NOT-EQUAL-PROOF (NCODE 1)
             (Z-SUBRP (Z-CAR (NCODE EXP)))
             (NCODE 0)
             (NCODE-NEQUAL-PROOF 1 0)
             (COMPOSE-CAR-PROOF (FN 16 1)
                                (NCODE 0)
                                EXP
                                (Z-SUBRP-NCODE-PROOF (CAR EXP)))))
(A-EV-DEFN-SUBR-OK-PROOF EXP
         VA
         FA
         (NCODE (EV FLG EXP VA FA N))
         (EV 1 (CDR EXP) VA FA N)
         11
         (EV-GRAPH FLG EXP VA FA N)

 (IN-GRAPH-PROOF (CONS (EV 1 (CDR EXP) VA FA N)
                       (CONS 1
                             (CONS (CDR EXP)
                                   (CONS VA FA))))
                 (EV-GRAPH FLG EXP VA FA N)))
(A-EV-DEFN-FUN-OK-PROOF EXP
VA
FA
(NCODE (EV FLG EXP VA FA N))
(EV 1 (CDR EXP) VA FA N)
(EV-GRAPH FLG EXP VA FA N)
(IN-GRAPH-PROOF (CONS (EV 1 (CDR EXP) VA FA N)
                      (CONS 1
                            (CONS (CDR EXP) (CONS VA FA))))
                (EV-GRAPH FLG EXP VA FA N))
(IN-GRAPH-PROOF (CONS (EV FLG EXP VA FA N)
                      (CONS 0
                            (CONS (GET (SUB1-N (CAR EXP)
                                               11)
                                       FA)
                                  (CONS (EV 1
                                            (CDR EXP)
                                            VA
                                            FA
                                            N)
                                        FA))))
                (EV-GRAPH FLG EXP VA FA N))))))
(A-GET1-OK-PROOF EXP VA 11 13 14 16))))

Definition: a-ev-defn-part-ok-proof (flg, exp, va, fa, n) = form-z-if-ok-proof (a-ev-defn-part-ok-pftree (flg, exp, va, fa, n),

z-ev-defn-part (flg, exp, va, fa, ncode (ev (flg, exp, va, fa, n)), graph-trans (ev-graph (flg,

exp, va, fa, n))))

Theorem: form-z-if-z-ev-defn-part subset (list (fn (16, 1),

fn (15, 2), fn (14, 2), fn (13, 2), fn (12, 2), fn (0, 0), fn (3, 1), fn (4, 1), fn (5, 1), fn (6, 1), fn (7, 1), fn (8, 1), fn (9, 1), fn (10, 1), fn (11, 2), fn (1, 2), fn (2, 2), p (2, 1), p (1, 2)),

symbols) → form-z-if (z-ev-defn-part (flg,

exp, va, fa, ncode (ev (flg, exp, va, fa, n)), graph-trans (ev-graph (flg, exp, va, fa, n))),

symbols)

Definition: a-ev-defn-part (flg, exp, va, fa, val, trace) = f-if (f-equal (ncode (flg), ncode (1)),

f-if (f-equal (z-listp (ncode (exp)), ncode (1)), a-ev-list-part (exp, va, fa, val, 11, 12, trace), f-equal (val, ncode (nil))),

f-if (f-equal (z-listp (ncode (exp)), ncode (1)),

f-if (f-equal (z-zerop (z-car (ncode (exp))), ncode (1)),

a-ev-if-part (ncode (exp), ncode (va), ncode (fa), val, trace,

              11),

f-if (f-equal (z-car (ncode (exp)), ncode (10)), f-equal (val, z-car-cdr (ncode (exp), list (1, 2))), f-if (f-equal (z-subrp (z-car (ncode (exp))), ncode (1)),

a-ev-subr-part (exp, va, fa, val, 11, trace), a-ev-fun-part (exp, va, fa, val, trace)))),

a-get1 (ncode (exp), ncode (va), val, 11, 13, 14, 16)))

Definition: ev-hyps (given, defns, symbols) = (subset (list (fn (16, 1),

fn (15, 2), fn (14, 2), fn (13, 2), fn (12, 2), fn (0, 0), fn (3, 1), fn (4, 1), fn (5, 1), fn (6, 1), fn (7, 1), fn (8, 1), fn (9, 1), fn (10, 1), fn (11, 2), fn (1, 2), fn (2, 2), p (2, 1), p (1, 2)),

symbols) ∧ z-apply-subr-all-hyps (given, defns, symbols) ∧ z-subrp-hyps (defns, symbols))

Theorem: a-ev-defn-part-ok-proof-proves-quote-case ((flg ≠ 1) ∧ listp (exp) ∧ (car (exp) = 10) ∧ ev-hyps (given, defns, symbols) ∧ (concl = a-ev-defn-part (flg,

exp, va, fa, ncode (ev (flg, exp, va, fa, n)), graph-trans (ev-graph (flg, exp, va, fa, n)))))

→ proves (a-ev-defn-part-ok-proof (flg, exp, va, fa, n), concl, given, Theorem: form-z-if-z-ev-defn-part-again (subset (list (fn (16, 1),

fn (15, 2), fn (14, 2), fn (13, 2), fn (12, 2), fn (0, 0), fn (3, 1), fn (4, 1), fn (5, 1), fn (6, 1), fn (7, 1), fn (8, 1), fn (9, 1), fn (10, 1), fn (11, 2), fn (1, 2), fn (2, 2), p (2, 1), p (1, 2)),

symbols) ∧ (concl = z-ev-defn-part (flg,

exp, va, fa, ncode (ev (flg, exp, va, fa, n)), graph-trans (ev-graph (flg, exp, va, fa, n)))))

→ form-z-if (concl, symbols)

Theorem: a-ev-defn-part-ok-proof-proves-list-case ((flg = 1) ∧ listp (exp) ∧ ev-hyps (given, defns, symbols) ∧ if flg = 1 then ¬ btmp (ev (1, exp, va, fa, n))

else ¬ btmp (ev (flg, exp, va, fa, n)) endif ∧ (concl = a-ev-defn-part (flg,

exp, va, fa, ncode (ev (flg, exp, va, fa, n)), graph-trans (ev-graph (flg, exp, va, fa, n)))))

→ proves (a-ev-defn-part-ok-proof (flg, exp, va, fa, n), concl, given, defns, symbols)

Theorem: a-ev-defn-part-ok-proof-proves-nlist-case ((flg = 1) ∧ (exp ≃ nil) ∧ ev-hyps (given, defns, symbols) ∧ if flg = 1 then ¬ btmp (ev (1, exp, va, fa, n))

else ¬ btmp (ev (flg, exp, va, fa, n)) endif ∧ (concl = a-ev-defn-part (flg,

exp, va, fa, ncode (ev (flg, exp, va, fa, n)), graph-trans (ev-graph (flg, exp, va, fa, n)))))

→ proves (a-ev-defn-part-ok-proof (flg, exp, va, fa, n), concl, given, defns, symbols)

Theorem: ncode-nequal-proof-proves-case ((0 < y) ∧ (x ≠ y) ∧ subset (list (fn (3, 1), p (2, 1), p (1, 2), fn (2, 2), fn (1, 2), fn (0, 0)),

symbols)

∧ z-succ-hyps (defns, symbols) ∧ z-int-hyps (defns, symbols) ∧ (x-bar = ncode (x)) ∧ (y-bar = ncode (y))) → proves (ncode-nequal-proof (x, y),

f-not (f-equal (x-bar, y-bar)), given, defns, symbols)

Theorem: a-ev-defn-part-ok-proof-proves-if-case1 ((flg ≠ 1) ∧ listp (exp) ∧ (car (exp) ≃ 0) ∧ ncode-equal (ev (0, cadr (exp), va, fa, n), 0) ∧ ev-hyps (given, defns, symbols)

∧ (¬ btmp (ev (flg, exp, va, fa, n))) ∧ (concl = a-ev-defn-part (flg,

exp, va, fa, ncode (ev (flg, exp, va, fa, n)), graph-trans (ev-graph (flg, exp, va, fa, n)))))

→ proves (a-ev-defn-part-ok-proof (flg, exp, va, fa, n), concl, given, defns, symbols)

Theorem: a-ev-defn-part-ok-proof-proves-if-case2 ((flg ≠ 1) ∧ listp (exp) ∧ (car (exp) ≃ 0) ∧ (¬ ncode-equal (ev (0, cadr (exp), va, fa, n), 0)) ∧ ev-hyps (given, defns, symbols) ∧ (¬ btmp (ev (flg, exp, va, fa, n))) ∧ (concl = a-ev-defn-part (flg,

exp, va, fa, ncode (ev (flg, exp, va, fa, n)), graph-trans (ev-graph (flg, exp, va, fa, n)))))

→ proves (a-ev-defn-part-ok-proof (flg, exp, va, fa, n), concl, given, defns, symbols)

Theorem: a-ev-defn-part-ok-proof-proves-subr-case ((flg ≠ 1) ∧ listp (exp) ∧ (car (exp) ≄ 0) ∧ (car (exp) ≠ 10) ∧ subrp (car (exp)) ∧ ev-hyps (given, defns, symbols) ∧ (¬ btmp (ev (flg, exp, va, fa, n))) ∧ (concl = a-ev-defn-part (flg,

exp, va, fa, ncode (ev (flg, exp, va, fa, n)), graph-trans (ev-graph (flg, exp, va, fa, n)))))

→ proves (a-ev-defn-part-ok-proof (flg, exp, va, fa, n), concl, given, defns, symbols)

Theorem: a-ev-defn-part-ok-proof-proves-fun-case ((flg ≠ 1) ∧ listp (exp) ∧ (car (exp) ≄ 0) ∧ (car (exp) ≠ 10) ∧ (¬ subrp (car (exp))) ∧ ev-hyps (given, defns, symbols) ∧ (¬ btmp (ev (flg, exp, va, fa, n))) ∧ (concl = a-ev-defn-part (flg,

exp, va, fa, ncode (ev (flg, exp, va, fa, n)), graph-trans (ev-graph (flg, exp, va, fa, n)))))

→ proves (a-ev-defn-part-ok-proof (flg, exp, va, fa, n), concl, given, defns, symbols)

Theorem: a-ev-defn-part-ok-proof-proves-var-case ((flg ≠ 1) ∧ (exp ≃ nil) ∧ ev-hyps (given, defns, symbols) ∧ if flg = 1 then ¬ btmp (ev (1, exp, va, fa, n))

else ¬ btmp (ev (flg, exp, va, fa, n)) endif ∧ (concl = a-ev-defn-part (flg,

exp, va, fa, ncode (ev (flg, exp, va, fa, n)), graph-trans (ev-graph (flg, exp, va, fa, n)))))

→ proves (a-ev-defn-part-ok-proof (flg, exp, va, fa, n), concl, given, defns, symbols)

Theorem: collect-free-var-list var-list (vlist, length (vlist)) → (collect-free (vlist, 1) = append (vlist, nil))

Definition: graph-trans-append-proof (x, y, z, exp, pf1 , pf2 ) = if listp (y)

then graph-trans-merge-proof (car (y), append (cdr (y), z), x, exp, chain-proof (f-equal (x, ncode (car (y))),

exp, list (isin (x, graph-trans (y))), list (tautconseq-proof (list (f-implies (f-equal (x,

ncode (car (y))), f-equal (ncode (car (y)), x)),

f-equal (graph-trans (y),

graph-trans (y)), isin (ncode (car (y)),

graph-trans (y)), f-implies (f-equal (ncode (car (y)),

x), f-implies (f-equal (graph-trans (y),

graph-trans (y)), f-implies (isin (ncode (car (y)),

graph-trans (y)), isin (x,

graph-trans (y)))))),

f-implies (f-equal (x,

ncode (car (y))), isin (x,

graph-trans (y))),

list (symmetry-proof1 (x,

ncode (car (y))),

ident-axiom-proof (graph-trans (y)), in-graph-proof (car (y),

y),

equal-axiom2-proof (p (1,

2), list (ncode (car (y)),

graph-trans (y)), list (x,

graph-trans (y))))),

pf1 )),

graph-trans-append-proof (x, cdr (y), z, exp, chain-proof (isin (x,

graph-trans (cdr (y))), exp, list (isin (x,

graph-trans (y))), list (tautconseq-proof (list (f-implies (f-or (f-equal (x,

ncode (car (y))), isin (x,

graph-trans (cdr (y)))),

isin (x,

graph-trans (y)))),

f-implies (isin (x,

graph-trans (cdr (y))), isin (x,

graph-trans (y))),

list (iff-split-proof2 (isin (x,

graph-trans (y)), f-or (f-equal (x,

ncode (car (y))), isin (x,

graph-trans (cdr (y)))),

in-graph-trans-proof (x, car (y), cdr (y))))),

pf1 )),

pf2 ))

else pf2 endif

Theorem: graph-trans-append-proof-proves (subset (list (p (1, 2), fn (0, 0), fn (1, 2), fn (2, 2), fn (3, 1)), symbols) ∧ termp (x, 0, symbols) ∧ formula (exp, symbols) ∧ proves (pf1 , f-implies (isin (x, graph-trans (y)), exp), given, defns, symbols) ∧ proves (pf2 , f-implies (isin (x, graph-trans (z)), exp), given, defns, symbols) ∧ (trace = graph-trans (append (y, z)))) → proves (graph-trans-append-proof (x, y, z, exp, pf1 , pf2 ),

f-implies (isin (x, trace), exp), given, Event: Enable graph-trans-append-proof; name this event ‘g0888’.

;;;;;;;Since we will be manipulating large if-trees with expressions containing
;;;;;;; "in", "forall", "^", "->", and so on, so we introduce symbols (shells) for them.

Event: Add the shell s-isin, with recognizer function symbol s-isinp and 2 accessors: s-elem, with type restriction (none-of) and default value zero; s-set, with type restriction (none-of) and default value zero.

Event: Add the shell s-and, with recognizer function symbol s-andp and 2 accessors: s-conj1 , with type restriction (none-of) and default value zero; sconj2 , with type restriction (none-of) and default value zero.

Event: Add the shell s-implies, with recognizer function symbol s-impliesp and 2 accessors: s-prem, with type restriction (none-of) and default value zero; s-conc, with type restriction (none-of) and default value zero.

Event: Add the shell s-forall, with recognizer function symbol s-forallp and 2 accessors: s-bind, with type restriction (one-of numberp) and default value zero; s-body, with type restriction (none-of) and default value zero.

Definition: weaken-isin (form1 , form2 , gr1 , gr2 ) = if z-ifp (form1 ) ∧ z-ifp (form2 )

then (z-test (form1 ) = z-test (form2 ))

∧ weaken-isin (z-left (form1 ), z-left (form2 ), gr1 , gr2 ) ∧ weaken-isin (z-right (form1 ), z-right (form2 ), gr1 , gr2 )

elseif forsomep (form1 ) ∧ forsomep (form2 )

then (bind (form1 ) = bind (form2 ))

∧ weaken-isin (body (form1 ), body (form2 ), gr1 , gr2 ) elseif s-forallp (form1 ) ∧ s-forallp (form2 ) then (s-bind (form1 ) = s-bind (form2 ))

∧ weaken-isin (s-body (form1 ), s-body (form2 ), gr1 , gr2 ) elseif s-andp (form1 ) ∧ s-andp (form2 ) then weaken-isin (s-conj1 (form1 ), s-conj1 (form2 ), gr1 , gr2 )

∧ weaken-isin (s-conj2 (form1 ), s-conj2 (form2 ), gr1 , gr2 ) elseif s-impliesp (form1 ) ∧ s-impliesp (form2 ) then (s-prem (form1 ) = s-prem (form2 ))

∧ weaken-isin (s-conc (form1 ), s-conc (form2 ), gr1 , gr2 ) elseif s-isinp (form1 ) ∧ s-isinp (form2 ) then (s-elem (form1 ) = s-elem (form2 ))

∧ (s-set (form1 ) = graph-trans (gr2 ))

∧ (s-set (form2 ) = graph-trans (cons (gr1 , gr2 ))) else form1 = form2 endif

Definition: make-form-symb (exp) = if z-ifp (exp)

then f-if (z-test (exp), make-form-symb (z-left (exp)), make-form-symb (z-right (exp)))

elseif forsomep (exp) then forsome (bind (exp), make-form-symb (body (exp))) elseif s-forallp (exp) then ∀ s-bind, exp make-form-symb (s-body (exp)) elseif s-andp (exp) then f-and (make-form-symb (s-conj1 (exp)), make-form-symb (s-conj2 (exp))) elseif s-impliesp (exp) then f-implies (s-prem (exp), make-form-symb (s-conc (exp))) elseif s-isinp (exp) then isin (s-elem (exp), s-set (exp)) else exp endif

Definition: weaken-isin-proof (form1 , form2 , gr1 , gr2 ) = if z-ifp (form1 ) ∧ z-ifp (form2 )

then tautconseq-proof (list (f-implies (make-form-symb (z-left (form1 )),

make-form-symb (z-left (form2 ))),

f-implies (make-form-symb (z-right (form1 )),

make-form-symb (z-right (form2 )))),

f-implies (make-form-symb (form1 ),

make-form-symb (form2 )),

list (weaken-isin-proof (z-left (form1 ), z-left (form2 ), gr1 , gr2 ),

weaken-isin-proof (z-right (form1 ), z-right (form2 ), gr1 , gr2 )))

elseif forsomep (form1 ) ∧ forsomep (form2 ) then distrib-rule-proof-a (bind (form2 ),

make-form-symb (body (form1 )), make-form-symb (body (form2 )), weaken-isin-proof (body (form1 ), body (form2 ), gr1 , gr2 ))

elseif s-forallp (form1 ) ∧ s-forallp (form2 ) then distrib-rule-proof-b (s-bind (form2 ),

make-form-symb (s-body (form1 )), make-form-symb (s-body (form2 )), weaken-isin-proof (s-body (form1 ),

s-body (form2 ), gr1 , gr2 ))

elseif s-andp (form1 ) ∧ s-andp (form2 ) then tautconseq-proof (list (f-implies (make-form-symb (s-conj1 (form1 )),

make-form-symb (s-conj1 (form2 ))),

f-implies (make-form-symb (s-conj2 (form1 )),

make-form-symb (s-conj2 (form2 )))),

f-implies (make-form-symb (form1 ),

make-form-symb (form2 )),

list (weaken-isin-proof (s-conj1 (form1 ), s-conj1 (form2 ), gr1 , gr2 ),

weaken-isin-proof (s-conj2 (form1 ), s-conj2 (form2 ), gr1 , gr2 )))

elseif s-impliesp (form1 ) ∧ s-impliesp (form2 ) then tautconseq-proof (list (f-implies (make-form-symb (s-conc (form1 )),

make-form-symb (s-conc (form2 )))),

f-implies (make-form-symb (form1 ),

make-form-symb (form2 )),

list (weaken-isin-proof (s-conc (form1 ), s-conc (form2 ), gr1 , gr2 )))

elseif s-isinp (form1 ) ∧ s-isinp (form2 ) then in-graph-cdr-proof (s-elem (form2 ), gr1 , gr2 ) else tautconseq-proof (nil, f-implies (form1 , form2 ), nil) endif

Definition: form-symb1 (exp, symbols) = if z-ifp (exp)

then formula (z-test (exp), symbols)

∧ form-symb1 (z-left (exp), symbols)

∧ form-symb1 (z-right (exp), symbols) elseif forsomep (exp) then form-symb1 (body (exp), symbols) elseif s-forallp (exp) then form-symb1 (s-body (exp), symbols) elseif s-andp (exp) then form-symb1 (s-conj1 (exp), symbols)

∧ form-symb1 (s-conj2 (exp), symbols) elseif s-impliesp (exp) then formula (s-prem (exp), symbols)

∧ form-symb1 (s-conc (exp), symbols) elseif s-isinp (exp) then (p (1, 2) ∈ symbols)

∧ termp (s-elem (exp), 0, symbols) ∧ termp (s-set (exp), 0, symbols)

else formula (exp, symbols) endif

Theorem: formula-make-form-symb form-symb1 (exp, symbols) → formula (make-form-symb (exp), symbols)

Theorem: weaken-isin-proof-proves (subset (list (p (1, 2), fn (0, 0), fn (1, 2), fn (2, 2), fn (3, 1)), symbols) ∧ form-symb1 (form1 , symbols) ∧ form-symb1 (form2 , symbols) ∧ weaken-isin (form1 , form2 , gr1 , gr2 ) ∧ (concl = f-implies (make-form-symb (form1 ), make-form-symb (form2 )))) → proves (weaken-isin-proof (form1 , form2 , gr1 , gr2 ),

concl, given, defns, symbols)

Event: Enable weaken-isin-proof; name this event ‘g0859’.

Definition: in-append-graph-proof1 (x, gr1 , gr2 ) = if listp (gr1 )

then tautconseq-proof (list (f-implies (isin (x, graph-trans (gr1 )),

f-or (f-equal (x, ncode (car (gr1 ))),

isin (x,

graph-trans (cdr (gr1 ))))),

f-implies (f-equal (x, ncode (car (gr1 ))),

isin (x,

graph-trans (append (gr1 , gr2 )))),

f-implies (isin (x, graph-trans (cdr (gr1 ))), isin (x, graph-trans (append (cdr (gr1 ),

gr2 )))),

f-implies (isin (x,

graph-trans (append (cdr (gr1 ),

gr2 ))),

isin (x,

graph-trans (append (gr1 , gr2 ))))),

f-implies (isin (x, graph-trans (gr1 )),

isin (x, graph-trans (append (gr1 , gr2 )))),

list (iff-split-proof1 (isin (x, graph-trans (gr1 )),

f-or (f-equal (x,

ncode (car (gr1 ))), isin (x,

graph-trans (cdr (gr1 )))),

in-graph-trans-proof (x, car (gr1 ), cdr (gr1 ))),

tautconseq-proof (list (f-implies (f-or (f-equal (x,

ncode (car (gr1 ))), isin (x,

graph-trans (append (cdr (gr1 ),

gr2 )))),

isin (x,

graph-trans (cons (car (gr1 ),

append (cdr (gr1 ),

gr2 )))))),

f-implies (f-equal (x,

ncode (car (gr1 ))), isin (x,

graph-trans (cons (car (gr1 ),

append (cdr (gr1 ),

gr2 ))))),

list (iff-split-proof2 (isin (x,

graph-trans (cons (car (gr1 ),

append (cdr (gr1 ),

gr2 )))),

f-or (f-equal (x,

ncode (car (gr1 ))), isin (x,

graph-trans (append (cdr (gr1 ),

gr2 )))),

in-graph-trans-proof (x, car (gr1 ), append (cdr (gr1 ),

gr2 ))))),

in-append-graph-proof1 (x, cdr (gr1 ), gr2 ), in-graph-cdr-proof (x,

car (gr1 ),

append (cdr (gr1 ), gr2 ))))

else tautconseq-proof (list (f-not (isin (x, graph-trans (gr1 )))),

f-implies (isin (x, graph-trans (gr1 )),

isin (x,

graph-trans (append (gr1 , gr2 )))),

list (null-axiom-proof (x))) endif

;;;;;;;Let "(X|Y)" denote (APPEND X Y).  Then |- "((x in Y) -> (x in (Y|Z)))".

Theorem: in-append-graph-proof1-proves (subset (list (p (1, 2), fn (0, 0), fn (1, 2), fn (2, 2), fn (3, 1)), symbols) ∧ termp (x, 0, symbols)) → proves (in-append-graph-proof1 (x, gr1 , gr2 ),

f-implies (isin (x, graph-trans (gr1 )),

isin (x, graph-trans (append (gr1 , gr2 )))),

given, defns, symbols)

Event: Enable in-append-graph-proof1; name this event ‘g0860’.

Definition: in-append-graph-proof2 (x, gr1 , gr2 ) = if listp (gr1 )

then tautconseq-proof (list (f-implies (isin (x, graph-trans (gr2 )),

isin (x,

graph-trans (append (cdr (gr1 ),

gr2 )))),

f-implies (isin (x,

graph-trans (append (cdr (gr1 ),

gr2 ))),

isin (x,

graph-trans (append (gr1 , gr2 ))))),

f-implies (isin (x, graph-trans (gr2 )),

isin (x, graph-trans (append (gr1 , gr2 )))),

list (in-append-graph-proof2 (x, cdr (gr1 ), gr2 ),

in-graph-cdr-proof (x, car (gr1 ), append (cdr (gr1 ), gr2 ))))

else tautconseq-proof (nil, f-implies (isin (x, graph-trans (gr2 )),

isin (x,

graph-trans (append (gr1 , gr2 )))),

nil) endif

;;;;;;; |- "((x in Z) -> (x in (Y|Z)))".

Theorem: in-append-graph-proof2-proves (subset (list (p (1, 2), fn (0, 0), fn (1, 2), fn (2, 2), fn (3, 1)), symbols) ∧ termp (x, 0, symbols)) → proves (in-append-graph-proof2 (x, gr1 , gr2 ),

f-implies (isin (x, graph-trans (gr2 )),

isin (x, graph-trans (append (gr1 , gr2 )))),

given, defns, symbols)

Event: Enable in-append-graph-proof2; name this event ‘g0861’.

Definition: weaken-append1 (form1 , form2 , y, gr1 , gr2 ) = if z-ifp (form1 ) ∧ z-ifp (form2 )

then (z-test (form1 ) = z-test (form2 ))

∧ (z-test (form2 ) = z-test (form2 ))

∧ weaken-append1 (z-left (form1 ), z-left (form2 ), y, gr1 , gr2 ) ∧ weaken-append1 (z-right (form1 ), z-right (form2 ), y, gr1 , gr2 )

elseif forsomep (form1 ) ∧ forsomep (form2 ) then (bind (form1 ) = bind (form2 ))

∧ weaken-append1 (body (form1 ), body (form2 ), y, gr1 , gr2 ) elseif s-forallp (form1 ) ∧ s-forallp (form2 ) then (s-bind (form1 ) = s-bind (form2 ))

∧ weaken-append1 (s-body (form1 ), s-body (form2 ), y, gr1 , gr2 ) elseif s-andp (form1 ) ∧ s-andp (form2 ) then weaken-append1 (s-conj1 (form1 ), s-conj1 (form2 ), y, gr1 , gr2 )

∧ weaken-append1 (s-conj2 (form1 ), s-conj2 (form2 ), y, gr1 , gr2 ) elseif s-impliesp (form1 ) ∧ s-impliesp (form2 ) then (s-prem (form1 ) = s-prem (form2 ))

∧ weaken-append1 (s-conc (form1 ), s-conc (form2 ), y, gr1 , gr2 ) elseif s-isinp (form1 ) ∧ s-isinp (form2 ) then (s-elem (form1 ) = s-elem (form2 ))

∧ (s-set (form1 ) = graph-trans (gr1 ))

∧ (s-set (form2 ) = graph-trans (cons (y, append (gr1 , gr2 )))) else form1 = form2 endif Definition: weaken-append2 (form1 , form2 , y, gr1 , gr2 ) = if z-ifp (form1 ) ∧ z-ifp (form2 )

then (z-test (form1 ) = z-test (form2 ))

∧ (z-test (form2 ) = z-test (form2 ))

∧ weaken-append2 (z-left (form1 ), z-left (form2 ), y, gr1 , gr2 ) ∧ weaken-append2 (z-right (form1 ), z-right (form2 ), y, gr1 , gr2 )

elseif forsomep (form1 ) ∧ forsomep (form2 ) then (bind (form1 ) = bind (form2 ))

∧ weaken-append2 (body (form1 ), body (form2 ), y, gr1 , gr2 ) elseif s-forallp (form1 ) ∧ s-forallp (form2 ) then (s-bind (form1 ) = s-bind (form2 ))

∧ weaken-append2 (s-body (form1 ), s-body (form2 ), y, gr1 , gr2 ) elseif s-andp (form1 ) ∧ s-andp (form2 ) then weaken-append2 (s-conj1 (form1 ), s-conj1 (form2 ), y, gr1 , gr2 )

∧ weaken-append2 (s-conj2 (form1 ), s-conj2 (form2 ), y, gr1 , gr2 ) elseif s-impliesp (form1 ) ∧ s-impliesp (form2 ) then (s-prem (form1 ) = s-prem (form2 ))

∧ weaken-append2 (s-conc (form1 ), s-conc (form2 ), y, gr1 , gr2 ) elseif s-isinp (form1 ) ∧ s-isinp (form2 ) then (s-elem (form1 ) = s-elem (form2 ))

∧ (s-set (form1 ) = graph-trans (gr2 ))

∧ (s-set (form2 ) = graph-trans (cons (y, append (gr1 , gr2 )))) else form1 = form2 endif

Definition: weaken-append1-proof (form1 , form2 , y, gr1 , gr2 ) = if z-ifp (form1 ) ∧ z-ifp (form2 )

then tautconseq-proof (list (f-implies (make-form-symb (z-left (form1 )),

make-form-symb (z-left (form2 ))),

f-implies (make-form-symb (z-right (form1 )),

make-form-symb (z-right (form2 )))),

f-implies (make-form-symb (form1 ),

make-form-symb (form2 )), list (weaken-append1-proof (z-left (form1 ),

z-left (form2 ), y, gr1 , gr2 ),

weaken-append1-proof (z-right (form1 ), z-right (form2 ), y, gr1 , gr2 ))) elseif forsomep (form1 ) ∧ forsomep (form2 ) then distrib-rule-proof-a (bind (form2 ),

make-form-symb (body (form1 )), make-form-symb (body (form2 )), weaken-append1-proof (body (form1 ),

body (form2 ), y, gr1 , gr2 ))

elseif s-forallp (form1 ) ∧ s-forallp (form2 ) then distrib-rule-proof-b (s-bind (form2 ),

make-form-symb (s-body (form1 )), make-form-symb (s-body (form2 )), weaken-append1-proof (s-body (form1 ),

s-body (form2 ), y, gr1 , gr2 ))

elseif s-andp (form1 ) ∧ s-andp (form2 ) then tautconseq-proof (list (f-implies (make-form-symb (s-conj1 (form1 )),

make-form-symb (s-conj1 (form2 ))),

f-implies (make-form-symb (s-conj2 (form1 )),

make-form-symb (s-conj2 (form2 )))),

f-implies (make-form-symb (form1 ),

make-form-symb (form2 )),

list (weaken-append1-proof (s-conj1 (form1 ), s-conj1 (form2 ), y, gr1 , gr2 ),

weaken-append1-proof (s-conj2 (form1 ), s-conj2 (form2 ), y, gr1 , gr2 )))

elseif s-impliesp (form1 ) ∧ s-impliesp (form2 ) then tautconseq-proof (list (f-implies (make-form-symb (s-conc (form1 )),

make-form-symb (s-conc (form2 )))),

f-implies (make-form-symb (form1 ),

make-form-symb (form2 )),

list (weaken-append1-proof (s-conc (form1 ), s-conc (form2 ), y, gr1 ,

gr2 )))

elseif s-isinp (form1 ) ∧ s-isinp (form2 ) then chain-proof (isin (s-elem (form2 ), graph-trans (gr1 )),

isin (s-elem (form2 ),

graph-trans (cons (y, append (gr1 , gr2 )))), list (isin (s-elem (form2 ), graph-trans (append (gr1 , gr2 )))), list (in-append-graph-proof1 (s-elem (form2 ), gr1 , gr2 ),

in-graph-cdr-proof (s-elem (form2 ), y, append (gr1 , gr2 ))))

else tautconseq-proof (nil, f-implies (form1 , form2 ), nil) endif

Definition: weaken-append2-proof (form1 , form2 , y, gr1 , gr2 ) = if z-ifp (form1 ) ∧ z-ifp (form2 )

then tautconseq-proof (list (f-implies (make-form-symb (z-left (form1 )),

make-form-symb (z-left (form2 ))),

f-implies (make-form-symb (z-right (form1 )),

make-form-symb (z-right (form2 )))),

f-implies (make-form-symb (form1 ),

make-form-symb (form2 )),

list (weaken-append2-proof (z-left (form1 ), z-left (form2 ), y, gr1 , gr2 ),

weaken-append2-proof (z-right (form1 ), z-right (form2 ), y, gr1 , gr2 )))

elseif forsomep (form1 ) ∧ forsomep (form2 ) then distrib-rule-proof-a (bind (form2 ),

make-form-symb (body (form1 )), make-form-symb (body (form2 )), weaken-append2-proof (body (form1 ),

body (form2 ), y, gr1 , gr2 ))

elseif s-forallp (form1 ) ∧ s-forallp (form2 ) then distrib-rule-proof-b (s-bind (form2 ),

make-form-symb (s-body (form1 )), make-form-symb (s-body (form2 )), weaken-append2-proof (s-body (form1 ),

s-body (form2 ), y, gr1 , gr2 ))

elseif s-andp (form1 ) ∧ s-andp (form2 ) then tautconseq-proof (list (f-implies (make-form-symb (s-conj1 (form1 )),

make-form-symb (s-conj1 (form2 ))),

f-implies (make-form-symb (s-conj2 (form1 )),

make-form-symb (s-conj2 (form2 )))),

f-implies (make-form-symb (form1 ),

make-form-symb (form2 )),

list (weaken-append2-proof (s-conj1 (form1 ), s-conj1 (form2 ), y, gr1 , gr2 ),

weaken-append2-proof (s-conj2 (form1 ), s-conj2 (form2 ), y, gr1 , gr2 )))

elseif s-impliesp (form1 ) ∧ s-impliesp (form2 ) then tautconseq-proof (list (f-implies (make-form-symb (s-conc (form1 )),

make-form-symb (s-conc (form2 )))),

f-implies (make-form-symb (form1 ),

make-form-symb (form2 )),

list (weaken-append2-proof (s-conc (form1 ), s-conc (form2 ), y, gr1 , gr2 )))

elseif s-isinp (form1 ) ∧ s-isinp (form2 ) then chain-proof (isin (s-elem (form2 ), graph-trans (gr2 )),

isin (s-elem (form2 ),

graph-trans (cons (y, append (gr1 , gr2 )))), list (isin (s-elem (form2 ), graph-trans (append (gr1 , gr2 )))), list (in-append-graph-proof2 (s-elem (form2 ), gr1 , gr2 ),

in-graph-cdr-proof (s-elem (form2 ), y, append (gr1 , gr2 ))))

else tautconseq-proof (nil, f-implies (form1 , form2 ), nil) endif

Theorem: weaken-append1-proof-proves (subset (list (p (1, 2), fn (0, 0), fn (1, 2), fn (2, 2), fn (3, 1)), symbols) ∧ form-symb1 (form1 , symbols) ∧ form-symb1 (form2 , symbols) ∧ weaken-append1 (form1 , form2 , y, gr1 , gr2 ) ∧ (concl = f-implies (make-form-symb (form1 ), make-form-symb (form2 )))) → proves (weaken-append1-proof (form1 , form2 , y, gr1 , gr2 ),

concl, given, defns, symbols)

Event: Enable weaken-append1-proof; name this event ‘g0862’.

Theorem: weaken-append2-proof-proves (subset (list (p (1, 2), fn (0, 0), fn (1, 2), fn (2, 2), fn (3, 1)), symbols) ∧ form-symb1 (form1 , symbols) ∧ form-symb1 (form2 , symbols) ∧ weaken-append2 (form1 , form2 , y, gr1 , gr2 ) ∧ (concl = f-implies (make-form-symb (form1 ), make-form-symb (form2 )))) → proves (weaken-append2-proof (form1 , form2 , y, gr1 , gr2 ),

concl, given, defns, symbols)

Event: Enable weaken-append2-proof; name this event ‘g0863’.

Definition: a-ev-defn-ok-frame-proof2 (formals,

y, gr1 , gr2 , defn-part, defn-part-form, rec1-defn-part, rec1-form, rec2-defn-part, rec2-form, defn-pf , recpf1 , recpf2 )

= graph-trans-merge-proof (y, append (gr1 , gr2 ), formals, defn-part, defn-pf , graph-trans-append-proof (formals,

gr1 , gr2 , defn-part, chain-proof (isin (formals,

graph-trans (gr1 )), defn-part, list (rec1-defn-part), list (recpf1 ,

weaken-append1-proof (rec1-form, defn-part-form, y, gr1 , gr2 ))),

chain-proof (isin (formals,

graph-trans (gr2 )), defn-part, list (rec2-defn-part), list (recpf2 ,

weaken-append2-proof (rec2-form, defn-part-form, y, gr1 , gr2 )))))

Theorem: a-ev-defn-ok-frame-proof2-proves (subset (list (p (1, 2), fn (0, 0), fn (1, 2), fn (2, 2), fn (3, 1)), symbols) ∧ (graph = cons (y, append (gr1 , gr2 ))) ∧ form-symb1 (defn-part-form, symbols) ∧ form-symb1 (rec1-form, symbols) ∧ form-symb1 (rec2-form, symbols) ∧ (defn-part = make-form-symb (defn-part-form)) ∧ (rec1-defn-part = make-form-symb (rec1-form)) ∧ (rec2-defn-part = make-form-symb (rec2-form)) ∧ weaken-append1 (rec1-form, defn-part-form, y, gr1 , gr2 ) ∧ weaken-append2 (rec2-form, defn-part-form, y, gr1 , gr2 ) ∧ proves (defn-pf ,

f-implies (f-equal (formals, ncode (y)), defn-part), given, defns, symbols)

∧ proves (recpf1 , f-implies (isin (formals, graph-trans (gr1 )), rec1-defn-part), given, defns, symbols)

∧ proves (recpf2 , f-implies (isin (formals, graph-trans (gr2 )), rec2-defn-part), given, defns, symbols))

→ proves (a-ev-defn-ok-frame-proof2 (formals, y, gr1 , gr2 , defn-part, defn-part-form, rec1-defn-part, rec1-form, rec2-defn-part, rec2-form, defn-pf , recpf1 , recpf2 ),

f-implies (isin (formals, graph-trans (graph)), defn-part), given, defns, symbols)

Event: Enable a-ev-defn-ok-frame-proof2; name this event ‘g0864’.

(DEFN
A-EV-SYMB-FORM
(FLG EXP VA FA VAL TRACE)
(Z-IF
(F-EQUAL FLG (NCODE 1))
(Z-IF (F-EQUAL (Z-LISTP EXP) (NCODE 1))
(FORSOME 11
(FORSOME 12
(S-AND (S-ISIN (Z-LIST (LIST 11 (NCODE 0) (Z-CAR EXP) VA FA)) TRACE)
(S-AND (S-ISIN (Z-LIST (LIST 12 (NCODE 1) (Z-CDR EXP) VA FA))
              TRACE)
      (F-EQUAL VAL (Z-OPAIR 11 12))))))
(F-EQUAL VAL (NCODE NIL)))

(Z-IF
(F-EQUAL (Z-LISTP EXP) (NCODE 1))
(Z-IF
(F-EQUAL (Z-ZEROP (Z-CAR EXP)) (NCODE 1))
(FORSOME 11
(S-AND (S-ISIN (Z-LIST (LIST 11 (NCODE 0) (Z-CAR (Z-CDR EXP)) VA FA)) TRACE)
(Z-IF (F-EQUAL 11 (NCODE 0))
(S-ISIN (Z-LIST (LIST VAL
(NCODE 0)
(Z-CAR-CDR EXP (LIST 1 2 2 2))
VA
FA))
TRACE)
(S-ISIN (Z-LIST (LIST VAL
(NCODE 0)
(Z-CAR-CDR EXP (LIST 1 2 2))
VA
FA))
TRACE))))
(Z-IF
(F-EQUAL (Z-CAR EXP) (NCODE 10))
(F-EQUAL VAL (Z-CAR-CDR EXP (LIST 1 2)))
(Z-IF
(F-EQUAL (Z-SUBRP (Z-CAR EXP)) (NCODE 1))
(FORSOME 11
(S-AND (S-ISIN (Z-LIST (LIST 11 (NCODE 1) (Z-CDR EXP) VA FA)) TRACE)
(F-EQUAL VAL (Z-APPLY-SUBR (Z-CAR EXP) 11))))
(FORSOME 11
(S-FORALL 15
(S-FORALL 16
(S-AND (S-ISIN (Z-LIST (LIST 11
                (NCODE 1)
                (Z-CDR EXP)
                VA
                FA))
  TRACE)
(S-IMPLIES (A-GET (Z-SUB1-N (Z-CAR EXP) 11)
            FA
            15
            11
            13
            14
            16)
     (S-ISIN (Z-LIST (LIST VAL

(NCODE 0)
15
11
FA))
TRACE)))))))))
(A-GET1 EXP VA VAL 11 13 14 16))))

Definition: a-ev-defn-part1 (flg, exp, va, fa, val, trace) = f-if (f-equal (flg, ncode (1)),

f-if (f-equal (z-listp (exp), ncode (1)),

forsome (11,

forsome (12,

f-and (isin (z-list (list (11, ncode (0), z-car (exp), va, fa)),

trace), f-and (isin (z-list (list (12,

ncode (1), z-cdr (exp), va, fa)),

trace), f-equal (val, z-opair (11, 12)))))),

f-equal (val, ncode (nil))), f-if (f-equal (z-listp (exp), ncode (1)),

f-if (f-equal (z-zerop (z-car (exp)), ncode (1)),

forsome (11,

f-and (isin (z-list (list (11, ncode (0), z-car (z-cdr (exp)), va, fa)),

trace), f-if (f-equal (11, ncode (0)),

isin (z-list (list (val, ncode (0), z-car-cdr (exp,

list (1,

2,
2,

2)), va, fa)),

trace), isin (z-list (list (val,

ncode (0), z-car-cdr (exp,

list (1,

            2,

2)),

va, fa)),

trace)))),

f-if (f-equal (z-car (exp), ncode (10)), f-equal (val, z-car-cdr (exp, list (1, 2))), f-if (f-equal (z-subrp (z-car (exp)), ncode (1)),

forsome (11,

f-and (isin (z-list (list (11, ncode (1), z-cdr (exp), va, fa)),

trace), f-equal (val,

z-apply-subr (z-car (exp),

11)))),

forsome (11,

∀ 15 ∀ 16 f-and (isin (z-list (list (11, ncode (1), z-cdr (exp), va, fa)),

trace), f-implies (a-get (z-sub1-n (z-car (exp),

                    11),

fa,

            15,
            11,
            13,
            14,
            16),

isin (z-list (list (val, ncode (0),

                    15,
                    11,

fa)),

trace))))))),

a-get1 (exp, va, val, 11, 13, 14, 16)))

Theorem: a-ev-symb-form-a-ev-defn-part make-form-symb (a-ev-symb-form (ncode (flg),

ncode (exp), ncode (va), ncode (fa), val, trace))

= a-ev-defn-part (flg, exp, va, fa, val, trace)

Theorem: weaken-append2-a-ev-defn-part weaken-append2 (a-ev-symb-form (flg, exp, va, fa, val, graph-trans (gr2 )),

a-ev-symb-form (flg, exp, va, fa, val, graph-trans (cons (y, append (gr1 , gr2 )))),

y, gr1 , gr2 )

Theorem: weaken-append1-a-ev-defn-part weaken-append1 (a-ev-symb-form (flg, exp, va, fa, val, graph-trans (gr1 )),

a-ev-symb-form (flg, exp, va, fa, val, graph-trans (cons (y, append (gr1 , gr2 )))),

y, gr1 , gr2 )

Definition: a-ev-inst-formals-proof (flg, exp, va, fa, n) = inst-formals-proof (list (10, 6, 7, 8, 9),

list (ncode (ev (flg, exp, va, fa, n)), ncode (flg), ncode (exp), ncode (va), ncode (fa)), a-ev-defn-part1 (6,

                   7,
                   8,
                   9,
                   10,

graph-trans (ev-graph (flg, exp, va, fa, n))),

a-ev-defn-part-ok-proof (flg, exp, va, fa, n))

Theorem: form-symb1-a-ev-symb-form (termp (list (flg, exp, va, fa, val, trace), 1, symbols) ∧ subset (list (p (1, 2),

fn (0, 0), fn (1, 2), fn (2, 2), fn (3, 1), fn (6, 1), fn (10, 1), fn (16, 1), fn (15, 2), fn (9, 1), fn (4, 1), fn (5, 1)),

symbols))

→ form-symb1 (a-ev-symb-form (flg, exp, va, fa, val, trace), symbols)

Theorem: formula-a-ev-defn-part1 (subset (list (p (1, 2),

fn (0, 0), fn (1, 2), fn (2, 2), fn (3, 1), fn (6, 1), fn (10, 1), fn (16, 1), fn (15, 2), fn (9, 1), fn (4, 1), fn (5, 1)),

symbols) ∧ termp (list (flg, exp, va, fa, val, trace), 1, symbols)) → formula (a-ev-defn-part1 (flg, exp, va, fa, val, trace), symbols)

Theorem: formula-a-ev-defn-part (subset (list (p (1, 2),

fn (0, 0), fn (1, 2), fn (2, 2), fn (3, 1), fn (6, 1), fn (10, 1), fn (16, 1), fn (15, 2), fn (9, 1), fn (4, 1), fn (5, 1)),

symbols) ∧ termp (list (val, trace), 1, symbols)) → formula (a-ev-defn-part (flg, exp, va, fa, val, trace), symbols)

Theorem: parallel-subst-a-ev-defn-part1 parallel-subst (a-ev-defn-part1 (6, 7, 8, 9, 10, graph-trans (graph)),

list (10, 6, 7, 8, 9),

list (val, ncode (flg), ncode (exp), ncode (va), ncode (fa)),

  0)

= a-ev-defn-part (flg, exp, va, fa, val, graph-trans (graph))

Event: Enable a-ev-defn-part1; name this event ‘g0865’.

Event: Enable a-ev-defn-part; name this event ‘g0866’.

Theorem: termp-z-opair-case subset (list (p (1, 2), fn (0, 0), fn (1, 2), fn (2, 2), fn (3, 1)), symbols) → (termp (z-opair (x, y), 0, symbols)

= (termp (x, 0, symbols) ∧ termp (y, 0, symbols)))

Theorem: graph-trans-merge-again (subset (list (p (1, 2), fn (0, 0), fn (1, 2), fn (2, 2), fn (3, 1)), symbols) ∧ proves (pf1 ,

f-implies (f-equal (exp1 , ncode (x)), exp2 ), given, defns, symbols)

∧ proves (pf2 , f-implies (isin (exp1 , graph-trans (y)), exp2 ), given, defns,

symbols))

→ proves (graph-trans-merge-proof (x, y, exp1 , exp2 , pf1 , pf2 ), f-implies (isin (exp1 , graph-trans (cons (x, y))), exp2 ), given, defns, symbols)

Event: Enable graph-trans-merge; name this event ‘g0867’.

Definition: a-ev-defn-ok-frame-proof3 (formals,

y, gr, defn-part, defn-part-form, rec-defn-part, rec-form, defn-pf , recpf )

= graph-trans-merge-proof (y, gr, formals, defn-part, defn-pf , chain-proof (isin (formals, graph-trans (gr)),

defn-part,

list (rec-defn-part), list (recpf ,

weaken-isin-proof (rec-form, defn-part-form, y, gr))))

Theorem: a-ev-defn-ok-frame-proof3-proves (subset (list (p (1, 2), fn (0, 0), fn (1, 2), fn (2, 2), fn (3, 1)), symbols) ∧ (graph = cons (y, gr)) ∧ form-symb1 (defn-part-form, symbols) ∧ form-symb1 (rec-form, symbols) ∧ (defn-part = make-form-symb (defn-part-form)) ∧ (rec-defn-part = make-form-symb (rec-form)) ∧ weaken-isin (rec-form, defn-part-form, y, gr) ∧ proves (defn-pf ,

f-implies (f-equal (formals, ncode (y)), defn-part), given, defns, symbols)

∧ proves (recpf , f-implies (isin (formals, graph-trans (gr)), rec-defn-part), given, defns, symbols))

→ proves (a-ev-defn-ok-frame-proof3 (formals, y, gr, defn-part, defn-part-form, rec-defn-part, rec-form, defn-pf , recpf ), f-implies (isin (formals, graph-trans (graph)), defn-part), given, defns, symbols)

Event: Enable a-ev-defn-ok-frame-proof3; name this event ‘g0869’.

Theorem: weaken-isin-a-ev-defn-part weaken-isin (a-ev-symb-form (flg, exp, va, fa, val, graph-trans (gr)),

a-ev-symb-form (flg, exp, va, fa, val, graph-trans (cons (y, gr))), y, gr)

Theorem: term-ncode-case subset (list (p (1, 2), fn (0, 0), fn (1, 2), fn (2, 2), fn (3, 1)), symbols) → termp (ncode (x), 0, symbols)

Theorem: term-graph-trans-case subset (list (p (1, 2), fn (0, 0), fn (1, 2), fn (2, 2), fn (3, 1)), symbols) → termp (graph-trans (x), 0, symbols)

Theorem: a-ev-symb-form-a-ev-defn-part1 make-form-symb (a-ev-symb-form (flg, exp, va, fa, val, trace)) = a-ev-defn-part1 (flg, exp, va, fa, val, trace)

Event: Enable a-ev-symb-form; name this event ‘g0890’.

Event: Enable a-ev-defn-part-ok-proof; name this event ‘g0891’.

Definition: a-ev-defn-ok-proof (flg, exp, va, fa, n, flg1 , exp1 , va1 , fa1 , val1 ) = if flg = 1

then if listp (exp)

then a-ev-defn-ok-frame-proof2 (z-list (list (val1 , flg1 , exp1 , va1 , fa1 )),

cons (ev (flg, exp, va, fa, n),

cons (flg,

cons (exp, cons (va, fa)))),

ev-graph (0, car (exp), va, fa, n), ev-graph (1, cdr (exp), va, fa, n), a-ev-defn-part1 (flg1 ,

exp1 , va1 , fa1 , val1 , graph-trans (ev-graph (flg,

exp, va, fa, n))),

a-ev-symb-form (flg1 , exp1 , va1 , fa1 , val1 , graph-trans (ev-graph (flg,

exp, va, fa, n))),

a-ev-defn-part1 (flg1 , exp1 , va1 , fa1 , val1 , graph-trans (ev-graph (0,

car (exp), va, fa, n))), a-ev-symb-form (flg1 ,

exp1 , va1 , fa1 , val1 , graph-trans (ev-graph (0,

car (exp), va, fa, n))),

a-ev-defn-part1 (flg1 , exp1 , va1 , fa1 , val1 , graph-trans (ev-graph (1,

cdr (exp), va, fa, n))),

a-ev-symb-form (flg1 , exp1 , va1 , fa1 , val1 , graph-trans (ev-graph (1,

cdr (exp), va, fa, n))),

a-ev-inst-formals-proof (flg, exp, va, fa, n),

a-ev-defn-ok-proof (0, car (exp), va, fa, n, flg1 , exp1 , va1 , fa1 ,

val1 ),

a-ev-defn-ok-proof (1, cdr (exp), va, fa, n, flg1 , exp1 , va1 , fa1 , val1 ))

else graph-trans-merge-proof (cons (ev (flg, exp, va, fa, n),

cons (flg,

cons (exp,

cons (va, fa)))),

nil, z-list (list (val1 ,

flg1 , exp1 , va1 , fa1 )),

a-ev-defn-part1 (flg1 , exp1 , va1 , fa1 , val1 , graph-trans (ev-graph (flg,

exp, va, fa, n))),

a-ev-inst-formals-proof (flg, exp, va, fa, n),

tautconseq-proof (list (f-not (isin (z-list (list (val1 , flg1 , exp1 , va1 , fa1 )),

graph-trans (nil)))),

f-implies (isin (z-list (list (val1 , flg1 , exp1 , va1 , fa1 )),

graph-trans (nil)), a-ev-defn-part1 (flg1 ,

exp1 , va1 , fa1 , val1 , graph-trans (ev-graph (flg,

exp, va, fa, n)))),

list (null-axiom-proof (z-list (list (val1 , flg1 , exp1 , va1 , fa1 )))))) endif

elseif listp (exp) then if car (exp) ≃ 0

then if ncode-equal (ev (0, cadr (exp), va, fa, n), 0)

then a-ev-defn-ok-frame-proof2 (z-list (list (val1 , flg1 , exp1 , va1 , fa1 )),

cons (ev (flg, exp, va, fa, n),

cons (flg,

cons (exp,

cons (va, fa)))),

ev-graph (0, cadr (exp), va, fa, n),

ev-graph (0, cadddr (exp), va, fa, n),

a-ev-defn-part1 (flg1 , exp1 , va1 , fa1 , val1 , graph-trans (ev-graph (flg,

exp, va, fa, n))),

a-ev-symb-form (flg1 , exp1 , va1 , fa1 , val1 , graph-trans (ev-graph (flg,

exp, va, fa, n))),

a-ev-defn-part1 (flg1 , exp1 , va1 , fa1 , val1 , graph-trans (ev-graph (0,

cadr (exp),

va, fa, n))),

a-ev-symb-form (flg1 , exp1 , va1 , fa1 , val1 , graph-trans (ev-graph (0,

cadr (exp), va, fa, n))),

a-ev-defn-part1 (flg1 , exp1 , va1 , fa1 , val1 , graph-trans (ev-graph (0,

cadddr (exp), va, fa, n))),

a-ev-symb-form (flg1 , exp1 , va1 , fa1 , val1 , graph-trans (ev-graph (0,

cadddr (exp), va, fa, n))),

a-ev-inst-formals-proof (flg, exp, va, fa, n),

a-ev-defn-ok-proof (0, cadr (exp), va, fa, n, flg1 , exp1 , va1 , fa1 , val1 ),

a-ev-defn-ok-proof (0, cadddr (exp), va, fa, n, flg1 , exp1 , va1 , fa1 , val1 ))

else a-ev-defn-ok-frame-proof2 (z-list (list (val1 , flg1 , exp1 , va1 , fa1 )),

cons (ev (flg, exp, va, fa, n),

cons (flg,

cons (exp,

cons (va,

fa)))),

ev-graph (0, cadr (exp), va, fa, n),

ev-graph (0, caddr (exp), va, fa, n),

a-ev-defn-part1 (flg1 , exp1 , va1 , fa1 , val1 , graph-trans (ev-graph (flg,

exp, va, fa, n))),

a-ev-symb-form (flg1 , exp1 , va1 , fa1 , val1 , graph-trans (ev-graph (flg,

exp, va, fa, n))),

a-ev-defn-part1 (flg1 , exp1 , va1 , fa1 , val1 , graph-trans (ev-graph (0, cadr (exp), va, fa, n))),

a-ev-symb-form (flg1 , exp1 , va1 , fa1 , val1 , graph-trans (ev-graph (0,

cadr (exp), va, fa, n))),

a-ev-defn-part1 (flg1 , exp1 , va1 , fa1 , val1 , graph-trans (ev-graph (0,

caddr (exp), va, fa, n))),

a-ev-symb-form (flg1 , exp1 , va1 , fa1 , val1 , graph-trans (ev-graph (0,

caddr (exp), va, fa, n))),

a-ev-inst-formals-proof (flg, exp, va, fa, n),

a-ev-defn-ok-proof (0, cadr (exp), va, fa, n, flg1 , exp1 , va1 , fa1 , val1 ),

a-ev-defn-ok-proof (0, caddr (exp), va, fa, n, flg1 , exp1 , va1 , fa1 , val1 )) endif

elseif car (exp) = 10 then graph-trans-merge-proof (cons (ev (flg, exp, va, fa, n),

cons (flg, cons (exp, cons (va, fa)))), nil, z-list (list (val1 , flg1 , exp1 , va1 , fa1 )), a-ev-defn-part1 (flg1 ,

exp1 , va1 , fa1 , val1 , graph-trans (ev-graph (flg,

exp, va, fa, n))),

a-ev-inst-formals-proof (flg, exp, va, fa, n),

tautconseq-proof (list (f-not (isin (z-list (list (val1 , flg1 , exp1 , va1 , fa1 )),

graph-trans (nil)))),

f-implies (isin (z-list (list (val1 , flg1 , exp1 , va1 , fa1 )),

graph-trans (nil)), a-ev-defn-part1 (flg1 ,

exp1 , va1 , fa1 , val1 , graph-trans (ev-graph (flg,

exp, va, fa, n)))),

list (null-axiom-proof (z-list (list (val1 , flg1 , exp1 , va1 , fa1 ))))))

elseif subrp (car (exp)) then a-ev-defn-ok-frame-proof3 (z-list (list (val1 ,

flg1 , exp1 , va1 , fa1 )),

cons (ev (flg, exp, va, fa, n),

cons (flg,

cons (exp, cons (va, fa)))),

ev-graph (1, cdr (exp), va, fa, n), a-ev-defn-part1 (flg1 ,

exp1 , va1 , fa1 , val1 , graph-trans (ev-graph (flg,

exp, va, fa, n))),

a-ev-symb-form (flg1 , exp1 , va1 , fa1 , val1 , graph-trans (ev-graph (flg, exp, va, fa, n))),

a-ev-defn-part1 (flg1 , exp1 , va1 , fa1 , val1 , graph-trans (ev-graph (1,

cdr (exp), va, fa, n))),

a-ev-symb-form (flg1 , exp1 , va1 , fa1 , val1 , graph-trans (ev-graph (1,

cdr (exp), va, fa, n))),

a-ev-inst-formals-proof (flg, exp, va, fa, n),

a-ev-defn-ok-proof (1, cdr (exp), va, fa, n, flg1 , exp1 , va1 , fa1 , val1 ))

elseif n ≃ 0 then nil else a-ev-defn-ok-frame-proof2 (z-list (list (val1 ,

flg1 , exp1 , va1 ,

fa1 )),

cons (ev (flg, exp, va, fa, n),

cons (flg,

cons (exp,

cons (va, fa)))),

ev-graph (0,

get (sub1-n (car (exp),

          11),

fa), ev (1,

cdr (exp), va, fa, n),

fa, n − 1),

ev-graph (1, cdr (exp), va, fa, n),

a-ev-defn-part1 (flg1 , exp1 , va1 , fa1 , val1 , graph-trans (ev-graph (flg,

exp, va, fa, n))),

a-ev-symb-form (flg1 , exp1 , va1 , fa1 , val1 , graph-trans (ev-graph (flg,

exp, va, fa, n))),

a-ev-defn-part1 (flg1 , exp1 , va1 , fa1 , val1 , graph-trans (ev-graph (0,

get (sub1-n (car (exp),

                             11),

fa), ev (1,

cdr (exp), va, fa, n),

fa,

n − 1))),

a-ev-symb-form (flg1 , exp1 , va1 , fa1 , val1 , graph-trans (ev-graph (0,

get (sub1-n (car (exp),

                             11),

fa), ev (1,

cdr (exp), va, fa, n),

fa,

n − 1))),

a-ev-defn-part1 (flg1 , exp1 , va1 , fa1 , val1 , graph-trans (ev-graph (1,

cdr (exp),

va, fa, n))),

a-ev-symb-form (flg1 , exp1 , va1 , fa1 , val1 , graph-trans (ev-graph (1,

cdr (exp), va, fa, n))),

a-ev-inst-formals-proof (flg, exp, va, fa, n),

a-ev-defn-ok-proof (0,

get (sub1-n (car (exp),

          11),

fa), ev (1,

cdr (exp), va, fa, n),

fa, n − 1, flg1 , exp1 , va1 , fa1 , val1 ),

a-ev-defn-ok-proof (1, cdr (exp), va, fa, n, flg1 , exp1 , va1 , fa1 , val1 )) endif

else graph-trans-merge-proof (cons (ev (flg, exp, va, fa, n),

cons (flg,

cons (exp, cons (va, fa)))),

nil, z-list (list (val1 , flg1 , exp1 , va1 , fa1 )), a-ev-defn-part1 (flg1 ,

exp1 , va1 , fa1 , val1 , graph-trans (ev-graph (flg,

exp, va, fa, n))),

a-ev-inst-formals-proof (flg, exp, va, fa, n),

tautconseq-proof (list (f-not (isin (z-list (list (val1 , flg1 , exp1 , va1 , fa1 )),

graph-trans (nil)))),

f-implies (isin (z-list (list (val1 , flg1 , exp1 , va1 , fa1 )),

graph-trans (nil)), a-ev-defn-part1 (flg1 ,

exp1 , va1 , fa1 , val1 , graph-trans (ev-graph (flg,

exp, va, fa, n)))),

list (null-axiom-proof (z-list (list (val1 , flg1 , exp1 , va1 , fa1 )))))) endif

;;;;;;;The definition part of "A-ev" is `OK'.

Theorem: a-ev-defn-ok-proof-proves (subset (list (fn (16, 1), fn (15, 2), fn (14, 2), fn (13, 2), fn (12, 2), fn (0, 0), fn (3, 1), fn (4, 1), fn (5, 1), fn (6, 1), fn (7, 1), fn (8, 1), fn (9, 1), fn (10, 1), fn (11, 2), fn (1, 2), fn (2, 2), p (2, 1), p (1, 2)),

symbols) ∧ subset (list (p (1, 2), fn (0, 0), fn (1, 2), fn (2, 2), fn (3, 1)), symbols) ∧ subset (list (p (1, 2),

fn (0, 0), fn (1, 2), fn (2, 2), fn (3, 1), fn (6, 1), fn (10, 1), fn (16, 1), fn (15, 2), fn (9, 1), fn (4, 1), fn (5, 1)),

symbols)

∧ subset (list (p (1, 2), fn (1, 2)), symbols) ∧ (fn (0, 0) ∈ symbols) ∧ (fn (1, 2) ∈ symbols) ∧ (p (1, 2) ∈ symbols) ∧ subset (list (fn (0, 0), p (1, 2)), symbols) ∧ z-apply-subr-all-hyps (given, defns, symbols) ∧ z-subrp-hyps (defns, symbols) ∧ (¬ btmp (ev (flg, exp, va, fa, n)))) → proves (a-ev-defn-ok-proof (flg, exp, va, fa, n, 6, 7, 8, 9, 10),

f-implies (isin (z-list (list (10, 6, 7, 8, 9)), graph-trans (ev-graph (flg, exp, va, fa, n))), a-ev-defn-part1 (6,

                                 7,
                                 8,
                                 9,
                                 10,

graph-trans (ev-graph (flg, exp, va, fa, n)))),

given, defns, symbols)

Event: Enable a-ev-defn-ok-proof; name this event ‘g0896’.

Event: Enable ev-graph; name this event ‘g0897’.

Definition: a-ev (flg, exp, va, fa, val, trace) = f-and (isin (z-list (list (val, flg, exp, va, fa)), trace),

list-all-quantify (list (6, 7, 8, 9, 10),

f-implies (isin (z-list (list (10, 6, 7, 8, 9)), trace),

a-ev-defn-part1 (6, 7, 8, 9, 10, trace))))

Definition: a-ev-ok-proof (flg, exp, va, fa, n) = and-join-proof (isin (z-list (list (ncode (ev (flg, exp, va, fa, n)),

ncode (flg), ncode (exp), ncode (va), ncode (fa))),

graph-trans (ev-graph (flg, exp, va, fa, n))), list-all-quantify (list (6, 7, 8, 9, 10),

f-implies (isin (z-list (list (10,

                                                   6,
                                                   7,
                                                   8,

9)), graph-trans (ev-graph (flg,

exp, va, fa, n))),

a-ev-defn-part1 (6,

                                                    7,

       9,
       10,

graph-trans (ev-graph (flg, exp, va, fa, n))))),

in-graph-proof (cons (ev (flg, exp, va, fa, n),

cons (flg, cons (exp, cons (va, fa)))), ev-graph (flg, exp, va, fa, n)),

list-gen-proof (list (6, 7, 8, 9, 10),

f-implies (isin (z-list (list (10, 6, 7, 8, 9)),

graph-trans (ev-graph (flg, exp, va, fa, n))),

a-ev-defn-part1 (6,

      7,
      8,
      9,
      10,

graph-trans (ev-graph (flg, exp, va, fa, n)))),

a-ev-defn-ok-proof (flg, exp, va, fa, n,

6,
7,
8,
9,

10)))

Theorem: a-ev-defn-ok-proof-proves-again (ev-hyps (given, defns, symbols) ∧ (¬ btmp (ev (flg, exp, va, fa, n))) ∧ (concl = f-implies (isin (z-list (list (10, 6, 7, 8, 9)),

graph-trans (ev-graph (flg, exp, va, fa, n))), a-ev-defn-part1 (6,

                        7,
                        8,
                        9,
                        10,

graph-trans (ev-graph (flg, exp, va, fa, n))))))

→ proves (a-ev-defn-ok-proof (flg, exp, va, fa, n, 6, 7, 8, 9, 10), concl, given, defns, symbols)

Event: Enable a-ev-defn-ok-proof-proves; name this event ‘g0898’.

;;;;;;;"A-ev" is `OK', i.e.,
;;;;;;;|- "A-ev(<FLG>, <EXP>, <VA>, <FA>, <(EV FLG EXP VA FA N)>,
;;;;;;;         [(EV-GRAPH FLG EXP VA FA N)])"

Theorem: a-ev-ok-proof-proves (ev-hyps (given, defns, symbols) ∧ (¬ btmp (ev (flg, exp, va, fa, n))) ∧ (concl = a-ev (ncode (flg),

ncode (exp), ncode (va), ncode (fa), ncode (ev (flg, exp, va, fa, n)), graph-trans (ev-graph (flg, exp, va, fa, n)))))

→ proves (a-ev-ok-proof (flg, exp, va, fa, n), concl, given, defns, symbols)

Event: Enable a-ev-ok-proof; name this event ‘g0899’.

Theorem: forsome-intro-proves-again (variable (var) ∧ (var ∉ collect-free (b, 0)) ∧ proves (pf , f-implies (a, b), given, defns, symbols)) → proves (forsome-intro-proof (var, a, b, pf ),

f-implies (forsome (var, a), b), given, defns, symbols)

Definition: a-ev-good-reduc-proof (flg, exp, expr, va, fa, val1 , trace, conc, pfexpr, pf ) = chain-proof (isin (z-list (list (val1 , ncode (flg), expr, ncode (va), ncode (fa))),

trace), conc, list (isin (z-list (list (val1 ,

ncode (flg), ncode (exp), ncode (va), ncode (fa))),

trace)), list (equal-isin-imp-proof (z-list (list (val1 ,

ncode (flg), expr, ncode (va), ncode (fa))),

z-list (list (val1 , ncode (flg), ncode (exp), ncode (va), ncode (fa))),

trace, flip-equals-proof (z-list (list (val1 ,

ncode (flg), ncode (exp), ncode (va), ncode (fa))),

z-list (list (val1 , ncode (flg), expr, ncode (va), ncode (fa))),

ev-equal-z-list-proof (val1 , flg, exp, expr, va, fa, pfexpr))),

pf ))

Theorem: a-ev-good-reduc-proof-proves (subset (list (p (1, 2), fn (0, 0), fn (1, 2), fn (2, 2), fn (3, 1)), symbols) ∧ termp (list (val1 , trace), 1, symbols)

∧ proves (pfexpr, f-equal (expr, ncode (exp)), given, defns, symbols) ∧ proves (pf ,

f-implies (isin (z-list (list (val1 , ncode (flg), ncode (exp), ncode (va), ncode (fa))),

trace), conc),

given, defns, symbols)

∧ (concl = f-implies (isin (z-list (list (val1 , ncode (flg), expr, ncode (va), ncode (fa))),

trace), conc)))

→ proves (a-ev-good-reduc-proof (flg, exp, expr, va, fa, val1 , trace, conc, pfexpr, pf ),

concl, given, defns, symbols)

Event: Enable a-ev-good-reduc-proof; name this event ‘g0900’.

Definition: a-ev-defn-good-step-proof (cl1 , cl2 , dexp, rvar, rval, val1 , val-bar, pf1 , pf2 ) = tautconseq-proof (list (f-implies (cl1 ,

f-implies (dexp,

f-equal (rvar, ncode (rval)))),

f-implies (f-equal (rvar, ncode (rval)),

f-implies (cl2 , f-implies (dexp, f-equal (val1 ,

val-bar))))),

f-implies (f-and (cl1 , cl2 ),

f-implies (dexp, f-equal (val1 , val-bar))),

list (pf1 ,

form-equal-case-proof (list (rvar), list (ncode (rval)), f-implies (cl2 ,

f-implies (dexp,

f-equal (val1 ,

val-bar))),

pf2 )))

Theorem: a-ev-defn-good-step-proof-proves (variable (rvar) ∧ formula (cl2 , symbols) ∧ termp (list (val1 , val-bar), 1, symbols) ∧ proves (pf1 ,

f-implies (cl1 , f-implies (dexp, f-equal (rvar, ncode (rval)))), given, defns, symbols)

∧ proves (pf2 ,

parallel-subst (f-implies (cl2 ,

f-implies (dexp, f-equal (val1 , val-bar))),

list (rvar),

list (ncode (rval)), 0),

given, defns, symbols))

→ proves (a-ev-defn-good-step-proof (cl1 , cl2 , dexp, rvar, rval, val1 , val-bar, pf1 , pf2 ),

f-implies (f-and (cl1 , cl2 ), f-implies (dexp, f-equal (val1 , val-bar))), given, defns, symbols)

Event: Enable a-ev-defn-good-step-proof; name this event ‘g0901’.

Definition: a-ev-defn-part-list-good-proof (exp,

va, fa, val1 , rvar1 , rvar2 , rval1 , rval2 , trace, dexp, pf1 , pf2 )

= forsome-intro-proof (rvar1 ,

forsome (rvar2 ,

f-and (isin (z-list (list (rvar1 , ncode (0), z-car (ncode (exp)), ncode (va), ncode (fa))),

trace), f-and (isin (z-list (list (rvar2 ,

ncode (1),

z-cdr (ncode (exp)), ncode (va), ncode (fa))),

trace), f-equal (val1 ,

z-opair (rvar1 , rvar2 ))))),

f-implies (dexp,

f-equal (val1 , ncode (cons (rval1 , rval2 )))),

forsome-intro-proof (rvar2 ,

f-and (isin (z-list (list (rvar1 , ncode (0), z-car (ncode (exp)), ncode (va), ncode (fa))),

trace), f-and (isin (z-list (list (rvar2 ,

ncode (1),

z-cdr (ncode (exp)), ncode (va), ncode (fa))),

trace), f-equal (val1 ,

z-opair (rvar1 ,

rvar2 )))),

f-implies (dexp,

f-equal (val1 ,

ncode (cons (rval1 ,

rval2 )))),

a-ev-defn-good-step-proof (isin (z-list (list (rvar1 , ncode (0), z-car (ncode (exp)), ncode (va), ncode (fa))),

trace), f-and (isin (z-list (list (rvar2 ,

ncode (1), z-cdr (ncode (exp)), ncode (va), ncode (fa))),

trace), f-equal (val1 ,

z-opair (rvar1 ,

rvar2 ))),

dexp, rvar1 , rval1 , val1 , ncode (cons (rval1 ,

rval2 )),

a-ev-good-reduc-proof (0, car (exp), z-car (ncode (exp)), va, fa, rvar1 , trace, f-implies (dexp,

f-equal (rvar1 ,

ncode (rval1 ))),

z-car-ncode-proof (exp), pf1 ),

a-ev-defn-good-step-proof (isin (z-list (list (rvar2 , ncode (1), z-cdr (ncode (exp)), ncode (va), ncode (fa))),

trace), f-equal (val1 ,

z-opair (ncode (rval1 ),

rvar2 )),

dexp, rvar2 , rval2 , val1 , ncode (cons (rval1 ,

rval2 )),

a-ev-good-reduc-proof (1, cdr (exp), z-cdr (ncode (exp)), va, fa, rvar2 , trace, f-implies (dexp,

f-equal (rvar2 ,

ncode (rval2 ))),

z-cdr-ncode-proof (exp), pf2 ),

tautconseq-proof (nil,

f-implies (f-equal (val1 ,

ncode (cons (rval1 ,

rval2 ))),

f-implies (dexp,

f-equal (val1 ,

ncode (cons (rval1 ,

rval2 ))))),

nil)))))

Event: Disable not-free-parallel-subst; name this event ‘g0908’.

Theorem: a-ev-defn-part-list-good-proof-proves (subset (list (fn (5, 1),

fn (4, 1), fn (3, 1), fn (2, 2), fn (1, 2), p (1, 2), p (2, 1), fn (0, 0)),

symbols) ∧ z-succ-hyps (defns, symbols) ∧ z-car-hyps (defns, symbols) ∧ z-cdr-hyps (defns, symbols) ∧ z-int-hyps (defns, symbols) ∧ var-set (list (rvar1 , rvar2 , val1 , trace), 4) ∧ nil-intersect (list (rvar1 , rvar2 ), collect-free (dexp, 0)) ∧ proves (pf1 ,

f-implies (isin (z-list (list (rvar1 , ncode (0), ncode (car (exp)), ncode (va), ncode (fa))),

trace), f-implies (dexp, f-equal (rvar1 , ncode (rval1 )))),

given, defns, symbols)

∧ proves (pf2 ,

f-implies (isin (z-list (list (rvar2 , ncode (1), ncode (cdr (exp)), ncode (va), ncode (fa))),

trace), f-implies (dexp, f-equal (rvar2 , ncode (rval2 )))),

given, defns, symbols)

∧ (concl = f-implies (a-ev-list-part (exp, va, fa, val1 , rvar1 , rvar2 , trace),

f-implies (dexp,

f-equal (val1 , ncode (cons (rval1 , rval2 )))))))

→ proves (a-ev-defn-part-list-good-proof (exp, va, fa, val1 , rvar1 , rvar2 , rval1 , rval2 , trace, dexp, pf1 , pf2 ),

concl, given, defns, symbols)

Event: Enable a-ev-defn-part-list-good-proof; name this event ‘g0916’.

Definition: a-ev-defn-part-if-good-proof (exp,

va, fa, val1 , val, trace, rvar1 , rval1 , dexp, pf1 , pf )

= forsome-intro-proof (rvar1 ,

body (a-ev-if-part (ncode (exp), ncode (va), ncode (fa), val1 , trace, rvar1 )),

f-implies (dexp, f-equal (val1 , ncode (val))), a-ev-defn-good-step-proof (isin (z-list (list (rvar1 ,

ncode (0),

z-car (z-cdr (ncode (exp))), ncode (va), ncode (fa))),

trace), f-if (f-equal (rvar1 ,

ncode (0)), isin (z-list (list (val1 ,

ncode (0),

z-car-cdr (ncode (exp), list (1,

                                               2,
                                               2,

2)),

ncode (va), ncode (fa))),

trace), isin (z-list (list (val1 ,

ncode (0), z-car-cdr (ncode (exp),

list (1,

         2,

2)),

ncode (va), ncode (fa))),

trace)), dexp, rvar1 , rval1 , val1 , ncode (val), a-ev-good-reduc-proof (0,

cadr (exp), z-car (z-cdr (ncode (exp))), va, fa, rvar1 , trace, f-implies (dexp,

f-equal (rvar1 ,

ncode (rval1 ))),

z-car-cdr-proof (exp,

list (1,

2)),

pf1 ),

rec-form-z-if-eval-proof (list (list (ncode-equal (rval1 ,

0), ident-axiom-proof (ncode (0)), ncode-nequal-proof (rval1 ,

0)),

a-ev-good-reduc-proof (0, cadddr (exp), z-car-cdr (ncode (exp), list (1,

                                    2,
                                    2,

2)), va, fa, val1 , trace, f-implies (dexp,

f-equal (val1 ,

ncode (val))),

z-car-cdr-proof (exp,

list (1,

                 2,
                 2,

2)),

pf ),

a-ev-good-reduc-proof (0, caddr (exp), z-car-cdr (ncode (exp),

list (1,

            2,

2)),

va, fa, val1 , trace, f-implies (dexp,

f-equal (val1 ,

ncode (val))),

z-car-cdr-proof (exp,

list (1,

                 2,

2)),

pf )),

z-if (f-equal (ncode (rval1 ),

ncode (0)), isin (z-list (list (val1 ,

ncode (0), z-car-cdr (ncode (exp),

list (1,

     2,
     2,

2)),

ncode (va), ncode (fa))),

trace), isin (z-list (list (val1 , ncode (0), z-car-cdr (ncode (exp), list (1,

                                                                                          2,

2)),

ncode (va), ncode (fa))),

trace)), f-implies (dexp,

f-equal (val1 , ncode (val))))))

Theorem: nlistp-nnumberp-ncode ((¬ listp (x)) ∧ (x ∉ N)) → (ncode (x) = ncode (0))

Theorem: a-ev-defn-part-if-good-proof-proves (subset (list (fn (5, 1),

fn (4, 1), fn (3, 1), fn (2, 2), fn (1, 2), p (1, 2), p (2, 1), fn (0, 0)),

symbols) ∧ z-succ-hyps (defns, symbols) ∧ z-car-hyps (defns, symbols) ∧ z-cdr-hyps (defns, symbols) ∧ z-int-hyps (defns, symbols) ∧ var-set (list (rvar1 , val1 , trace), 3) ∧ (rvar1 ∉ collect-free (dexp, 0)) ∧ proves (pf1 ,

f-implies (isin (z-list (list (rvar1 , ncode (0), ncode (cadr (exp)), ncode (va), ncode (fa))),

trace), f-implies (dexp, f-equal (rvar1 , ncode (rval1 )))),

given, defns, symbols)

∧ if ncode-equal (rval1 , 0)

then proves (pf , f-implies (isin (z-list (list (val1 ,

ncode (0),

ncode (cadddr (exp)), ncode (va), ncode (fa))),

trace), f-implies (dexp, f-equal (val1 , ncode (val)))),

given, defns, symbols)

else proves (pf ,

f-implies (isin (z-list (list (val1 , ncode (0), ncode (caddr (exp)), ncode (va), ncode (fa))),

trace), f-implies (dexp, f-equal (val1 , ncode (val)))),

given, defns, symbols) endif

∧ (concl = f-implies (a-ev-if-part (ncode (exp), ncode (va), ncode (fa), val1 , trace, rvar1 ),

f-implies (dexp, f-equal (val1 , ncode (val))))))

→ proves (a-ev-defn-part-if-good-proof (exp, va, fa, val1 , val, trace, rvar1 , rval1 , dexp, pf1 , pf ),

concl, given, defns, symbols)

Event: Enable a-ev-defn-part-if-good-proof; name this event ‘g0919’.

Event: Enable nlistp-nnumberp-ncode; name this event ‘g0920’.

Definition: a-ev-defn-part-subr-good-proof (exp, va, fa, val1 , trace, rvar1 , rval1 , dexp, pf ) = forsome-intro-proof (rvar1 ,

body (a-ev-subr-part (exp, va, fa, val1 , rvar1 , trace)), f-implies (dexp,

f-equal (val1 ,

ncode (apply-subr (car (exp), rval1 )))),

a-ev-defn-good-step-proof (isin (z-list (list (rvar1 , ncode (1), z-cdr (ncode (exp)), ncode (va), ncode (fa))),

trace), f-equal (val1 ,

z-apply-subr (z-car (ncode (exp)),

rvar1 )),

dexp, rvar1 , rval1 , val1 , ncode (apply-subr (car (exp),

rval1 )),

a-ev-good-reduc-proof (1, cdr (exp), z-cdr (ncode (exp)), va, fa, rvar1 , trace, f-implies (dexp,

f-equal (rvar1 ,

ncode (rval1 ))),

z-cdr-ncode-proof (exp), pf ),

tautconseq-proof (list (f-equal (z-apply-subr (z-car (ncode (exp)),

ncode (rval1 )),

ncode (apply-subr (car (exp),

rval1 ))),

f-implies (f-equal (val1 , z-apply-subr (z-car (ncode (exp)),

ncode (rval1 ))),

f-implies (f-equal (z-apply-subr (z-car (ncode (exp)),

ncode (rval1 )),

ncode (apply-subr (car (exp),

rval1 ))),

f-equal (val1 ,

ncode (apply-subr (car (exp),

rval1 )))))),

f-implies (f-equal (val1 ,

z-apply-subr (z-car (ncode (exp)),

ncode (rval1 ))),

f-implies (dexp,

f-equal (val1 ,

ncode (apply-subr (car (exp),

rval1 ))))),

list (compose-proof (fn (15,

2), ncode (apply-subr (car (exp),

rval1 )),

list (z-car (ncode (exp)), ncode (rval1 )), list (ncode (car (exp)), ncode (rval1 )), list (z-car-ncode-proof (exp),

ident-axiom-proof (ncode (rval1 ))), z-apply-subr-ncode-proof (car (exp),

rval1 )),

trans-equal-proof3 (val1 ,

z-apply-subr (z-car (ncode (exp)),

ncode (rval1 )),

ncode (apply-subr (car (exp), rval1 )))))))

Theorem: a-ev-defn-part-subr-good-proof-proves (subset (list (fn (15, 2),

fn (14, 2), fn (13, 2), fn (12, 2), fn (0, 0), fn (3, 1), fn (4, 1), fn (5, 1), fn (6, 1), fn (7, 1), fn (8, 1), fn (9, 1), fn (10, 1), fn (11, 2), fn (1, 2), fn (2, 2), p (2, 1), p (1, 2)),

symbols) ∧ z-apply-subr-all-hyps (given, defns, symbols) ∧ var-set (list (rvar1 , val1 , trace), 3) ∧ (rvar1 ∉ collect-free (dexp, 0)) ∧ proves (pf ,

f-implies (isin (z-list (list (rvar1 , ncode (1), ncode (cdr (exp)), ncode (va), ncode (fa))),

trace), f-implies (dexp, f-equal (rvar1 , ncode (rval1 )))),

given, defns, symbols)

∧ (concl = f-implies (a-ev-subr-part (exp, va, fa, val1 , rvar1 , trace),

f-implies (dexp,

f-equal (val1 ,

ncode (apply-subr (car (exp),

rval1 )))))))

→ proves (a-ev-defn-part-subr-good-proof (exp, va, fa, val1 , trace, rvar1 , rval1 , dexp, pf ),

concl, given, defns, symbols)

Event: Enable a-ev-defn-part-subr-good-proof; name this event ‘g0921’.

Theorem: parallel-subst-var (exp ∈ N) → (parallel-subst (exp, vars, terms, 0) = getpf (exp, vars, terms))

Event: Enable not-free-parallel-subst; name this event ‘g0922’.

Event: Disable parallel-subst-nil; name this event ‘g0923’.

Event: Enable get-graph; name this event ‘g0924’.

Definition: a-ev-fun-part-body (exp, fa, val1 , trace, rvar1 , getva, tr1 ) = f-implies (a-get (z-sub1-n (z-car (ncode (exp)), 11),

ncode (fa), getva,

                 11,
                 13,
                 14,

tr1 ), isin (z-list (list (val1 , ncode (0), getva, rvar1 , ncode (fa))),

trace))

Definition: a-get-ev-good-reduc-proof (exp, fa, getval, x1 , y1 , val1 , tr1 ) = tautconseq-proof (list (f-implies (isin (z-list (list (getval,

ncode (sub1-n (car (exp),

11)),

ncode (fa))),

tr1 ), isin (z-list (list (getval,

z-sub1-n (z-car (ncode (exp)),

                                                   11),

ncode (fa))),

tr1 )), a-get (ncode (sub1-n (car (exp), 11)),

ncode (fa), getval, x1 , y1 , val1 , tr1 )),

a-get (z-sub1-n (z-car (ncode (exp)), 11), ncode (fa), getval, x1 , y1 , val1 , tr1 ),

list (equal-z-list-isin-imp-proof (list (getval,

ncode (sub1-n (car (exp),

11)),

ncode (fa)), list (getval,

z-sub1-n (z-car (ncode (exp)),

                                             11),

ncode (fa)), tr1 , list (ident-axiom-proof (getval),

flip-equals-proof (z-sub1-n (z-car (ncode (exp)),

                                                           11),

ncode (sub1-n (car (exp),

11)),

z-sub1-n-ncode-proof (z-car (ncode (exp)),

                                                                      11,

car (exp),

z-car-ncode-proof (exp))),

ident-axiom-proof (ncode (fa)))),

a-get-ok-proof1 (sub1-n (car (exp), 11), fa, x1 , y1 , val1 )))

Theorem: a-get-ev-good-reduc-proof-proves (subset (list (fn (10, 1),

fn (9, 1), fn (5, 1), fn (4, 1), fn (3, 1), fn (2, 2), fn (1, 2), p (1, 2), p (2, 1), fn (0, 0)),

symbols) ∧ z-succ-hyps (defns, symbols) ∧ z-car-hyps (defns, symbols) ∧ z-cdr-hyps (defns, symbols)

∧ z-zerop-hyps (defns, symbols) ∧ z-sub1-hyps (defns, symbols) ∧ z-int-hyps (defns, symbols) ∧ var-set (list (x1 , y1 , val1 ), 3) ∧ (getval = ncode (get (sub1-n (car (exp), 11), fa))) ∧ (tr1 = graph-trans (get-graph (sub1-n (car (exp), 11), fa))) ∧ (concl = a-get (z-sub1-n (z-car (ncode (exp)), 11),

ncode (fa), getval, x1 , y1 , val1 , tr1 )))

→ proves (a-get-ev-good-reduc-proof (exp, fa, getval, x1 , y1 , val1 , tr1 ), concl, given, defns, symbols)

Event: Enable a-get-ev-good-reduc-proof; name this event ‘g0925’.

Definition: a-ev-defn-part-fun-good-proof (exp, va, fa, val1 , val, trace, rval1 , dexp, pf1 , pf2 ) = forsome-intro-proof (11,

body (a-ev-fun-part (exp, va, fa, val1 , trace)), f-implies (dexp, f-equal (val1 , ncode (val))), chain-proof (body (a-ev-fun-part (exp,

va, fa, val1 , trace)),

f-implies (dexp,

f-equal (val1 , ncode (val))),

list (f-and (isin (z-list (list (11, ncode (1), z-cdr (ncode (exp)), ncode (va), ncode (fa))),

trace), a-ev-fun-part-body (exp,

fa, val1 , trace,

                                                       11,

ncode (get (sub1-n (car (exp),

11),

fa)),

graph-trans (get-graph (sub1-n (car (exp),

          11),

fa))))),

list (subst-thm-b-proof (f-and (isin (z-list (list (11, ncode (1), z-cdr (ncode (exp)), ncode (va), ncode (fa))),

trace), a-ev-fun-part-body (exp,

fa, val1 , trace,

11,
15,

16)),

list (15, 16), list (ncode (get (sub1-n (car (exp),

11),

fa)),

graph-trans (get-graph (sub1-n (car (exp),

        11),

fa)))),

a-ev-defn-good-step-proof (isin (z-list (list (11, ncode (1), z-cdr (ncode (exp)), ncode (va), ncode (fa))),

trace), a-ev-fun-part-body (exp,

fa, val1 , trace,

 11,

ncode (get (sub1-n (car (exp),

                 11),

fa)),

graph-trans (get-graph (sub1-n (car (exp),

                           11),

fa))),

dexp, rval1 , val1 , ncode (val), a-ev-good-reduc-proof (1,

cdr (exp), z-cdr (ncode (exp)), va, fa,

11,

trace, f-implies (dexp,

f-equal (11,

ncode (rval1 ))),

z-cdr-ncode-proof (exp), pf1 ),

tautconseq-proof (list (a-get (z-sub1-n (z-car (ncode (exp)),

            11),

ncode (fa),

ncode (get (sub1-n (car (exp),

                    11),

fa)),

    11,
    13,
    14,

graph-trans (get-graph (sub1-n (car (exp),

                               11),

fa))),

f-implies (isin (z-list (list (val1 , ncode (0), ncode (get (sub1-n (car (exp),

                                    11),

fa)),

ncode (rval1 ), ncode (fa))),

trace), f-implies (dexp,

f-equal (val1 ,

ncode (val))))),

f-implies (a-ev-fun-part-body (exp, fa, val1 , trace, ncode (rval1 ), ncode (get (sub1-n (car (exp),

                                                                                                      11),

fa)),

graph-trans (get-graph (sub1-n (car (exp),

                                                                                                                11),

fa))),

f-implies (dexp,

f-equal (val1 ,

ncode (val)))),

list (a-get-ev-good-reduc-proof (exp, fa, ncode (get (sub1-n (car (exp),

                                                                                                       11),

fa)),

                                                                                       11,
                                                                                       13,
                                                                                       14,

graph-trans (get-graph (sub1-n (car (exp),

                                                                                                                 11),

fa))),

pf2 ))))))

Theorem: a-ev-defn-part-fun-good-proof-proves (subset (list (fn (10, 1),

fn (9, 1), fn (5, 1), fn (4, 1), fn (3, 1), fn (2, 2), fn (1, 2), p (1, 2), p (2, 1), fn (0, 0)),

symbols) ∧ z-succ-hyps (defns, symbols) ∧ z-car-hyps (defns, symbols) ∧ z-cdr-hyps (defns, symbols) ∧ z-int-hyps (defns, symbols) ∧ z-zerop-hyps (defns, symbols) ∧ z-sub1-hyps (defns, symbols) ∧ var-set (list (11, 15, 16, val1 , trace), 5) ∧ (11 ∉ collect-free (dexp, 0)) ∧ proves (pf1 ,

f-implies (isin (z-list (list (11, ncode (1), ncode (cdr (exp)), ncode (va), ncode (fa))),

trace), f-implies (dexp, f-equal (11, ncode (rval1 )))),

given, defns, symbols)

∧ proves (pf2 ,

f-implies (isin (z-list (list (val1 , ncode (0), ncode (get (sub1-n (car (exp), 11), fa)), ncode (rval1 ), ncode (fa))),

trace), f-implies (dexp, f-equal (val1 , ncode (val)))),

given, defns, symbols)

∧ (concl = f-implies (a-ev-fun-part (exp, va, fa, val1 , trace),

f-implies (dexp, f-equal (val1 , ncode (val))))))

→ proves (a-ev-defn-part-fun-good-proof (exp, va, fa, val1 , val, trace, rval1 , dexp, pf1 , pf2 ),

concl, given, defns, symbols)

Event: Enable a-ev-defn-part-fun-good-proof; name this event ‘g0926’.

Definition: sub-rvar-proof (flg, exp, va, fa, trace, rvar, val1 , dexp, rval, pf ) = subst-rule-proof (f-implies (isin (z-list (list (val1 ,

ncode (flg), ncode (exp), ncode (va), ncode (fa))),

trace), f-implies (dexp, f-equal (val1 , ncode (rval)))),

val1 , rvar, pf )

Event: Disable not-free-covering; name this event ‘g0927’.

Theorem: sub-rvar-proof-proves (var-set (list (val1 , trace), 2) ∧ termp (rvar, 0, symbols) ∧ (val1 ∉ collect-free (dexp, 0)) ∧ proves (pf ,

f-implies (isin (z-list (list (val1 , ncode (flg), ncode (exp), ncode (va), ncode (fa))),

trace), f-implies (dexp, f-equal (val1 , ncode (rval)))),

given, defns, symbols)

∧ (concl = f-implies (isin (z-list (list (rvar, ncode (flg), ncode (exp), ncode (va), ncode (fa))),

trace), f-implies (dexp, f-equal (rvar, ncode (rval))))))

→ proves (sub-rvar-proof (flg, exp, va, fa, trace, rvar, val1 , dexp, rval, pf ), concl, given, defns, symbols)

Event: Enable sub-rvar-proof; name this event ‘g0928’.

Definition: ind-form (flg, exp, va, fa, val1 , val, trace, dexp) = f-implies (isin (z-list (list (val1 , ncode (flg), ncode (exp), ncode (va), ncode (fa))),

trace), f-implies (dexp, f-equal (val1 , ncode (val))))

Theorem: form-z-if-ev-defn-part-again (subset (list (fn (16, 1),

fn (15, 2), fn (14, 2), fn (13, 2), fn (12, 2), fn (0, 0), fn (3, 1), fn (4, 1), fn (5, 1), fn (6, 1), fn (7, 1), fn (8, 1), fn (9, 1), fn (10, 1), fn (11, 2), fn (1, 2), fn (2, 2), p (2, 1), p (1, 2)),

symbols) ∧ termp (list (val1 , trace), 1, symbols)) → form-z-if (z-ev-defn-part (flg, exp, va, fa, val1 , trace), symbols)

Theorem: ncode-equal-ident-axiom-proof-proves (subset (list (fn (0, 0), fn (1, 2), fn (2, 2), fn (3, 1)), symbols) ∧ ncode-equal (x, y)) → proves (ident-axiom-proof (ncode (x)),

f-equal (ncode (x), ncode (y)), given, defns, symbols)

Event: Disable a-ev-defn-part; name this event ‘g0929’.

Definition: a-ev-defn-part-good-pftree (flg, exp, va, fa, n, val1 , trace, dexp, pf1 , pf2 )

= list (list (flg = 1, ident-axiom-proof (ncode (1)), ncode-nequal-proof (flg, 1)),

list (list (listp (exp), z-listp-ncode-proof (exp), trans-not-equal-proof (ncode (1),

z-listp (ncode (exp)), ncode (0), ncode-nequal-proof (1, 0), z-listp-ncode-proof (exp))),

a-ev-defn-part-list-good-proof (exp, va, fa, val1 ,

11,
12,

ev (0, car (exp), va, fa, n), ev (1, cdr (exp), va, fa, n), trace, dexp, sub-rvar-proof (0,

car (exp), va, fa, trace,

11,

val1 , dexp, ev (0,

car (exp), va, fa, n),

pf1 ),

sub-rvar-proof (1, cdr (exp), va, fa, trace,

12,

val1 , dexp, ev (1,

cdr (exp), va, fa, n), pf2 )),

tautconseq-proof (nil,

f-implies (f-equal (val1 , ncode (nil)),

f-implies (dexp,

f-equal (val1 ,

ncode (nil)))),

nil)),

list (list (listp (exp), z-listp-ncode-proof (exp), trans-not-equal-proof (ncode (1),

z-listp (ncode (exp)), ncode (0), ncode-nequal-proof (1, 0), z-listp-ncode-proof (exp))),

list (list (car (exp) ≃ 0,

compose-car-proof (fn (9, 1), ncode (1), exp, z-zerop-ncode-proof (car (exp))),

trans-not-equal-proof (ncode (1), z-zerop (z-car (ncode (exp))), ncode (0), ncode-nequal-proof (1, 0), compose-car-proof (fn (9, 1),

ncode (0),

exp,

z-zerop-ncode-proof (car (exp))))),

a-ev-defn-part-if-good-proof (exp, va, fa, val1 , ev (flg, exp, va, fa, n), trace,

11,

ev (0, cadr (exp), va, fa, n), dexp, sub-rvar-proof (0,

cadr (exp), va, fa, trace, val1 , dexp, ev (0,

cadr (exp), va, fa, n),

pf1 ),

pf2 ),

list (list (car (exp) = 10, z-car-ncode-proof (exp), trans-not-equal-proof (ncode (10),

z-car (ncode (exp)), ncode (car (exp)), ncode-nequal-proof (10,

car (exp)),

z-car-ncode-proof (exp))),

tautconseq-proof (list (f-equal (z-car-cdr (ncode (exp),

list (1, 2)),

ncode (cadr (exp))), f-implies (f-equal (val1 ,

z-car-cdr (ncode (exp),

list (1,

2))),

f-implies (f-equal (z-car-cdr (ncode (exp),

list (1,

2)),

ncode (cadr (exp))), f-equal (val1 ,

ncode (cadr (exp)))))),

f-implies (f-equal (val1 ,

z-car-cdr (ncode (exp),

list (1,

2))),

f-implies (dexp,

f-equal (val1 ,

ncode (cadr (exp))))),

list (z-car-cdr-proof (exp,

list (1, 2)),

trans-equal-proof3 (val1 ,

z-car-cdr (ncode (exp),

list (1, 2)),

ncode (cadr (exp))))),

list (list (subrp (car (exp)),

compose-car-proof (fn (16, 1), ncode (1), exp, z-subrp-ncode-proof (car (exp))),

trans-not-equal-proof (ncode (1), z-subrp (z-car (ncode (exp))), ncode (0), ncode-nequal-proof (1,

0),

compose-car-proof (fn (16,

1), ncode (0), exp, z-subrp-ncode-proof (car (exp))))),

a-ev-defn-part-subr-good-proof (exp, va, fa, val1 , trace,

11,

ev (1, cdr (exp), va, fa, n),

dexp, sub-rvar-proof (1,

cdr (exp), va, fa, trace,

11,

val1 , dexp, ev (1,

cdr (exp), va, fa, n),

pf1 )),

a-ev-defn-part-fun-good-proof (exp, va, fa, val1 , ev (flg,

exp, va, fa, n),

trace, ev (1,

cdr (exp), va, fa, n),

dexp, sub-rvar-proof (1,

cdr (exp), va, fa, trace,

11,

val1 , dexp, ev (1,

cdr (exp), va, fa, n),

pf1 ),

pf2 )))),

tautconseq-proof (list (f-implies (a-get1 (ncode (exp), ncode (va), val1 ,

11,
13,
14,
16),

f-equal (val1 ,

ncode (ev (flg, exp, va, fa, n))))),

f-implies (a-get1 (ncode (exp), ncode (va), val1 ,

11,
13,
14,
16),

f-implies (dexp,

f-equal (val1 ,

ncode (ev (flg, exp, va, fa, n))))),

list (a-get1-good-proof (exp, va, val1 ,

11,
13,
14,

16)))))

Definition: a-ev-defn-part-good-proof (flg, exp, va, fa, n, val1 , trace, dexp, pf1 , pf2 ) = rec-form-z-if-eval-proof (a-ev-defn-part-good-pftree (flg,

exp, va, fa, n, val1 , trace, dexp, pf1 , pf2 ),

z-ev-defn-part (flg, exp, va, fa, val1 , trace), f-implies (dexp,

f-equal (val1 , ncode (ev (flg, exp, va, fa, n)))))

Theorem: a-ev-defn-part-good-proof-proves-quote-case ((flg ≠ 1) ∧ listp (exp) ∧ (car (exp) = 10) ∧ ev-hyps (given, defns, symbols) ∧ var-set (list (11, 12, 15, 16, val1 , trace), 6) ∧ formula (dexp, symbols)

∧ (¬ btmp (ev (flg, exp, va, fa, n))) ∧ (concl = f-implies (a-ev-defn-part (flg, exp, va, fa, val1 , trace),

f-implies (dexp,

f-equal (val1 ,

ncode (ev (flg, exp, va, fa, n)))))))

→ proves (a-ev-defn-part-good-proof (flg, exp, va, fa, n, val1 , trace, dexp, pf1 , pf2 ),

concl, given, defns, symbols)

Theorem: a-ev-defn-part-good-proof-proves-list-case ((flg = 1) ∧ listp (exp) ∧ ev-hyps (given, defns, symbols) ∧ var-set (list (11, 12, 15, 16, val1 , trace), 6) ∧ nil-intersect (list (11, 12, val1 ), collect-free (dexp, 0)) ∧ (¬ btmp (ev (1, exp, va, fa, n))) ∧ (proves (pf1 ,

ind-form (0, car (exp), va, fa, val1 , ev (0, car (exp), va, fa, n), trace, dexp),

given, defns, symbols)

∧ proves (pf2 ,

ind-form (1, cdr (exp), va, fa, val1 , ev (1, cdr (exp), va, fa, n), trace, dexp),

given, defns, symbols))

∧ (concl = f-implies (a-ev-defn-part (flg, exp, va, fa, val1 , trace),

f-implies (dexp,

f-equal (val1 ,

ncode (ev (flg, exp, va, fa, n)))))))

→ proves (a-ev-defn-part-good-proof (flg, exp, va, fa, n, val1 , trace, dexp, pf1 , pf2 ),

concl, given, defns, symbols)

Theorem: a-ev-defn-part-good-proof-proves-nlist-case ((flg = 1) ∧ (exp ≃ nil) ∧ ev-hyps (given, defns, symbols) ∧ var-set (list (11, 12, 15, 16, val1 , trace), 6) ∧ formula (dexp, symbols) ∧ (¬ btmp (ev (1, exp, va, fa, n))) ∧ (concl = f-implies (a-ev-defn-part (flg, exp, va, fa, val1 , trace),

f-implies (dexp,

f-equal (val1 ,

ncode (ev (flg, exp, va, fa, n)))))))

→ proves (a-ev-defn-part-good-proof (flg, exp, va, fa, n, val1 , trace, dexp, pf1 , pf2 ),

concl, given, defns, symbols)

Theorem: a-ev-defn-part-good-proof-proves-if-case ((flg ≠ 1) ∧ listp (exp) ∧ (car (exp) ≃ 0) ∧ ev-hyps (given, defns, symbols) ∧ var-set (list (11, 12, 15, 16, val1 , trace), 6) ∧ nil-intersect (list (11, 12, val1 ), collect-free (dexp, 0)) ∧ (¬ btmp (ev (flg, exp, va, fa, n))) ∧ (proves (pf1 ,

ind-form (0, cadr (exp), va, fa, val1 , ev (0, cadr (exp), va, fa, n), trace, dexp),

given, defns, symbols)

∧ if ncode-equal (ev (0, cadr (exp), va, fa, n), 0)

then proves (pf2 ,

ind-form (0, cadddr (exp), va, fa, val1 , ev (0, cadddr (exp), va, fa, n), trace, dexp),

given, defns, symbols)

else proves (pf2 ,

ind-form (0, caddr (exp), va, fa, val1 , ev (0, caddr (exp), va, fa, n), trace, dexp),

given, defns, symbols) endif)

∧ (concl = f-implies (a-ev-defn-part (flg, exp, va, fa, val1 , trace),

f-implies (dexp,

f-equal (val1 ,

ncode (ev (flg, exp, va, fa, n)))))))

→ proves (a-ev-defn-part-good-proof (flg, exp, va, fa, n, val1 , trace, dexp, pf1 , pf2 ),

concl, given, defns, symbols)

Theorem: a-ev-defn-part-good-proof-proves-subr-case ((flg ≠ 1) ∧ listp (exp) ∧ (car (exp) ≄ 0) ∧ (car (exp) ≠ 10) ∧ subrp (car (exp)) ∧ ev-hyps (given, defns, symbols) ∧ var-set (list (11, 12, 15, 16, val1 , trace), 6) ∧ nil-intersect (list (11, 12, val1 ), collect-free (dexp, 0)) ∧ (¬ btmp (ev (flg, exp, va, fa, n))) ∧ proves (pf1 ,

ind-form (1, cdr (exp), va, fa, val1 , ev (1, cdr (exp), va, fa, n), trace, dexp),

given, defns, symbols)

∧ (concl = f-implies (a-ev-defn-part (flg, exp, va, fa, val1 , trace),

f-implies (dexp,

f-equal (val1 ,

ncode (ev (flg, exp, va, fa, n)))))))

→ proves (a-ev-defn-part-good-proof (flg, exp, va, fa, n, val1 , trace, dexp, pf1 , pf2 ),

concl, given, defns, symbols)

Theorem: a-ev-defn-part-good-proof-proves-fun-case ((flg ≠ 1) ∧ listp (exp) ∧ (car (exp) ≄ 0) ∧ (car (exp) ≠ 10) ∧ (¬ subrp (car (exp))) ∧ ev-hyps (given, defns, symbols) ∧ var-set (list (11, 12, 15, 16, val1 , trace), 6) ∧ nil-intersect (list (11, 12, val1 ), collect-free (dexp, 0)) ∧ (¬ btmp (ev (flg, exp, va, fa, n))) ∧ proves (pf1 ,

ind-form (1, cdr (exp), va, fa, val1 , ev (1, cdr (exp), va, fa, n), trace, dexp), given, defns, symbols)

∧ proves (pf2 ,

ind-form (0, get (sub1-n (car (exp), 11), fa), ev (1, cdr (exp), va, fa, n), fa, val1 , ev (flg, exp, va, fa, n), trace, dexp),

given, defns, symbols)

∧ (concl = f-implies (a-ev-defn-part (flg, exp, va, fa, val1 , trace),

f-implies (dexp,

f-equal (val1 ,

ncode (ev (flg, exp, va, fa, n)))))))

→ proves (a-ev-defn-part-good-proof (flg, exp, va, fa, n, val1 , trace, dexp, pf1 , pf2 ),

concl, given, defns, symbols)

Theorem: a-ev-defn-part-good-proof-proves-var-case ((flg ≠ 1) ∧ (¬ listp (exp)) ∧ ev-hyps (given, defns, symbols) ∧ formula (dexp, symbols) ∧ var-set (list (11, 12, 15, 16, val1 , trace), 6) ∧ nil-intersect (list (11, 12, val1 ), collect-free (dexp, 0)) ∧ (¬ btmp (ev (flg, exp, va, fa, n))) ∧ (concl = f-implies (a-ev-defn-part (flg, exp, va, fa, val1 , trace),

f-implies (dexp, f-equal (val1 ,

ncode (ev (flg, exp, va, fa, n)))))))

→ proves (a-ev-defn-part-good-proof (flg, exp, va, fa, n, val1 , trace, dexp, pf1 , pf2 ),

concl, given, defns, symbols)

Event: Enable a-ev-defn-part-good-proof; name this event ‘g0930’.

Theorem: free-for-x-x variable (x) → free-for (exp, x, x, flg)

Event: Enable free-for; name this event ‘g0932’.

Event: Disable free-for-list; name this event ‘g0933’.

Definition: a-ev-reduc-proof (flg, exp, va, fa, val1 , trace) = f-iff-mp-proof2 (f-implies (a-ev (ncode (flg),

ncode (exp), ncode (va), ncode (fa), val1 , trace),

a-ev-defn-part (flg, exp, va, fa, val1 , trace)),

f-implies (list-all-quantify (list (6, 7, 8, 9, 10),

f-implies (isin (z-list (list (10,

                          6,
                          7,
                          8,

9)),

trace), a-ev-defn-part1 (6,

8,
9,
10,

trace))),

f-implies (isin (z-list (list (val1 , ncode (flg), ncode (exp), ncode (va), ncode (fa))),

trace), a-ev-defn-part (flg,

exp, va, fa, val1 , trace))),

good-frame1-proof (isin (z-list (list (val1 , ncode (flg), ncode (exp), ncode (va), ncode (fa))),

trace), list-all-quantify (list (6, 7, 8, 9, 10),

f-implies (isin (z-list (list (10,

       6,
       7,
       8,

9)),

trace), a-ev-defn-part1 (6,

        7,
        8,
        9,
        10,

trace))),

a-ev-defn-part (flg, exp, va, fa, val1 , trace)),

subst-thm-b-proof (f-implies (isin (z-list (list (10,

6,

                                                      8,

9)),

trace), a-ev-defn-part1 (6,

                                                       7,
                                                       8,
                                                       9,
                                                       10,

trace)),

list (6, 7, 8, 9, 10), list (ncode (flg), ncode (exp), ncode (va), ncode (fa), val1 )))

Theorem: parallel-subst-a-ev-defn-part1-again (variable (trace) ∧ (trace ∉ list (6, 7, 8, 9, 10))) → (parallel-subst (a-ev-defn-part1 (6, 7, 8, 9, 10, trace),

list (6, 7, 8, 9, 10), list (ncode (flg), ncode (exp), ncode (va), ncode (fa), val-bar),

                  0)

= a-ev-defn-part (flg, exp, va, fa, val-bar, trace))

Event: Enable a-ev-defn-part; name this event ‘g0935’.

Theorem: free-for-list-reduc free-for-list (exp, vars, terms) = if listp (vars) ∧ listp (terms)

then free-for (exp, car (vars), car (terms), 0)

∧ free-for-list (exp, cdr (vars), cdr (terms)) else t endif

Event: Enable free-for-list; name this event ‘g0940’.

Definition: all-symbs (symbols) = subset (list (fn (16, 1),

fn (15, 2), fn (14, 2), fn (13, 2), fn (12, 2), fn (0, 0), fn (3, 1), fn (4, 1), fn (5, 1), fn (6, 1), fn (7, 1), fn (8, 1), fn (9, 1), fn (10, 1), fn (11, 2), fn (1, 2), fn (2, 2), p (2, 1), p (1, 2)),

symbols)

Theorem: a-ev-reduc-proof-proves (all-symbs (symbols) ∧ variable (trace) ∧ (trace ∉ list (6, 7, 8, 9, 10)) ∧ (concl = f-implies (a-ev (ncode (flg),

ncode (exp), ncode (va), ncode (fa),

            10,

trace), a-ev-defn-part (flg, exp, va, fa, 10, trace))))

→ proves (a-ev-reduc-proof (flg, exp, va, fa, 10, trace), concl, given, defns, symbols)

Event: Enable a-ev-reduc-proof; name this event ‘g0947’.

Event: Disable a-ev-defn-part1; name this event ‘g0949’.

Definition: a-ev-defn (trace) = list-all-quantify (list (6, 7, 8, 9, 10), f-implies (isin (z-list (list (10, 6, 7, 8, 9)), trace),

a-ev-defn-part1 (6, 7, 8, 9, 10, trace)))

Theorem: collect-free-z-sub1-n (var ∈ collect-free (z-sub1-n (exp, n), 0)) = (var ∈ collect-free (exp, 0))

Theorem: nil-int-a-ev-defn (variable (trace) ∧ (trace ∉ list (11, 12, 10))) → nil-intersect (list (11, 12, 10), collect-free (a-ev-defn (trace), 0))

Theorem: formula-a-ev-defn (all-symbs (symbols) ∧ variable (trace)) → formula (a-ev-defn (trace), symbols)

Event: Enable a-ev-defn-part1; name this event ‘g0950’.

Theorem: a-ev-reduc a-ev (flg-bar, exp-bar, va-bar, fa-bar, val1 , trace) = f-and (isin (z-list (list (val1 , flg-bar, exp-bar, va-bar, fa-bar)), trace),

a-ev-defn (trace))

Event: Enable a-ev-defn; name this event ‘g0951’.

Event: Enable a-ev; name this event ‘g0952’.

Theorem: good-frame2-proof-proves-again (proves (pf1 , f-implies (f-and (a, b), c), given, defns, symbols) ∧ proves (pf2 , f-implies (c, f-implies (b, d)), given, defns, symbols)) → proves (good-frame2-proof (a, b, c, d, pf1 , pf2 ),

f-implies (f-and (a, b), d), given, defns, symbols)

Event: Enable good-frame2-proof-proves; name this event ‘g0953’.

Definition: a-ev-good-proof (flg, exp, va, fa, n, trace) = if flg = 1

then if listp (exp)

then good-frame2-proof (isin (z-list (list (10, ncode (flg), ncode (exp), ncode (va), ncode (fa))),

trace), a-ev-defn (trace), a-ev-defn-part (flg, exp, va, fa, 10, trace), f-equal (10, ncode (ev (flg, exp, va, fa, n))), a-ev-reduc-proof (flg, exp, va, fa, 10, trace), a-ev-defn-part-good-proof (flg,

exp, va, fa, n,

10,

trace, a-ev-defn (trace), good-frame3-proof (isin (z-list (list (10,

ncode (0),

ncode (car (exp)), ncode (va), ncode (fa))),

trace), a-ev-defn (trace), f-equal (10,

ncode (ev (0, car (exp), va, fa, n))),

a-ev-good-proof (0, car (exp), va, fa, n, trace)),

good-frame3-proof (isin (z-list (list (10, ncode (1), ncode (cdr (exp)), ncode (va), ncode (fa))),

trace), a-ev-defn (trace), f-equal (10,

ncode (ev (1, cdr (exp), va, fa, n))),

a-ev-good-proof (1, cdr (exp), va, fa, n, trace))))

else good-frame2-proof (isin (z-list (list (10, ncode (flg), ncode (exp), ncode (va), ncode (fa))),

trace), a-ev-defn (trace), a-ev-defn-part (flg,

exp, va, fa,

10,

trace),

f-equal (10,

ncode (ev (flg, exp, va, fa, n))), a-ev-reduc-proof (flg,

exp, va, fa,

10,

trace),

a-ev-defn-part-good-proof (flg, exp, va, fa, n,

10,

trace, a-ev-defn (trace), nil, nil)) endif

elseif listp (exp) then if car (exp) ≃ 0

then good-frame2-proof (isin (z-list (list (10, ncode (flg), ncode (exp), ncode (va), ncode (fa))),

trace), a-ev-defn (trace), a-ev-defn-part (flg, exp, va, fa, 10, trace), f-equal (10, ncode (ev (flg, exp, va, fa, n))), a-ev-reduc-proof (flg, exp, va, fa, 10, trace), a-ev-defn-part-good-proof (flg,

exp, va, fa, n,

10,

trace, a-ev-defn (trace), good-frame3-proof (isin (z-list (list (10,

ncode (0),

ncode (cadr (exp)), ncode (va), ncode (fa))),

trace), a-ev-defn (trace), f-equal (10,

ncode (ev (0, cadr (exp), va, fa, n))),

a-ev-good-proof (0, cadr (exp), va, fa, n, trace)),

if ncode-equal (ev (0, cadr (exp), va, fa, n),

             0)

then good-frame3-proof (isin (z-list (list (10, ncode (0), ncode (cadddr (exp)), ncode (va), ncode (fa))),

trace), a-ev-defn (trace), f-equal (10,

ncode (ev (0, cadddr (exp), va, fa, n))),

a-ev-good-proof (0, cadddr (exp), va, fa, n, trace))

else good-frame3-proof (isin (z-list (list (10, ncode (0), ncode (caddr (exp)), ncode (va), ncode (fa))),

trace), a-ev-defn (trace), f-equal (10,

ncode (ev (0, caddr (exp), va, fa, n))),

a-ev-good-proof (0, caddr (exp), va, fa, n, trace)) endif))

elseif car (exp) = 10 then good-frame2-proof (isin (z-list (list (10,

ncode (flg), ncode (exp), ncode (va), ncode (fa))),

trace), a-ev-defn (trace), a-ev-defn-part (flg, exp, va, fa, 10, trace), f-equal (10, ncode (ev (flg, exp, va, fa, n))), a-ev-reduc-proof (flg, exp, va, fa, 10, trace), a-ev-defn-part-good-proof (flg,

exp, va, fa, n,

10,

trace, a-ev-defn (trace), nil, nil))

elseif subrp (car (exp)) then good-frame2-proof (isin (z-list (list (10,

ncode (flg), ncode (exp), ncode (va), ncode (fa))),

trace), a-ev-defn (trace), a-ev-defn-part (flg, exp, va, fa, 10, trace), f-equal (10, ncode (ev (flg, exp, va, fa, n))), a-ev-reduc-proof (flg, exp, va, fa, 10, trace), a-ev-defn-part-good-proof (flg,

exp, va, fa, n,

10,

trace, a-ev-defn (trace), good-frame3-proof (isin (z-list (list (10,

ncode (1),

ncode (cdr (exp)), ncode (va), ncode (fa))),

trace), a-ev-defn (trace), f-equal (10,

ncode (ev (1, cdr (exp), va, fa,

n))),

a-ev-good-proof (1, cdr (exp), va, fa, n, trace)),

nil))

elseif n ≃ 0 then nil else good-frame2-proof (isin (z-list (list (10,

ncode (flg), ncode (exp), ncode (va), ncode (fa))),

trace), a-ev-defn (trace), a-ev-defn-part (flg,

exp, va, fa,

10,

trace),

f-equal (10,

ncode (ev (flg, exp, va, fa, n))), a-ev-reduc-proof (flg,

exp, va, fa,

10,

trace),

a-ev-defn-part-good-proof (flg, exp, va, fa, n,

10,

trace, a-ev-defn (trace), good-frame3-proof (isin (z-list (list (10,

ncode (1),

ncode (cdr (exp)), ncode (va), ncode (fa))),

trace), a-ev-defn (trace), f-equal (10,

ncode (ev (1, cdr (exp), va, fa, n))),

a-ev-good-proof (1, cdr (exp), va, fa, n, trace)),

good-frame3-proof (isin (z-list (list (10, ncode (0), ncode (get (sub1-n (car (exp),

             11),

fa)),

ncode (ev (1, cdr (exp), va, fa, n)),

ncode (fa))),

trace), a-ev-defn (trace), f-equal (10,

ncode (ev (0,

get (sub1-n (car (exp),

          11),

fa), ev (1,

cdr (exp), va, fa, n),

fa, n − 1))),

a-ev-good-proof (0,

get (sub1-n (car (exp),

         11),

fa), ev (1,

cdr (exp), va, fa, n),

fa, n − 1, trace)))) endif

else good-frame2-proof (isin (z-list (list (10, ncode (flg), ncode (exp), ncode (va), ncode (fa))),

trace), a-ev-defn (trace), a-ev-defn-part (flg, exp, va, fa, 10, trace), f-equal (10, ncode (ev (flg, exp, va, fa, n))), a-ev-reduc-proof (flg, exp, va, fa, 10, trace), a-ev-defn-part-good-proof (flg,

exp, va, fa, n,

10,

trace, a-ev-defn (trace), nil, nil)) endif

;;;;;;;"A-EV" is `GOOD', i.e.,
;;;;;;; |- "(A-ev(<FLG>, <EXP>, <VA>, <FA>, val, trace) -> (val = <(EV FLG VA FA N)>))".

Theorem: a-ev-good-proof-proves (ev-hyps (given, defns, symbols) ∧ variable (trace) ∧ (trace ∉ list (6, 7, 8, 9, 10, 11, 12, 15, 16)) ∧ (¬ btmp (ev (flg, exp, va, fa, n)))) → proves (a-ev-good-proof (flg, exp, va, fa, n, trace),

f-implies (a-ev (ncode (flg), ncode (exp), ncode (va), ncode (fa),

10,

trace), f-equal (10, ncode (ev (flg, exp, va, fa, n)))),

given, Event: Enable a-ev-good-proof; name this event ‘g0954’.

;;;;;;;
;;;;;;;This brings us to an entirely different section of the proof.  So far we have
;;;;;;;shown that a Lisp interpreter is representable by a Z2 formula.  In order to
;;;;;;;construct the undecidable sentence, we need to show that the metatheory of Z2
;;;;;;;is representable in Z2.  We do that by showing that the metatheoretic formalization
;;;;;;;of Z2 is computable by means of the Lisp interpreter EV.  Since EV is only aware
;;;;;;;of data-structures which are lists or numbers (num-trees), we need to first
;;;;;;;represent the Z2 expressions and proofs in these terms.  The function GCODE
;;;;;;;translates the shell-constructors F-NOT, F-OR, FORSOME, CONS, and ADD1, into
;;;;;;;distinct num-trees.  If it is none of the above (NIL, for instance), then GCODE
;;;;;;;returns the num-tree (CONS 5 0).
;;;;;;;

Definition: gcode (x) = if listp (x) then cons (1, cons (gcode (car (x)), gcode (cdr (x))))

elseif f-notp (x) then cons (2, cons (gcode (arg (x)), 0))

elseif f-orp (x) then cons (3, cons (gcode (arg1 (x)), gcode (arg2 (x)))) elseif forsomep (x) then cons (4, cons (bind (x), gcode (body (x)))) elseif x ∈ N then x else cons (5, 0) endif

;;;;;;;The lemma below establishes the connection between EQL and GCODE.

Theorem: eql-gcode-equal eql (x, y) = (gcode (x) = gcode (y))

;;;;;;;Then we introduce functions which form e-expressions corresponding to e-function
;;;;;;;applications of the Lisp primitives.  The prefix PR stands for `primitive'.

Definition: pr-cons (x, y) = list (7, x, y)

Definition: pr-car (x) = list (8, x)

Definition: pr-cdr (x) = list (9, x)

Definition: pr-equal (x, y) = list (1, x, y)

Definition: pr-numberp (x) = list (2, x)

Definition: pr-zerop (x) = list (3, x)

Definition: pr-add1 (x) = list (4, x)

Definition: pr-sub1 (x) = list (5, x)

Definition: pr-listp (x) = list (6, x)

;;;;;;;The functions suffixed with `N' are the Lisp analogues of the e-functions.
;;;;;;;CONS is not the Lisp analogue of PR-CONS since PR-CONS can return (BTM),
;;;;;;;whereas CONS cannot.  The function PR-CONSN returns (BTM) if one of its
;;;;;;;arguments is (BTM), and (CONS X Y) otherwise.  Similarly, we have the
;;;;;;;Lisp analogues for the other primitives.

Definition: pr-consn (x, y) = if btmp (x) ∨ btmp (y) then btm

else cons (x, y) endif

Definition: pr-carn (x) = if btmp (x) then btm

else car (x) endif

Definition: pr-cdrn (x) = if btmp (x) then btm

else cdr (x) endif

Definition: pr-equaln (x, y) = if btmp (x) ∨ btmp (y) then btm

else bool-fix (ncode-equal (x, y)) endif

Definition: pr-numberpn (x) = if btmp (x) then btm

else bool-fix (¬ listp (x)) endif

Definition: pr-zeropn (x) = if btmp (x) then btm

else bool-fix (x ≃ 0) endif

Definition: pr-add1n (x) = if btmp (x) then btm

else 1 + x endif Definition: pr-listpn (x) = if btmp (x) then btm

else bool-fix (listp (x)) endif

Event: Disable subrp; name this event ‘g0955’.

Event: Disable apply-subr; name this event ‘g0956’.

Event: Disable apply-subr1; name this event ‘g0957’.

Event: Disable apply-subr2; name this event ‘g0958’.

;;;;;;;The relationship between PR-CONS and PR-CONSN is established below.  The lemma
;;;;;;;asserts that the result of evaluating (PR-CONS X Y) with EV is (PR-CONSN x y),
;;;;;;;where x and y are the results of evaluating X and Y, respectively.

Theorem: pr-cons-eval ev (0, pr-cons (x, y), va, fa, n) = pr-consn (ev (0, x, va, fa, n), ev (0, y, va, fa, n))

Theorem: pr-car-eval ev (0, pr-car (x), va, fa, n) = pr-carn (ev (0, x, va, fa, n))

Theorem: pr-cdr-eval ev (0, pr-cdr (x), va, fa, n) = pr-cdrn (ev (0, x, va, fa, n))

Theorem: pr-equal-eval ev (0, pr-equal (x, y), va, fa, n) = pr-equaln (ev (0, x, va, fa, n), ev (0, y, va, fa, n))

Theorem: pr-numberp-eval ev (0, pr-numberp (x), va, fa, n) = pr-numberpn (ev (0, x, va, fa, n))

Theorem: pr-zerop-eval ev (0, pr-zerop (x), va, fa, n) = pr-zeropn (ev (0, x, va, fa, n))

Theorem: pr-add1-eval ev (0, pr-add1 (x), va, fa, n) = pr-add1n (ev (0, x, va, fa, n))

Definition: pr-sub1n (x) = if btmp (x) then btm

else x − 1 endif

Theorem: pr-sub1-eval ev (0, pr-sub1 (x), va, fa, n) = pr-sub1n (ev (0, x, va, fa, n))

Theorem: pr-listp-eval ev (0, pr-listp (x), va, fa, n) = pr-listpn (ev (0, x, va, fa, n)) Event: Enable pr-cons; name this event ‘g0959’. Event: Enable pr-car; name this event ‘g0960’. Event: Enable pr-cdr; name this event ‘g0961’. Event: Enable pr-equal; name this event ‘g0962’. Event: Enable pr-zerop; name this event ‘g0963’. Event: Enable pr-numberp; name this event ‘g0964’. Event: Enable pr-add1; name this event ‘g0965’. Event: Enable pr-sub1; name this event ‘g0966’. Event: Enable pr-listp; name this event ‘g0967’.

;;;;;;;Similarly we construct e-expressions for IF-expressions and QUOTE-expressions,
;;;;;;;and show how they are evaluated.

Definition: pr-if (x, y, z) = list (0, x, y, z) Theorem: pr-if-eval ev (0, pr-if (x, y, z), va, fa, n) = if btmp (ev (0, x, va, fa, n)) then btm

elseif ncode-equal (ev (0, x, va, fa, n), 0) then ev (0, z, va, fa, n) else ev (0, y, va, fa, n) endif

Event: Enable pr-if; name this event ‘g0968’. Definition: pr-quote (x) = list (10, x) Theorem: pr-quote-eval ev (0, pr-quote (x), va, fa, n) = x

;;;;;;;Having dealt with the primitives, we now get into the defined notions.
;;;;;;;There are two kinds of definitions: explicit and recursive.  The explicit
;;;;;;;definitions will be treated as abbreviations and no efunction symbol will
;;;;;;;introduced on their behalf.  E-function symbols will be introduced for
;;;;;;;recursively defined e-functions.  We first develop the basic logical connectives
;;;;;;;and analogues for the GCODEd versions of the shell-constructors/destructors/recognizers.
;;;;;;;G-CONS constructs the e-expression for the GCODE analogue of CONS, i.e., (G-CONS X Y)
;;;;;;;evaluates to (GCODE (CONS x y)).  We will adopt the convention of representing the
;;;;;;;value of X by x.

Definition: g-cons (x, y) = pr-cons (pr-quote (1), pr-cons (x, y))

;;;;;;;The logical-and connective is defined below.  Note that PR-AND evaluates to 1 or 0.

Definition: pr-and (x, y) = pr-if (x, pr-if (y, pr-quote (1), pr-quote (0)), pr-quote (0))

Definition: pr-andn (x, y) = if btmp (x) then btm

elseif ncode-equal (x, 0) then 0 elseif btmp (y) then btm elseif ncode-equal (y, 0) then 0 else 1 endif

Theorem: pr-and-eval ev (0, pr-and (x, y), va, fa, n) = pr-andn (ev (0, x, va, fa, n), ev (0, y, va, fa, n))

Event: Enable pr-and; name this event ‘g0990’.

Theorem: pr-andn-reduc pr-andn (bool-fix (x), bool-fix (y)) = bool-fix (x ∧ y)

;;;;;;;The logical-not connective.

Definition: pr-not (x) = pr-if (x, pr-quote (0), pr-quote (1))

Definition: pr-notn (x) = if btmp (x) then btm

elseif ncode-equal (x, 0) then 1 else 0 endif

Theorem: pr-not-eval ev (0, pr-not (x), va, fa, n) = pr-notn (ev (0, x, va, fa, n))

Event: Enable pr-quote; name this event ‘g0991’.

Event: Enable pr-not; name this event ‘g0992’.

Theorem: pr-notn-reduc pr-notn (bool-fix (x)) = bool-fix (¬ x)

;;;;;;;The logical-or connective.

Definition: pr-or (x, y) = pr-if (x, pr-quote (1), pr-if (y, pr-quote (1), pr-quote (0)))

Definition: pr-orn (x, y) = if btmp (x) then btm

elseif ncode-equal (x, 0) then if btmp (y) then btm

elseif ncode-equal (y, 0) then 0 else 1 endif

else 1 endif

Theorem: pr-or-eval ev (0, pr-or (x, y), va, fa, n) = pr-orn (ev (0, x, va, fa, n), ev (0, y, va, fa, n))

Event: Enable pr-or; name this event ‘g0993’.

Theorem: pr-orn-reduc pr-orn (bool-fix (x), bool-fix (y)) = bool-fix (x ∨ y)

;;;;;;;The next e-definition is an important one.  Given (GCODE X), we can recover
;;;;;;;the type of X by looking at (CAR X).  If it is 1, X is a list; if it is 2,
;;;;;;;X is of the form (F-NOT Y); if it is 3, X is of the form (F-OR Y Z); if it is
;;;;;;;4, X is of the form (FORSOME Y Z); otherwise it could either be a natural number
;;;;;;;for which we already have a NUMBERP primitive, or any remaining type which is
;;;;;;;coerced to NIL.  G-TYPEP checks if X is of type TYPE.  Note that TYPE is going
;;;;;;;to be a number, not an e-expression, since it appears withing PR-QUOTE in G-TYPEP.

Definition: g-typep (x, type) = pr-equal (pr-car (x), pr-quote (type))

Definition: g-typepn (x, type) = pr-equaln (pr-carn (x), type)

Theorem: g-typep-eval ev (0, g-typep (x, type), va, fa, n) = g-typepn (ev (0, x, va, fa, n), type)

Event: Enable g-typep; name this event ‘g0995’.

;;;;;;;PR-IFN is the Lisp analogue of PR-IF.

Definition: pr-ifn (x, y, z) = if btmp (x) then btm

elseif ncode-equal (x, 0) then z

else y endif

;;;;;;;PR-CAR-CDR is the iterated CAR/CDR e-expression.

Definition: pr-car-cdr (x, list) = if listp (list)

then if car (list) = 1 then pr-car (pr-car-cdr (x, cdr (list))) else pr-cdr (pr-car-cdr (x, cdr (list))) endif

else x endif

;;;;;;;The destructors for GCODEd objects are derived from G-ARG below.
;;;;;;;Let us represent (GCODE X) as \X\.
;;;;;;;G-ARG selects a field from \X\ according to its type TYPE and the
;;;;;;;desired field ARGNUM.  E.g., (G-ARG Y (PR-QUOTE 1) 1) evaluates to
;;;;;;;\(CAR X)\, if Y evaluates to \X\.

Definition: g-arg (x, argnum, type) = pr-if (g-typep (x, type),

pr-if (argnum, pr-car-cdr (x, list (2, 2)), pr-car-cdr (x, list (1, 2))), pr-quote (0))

Event: Enable g-typepn; name this event ‘g0997’.

Event: Enable pr-carn; name this event ‘g0998’.

Event: Enable pr-cdrn; name this event ‘g0999’.

Definition: g-argn (x, argnum, type) = pr-ifn (g-typepn (x, type),

pr-ifn (argnum, pr-cdrn (pr-cdrn (x)), pr-carn (pr-cdrn (x))),

         0)

Theorem: g-arg-eval ev (0, g-arg (x, argnum, type), va, fa, n) = g-argn (ev (0, x, va, fa, n), ev (0, argnum, va, fa, n), type)

Event: Enable g-arg; name this event ‘g1000’.

Event: Disable g-typepn; name this event ‘g1001’.

Event: Disable pr-carn; name this event ‘g1003’.

Theorem: pr-carn-gcode pr-carn (gcode (x)) = car (gcode (x))

Event: Disable pr-cdrn; name this event ‘g1004’.

Theorem: pr-cdrn-gcode pr-cdrn (gcode (x)) = cdr (gcode (x))

;;;;;;;G-TYPEPN on Lists, negations, disjunctions, and existential quantifications.

Theorem: g-typepn-gcode-list g-typepn (gcode (x), 1) = bool-fix (listp (x))

Theorem: g-typepn-gcode-f-notp g-typepn (gcode (x), 2) = bool-fix (f-notp (x))

Theorem: g-typepn-gcode-f-orp g-typepn (gcode (x), 3) = bool-fix (f-orp (x))

Theorem: g-typepn-gcode-forsomep g-typepn (gcode (x), 4) = bool-fix (forsomep (x))

Theorem: car-gcode g-argn (gcode (x), 0, 1) = gcode (car (x))

Theorem: cdr-gcode g-argn (gcode (x), 1, 1) = gcode (cdr (x))

Theorem: arg-gcode g-argn (gcode (x), 0, 2) = gcode (arg (x))

Theorem: arg1-gcode g-argn (gcode (x), 0, 3) = gcode (arg1 (x))

Theorem: arg2-gcode g-argn (gcode (x), 1, 3) = gcode (arg2 (x)) Theorem: bind-gcode g-argn (gcode (x), 0, 4) = gcode (bind (x)) Theorem: body-gcode g-argn (gcode (x), 1, 4) = gcode (body (x))

;;;;;;;From G-ARG, we derive the selectors (destructors) for the GCODEd objects.

Definition: g-car (x) = g-arg (x, pr-quote (0), 1) Definition: g-cdr (x) = g-arg (x, pr-quote (1), 1) Definition: g-carn (x) = g-argn (x, 0, 1)

;;;;;;;G-FUNCTION is the EV analogue of the metatheoretic function FUNCTION.

Definition: g-function (fn) = pr-equal (g-car (fn), pr-quote (2)) Definition: g-functionn (fn) = pr-equaln (g-carn (fn), 2) Theorem: eval-g-function ev (0, g-function (fn), va, fa, n) = g-functionn (ev (0, fn, va, fa, n)) Event: Disable function; name this event ‘g0969’.

Theorem: g-functionn-gcode g-functionn (gcode (fn)) = bool-fix (function (fn)) Event: Enable function; name this event ‘g0970’.

Event: Enable g-function; name this event ‘g0971’.

Event: Enable g-functionn; name this event ‘g0972’.

;;;;;;;G-VARIABLE is the EV analogue of VARIABLE.

Definition: g-variable (x) = pr-numberp (x) Definition: g-variablen (x) = pr-numberpn (x) Theorem: eval-g-variable ev (0, g-variable (x), va, fa, n) = g-variablen (ev (0, x, va, fa, n))

Theorem: g-variablen-gcode g-variablen (gcode (x)) = bool-fix (variable (x)) Event: Enable g-variable; name this event ‘g0973’.

Event: Enable g-variablen; name this event ‘g0976’.

Event: Enable pr-consn; name this event ‘g0977’.

Definition: g-consn (x, y) = pr-consn (1, pr-consn (x, y)) Theorem: g-cons-eval ev (0, g-cons (x, y), va, fa, n) = g-consn (ev (0, x, va, fa, n), ev (0, y, va, fa, n)) Event: Disable pr-consn; name this event ‘g0978’.

Theorem: g-consn-gcode g-consn (gcode (x), gcode (y)) = gcode (cons (x, y)) Event: Enable pr-consn; name this event ‘g0979’.

Event: Enable g-consn; name this event ‘g0980’.

Event: Enable g-cons; name this event ‘g0981’.

;;;;;;;G-FIX is the EV analogue of FIX.

Definition: g-fix (x) = pr-if (pr-numberp (x), x, pr-quote (0)) Definition: g-fixn (x) = pr-ifn (pr-numberpn (x), x, 0) Theorem: eval-g-fix ev (0, g-fix (x), va, fa, n) = g-fixn (ev (0, x, va, fa, n)) Theorem: g-fix-gcode g-fixn (gcode (x)) = gcode (fix (x)) Event: Enable g-fix; name this event ‘g0982’.

Event: Enable g-fixn; name this event ‘g0983’.

Definition: g-f-not (x) = pr-cons (pr-quote (2), pr-cons (x, pr-quote (0))) Definition: g-f-notn (x) = pr-consn (2, pr-consn (x, 0)) Theorem: eval-g-f-not ev (0, g-f-not (x), va, fa, n) = g-f-notn (ev (0, x, va, fa, n)) Event: Disable pr-consn; name this event ‘g0984’.

Theorem: g-f-notn-gcode g-f-notn (gcode (x)) = gcode (f-not (x)) Event: Enable g-f-not; name this event ‘g0985’.

Event: Enable g-f-notn; name this event ‘g0986’.

Definition: g-f-or (x, y) = pr-cons (pr-quote (3), pr-cons (x, y)) Definition: g-f-orn (x, y) = pr-consn (3, pr-consn (x, y)) Theorem: eval-g-f-or ev (0, g-f-or (x, y), va, fa, n) = g-f-orn (ev (0, x, va, fa, n), ev (0, y, va, fa, n)) Theorem: g-f-orn-gcode g-f-orn (gcode (x), gcode (y)) = gcode (f-or (x, y)) Event: Enable g-f-or; name this event ‘g0987’.

Event: Enable g-f-orn; name this event ‘g0988’.

Definition: g-forsome (x, y) = pr-cons (pr-quote (4), pr-cons (g-fix (x), y)) Definition: g-forsomen (x, y) = pr-consn (4, pr-consn (g-fixn (x), y)) Theorem: eval-g-forsome ev (0, g-forsome (x, y), va, fa, n) = g-forsomen (ev (0, x, va, fa, n), ev (0, y, va, fa, n)) Theorem: g-forsomen-gcode g-forsomen (gcode (x), gcode (y)) = gcode (forsome (x, y))

Event: Enable g-forsome; name this event ‘g0989’.

Event: Enable g-forsomen; name this event ‘g0994’.

;;;;;;;G-PREDICATE is the EV analogue of PREDICATE.  In general G-FOO is the
;;;;;;;EV analogue of FOO.

Definition: g-predicate (x) = pr-equal (g-car (x), pr-quote (3)) Definition: g-predicaten (x) = pr-equaln (g-carn (x), 3) Theorem: eval-g-predicate ev (0, g-predicate (x), va, fa, n) = g-predicaten (ev (0, x, va, fa, n)) Event: Disable predicate; name this event ‘g0996’.

Theorem: g-predicaten-gcode g-predicaten (gcode (x)) = bool-fix (predicate (x)) Event: Enable predicate; name this event ‘g1002’.

Event: Enable g-predicate; name this event ‘g1005’.

Event: Enable g-predicaten; name this event ‘g1006’.

Definition: g-func-pred (x) = pr-or (g-function (x), g-predicate (x)) Definition: g-func-predn (x) = pr-orn (g-functionn (x), g-predicaten (x)) Theorem: eval-g-func-pred ev (0, g-func-pred (x), va, fa, n) = g-func-predn (ev (0, x, va, fa, n)) Theorem: g-func-predn-gcode g-func-predn (gcode (x)) = bool-fix (func-pred (x)) Event: Enable g-func-pred; name this event ‘g1007’.

Event: Enable g-func-predn; name this event ‘g1008’.

;;;;;;;Now we start defining the EV analogues of the recursive metatheoretic functions.
;;;;;;;These will all be defined first, and then shown to correspond to their
;;;;;;;Boyer-Moore counterparts.

Definition: g-append (x, y) = list (11, x, y)

Definition: g-cdrn (x) = g-argn (x, 1, 1)

Event: Enable g-argn; name this event ‘g1009’.

Event: Enable g-typepn; name this event ‘g1010’.

Theorem: eval-pr-if-again ev (0, pr-if (x, y, z), va, fa, n) = pr-ifn (ev (0, x, va, fa, n), ev (0, y, va, fa, n), ev (0, z, va, fa, n))

Theorem: pr-ifn-gcode pr-ifn (bool-fix (x), y, z) = if x then y

else z endif

Event: Enable pr-ifn; name this event ‘g1011’.

Theorem: eval-var (x ∈ N) → (ev (0, x, va, fa, n) = get (x, va))

Theorem: eval-fun-zero ((10 < fn) ∧ (n ≃ 0)) → (ev (0, cons (fn, args), va, fa, n) = btm)

Theorem: eval-fun1 ((flg ≠ 1) ∧ listp (exp) ∧ (10 < car (exp))) → (ev (flg, exp, va, fa, n)

= if btmp (ev (1, cdr (exp), va, fa, n)) then btm elseif n ≃ 0 then btm else ev (0,

get (sub1-n (car (exp), 11), fa), ev (1, cdr (exp), va, fa, n), fa, n − 1) endif)

Theorem: eval-fun2 (10 < fn) → (ev (0, cons (fn, args), va, fa, n)

= if btmp (ev (1, args, va, fa, n)) then btm elseif n ≃ 0 then btm else ev (0,

get (sub1-n (fn, 11), fa), ev (1, args, va, fa, n), fa, n − 1) endif)

Theorem: ev-list1 ev (1, cons (x, y), va, fa, n) = if btmp (ev (0, x, va, fa, n)) ∨ btmp (ev (1, y, va, fa, n)) then btm

else cons (ev (0, x, va, fa, n), ev (1, y, va, fa, n)) endif

Theorem: ev-list2 ev (1, nil, va, fa, n) = nil

Event: Enable ev; name this event ‘g1012’.

Event: Disable sub1; name this event ‘g1013’.

Event: Disable get; name this event ‘g1014’.

Event: Enable g-typepn; name this event ‘g1015’.

Event: Enable eval-fun1; name this event ‘g1016’.

Theorem: eval-fun3 ((10 < fn) ∧ (n ≄ 0)) → (ev (0, cons (fn, args), va, fa, n)

= if btmp (ev (1, args, va, fa, n)) then btm

else ev (0, get (sub1-n (fn, 11), fa), ev (1, args, va, fa, n), fa, n − 1) endif)

;;;;;;;The e-definition of G-APPEND.

Definition: g-append-defn = pr-if (g-typep (0, 1), g-cons (g-car (0), g-append (g-cdr (0), 1)), 1)

Event: Enable g-append; name this event ‘g1017’.

;;;;;;;The e-definition of G-DEL.

Definition: g-del (x, y) = list (12, x, y)

Definition: g-del-defn = pr-if (g-typep (1, 1),

pr-if (pr-equal (0, g-car (1)), g-del (0, g-cdr (1)), g-cons (g-car (1), g-del (0, g-cdr (1)))),

        1)

Event: Enable g-del; name this event ‘g1018’.

;;;;;;;The e-definition of G-MEMB.

Definition: g-memb (x, y) = list (13, x, y)

Definition: g-memb-defn = pr-if (g-typep (1, 1),

pr-if (pr-equal (0, g-car (1)), pr-quote (1), g-memb (0, g-cdr (1))), pr-quote (0))

Event: Enable g-memb; name this event ‘g1019’.

;;;;;;;The e-definition of G-COLLECT-FREE.

Definition: g-collect-free (exp, flg) = list (14, exp, flg)

Definition: g-collect-free-defn = pr-if (pr-zerop (1),

pr-if (g-variable (0), g-cons (0, pr-quote (gcode (nil))), pr-if (g-typep (0, 2),

g-collect-free (g-arg (0, pr-quote (0), 2), pr-quote (0)), pr-if (g-typep (0, 3),

g-append (g-collect-free (g-arg (0, pr-quote (0), 3), pr-quote (0)),

g-collect-free (g-arg (0, pr-quote (1),

pr-quote (0))),

pr-if (g-typep (0, 4),

g-del (g-arg (0, pr-quote (0), 4), g-collect-free (g-arg (0,

pr-quote (1), 4), pr-quote (0))),

pr-if (g-typep (0, 1),

g-collect-free (g-cdr (0),

pr-quote (1)),

pr-quote (gcode (nil))))))),

pr-if (g-typep (0, 1),

g-append (g-collect-free (g-car (0), pr-quote (0)),

g-collect-free (g-cdr (0), pr-quote (1))),

pr-quote (gcode (nil))))

Event: Enable g-collect-free; name this event ‘g1020’.

;;;;;;;The e-definition of G-COVERING.

Definition: g-covering (exp, var, flg) = list (15, exp, var, flg)

Definition: g-covering-defn = pr-if (pr-zerop (2),

pr-if (g-typep (0, 2), g-covering (g-arg (0, pr-quote (0), 2), 1, pr-quote (0)), pr-if (g-typep (0, 3),

g-append (g-covering (g-arg (0, pr-quote (0), 3),

                                    1,

pr-quote (0)), g-covering (g-arg (0, pr-quote (1), 3),

                                    1,

pr-quote (0))),

pr-if (g-typep (0, 4),

pr-if (g-memb (1, g-collect-free (0, pr-quote (0))), g-cons (g-arg (0, pr-quote (0), 4), g-covering (g-arg (0,

pr-quote (1), 4),

                                          1,

pr-quote (0))),

pr-quote (gcode (nil))), pr-if (g-typep (0, 1),

g-covering (g-cdr (0), 1, pr-quote (1)), pr-quote (gcode (nil)))))),

pr-if (g-typep (0, 1),

g-append (g-covering (g-car (0), 1, pr-quote (0)),

g-covering (g-cdr (0), 1, pr-quote (1))),

pr-quote (gcode (nil))))

Event: Enable g-covering; name this event ‘g1021’.

;;;;;;;The e-definition of G-NIL-INTERSECT.

Definition: g-nil-intersect (x, y) = list (16, x, y)

Event: Enable bool-fix; name this event ‘g1022’.

Definition: g-nil-intersect-defn = pr-if (g-typep (0, 1),

pr-and (pr-not (g-memb (g-car (0), 1)), g-nil-intersect (g-cdr (0), 1)), pr-quote (bool-fix (t)))

Event: Enable g-nil-intersect; name this event ‘g1023’.

;;;;;;;The e-definition of G-VAR-LIST.

Definition: g-var-list (list, len) = list (17, list, len)

Theorem: pr-sub1n-gcode pr-sub1n (gcode (x)) = gcode (x − 1)

Event: Enable pr-sub1n; name this event ‘g1024’.

Definition: g-var-list-defn = pr-if (pr-or (pr-zerop (1), pr-not (g-typep (0, 1))),

pr-and (pr-zerop (1), pr-not (g-typep (0, 1))),

pr-and (g-variable (g-car (0)), g-var-list (g-cdr (0), pr-sub1 (1))))

Event: Enable g-var-list; name this event ‘g1025’.

;;;;;;;The e-definition of G-TERMP.

Definition: g-termp (exp, flg, symbols) = list (19, exp, flg, symbols)

Event: Enable pr-equaln; name this event ‘g1026’.

Definition: g-symb (x, symbols) = pr-or (pr-equal (x,

g-cons (pr-quote (gcode (3)),

g-cons (pr-quote (gcode (0)), pr-quote (gcode (2))))),

g-memb (x, symbols))

Event: Enable g-symb; name this event ‘g1027’.

Definition: g-length (x) = list (18, x)

Definition: g-length-defn = pr-if (g-typep (0, 1), pr-add1 (g-length (g-cdr (0))), pr-quote (gcode (0)))

Definition: g-termp-defn = pr-if (pr-zerop (1),

pr-if (g-typep (0, 1),

pr-and (g-function (g-car (0)),

pr-and (g-symb (g-car (0), 2),

pr-and (g-termp (g-cdr (0), pr-quote (1), 2), pr-equal (g-length (g-cdr (0)),

g-fix (g-cdr (g-cdr (g-car (0)))))))),

g-variable (0)), pr-if (g-typep (0, 1),

pr-and (g-termp (g-car (0), pr-quote (0), 2),

g-termp (g-cdr (0), pr-quote (1), 2)), pr-quote (bool-fix (t))))

;;;;;;;The e-definition of G-SUBST.

Definition: g-subst (exp, var, term, flg) = list (20, exp, var, term, flg)

Definition: g-subst-defn = pr-if (pr-zerop (3),

pr-if (g-variable (0), pr-if (pr-equal (0, 1), 2, 0), pr-if (g-typep (0, 2),

g-f-not (g-subst (g-arg (0, pr-quote (0), 2),

1,
2,

pr-quote (gcode (0)))),

pr-if (g-typep (0, 3),

g-f-or (g-subst (g-arg (0, pr-quote (0), 3),

1,
2,

pr-quote (gcode (0))), g-subst (g-arg (0, pr-quote (1), 3),

1,
2,

pr-quote (gcode (0)))),

pr-if (g-typep (0, 4),

pr-if (pr-equal (g-arg (0, pr-quote (0), 4),

1),

0,

g-forsome (g-arg (0, pr-quote (0), 4),

g-subst (g-arg (0, pr-quote (1), 4),

             1,
             2,

pr-quote (gcode (0))))),

pr-if (g-typep (0, 1),

g-cons (g-car (0),

g-subst (g-cdr (0),

          1,
          2,

pr-quote (gcode (1)))),

0))))),

pr-if (g-typep (0, 1),

g-cons (g-subst (g-car (0), 1, 2, pr-quote (gcode (0))),

g-subst (g-cdr (0), 1, 2, pr-quote (gcode (1)))), 0))

Definition: g-sub (x, y) = list (21, x, y)

Definition: g-sub-defn = pr-if (g-typep (0, 1),

pr-and (g-memb (g-car (0), 1), g-sub (g-cdr (0), 1)), pr-quote (bool-fix (t)))

;;;;;;;The e-definition of G-FORMULA.

Definition: g-formula (exp, symbols) = list (22, exp, symbols)

Definition: g-atomp (exp, symbols) = pr-and (g-predicate (g-car (exp)),

pr-and (g-symb (g-car (exp), symbols),

pr-and (pr-equal (g-length (g-cdr (exp)),

g-fix (g-cdr (g-cdr (g-car (exp))))),

g-termp (g-cdr (exp), pr-quote (1), symbols))))

Event: Enable g-atomp; name this event ‘g1028’.

Definition: g-formula-defn = pr-if (g-typep (0, 2),

g-formula (g-arg (0, pr-quote (0), 2), 1), pr-if (g-typep (0, 3),

pr-and (g-formula (g-arg (0, pr-quote (0), 3), 1),

g-formula (g-arg (0, pr-quote (1), 3), 1)), pr-if (g-typep (0, 4),

g-formula (g-arg (0, pr-quote (1), 4), 1), g-atomp (0, 1))))

Definition: g-pairequals (vars1 , vars2 , exp) = list (23, vars1 , vars2 , exp)

Definition: g-f-and (x, y) = g-f-not (g-f-or (g-f-not (x), g-f-not (y)))

Definition: g-f-andn (x, y) = g-f-notn (g-f-orn (g-f-notn (x), g-f-notn (y)))

Theorem: g-f-and-eval ev (0, g-f-and (x, y), va, fa, n) = g-f-andn (ev (0, x, va, fa, n), ev (0, y, va, fa, n))

Event: Disable f-and; name this event ‘g1098’.

Theorem: g-f-andn-gcode g-f-andn (gcode (x), gcode (y)) = gcode (f-and (x, y))

Event: Enable f-and; name this event ‘g1099’.

Event: Enable g-f-and; name this event ‘g1100’.

Event: Enable g-f-andn; name this event ‘g1101’. Definition: g-f-implies (x, y) = g-f-or (g-f-not (x), y) Definition: g-f-impliesn (x, y) = g-f-orn (g-f-notn (x), y) Theorem: g-f-implies-eval ev (0, g-f-implies (x, y), va, fa, n) = g-f-impliesn (ev (0, x, va, fa, n), ev (0, y, va, fa, n)) Event: Disable f-implies; name this event ‘g1102’. Theorem: g-f-impliesn-gcode g-f-impliesn (gcode (x), gcode (y)) = gcode (f-implies (x, y)) Event: Enable f-implies; name this event ‘g1103’. Event: Enable g-f-implies; name this event ‘g1104’. Event: Enable g-f-impliesn; name this event ‘g1105’. Definition: g-forall (var, exp) = g-f-not (g-forsome (var, g-f-not (exp))) Definition: g-foralln (var, exp) = g-f-notn (g-forsomen (var, g-f-notn (exp))) Theorem: g-forall-eval ev (0, g-forall (x, y), va, fa, n) = g-foralln (ev (0, x, va, fa, n), ev (0, y, va, fa, n)) Event: Disable forall; name this event ‘g1106’. Theorem: g-foralln-gcode g-foralln (gcode (x), gcode (y)) = gcode (∀ x y) Event: Enable forall; name this event ‘g1107’. Event: Enable g-forall; name this event ‘g1108’. Event: Enable g-foralln; name this event ‘g1109’.

Definition: g-f-equal (x, y) = g-cons (g-cons (pr-quote (gcode (3)),

g-cons (pr-quote (gcode (0)), pr-quote (gcode (2)))), g-cons (x, g-cons (y, pr-quote (gcode (nil)))))

Definition: g-f-equaln (x, y) = g-consn (g-consn (gcode (3), g-consn (gcode (0), gcode (2))),

g-consn (x, g-consn (y, gcode (nil))))

Theorem: g-f-equal-eval ev (0, g-f-equal (x, y), va, fa, n) = g-f-equaln (ev (0, x, va, fa, n), ev (0, y, va, fa, n))

Event: Disable p; name this event ‘g1049’.

Event: Disable f-equal; name this event ‘g1050’.

Theorem: g-f-equaln-gcode g-f-equaln (gcode (x), gcode (y)) = gcode (f-equal (x, y))

Event: Enable p; name this event ‘g1051’.

Event: Enable f-equal; name this event ‘g1052’.

Event: Enable g-f-equal; name this event ‘g1053’.

Event: Enable g-f-equaln; name this event ‘g1054’.

;;;;;;;The e-definition of G-PAIREQUALS.

Definition: g-pairequals-defn = pr-if (pr-and (g-typep (0, 1), g-typep (1, 1)),

g-f-implies (g-f-equal (g-car (0), g-car (1)),

g-pairequals (g-cdr (0), g-cdr (1), 2)),

        2)
;;;;;;;The e-definition of G-SET.

Definition: g-set (x) = list (24, x)

Definition: g-set-defn = pr-if (g-typep (0, 1),

pr-and (pr-not (g-memb (g-car (0), g-cdr (0))), g-set (g-cdr (0))), pr-quote (bool-fix (t)))

Definition: g-conc (pf , flg) = list (25, pf , flg)

Definition: g-cadr (x) = g-car (g-cdr (x))

Definition: g-caddr (x) = g-car (g-cdr (g-cdr (x)))

Definition: g-cadddr (x) = g-car (g-cdr (g-cdr (g-cdr (x))))

;;;;;;;The e-definition of G-CONC.

Definition: g-conc-defn = pr-if (pr-zerop (1),

g-caddr (0),

pr-if (g-typep (0, 1),

g-cons (g-conc (g-car (0), pr-quote (0)),

g-conc (g-cdr (0), pr-quote (1))), pr-quote (gcode (nil))))

;;;;;;;The e-definition of G-REST-OF.

Definition: g-rest-of (sym, symbols) = list (26, sym, symbols)

Definition: g-rest-of-defn = pr-if (g-typep (1, 1),

pr-if (pr-and (pr-equal (g-car (1), 0), pr-not (g-memb (0, g-cdr (1)))), g-cdr (1), g-rest-of (0, g-cdr (1))),

pr-quote (gcode (nil)))

;;;;;;;The e-definition of G-ASSOC.

Definition: g-assoc (x, y) = list (27, x, y)

Definition: g-assoc-defn = pr-if (g-typep (1, 1),

pr-if (pr-equal (g-car (g-car (1)), 0), g-cdr (g-car (1)), g-assoc (0, g-cdr (1))),

pr-quote (0))

Definition: g-prf (pf , given, defns, flg, symbols) = list (28, pf , given, defns, flg, symbols)

Definition: g-free-for (exp, var, term, flg) = g-nil-intersect (g-covering (exp, var, flg),

g-collect-free (term, pr-quote (0)))

Event: Enable g-free-for; name this event ‘g1029’.

;;;;;;;The EV analogues of the FOL axiom-checkers.

Definition: g-subst-axiom-proof (conc, hints, symbols) = pr-and (g-formula (g-cadr (hints), symbols),

pr-and (g-variable (g-caddr (hints)),

pr-and (g-termp (g-cadddr (hints), pr-quote (0), symbols),

pr-and (g-free-for (g-cadr (hints), g-caddr (hints), g-cadddr (hints), pr-quote (0)),

pr-equal (conc,

g-f-implies (g-subst (g-cadr (hints), g-caddr (hints), g-cadddr (hints), pr-quote (0)), g-forsome (g-caddr (hints),

g-cadr (hints))))))))

Definition: g-degree (x) = g-fix (g-cdr (g-cdr (x)))

Definition: g-fun-equal-axiom-proof (conc, hints, symbols) = pr-and (g-termp (g-caddr (hints), pr-quote (1), symbols),

pr-and (g-termp (g-cadddr (hints), pr-quote (1), symbols),

pr-and (g-function (g-cadr (hints)),

pr-and (pr-equal (g-length (g-caddr (hints)),

g-degree (g-cadr (hints))), pr-and (pr-equal (g-length (g-cadddr (hints)),

g-degree (g-cadr (hints))),

pr-equal (conc,

g-pairequals (g-caddr (hints), g-cadddr (hints), g-f-equal (g-cons (g-cadr (hints),

g-caddr (hints)), g-cons (g-cadr (hints),

g-cadddr (hints))))))))))

Definition: g-pred-equal-axiom-proof (conc, hints, symbols) = pr-and (g-termp (g-caddr (hints), pr-quote (1), symbols),

pr-and (g-termp (g-cadddr (hints), pr-quote (1), symbols),

pr-and (g-predicate (g-cadr (hints)),

pr-and (pr-equal (g-length (g-caddr (hints)),

g-degree (g-cadr (hints))), pr-and (pr-equal (g-length (g-cadddr (hints)),

g-degree (g-cadr (hints))),

pr-equal (conc,

g-pairequals (g-caddr (hints), g-cadddr (hints), g-f-implies (g-cons (g-cadr (hints),

g-caddr (hints)), g-cons (g-cadr (hints),

g-cadddr (hints))))))))))

;;;;;;;The EV analogue of FOL-AXIOM-PROOF.

Definition: g-fol-axiom-proof (conc, hints, symbols) = pr-if (pr-equal (g-car (hints), pr-quote (1)),

pr-and (g-formula (g-cadr (hints), symbols),

pr-equal (conc,

g-f-or (g-f-not (g-cadr (hints)), g-cadr (hints)))),

pr-if (pr-equal (g-car (hints), pr-quote (2)), g-subst-axiom-proof (conc, hints, symbols), pr-if (pr-equal (g-car (hints), pr-quote (3)),

pr-and (g-termp (g-cadr (hints), pr-quote (0), symbols),

pr-equal (conc,

g-f-equal (g-cadr (hints),

g-cadr (hints)))),

pr-if (pr-equal (g-car (hints), pr-quote (4)), g-fun-equal-axiom-proof (conc, hints, symbols), pr-if (pr-equal (g-car (hints), pr-quote (5)), g-pred-equal-axiom-proof (conc,

hints, symbols),

pr-quote (bool-fix (f)))))))

;;;;;;;The EV analogues of the various FOL rule-checkers.

Definition: g-expan-rule (conc, hints, sub-goals, symbols) = pr-and (g-formula (g-cadr (hints), symbols),

pr-and (g-formula (g-car (sub-goals), symbols), pr-equal (conc, g-f-or (g-cadr (hints), g-car (sub-goals)))))

Definition: g-contrac-rule (conc, hints, sub-goals, symbols) = pr-and (g-formula (g-cadr (hints), symbols),

pr-and (pr-equal (sub-goals,

g-cons (g-f-or (g-cadr (hints), g-cadr (hints)), pr-quote (gcode (nil)))),

pr-equal (conc, g-cadr (hints))))

Definition: g-assoc-rule (conc, hints, sub-goals, symbols) = pr-and (g-formula (g-cadr (hints), symbols),

pr-and (g-formula (g-caddr (hints), symbols),

pr-and (g-formula (g-cadddr (hints), symbols), pr-and (pr-equal (sub-goals,

g-cons (g-f-or (g-cadr (hints),

g-f-or (g-caddr (hints),

g-cadddr (hints))),

pr-quote (gcode (nil)))),

pr-equal (conc,

g-f-or (g-f-or (g-cadr (hints),

g-caddr (hints)), g-cadddr (hints)))))))

Definition: g-cut-rule (conc, hints, sub-goals, symbols) = pr-and (g-formula (g-cadr (hints), symbols),

pr-and (g-formula (g-caddr (hints), symbols),

pr-and (g-formula (g-cadddr (hints), symbols), pr-and (pr-equal (sub-goals,

g-cons (g-f-or (g-cadr (hints),

g-caddr (hints)), g-cons (g-f-or (g-f-not (g-cadr (hints)),

g-cadddr (hints)), pr-quote (gcode (nil))))),

pr-equal (conc,

g-f-or (g-caddr (hints), g-cadddr (hints)))))))

Definition: g-forsome-intro-rule (conc, hints, sub-goals, symbols) = pr-and (g-variable (g-cadr (hints)),

pr-and (g-formula (g-caddr (hints), symbols),

pr-and (g-formula (g-cadddr (hints), symbols),

pr-and (pr-not (g-memb (g-cadr (hints),

g-collect-free (g-cadddr (hints),

pr-quote (0)))),

pr-and (pr-equal (sub-goals,

g-cons (g-f-implies (g-caddr (hints),

g-cadddr (hints)),

pr-quote (gcode (nil)))),

pr-equal (conc,

g-f-implies (g-forsome (g-cadr (hints),

g-caddr (hints)),

g-cadddr (hints))))))))

;;;;;;;The EV analogue of G-FOL-RULES.

Definition: g-fol-rules (conc, hints, sub-goals, symbols) = pr-if (pr-equal (g-car (hints), pr-quote (1)),

g-expan-rule (conc, hints, sub-goals, symbols), pr-if (pr-equal (g-car (hints), pr-quote (2)),

g-contrac-rule (conc, hints, sub-goals, symbols), pr-if (pr-equal (g-car (hints), pr-quote (3)),

g-assoc-rule (conc, hints, sub-goals, symbols), pr-if (pr-equal (g-car (hints), pr-quote (4)),

g-cut-rule (conc, hints, sub-goals, symbols), pr-if (pr-equal (g-car (hints), pr-quote (5)), g-forsome-intro-rule (conc,

hints, sub-goals, symbols),

pr-quote (bool-fix (f)))))))

;;;;;;;The EV analogues of the various set-theoretic operations.

Definition: g-isin (x, y) = g-cons (g-cons (pr-quote (3), g-cons (pr-quote (1), pr-quote (2))),

g-cons (x, g-cons (y, pr-quote (gcode (nil)))))

Definition: g-phi = g-cons (g-cons (pr-quote (2), g-cons (pr-quote (0), pr-quote (0))),

pr-quote (gcode (nil)))

Definition: g-z-pair (x, y) = g-cons (g-cons (pr-quote (2), g-cons (pr-quote (1), pr-quote (2))),

g-cons (x, g-cons (y, pr-quote (gcode (nil)))))

Definition: g-z-union (x, y) = g-cons (g-cons (pr-quote (2), g-cons (pr-quote (2), pr-quote (2))),

g-cons (x, g-cons (y, pr-quote (gcode (nil)))))

Definition: g-z-int (x) = g-cons (g-cons (pr-quote (3), g-cons (pr-quote (2), pr-quote (1))),

g-cons (x, pr-quote (gcode (nil))))

Definition: g-z-succ (x) = g-cons (g-cons (pr-quote (2), g-cons (pr-quote (3), pr-quote (1))),

g-cons (x, pr-quote (gcode (nil))))

Definition: g-f-iff (x, y) = g-f-and (g-f-implies (x, y), g-f-implies (y, x))

;;;;;;;The EV analogue of Z2-AXIOMS.

;;;;;;;The EV analogue of Z2-AXIOMS.
(DEFN
 G-Z2-AXIOMS
 (CONC HINTS SYMBOLS)
 (PR-IF
  (PR-EQUAL (G-CAR HINTS) (PR-QUOTE 1))
  (PR-AND
   (G-VARIABLE (G-CADDDR HINTS))
   (PR-AND
    (G-TERMP (G-CADR HINTS) (PR-QUOTE 0) SYMBOLS)
    (PR-AND
     (G-TERMP (G-CADDR HINTS) (PR-QUOTE 0) SYMBOLS)
     (PR-AND (PR-NOT (G-MEMB (G-CADDDR HINTS) (G-COLLECT-FREE (G-CADR HINTS) (PR-QUOTE 0))))
             (PR-AND (PR-NOT (G-MEMB (G-CADDDR HINTS)
                                     (G-COLLECT-FREE (G-CADDR HINTS) (PR-QUOTE 0))))
                     (PR-EQUAL CONC
                               (G-F-IFF (G-F-EQUAL (G-CADR HINTS) (G-CADDR HINTS))
                                        (G-FORALL (G-CADDDR HINTS)
                                                  (G-F-IFF (G-ISIN (G-CADDDR HINTS)

                                                                (G-CADR HINTS))
                                                        (G-ISIN (G-CADDDR HINTS)
                                                                (G-CADDR HINTS)))))))))))
(PR-IF
(PR-EQUAL (G-CAR HINTS) (PR-QUOTE 2))
(PR-AND (G-TERMP (G-CADR HINTS) (PR-QUOTE 0) SYMBOLS)
        (PR-EQUAL CONC (G-F-NOT (G-ISIN (G-CADR HINTS) (G-PHI)))))
(PR-IF
 (PR-EQUAL (G-CAR HINTS) (PR-QUOTE 3))
 (PR-AND (G-TERMP (G-CONS (G-CADR HINTS)
                          (G-CONS (G-CADDR HINTS)
                                  (G-CONS (G-CADDDR HINTS) (PR-QUOTE (GCODE NIL)))))
                  (PR-QUOTE 1)
                  SYMBOLS)
         (PR-EQUAL CONC
                   (G-F-IFF (G-ISIN (G-CADDDR HINTS)
                                    (G-Z-PAIR (G-CADR HINTS) (G-CADDR HINTS)))
                            (G-F-OR (G-F-EQUAL (G-CADDDR HINTS) (G-CADR HINTS))
                                    (G-F-EQUAL (G-CADDDR HINTS) (G-CADDR HINTS))))))
 (PR-IF
  (PR-EQUAL (G-CAR HINTS) (PR-QUOTE 4))
  (PR-AND (G-TERMP (G-CONS (G-CADR HINTS)
                           (G-CONS (G-CADDR HINTS)
                                   (G-CONS (G-CADDDR HINTS) (PR-QUOTE (GCODE NIL)))))
                   (PR-QUOTE 1)
                   SYMBOLS)
          (PR-EQUAL CONC
                    (G-F-IFF (G-ISIN (G-CADDDR HINTS)
                                     (G-Z-UNION (G-CADR HINTS) (G-CADDR HINTS)))
                             (G-F-OR (G-ISIN (G-CADDDR HINTS) (G-CADR HINTS))
                                     (G-ISIN (G-CADDDR HINTS) (G-CADDR HINTS))))))
  (PR-IF
   (PR-EQUAL (G-CAR HINTS) (PR-QUOTE 5))
   (PR-AND
    (G-VARIABLE (G-CADDR HINTS))
    (PR-AND
     (G-FORMULA (G-CADR HINTS) SYMBOLS)
     (PR-EQUAL
      CONC
      (G-F-IMPLIES
       (G-F-AND (G-SUBST (G-CADR HINTS) (G-CADDR HINTS) (G-PHI) (PR-QUOTE 0))
                (G-FORALL (G-CADDR HINTS)
                          (G-F-IMPLIES (G-F-AND (G-Z-INT (G-CADDR HINTS))
                                                (G-CADR HINTS))

                                (G-SUBST (G-CADR HINTS)
                                         (G-CADDR HINTS)
                                         (G-Z-SUCC (G-CADDR HINTS))
                                         (PR-QUOTE 0)))))
(G-FORALL (G-CADDR HINTS)
          (G-F-IMPLIES (G-Z-INT (G-CADDR HINTS)) (G-CADR HINTS)))))))
(PR-QUOTE (BOOL-FIX F))))))))
;;;;;;;The EV analogue of SYMB-DEFN-PROOF.

;;;;;;;The EV analogue of SYMB-DEFN-PROOF.
(DEFN
G-SYMB-DEFN-PROOF
(CONC HINTS SUB-GOALS DEFN SYMBOLS)
(PR-IF
(G-PREDICATE (G-CAR (G-CAR HINTS)))
(PR-AND (G-SET (G-CDR (G-CAR HINTS)))
(PR-AND (G-VAR-LIST (G-CDR (G-CAR HINTS)) (G-DEGREE (G-CAR (G-CAR HINTS))))
        (PR-AND (PR-EQUAL CONC (G-F-IFF (G-CAR HINTS) DEFN))
                (PR-AND (G-SUB (G-COLLECT-FREE DEFN (PR-QUOTE 0))
                               (G-CDR (G-CAR HINTS)))
                        (G-FORMULA DEFN (G-REST-OF (G-CAR (G-CAR HINTS)) SYMBOLS))))))
(PR-IF
(G-FUNCTION (G-CAR (G-CAR HINTS)))
(PR-AND
(G-SET (G-CONS (G-CADDDR HINTS) (G-CONS (G-CADR HINTS) (G-CDR (G-CAR HINTS)))))
(PR-AND
(G-VAR-LIST (G-CDR (G-CAR HINTS)) (G-DEGREE (G-CAR (G-CAR HINTS))))
(PR-AND
(G-VARIABLE (G-CADR HINTS))
(PR-AND
(G-VARIABLE (G-CADDDR HINTS))
(PR-AND
(G-FORMULA (G-CADDR HINTS) (G-REST-OF (G-CAR (G-CAR HINTS)) SYMBOLS))
(PR-AND
(G-SUB (G-COLLECT-FREE (G-CADDR HINTS) (PR-QUOTE 0))
      (G-CONS (G-CADR HINTS) (G-CDR (G-CAR HINTS))))
(PR-AND
(G-FREE-FOR (G-CADDR HINTS) (G-CADR HINTS) (G-CAR HINTS) (PR-QUOTE 0))
(PR-AND
 (G-FREE-FOR (G-CADDR HINTS) (G-CADR HINTS) (G-CADDDR HINTS) (PR-QUOTE 0))
 (PR-AND
  (PR-EQUAL CONC

                      (G-SUBST (G-CADDR HINTS)
                               (G-CADR HINTS)
                               (G-CAR HINTS)
                               (PR-QUOTE 0)))
            (PR-AND
             (PR-EQUAL CONC DEFN)
             (PR-EQUAL
              SUB-GOALS
              (G-CONS (G-FORSOME (G-CADR HINTS) (G-CADDR HINTS))
                      (G-CONS (G-F-IMPLIES (G-F-AND (G-CADDR HINTS)
                                                    (G-SUBST (G-CADDR HINTS)
                                                             (G-CADR HINTS)
                                                             (G-CADDDR HINTS)
                                                             (PR-QUOTE 0)))
                                           (G-F-EQUAL (G-CADR HINTS)
                                                      (G-CADDDR HINTS)))
                              (PR-QUOTE (GCODE NIL)))))))))))))))
   (PR-QUOTE (BOOL-FIX F)))))

Event: Enable g-symb-defn-proof; name this event ‘g1286’.

Event: Enable g-z2-axioms; name this event ‘g1287’.

Event: Enable g-fol-rules; name this event ‘g1288’.

;;;;;;;The e-definition of G-PRF.

Definition: g-prf-defn (pf , given, defns, flg, symbols) = pr-if (pr-zerop (flg),

pr-if (g-typep (pf , 1),

pr-if (pr-not (g-formula (g-conc (pf , pr-quote (0)), symbols)), pr-quote (bool-fix (f)), pr-if (pr-equal (g-car (pf ), pr-quote (1)),

g-fol-axiom-proof (g-conc (pf , pr-quote (0)), g-cadr (pf ), symbols),

pr-if (pr-equal (g-car (pf ), pr-quote (2)), pr-and (g-fol-rules (g-conc (pf ,

pr-quote (0)), g-cadr (pf ), g-conc (g-cadddr (pf ),

pr-quote (1)),

symbols),

g-prf (g-cadddr (pf ), given, defns, pr-quote (1), symbols)),

pr-if (pr-equal (g-car (pf ), pr-quote (3)),

g-z2-axioms (g-conc (pf ,

pr-quote (0)), g-cadr (pf ), symbols),

pr-if (pr-equal (g-car (pf ),

pr-quote (4)),

pr-and (g-symb-defn-proof (g-conc (pf ,

pr-quote (0)), g-cadr (pf ), g-conc (g-cadddr (pf ),

pr-quote (1)), g-assoc (g-car (g-car (g-cadr (pf ))),

defns), symbols), pr-if (g-function (g-car (g-car (g-cadr (pf )))),

g-prf (g-cadddr (pf ), given, defns, pr-quote (1), g-rest-of (g-car (g-car (g-cadr (pf ))),

symbols)),

pr-quote (bool-fix (t)))),

pr-if (pr-equal (g-car (pf ),

pr-quote (5)),

g-memb (g-conc (pf ,

pr-quote (0)), given),

pr-quote (bool-fix (f)))))))),

pr-quote (bool-fix (f))), pr-if (g-typep (pf , 1),

pr-and (g-prf (g-car (pf ), given, defns, pr-quote (0), symbols),

g-prf (g-cdr (pf ), given, defns, pr-quote (1), symbols)), pr-quote (bool-fix (t))))

;;;;;;;So far we have presented the e-definitions leading to the EV analogue
;;;;;;;of the proof-checker PRF.  We need a few more e-definitions in order to
;;;;;;;construct the undecidable sentence.

;;;;;;;Below is the e-definition for G-NUMERAL.

Definition: g-numeral (x) = list (29, x) Definition: g-numeral-defn = pr-if (pr-zerop (0), g-phi, g-z-succ (g-numeral (pr-sub1 (0)))) Definition: g-z-sing (x) = g-z-pair (x, x) Definition: g-z-opair (x, y) = g-z-pair (g-z-sing (x), g-z-pair (x, y))

;;;;;;;The e-definition for G-PLUS (addition).

Definition: g-plus (x, y) = list (30, x, y) Definition: g-plus-defn = pr-if (pr-zerop (0), g-fix (1), pr-add1 (g-plus (pr-sub1 (0), 1)))

;;;;;;;The e-definition for G-TIMES (multiplication).

Definition: g-times (x, y) = list (31, x, y) Definition: g-times-defn = pr-if (pr-zerop (0),

pr-quote (gcode (0)),

g-plus (1, g-times (pr-sub1 (0), 1)))

;;;;;;;The e-definition for G-EXP (exponentiation).

Definition: g-exp (x, y) = list (32, x, y) Definition: g-exp-defn = pr-if (pr-zerop (1), pr-quote (gcode (1)), g-times (0, g-exp (0, pr-sub1 (1))))

;;;;;;;The e-definition for G-HALVE (integer division by 2).

Definition: g-halve (x) = list (33, x) Definition: g-halve-defn = pr-if (pr-zerop (0),

pr-quote (gcode (0)),

pr-if (pr-zerop (pr-sub1 (0)), pr-quote (gcode (0)), pr-add1 (g-halve (pr-sub1 (pr-sub1 (0))))))

;;;;;;;The e-definition for G-LESSP.

Definition: g-lessp (x, y) = list (34, x, y)

Definition: g-lessp-defn = pr-if (pr-zerop (1),

pr-quote (bool-fix (f)), pr-if (pr-zerop (0),

pr-quote (bool-fix (t)),

g-lessp (pr-sub1 (0), pr-sub1 (1))))

;;;;;;;With PLUS, TIMES, and EXP, we can cipher num-trees as numbers, and with these
;;;;;;;and the HALVE function, we can decipher back the num-trees from the numbers
;;;;;;;by a yet-to-be-defined function DECIPHER1.  The e-definition for G-DECIPHER1 is
;;;;;;;shown below.

Definition: g-decipher1 (x, y, z) = list (35, x, y, z)

Definition: g-decipher1-defn = pr-if (pr-zerop (1),

g-halve (pr-sub1 (0)), pr-if (pr-zerop (2),

g-decipher1 (0, pr-sub1 (1), 0),

pr-if (pr-and (g-lessp (1, 0), g-lessp (2, 0)),

pr-if (pr-equal (0,

g-times (g-exp (pr-quote (gcode (2)), 1),

g-exp (pr-quote (gcode (3)), 2))),

pr-cons (g-decipher1 (1, pr-sub1 (1), pr-sub1 (1)),

g-decipher1 (2, pr-sub1 (2), pr-sub1 (2))), g-decipher1 (0, 1, pr-sub1 (2))),

g-decipher1 (0, 1, pr-sub1 (2)))))

Definition: g-proves (pf , exp, given, defns, symbols) = pr-and (pr-equal (g-conc (pf , pr-quote (0)), exp),

pr-and (g-formula (exp, symbols), g-prf (pf , given, defns, pr-quote (0), symbols)))

Event: Enable g-proves; name this event ‘g1035’.

Definition: g-decipher (x) = g-decipher1 (x, pr-sub1 (x), pr-sub1 (x))

;;;;;;;G-INV-CODE is the EV analogue of a function INV-CODE which is the inverse for GCODE.
;;;;;;;At first sight, G-INV-CODE might seem like an identity mapping but that is only
;;;;;;;true when its argument is a GCODE and as we shall see, this is not always the case.

Definition: g-inv-code (x) = list (36, x)

Definition: g-inv-code-defn = pr-if (pr-listp (0),

pr-if (pr-equal (pr-car (0), pr-quote (1)),

g-cons (g-inv-code (pr-car (pr-cdr (0))),

g-inv-code (pr-cdr (pr-cdr (0)))), pr-if (pr-equal (pr-car (0), pr-quote (2)),

g-f-not (g-inv-code (pr-car (pr-cdr (0)))), pr-if (pr-equal (pr-car (0), pr-quote (3)),

g-f-or (g-inv-code (pr-car (pr-cdr (0))),

g-inv-code (pr-cdr (pr-cdr (0)))), pr-if (pr-equal (pr-car (0), pr-quote (4)),

g-forsome (g-inv-code (pr-car (pr-cdr (0))),

g-inv-code (pr-cdr (pr-cdr (0)))),

pr-if (pr-equal (pr-car (0), pr-quote (5)), pr-quote (gcode (t)), pr-if (pr-equal (pr-car (0),

pr-quote (6)),

pr-quote (gcode (f)),

pr-quote (gcode (nil)))))))),

g-fix (0))

;;;;;;;G-ISTHM is the EV analogue of the `theorem-checker' ISTHM which will be described
;;;;;;;later.  The e-definition is presented below.

Definition: g-isthm (pfn, exp, given, defns, symbols) = list (37, pfn, exp, given, defns, symbols)

Definition: g-isthm-defn = pr-if (g-proves (g-inv-code (g-decipher (0)), 1, 2, 3, 4),

pr-quote (bool-fix (t)),

pr-if (g-proves (g-inv-code (g-decipher (0)), g-f-not (1), 2, 3, 4), pr-quote (bool-fix (f)), g-isthm (pr-add1 (0), 1, 2, 3, 4)))

;;;;;;;The last e-definition is that of GC-NCODE which is the EV analogue of NCODE.

Definition: gc-ncode (x) = list (38, x)

Definition: gc-ncode-defn = pr-if (pr-listp (0),

g-z-opair (gc-ncode (pr-car (0)), gc-ncode (pr-cdr (0))), g-numeral (0))

;;;;;;;For the time being, we disable all the e-definitions.

Event: Enable g-append-defn; name this event ‘g1036’. Event: Enable g-del-defn; name this event ‘g1037’. Event: Enable g-memb-defn; name this event ‘g1038’. Event: Enable g-collect-free-defn; name this event ‘g1039’. Event: Enable g-covering-defn; name this event ‘g1040’. Event: Enable g-nil-intersect-defn; name this event ‘g1041’. Event: Enable g-var-list-defn; name this event ‘g1042’. Event: Enable g-length-defn; name this event ‘g1043’. Event: Enable g-termp-defn; name this event ‘g1044’. Event: Enable g-subst-defn; name this event ‘g1045’. Event: Enable g-sub-defn; name this event ‘g1046’. Event: Enable g-formula-defn; name this event ‘g1047’. Event: Enable g-pairequals-defn; name this event ‘g1048’. Event: Enable g-set-defn; name this event ‘g1055’. Event: Enable g-conc-defn; name this event ‘g1056’.

Event: Enable g-rest-of-defn; name this event ‘g1057’. Event: Enable g-assoc-defn; name this event ‘g1058’. Event: Enable g-prf-defn; name this event ‘g1059’. Event: Enable g-numeral-defn; name this event ‘g1060’. Event: Enable g-plus-defn; name this event ‘g1061’. Event: Enable g-times-defn; name this event ‘g1062’. Event: Enable g-exp-defn; name this event ‘g1063’. Event: Enable g-halve-defn; name this event ‘g1064’. Event: Enable g-lessp-defn; name this event ‘g1065’. Event: Enable g-decipher1-defn; name this event ‘g1066’. Event: Enable g-inv-code-defn; name this event ‘g1067’. Event: Enable g-isthm-defn; name this event ‘g1068’. Event: Enable gc-ncode-defn; name this event ‘g1069’. Event: Disable sub1-n; name this event ‘g1070’.

;;;;;;;The function FA below is the big list of e-definitions.

Definition: fa = list (g-append-defn,

g-del-defn, g-memb-defn, g-collect-free-defn, g-covering-defn, g-nil-intersect-defn, g-var-list-defn, g-length-defn, g-termp-defn, g-subst-defn, g-sub-defn, g-formula-defn, g-pairequals-defn, g-set-defn, g-conc-defn, g-rest-of-defn, g-assoc-defn, g-prf-defn (0, 1, 2, 3, 4), g-numeral-defn, g-plus-defn, g-times-defn, g-exp-defn, g-halve-defn, g-lessp-defn, g-decipher1-defn, g-inv-code-defn, g-isthm-defn, gc-ncode-defn)

Event: Disable sub1-n; name this event ‘g1072’.

Theorem: difference-lessp (x ≤ y) → ((x − y) = 0)

Theorem: difference-sub1-n (x ∈ N) → (sub1-n (x, y) = (x − y))

Event: Enable sub1-n; name this event ‘g1073’.

;;;;;;;We prove that GET of the e-function symbol (minus 11) on (FA) yields the
;;;;;;;appropriate e-definition for each of the defined e-function symbols.

Theorem: get-g-append-defn get (sub1-n (11, 11), fa) = g-append-defn

Theorem: get-sub1-n-nzerop get (1 + x, list) = get (x, cdr (list))

Theorem: difference-lessp2 (y ≤ x) → (((1 + x) − y) = (1 + (x − y)))

Theorem: get-g-del-defn get (sub1-n (12, 11), fa) = g-del-defn

Theorem: get-g-memb-defn get (sub1-n (13, 11), fa) = g-memb-defn

Theorem: get-g-collect-free-defn get (sub1-n (14, 11), fa) = g-collect-free-defn

Theorem: get-g-covering-defn get (sub1-n (15, 11), fa) = g-covering-defn

Theorem: get-g-nil-intersect-defn get (sub1-n (16, 11), fa) = g-nil-intersect-defn

Theorem: get-g-var-list-defn get (sub1-n (17, 11), fa) = g-var-list-defn

Theorem: get-g-length-defn get (sub1-n (18, 11), fa) = g-length-defn

Theorem: get-g-termp-defn get (sub1-n (19, 11), fa) = g-termp-defn

Theorem: get-g-subst-defn get (sub1-n (20, 11), fa) = g-subst-defn

Theorem: get-g-sub-defn get (sub1-n (21, 11), fa) = g-sub-defn

Theorem: get-g-pairequals-defn get (sub1-n (23, 11), fa) = g-pairequals-defn

Theorem: get-g-set-defn get (sub1-n (24, 11), fa) = g-set-defn

Theorem: get-g-conc-defn get (sub1-n (25, 11), fa) = g-conc-defn

Theorem: get-g-rest-of-defn get (sub1-n (26, 11), fa) = g-rest-of-defn

Theorem: get-g-assoc-defn get (sub1-n (27, 11), fa) = g-assoc-defn

Theorem: get-g-prf-defn get (sub1-n (28, 11), fa) = g-prf-defn (0, 1, 2, 3, 4)

Theorem: get-g-numeral-defn get (sub1-n (29, 11), fa) = g-numeral-defn

Theorem: get-g-plus-defn get (sub1-n (30, 11), fa) = g-plus-defn

Theorem: get-g-times-defn get (sub1-n (31, 11), fa) = g-times-defn

Theorem: get-g-exp-defn get (sub1-n (32, 11), fa) = g-exp-defn

Theorem: get-g-halve-defn get (sub1-n (33, 11), fa) = g-halve-defn

Theorem: get-g-lessp-defn get (sub1-n (34, 11), fa) = g-lessp-defn

Theorem: get-g-decipher1-defn get (sub1-n (35, 11), fa) = g-decipher1-defn

Theorem: get-g-inv-code-defn get (sub1-n (36, 11), fa) = g-inv-code-defn

Theorem: get-g-isthm-defn get (sub1-n (37, 11), fa) = g-isthm-defn

Theorem: get-gc-ncode-defn get (sub1-n (38, 11), fa) = gc-ncode-defn

Event: Enable fa; name this event ‘g1074’.

Event: Enable difference-sub1-n; name this event ‘g1075’.

Event: Enable difference-lessp; name this event ‘g1076’.

Event: Enable difference-lessp2; name this event ‘g1077’.

;;;;;;;In the next series of events, we prove that the e-functions defined correspond
;;;;;;;to their Lisp analogues.  This involves two steps, in the first step we show,
;;;;;;;for example, that G-APPEND when evaluated corresponds to G-APPENDN.  This is done
;;;;;;;in EVAL-G-APPEND.  In the
;;;;;;;second step we show that G-APPENDN when given a large enough stack bound N
;;;;;;;corresponds to APPEND.  This is done in G-APPENDN-GCODE.
;;;;;;;We do the same thing for each of the e-functions.
;;;;;;;G-APPEND-IND is the induction scheme for EVAL-G-APPEND, and is quite subtle
;;;;;;;and could not have been guessed by the theorem-prover.

Definition: g-append-ind (x, y, va, n) = if n ≃ 0 then t

else g-append-ind (g-cdr (0), 1, ev (1, list (x, y), va, fa, n), n − 1) endif

;;;;;;;G-APPENDN is the Lisp analogue of G-APPEND with N.

Definition: g-appendn (x, y, n) = if (n ≃ 0) ∨ btmp (x) ∨ btmp (y) then btm

else pr-ifn (g-typepn (x, 1), g-consn (g-carn (x), g-appendn (g-cdrn (x), y, n − 1)),

y) endif

Event: Disable g-append; name this event ‘g1078’.

Event: Disable g-append-defn; name this event ‘g1079’.

;;;;;;;EV of G-APPEND applied to arguments is G-APPENDN of the EV of the arguments.

Theorem: eval-g-append ev (0, g-append (x, y), va, fa, n) = g-appendn (ev (0, x, va, fa, n), ev (0, y, va, fa, n), n)

;;;;;;;APPENDN-IND is the induction scheme for G-APPENDN-GCODE.

Definition: appendn-ind (x, y, n) = if listp (x) then appendn-ind (cdr (x), y, n − 1)

else t endif

;;;;;;;For a sufficiently large N, G-APPENDN of the GCODE of the arguments is
;;;;;;;the GCODE of the APPEND of the arguments.

Theorem: g-appendn-gcode (length (x) < n) → (g-appendn (gcode (x), gcode (y), n) = gcode (append (x, y)))

Event: Enable g-appendn; name this event ‘g1080’.

Event: Enable g-append; name this event ‘g1081’.

Event: Enable g-append-defn; name this event ‘g1082’.

Event: Enable eval-fun2; name this event ‘g1083’.

;;;;;;;Correspondence between G-DEL and G-DELN, and G-DELN and DEL.

Definition: g-deln (x, y, n) = if (n ≃ 0) ∨ btmp (x) ∨ btmp (y) then btm

else pr-ifn (g-typepn (y, 1),

pr-ifn (pr-equaln (x, g-carn (y)), g-deln (x, g-cdrn (y), n − 1), g-consn (g-carn (y), g-deln (x, g-cdrn (y), n − 1))),

y) endif

Definition: g-del-ind (x, y, va, n) = if n ≃ 0 then t

else g-del-ind (0, g-cdr (1), ev (1, list (x, y), va, fa, n), n − 1) endif

Event: Disable g-del; name this event ‘g1084’.

Event: Disable g-del-defn; name this event ‘g1085’.

Theorem: eval-g-del ev (0, g-del (x, y), va, fa, n) = g-deln (ev (0, x, va, fa, n), ev (0, y, va, fa, n), n)

Theorem: ncode-equal-reflex ncode-equal (x, x)

Theorem: numberp-ncode-equal ((x ∈ N) ∧ (y ∈ N)) → (ncode-equal (x, y) = (x = y))

Theorem: ncode-gcode-equal ncode-equal (gcode (x), gcode (y)) = eql (x, y)

Event: Enable numberp-ncode-equal; name this event ‘g1086’.

Event: Disable pr-equaln; name this event ‘g1087’.

Theorem: g-deln-gcode (length (y) < n) → (g-deln (gcode (x), gcode (y), n) = gcode (del (x, y)))

Event: Enable g-deln; name this event ‘g1088’.

Event: Enable g-del; name this event ‘g1089’.

Event: Enable g-del-defn; name this event ‘g1090’.

;;;;;;;Correspondence between G-MEMB, G-MEMBN, and MEMB.

Definition: g-membn (x, y, n) = if (n ≃ 0) ∨ btmp (x) ∨ btmp (y) then btm

else pr-ifn (g-typepn (y, 1),

pr-ifn (pr-equaln (x, g-carn (y)),

                   1,

g-membn (x, g-cdrn (y), n − 1)),

0) endif

Event: Disable g-memb; name this event ‘g1091’.

Event: Disable g-memb-defn; name this event ‘g1092’.

Definition: g-memb-ind (x, y, va, n) = if n ≃ 0 then t

else g-memb-ind (0, g-cdr (1), ev (1, list (x, y), va, fa, n), n − 1) endif

Theorem: g-memb-eval ev (0, g-memb (x, y), va, fa, n) = g-membn (ev (0, x, va, fa, n), ev (0, y, va, fa, n), n)

Theorem: g-membn-gcode (length (y) < n) → (g-membn (gcode (x), gcode (y), n)

= if memb (x, y) then 1 else 0 endif)

Event: Enable g-memb; name this event ‘g1093’.

Event: Enable g-membn; name this event ‘g1094’.

Event: Enable g-memb-defn; name this event ‘g1095’.

;;;;;;;Correspondence between G-COLLECT-FREE, G-COLLECT-FREEN, and COLLECT-FREE.

Definition: g-collect-freen (exp, flg, n) = if (n ≃ 0) ∨ btmp (exp) ∨ btmp (flg) then btm

else pr-ifn (pr-zeropn (flg),

pr-ifn (g-variablen (exp), g-consn (exp, gcode (nil)), pr-ifn (g-typepn (exp, 2),

g-collect-freen (g-argn (exp, 0, 2),

0,

n − 1),

pr-ifn (g-typepn (exp, 3),

g-appendn (g-collect-freen (g-argn (exp,

0,

3),

0,

n − 1),

g-collect-freen (g-argn (exp,

1,

3),

0,

n − 1),

n − 1),

pr-ifn (g-typepn (exp, 4),

g-deln (g-argn (exp, 0, 4),

g-collect-freen (g-argn (exp,

  1,

4),

0,

n − 1),

n − 1), pr-ifn (g-typepn (exp, 1),

g-collect-freen (g-cdrn (exp),

1,

n − 1),

gcode (nil)))))),

pr-ifn (g-typepn (exp, 1),

g-appendn (g-collect-freen (g-carn (exp),

0,

n − 1),

g-collect-freen (g-cdrn (exp),

1,

n − 1),

n − 1),

gcode (nil))) endif

Event: Disable g-collect-free; name this event ‘g1096’.

Event: Disable g-collect-free-defn; name this event ‘g1097’.

Definition: g-collect-free-ind (exp, flg, va, n) = if n ≃ 0 then t

else g-collect-free-ind (g-arg (0, pr-quote (0), 2), pr-quote (0), ev (1, list (exp, flg), va, fa, n), n − 1)

∧ g-collect-free-ind (g-arg (0, pr-quote (0), 3), pr-quote (0), ev (1, list (exp, flg), va, fa, n), n − 1)

∧ g-collect-free-ind (g-arg (0, pr-quote (1), 3), pr-quote (0), ev (1, list (exp, flg), va, fa, n), n − 1)

∧ g-collect-free-ind (g-arg (0, pr-quote (1), 4), pr-quote (0), ev (1, list (exp, flg), va, fa, n), n − 1)

∧ g-collect-free-ind (g-cdr (0), pr-quote (1), ev (1, list (exp, flg), va, fa, n), n − 1)

∧ g-collect-free-ind (g-car (0), pr-quote (0), ev (1, list (exp, flg), va, fa, n), n − 1) endif

Theorem: g-collect-free-eval ev (0, g-collect-free (exp, flg), va, fa, n) = g-collect-freen (ev (0, exp, va, fa, n), ev (0, flg, va, fa, n), n)

Definition: exp-count (exp) = if listp (exp) then 1 + (exp-count (car (exp)) + exp-count (cdr (exp)))

elseif f-notp (exp) then 1 + exp-count (arg (exp)) elseif f-orp (exp) then 1 + (exp-count (arg1 (exp)) + exp-count (arg2 (exp))) elseif forsomep (exp) then 1 + exp-count (body (exp)) else 1 endif

Theorem: exp-count-append exp-count (append (x, y)) < (exp-count (x) + exp-count (y))

Theorem: exp-count-del exp-count (del (x, y)) < (1 + exp-count (y))

Theorem: length-exp-count length (x) < (1 + exp-count (x))

Theorem: length-append length (append (x, y)) = (length (x) + length (y))

Theorem: length-del length (del (x, y)) < (1 + length (y))

Theorem: collect-free-count length (collect-free (exp, flg)) < (1 + exp-count (exp))

Definition: collect-freen-ind (exp, flg, n) = if flg ≃ 0

then if variable (exp) then nil elseif f-notp (exp) then collect-freen-ind (arg (exp), 0, n − 1) elseif f-orp (exp) then collect-freen-ind (arg1 (exp), 0, n − 1)

∧ collect-freen-ind (arg2 (exp), 0, n − 1) elseif forsomep (exp) then collect-freen-ind (body (exp), 0, n − 1) elseif listp (exp) then collect-freen-ind (cdr (exp), 1, n − 1) else nil endif

elseif listp (exp)

then collect-freen-ind (car (exp), 0, n − 1)

∧ collect-freen-ind (cdr (exp), 1, n − 1) else nil endif

Theorem: g-collect-freen-gcode ((¬ btmp (flg)) ∧ (exp-count (exp) < n)) → (g-collect-freen (gcode (exp), flg, n) = gcode (collect-free (exp, flg)))

Theorem: numberp-gcode (gcode (exp) ∈ N) = (exp ∈ N)

Theorem: collect-free-gcode-flg collect-free (exp, gcode (flg)) = collect-free (exp, flg)

Event: Enable g-collect-free; name this event ‘g1110’.

Event: Enable g-collect-freen; name this event ‘g1111’.

Event: Enable g-collect-free-defn; name this event ‘g1112’.

Event: Enable pr-andn; name this event ‘g1113’.

;;;;;;;Correspondence between G-COVERING, G-COVERINGN, and COVERING.

Definition: g-coveringn (exp, var, flg, n) = if (n ≃ 0) ∨ btmp (exp) ∨ btmp (var) ∨ btmp (flg) then btm

else pr-ifn (pr-zeropn (flg),

pr-ifn (g-typepn (exp, 2),

g-coveringn (g-argn (exp, 0, 2), var, gcode (0), n − 1),

pr-ifn (g-typepn (exp, 3),

g-appendn (g-coveringn (g-argn (exp, 0, 3), var, gcode (0), n − 1),

g-coveringn (g-argn (exp, 1, 3), var, gcode (0), n − 1),

n − 1),

pr-ifn (g-typepn (exp, 4),

pr-ifn (g-membn (var,

g-collect-freen (exp, gcode (0), n − 1),

n − 1),

g-consn (g-argn (exp, 0, 4),

g-coveringn (g-argn (exp,

               1,

4), var, gcode (0), n − 1)),

gcode (nil)), pr-ifn (g-typepn (exp, 1),

g-coveringn (g-cdrn (exp), var, gcode (1), n − 1),

gcode (nil))))),

pr-ifn (g-typepn (exp, 1),

g-appendn (g-coveringn (g-carn (exp), var, gcode (0), n − 1),

g-coveringn (g-cdrn (exp), var, gcode (1), n − 1),

n − 1),

gcode (nil))) endif

Event: Disable g-covering; name this event ‘g1114’.

Event: Disable g-covering-defn; name this event ‘g1115’.

Definition: g-covering-ind (exp, var, flg, va, n) = if n ≃ 0 then t

else g-covering-ind (g-arg (0, pr-quote (0), 2),

1,

pr-quote (0), ev (1, list (exp, var, flg), va, fa, n), n − 1)

∧ g-covering-ind (g-arg (0, pr-quote (0), 3),

1,

pr-quote (0), ev (1, list (exp, var, flg), va, fa, n), n − 1)

∧ g-covering-ind (g-arg (0, pr-quote (1), 3),

1,

pr-quote (0), ev (1, list (exp, var, flg), va, fa, n), n − 1)

∧ g-covering-ind (g-arg (0, pr-quote (1), 4),

1,

pr-quote (0), ev (1, list (exp, var, flg), va, fa, n), n − 1)

∧ g-covering-ind (g-cdr (0),

1,

pr-quote (1), ev (1, list (exp, var, flg), va, fa, n), n − 1)

∧ g-covering-ind (g-car (0),

1,

pr-quote (0),

ev (1, list (exp, var, flg), va, fa, n), n − 1) endif

Theorem: g-covering-eval ev (0, g-covering (exp, var, flg), va, fa, n) = g-coveringn (ev (0, exp, va, fa, n), ev (0, var, va, fa, n), ev (0, flg, va, fa, n), n)

Theorem: covering-count length (covering (exp, var, flg)) < exp-count (exp)

Theorem: pr-zeropn-gcode pr-zeropn (gcode (x)) = bool-fix (x ≃ 0)

Event: Enable pr-zeropn; name this event ‘g1116’.

Event: Disable bool-fix; name this event ‘g1117’.

Theorem: g-membn-gcode-again (length (y) < n) → (g-membn (gcode (x), gcode (y), n) = bool-fix (memb (x, y)))

Event: Enable bool-fix; name this event ‘g1118’.

Event: Enable g-membn-gcode; name this event ‘g1119’.

Definition: coveringn-ind (exp, var, flg, n) = if flg ≃ 0

then if f-notp (exp) then coveringn-ind (arg (exp), var, 0, n − 1) elseif f-orp (exp) then coveringn-ind (arg1 (exp), var, 0, n − 1)

∧ coveringn-ind (arg2 (exp), var, 0, n − 1) elseif forsomep (exp) then if memb (var, collect-free (exp, 0))

then coveringn-ind (body (exp), var, 0, n − 1) else nil endif

elseif listp (exp) then coveringn-ind (cdr (exp), var, 1, n − 1) elseif exp ∈ N then nil else nil endif

elseif listp (exp)

then coveringn-ind (car (exp), var, 0, n − 1)

∧ coveringn-ind (cdr (exp), var, 1, n − 1) else nil endif Theorem: g-coveringn-gcode ((1 + exp-count (exp)) < n) → (g-coveringn (gcode (exp), gcode (var), gcode (flg), n)

= gcode (covering (exp, var, flg)))

Event: Enable g-coveringn; name this event ‘g1120’.

Event: Enable g-covering; name this event ‘g1121’.

Event: Enable g-covering-defn; name this event ‘g1122’.

;;;;;;;Correspondence between G-NIL-INTERSECT, G-NIL-INTERSECTN, and NIL-INTERSECT.

Definition: g-nil-intersectn (x, y, n) = if btmp (x) ∨ btmp (y) ∨ (n ≃ 0) then btm

else pr-ifn (g-typepn (x, 1),

pr-andn (pr-notn (g-membn (g-carn (x), y, n − 1)),

g-nil-intersectn (g-cdrn (x), y, n − 1)),

bool-fix (t)) endif

Event: Disable g-nil-intersect-defn; name this event ‘g1123’.

Event: Disable g-nil-intersect; name this event ‘g1124’.

Theorem: g-nil-intersect-eval ev (0, g-nil-intersect (x, y), va, fa, n) = g-nil-intersectn (ev (0, x, va, fa, n), ev (0, y, va, fa, n), n)

Event: Enable pr-notn; name this event ‘g1125’.

Definition: nil-intersect-ind (x, y, n) = if n ≃ 0 then t

elseif listp (x) then nil-intersect-ind (cdr (x), y, n − 1)

else t endif

Theorem: g-nil-intersectn-gcode ((length (x) + length (y)) < n) → (g-nil-intersectn (gcode (x), gcode (y), n)

= bool-fix (nil-intersect (x, y)))

Event: Enable g-nil-intersect; name this event ‘g1126’.

Event: Enable g-nil-intersectn; name this event ‘g1127’.

Event: Enable g-nil-intersect-defn; name this event ‘g1128’.

Event: Disable g-free-for; name this event ‘g1129’.

;;;;;;;Correspondence between G-FREE-FOR, G-FREE-FORN, and FREE-FOR.

Definition: g-free-forn (exp, var, term, flg, n) = g-nil-intersectn (g-coveringn (exp, var, flg, n),

g-collect-freen (term, gcode (0), n), n)

Theorem: eval-g-free-for ev (0, g-free-for (exp, var, term, flg), va, fa, n) = g-free-forn (ev (0, exp, va, fa, n),

ev (0, var, va, fa, n), ev (0, term, va, fa, n), ev (0, flg, va, fa, n), n)

Event: Disable free-for; name this event ‘g1130’.

Theorem: g-free-forn-gcode ((1 + (exp-count (exp) + exp-count (term))) < n) → (g-free-forn (gcode (exp), gcode (var), gcode (term), gcode (flg), n)

= bool-fix (free-for (exp, var, term, flg)))

Event: Enable g-free-for; name this event ‘g1131’.

Event: Enable g-free-forn; name this event ‘g1132’.

Event: Enable free-for; name this event ‘g1133’.

;;;;;;;Correspondence between G-VAR-LIST, G-VAR-LISTN, and VAR-LIST.

Definition: g-var-listn (list, len, n)

= if (n ≃ 0) ∨ btmp (list) ∨ btmp (len) then btm

else pr-ifn (pr-orn (pr-zeropn (len), pr-notn (g-typepn (list, 1))), pr-andn (pr-zeropn (len), pr-notn (g-typepn (list, 1))), pr-andn (g-variablen (g-carn (list)),

g-var-listn (g-cdrn (list), pr-sub1n (len), n − 1))) endif

Event: Disable g-var-list; name this event ‘g1139’.

Event: Disable g-var-list-defn; name this event ‘g1140’.

Definition: g-var-list-ind (list, len, va, n) = if n ≃ 0 then t

else g-var-list-ind (g-cdr (0), pr-sub1 (1), ev (1, list (list, len), va, fa, n), n − 1) endif

Theorem: g-var-list-eval ev (0, g-var-list (list, len), va, fa, n) = g-var-listn (ev (0, list, va, fa, n), ev (0, len, va, fa, n), n)

Definition: var-listn-ind (list, len, n) = if n ≃ 0 then t

elseif (len ≃ 0) ∨ (list ≃ nil) then t

else var-listn-ind (cdr (list), len − 1, n − 1) endif

Theorem: g-var-listn-gcode (len < n) → (g-var-listn (gcode (list), gcode (len), n)

= bool-fix (var-list (list, len)))

Event: Enable g-var-listn; name this event ‘g1141’.

Event: Enable g-var-list; name this event ‘g1142’.

Event: Enable g-var-list-defn; name this event ‘g1143’.

Theorem: pr-equaln-reduc pr-equaln (gcode (x), gcode (y)) = bool-fix (eql (x, y))

Event: Enable pr-equaln; name this event ‘g1147’. Event: Enable pr-orn; name this event ‘g1150’.

;;;;;;;Correspondence between G-SYMB, G-SYMBN, and SYMB.

Definition: g-symbn (x, symbols, n) = pr-orn (pr-equaln (x, g-consn (gcode (3), g-consn (gcode (0), gcode (2)))),

g-membn (x, symbols, n))

Event: Disable g-symb; name this event ‘g1151’. Theorem: g-symb-eval ev (0, g-symb (x, symbols), va, fa, n) = g-symbn (ev (0, x, va, fa, n), ev (0, symbols, va, fa, n), n) Event: Disable p; name this event ‘g1152’. Event: Disable bool-fix; name this event ‘g1153’. Theorem: gcode-p bool-fix (x = cons (3, cons (0, 2))) = bool-fix (gcode (x) = gcode (cons (3, cons (0, 2)))) Event: Enable bool-fix; name this event ‘g1154’. Theorem: g-symbn-gcode (length (symbols) < n) → (g-symbn (gcode (x), gcode (symbols), n) = bool-fix (symb (x, symbols))) Event: Enable p; name this event ‘g1155’. Event: Enable g-symb; name this event ‘g1156’. Event: Enable g-symbn; name this event ‘g1157’.

;;;;;;;Correspondence between G-LENGTH, G-LENGTHN, and LENGTH.

Definition: g-lengthn (x, n)

= if btmp (x) ∨ (n ≃ 0) then btm

else pr-ifn (g-typepn (x, 1), pr-add1n (g-lengthn (g-cdrn (x), n − 1)), gcode (0)) endif

Event: Disable g-length-defn; name this event ‘g1158’.

Event: Disable g-length; name this event ‘g1159’.

Definition: g-length-ind (x, va, n) = if n ≃ 0 then t

else g-length-ind (g-cdr (0), ev (1, list (x), va, fa, n), n − 1) endif

Theorem: eval-g-length ev (0, g-length (x), va, fa, n) = g-lengthn (ev (0, x, va, fa, n), n)

Theorem: add1-gcode (1 + gcode (x)) = gcode (1 + x)

Theorem: g-lengthn-gcode (length (x) < n) → (g-lengthn (gcode (x), n) = gcode (length (x)))

Event: Enable g-length; name this event ‘g1160’.

Event: Enable g-lengthn; name this event ‘g1161’.

Event: Enable g-length-defn; name this event ‘g1162’.

;;;;;;;Correspondence between G-TERMP, G-TERMPN, and TERMP.

Definition: g-termpn (exp, flg, symbols, n) = if btmp (exp) ∨ btmp (flg) ∨ btmp (symbols) ∨ (n ≃ 0) then btm

else pr-ifn (pr-zeropn (flg),

pr-ifn (g-typepn (exp, 1),

pr-andn (g-functionn (g-carn (exp)),

pr-andn (g-symbn (g-carn (exp), symbols, n − 1),

pr-andn (g-termpn (g-cdrn (exp), gcode (1), symbols,

n − 1),

pr-equaln (g-lengthn (g-cdrn (exp),

n − 1),

g-fixn (g-cdrn (g-cdrn (g-carn (exp)))))))),

g-variablen (exp)), pr-ifn (g-typepn (exp, 1),

pr-andn (g-termpn (g-carn (exp), gcode (0), symbols, n − 1), g-termpn (g-cdrn (exp),

gcode (1), symbols, n − 1)),

bool-fix (t))) endif

Event: Disable g-termp; name this event ‘g1163’.

Event: Disable g-termp-defn; name this event ‘g1164’.

Definition: g-termp-ind (exp, flg, symbols, va, n) = if n ≃ 0 then t

else g-termp-ind (g-cdr (0), pr-quote (1),

                   2,

ev (1, list (exp, flg, symbols), va, fa, n), n − 1)

∧ g-termp-ind (g-car (0), pr-quote (0),

                      2,

ev (1, list (exp, flg, symbols), va, fa, n), n − 1) endif

Theorem: g-termp-eval ev (0, g-termp (exp, flg, symbols), va, fa, n) = g-termpn (ev (0, exp, va, fa, n), ev (0, flg, va, fa, n), ev (0, symbols, va, fa, n), n)

Definition: termp-ind (exp, flg, symbols, n) = if n ≃ 0 then t

elseif flg ≃ 0

then if listp (exp) then termp-ind (cdr (exp), 1, symbols, n − 1) else t endif elseif listp (exp) then termp-ind (car (exp), 0, symbols, n − 1)

∧ termp-ind (cdr (exp), 1, symbols, n − 1) else t endif

Theorem: length-listp-cdr listp (x) → (length (cdr (x)) < length (x))

Theorem: not-length-cdr length (x) ≮ length (cdr (x))

Definition: termp-cnt (exp, flg, symbols) = if flg ≃ 0

then if listp (exp) then 1 + termp-cnt (cdr (exp), 1, symbols)

else 1 + (1 + length (symbols)) endif elseif listp (exp) then 1 + (termp-cnt (car (exp), 0, symbols)

+ termp-cnt (cdr (exp), 1, symbols))

else 1 + (1 + length (symbols)) endif

Theorem: lessp-symbols-termp-cnt length (symbols) < (termp-cnt (exp, flg, symbols) − 1)

Theorem: lessp-length-termp-cnt length (exp) < termp-cnt (exp, flg, symbols)

Event: Disable degree; name this event ‘g1165’.

Theorem: numberp-gcode-equal ((x ∈ N) ∨ (y ∈ N)) → ((gcode (x) = gcode (y)) = (x = y))

Theorem: g-termpn-gcode (termp-cnt (exp, flg, symbols) < n) → (g-termpn (gcode (exp), gcode (flg), gcode (symbols), n)

= bool-fix (termp (exp, flg, symbols)))

Event: Enable g-termp; name this event ‘g1166’.

Event: Enable g-termpn; name this event ‘g1167’.

Event: Enable g-termp-defn; name this event ‘g1168’.

Event: Enable termp-cnt; name this event ‘g1169’.

;;;;;;;Correspondence between G-ATOMP, G-ATOMPN, and ATOMP.

Definition: g-atompn (exp, symbols, n) = pr-andn (g-predicaten (g-carn (exp)),

pr-andn (g-symbn (g-carn (exp), symbols, n),

pr-andn (pr-equaln (g-lengthn (g-cdrn (exp), n),

g-fixn (g-cdrn (g-cdrn (g-carn (exp))))),

g-termpn (g-cdrn (exp), gcode (1), symbols, n))))

Event: Disable g-atomp; name this event ‘g1170’.

Theorem: g-atomp-eval ev (0, g-atomp (exp, symbols), va, fa, n) = g-atompn (ev (0, exp, va, fa, n), ev (0, symbols, va, fa, n), n)

Event: Disable pr-andn; name this event ‘g1171’.

Event: Disable bool-fix; name this event ‘g1172’.

Theorem: lazy-pr-andn-reduc pr-andn (bool-fix (f), y) = bool-fix (f)

Theorem: lazy-pr-andn-reduc2 pr-andn (bool-fix (t), bool-fix (y)) = bool-fix (y)

Event: Enable pr-andn; name this event ‘g1173’.

Event: Enable bool-fix; name this event ‘g1174’.

Theorem: g-atompn-gcode (termp-cnt (cdr (exp), 1, symbols) < n) → (g-atompn (gcode (exp), gcode (symbols), n)

= bool-fix (atomp (exp, symbols)))

Event: Enable g-atomp; name this event ‘g1175’.

Event: Enable g-atompn; name this event ‘g1176’.

;;;;;;;Correspondence between G-SUBST, G-SUBSTN, and SUBST.

Definition: g-substn (exp, var, term, flg, n) = if btmp (exp) ∨ btmp (var) ∨ btmp (term) ∨ btmp (flg) ∨ (n ≃ 0)

then btm else pr-ifn (pr-zeropn (flg),

pr-ifn (g-variablen (exp), pr-ifn (pr-equaln (exp, var), term, exp), pr-ifn (g-typepn (exp, 2),

g-f-notn (g-substn (g-argn (exp, 0, 2), var, term, gcode (0), n − 1)),

pr-ifn (g-typepn (exp, 3),

g-f-orn (g-substn (g-argn (exp,

      0,

3), var, term, gcode (0), n − 1),

g-substn (g-argn (exp,

      1,

3), var, term, gcode (0), n − 1)),

pr-ifn (g-typepn (exp, 4),

pr-ifn (pr-equaln (g-argn (exp,

            0,

4), var),

exp, g-forsomen (g-argn (exp,

             0,

4), g-substn (g-argn (exp,

                     1,

4), var, term, gcode (0), n − 1))), pr-ifn (g-typepn (exp, 1),

g-consn (g-carn (exp),

g-substn (g-cdrn (exp), var, term, gcode (1), n − 1)),

exp))))),

pr-ifn (g-typepn (exp, 1),

g-consn (g-substn (g-carn (exp), var, term, gcode (0), n − 1),

g-substn (g-cdrn (exp), var, term, gcode (1), n − 1)),

exp)) endif

Event: Disable g-subst; name this event ‘g1177’.

Event: Disable g-subst-defn; name this event ‘g1178’.

Definition: g-subst-ind (exp, var, term, flg, va, n) = if n ≃ 0 then t

else g-subst-ind (g-arg (0, pr-quote (0), 2),

1,
2,

pr-quote (gcode (0)), ev (1, list (exp, var, term, flg), va, fa, n), n − 1)

∧ g-subst-ind (g-arg (0, pr-quote (0), 3),

1,
2,

pr-quote (gcode (0)), ev (1, list (exp, var, term, flg), va, fa, n), n − 1)

∧ g-subst-ind (g-arg (0, pr-quote (1), 3),

1,
2,

pr-quote (gcode (0)), ev (1, list (exp, var, term, flg), va, fa, n), n − 1)

∧ g-subst-ind (g-arg (0, pr-quote (1), 4),

1,
2,

pr-quote (gcode (0)), ev (1, list (exp, var, term, flg), va, fa, n), n − 1)

∧ g-subst-ind (g-arg (0, pr-quote (1), 1),

1,
2,

pr-quote (gcode (1)), ev (1, list (exp, var, term, flg), va, fa, n), n − 1)

∧ g-subst-ind (g-arg (0, pr-quote (0), 1),

1,
2,

pr-quote (gcode (0)), ev (1, list (exp, var, term, flg), va, fa, n), n − 1) endif

Theorem: g-subst-eval ev (0, g-subst (exp, var, term, flg), va, fa, n) = g-substn (ev (0, exp, va, fa, n),

ev (0, var, va, fa, n), ev (0, term, va, fa, n), ev (0, flg, va, fa, n), n)

Definition: subst-ind (exp, var, term, flg, n) = if flg ≃ 0

then if variable (exp) then t elseif f-notp (exp) then subst-ind (arg (exp), var, term, 0, n − 1) elseif f-orp (exp) then subst-ind (arg1 (exp), var, term, 0, n − 1)

∧ subst-ind (arg2 (exp), var, term, 0, n − 1) elseif forsomep (exp) then subst-ind (body (exp), var, term, 0, n − 1) elseif listp (exp) then subst-ind (cdr (exp), var, term, 1, n − 1) else t endif

elseif listp (exp) then subst-ind (car (exp), var, term, 0, n − 1)

∧ subst-ind (cdr (exp), var, term, 1, n − 1) else t endif Theorem: g-substn-gcode (exp-count (exp) < n) → (g-substn (gcode (exp), gcode (var), gcode (term), gcode (flg), n)

= gcode (subst (exp, var, term, flg)))

Event: Enable g-subst; name this event ‘g1179’.

Event: Enable g-substn; name this event ‘g1180’.

Event: Enable g-subst-defn; name this event ‘g1181’.

;;;;;;;Correspondence between G-SUB, G-SUBN, and SUB.

Definition: g-subn (x, y, n) = if btmp (x) ∨ btmp (y) ∨ (n ≃ 0) then btm

else pr-ifn (g-typepn (x, 1),

pr-andn (g-membn (g-carn (x), y, n − 1),

g-subn (g-cdrn (x), y, n − 1)),

bool-fix (t)) endif

Event: Disable g-sub; name this event ‘g1182’.

Event: Disable g-sub-defn; name this event ‘g1183’.

Definition: g-sub-ind (x, y, va, n) = if n ≃ 0 then t

else g-sub-ind (g-cdr (0), 1, ev (1, list (x, y), va, fa, n), n − 1) endif

Theorem: g-sub-eval ev (0, g-sub (x, y), va, fa, n) = g-subn (ev (0, x, va, fa, n), ev (0, y, va, fa, n), n)

Theorem: g-subn-gcode ((length (x) + length (y)) < n) → (g-subn (gcode (x), gcode (y), n) = bool-fix (sub (x, y)))

Event: Enable g-sub; name this event ‘g1184’.

Event: Enable g-subn; name this event ‘g1185’.

Event: Enable g-sub-defn; name this event ‘g1186’.

;;;;;;;Correspondence between G-FORMULA, G-FORMULAN, and FORMULA.

Definition: g-formulan (exp, symbols, n) = if btmp (exp) ∨ btmp (symbols) ∨ (n ≃ 0) then btm

else pr-ifn (g-typepn (exp, 2), g-formulan (g-argn (exp, 0, 2), symbols, n − 1), pr-ifn (g-typepn (exp, 3),

pr-andn (g-formulan (g-argn (exp, 0, 3), symbols, n − 1), g-formulan (g-argn (exp, 1, 3), symbols, n − 1)),

pr-ifn (g-typepn (exp, 4),

g-formulan (g-argn (exp, 1, 4), symbols, n − 1),

g-atompn (exp, symbols, n − 1)))) endif

Event: Disable g-formula; name this event ‘g1187’.

Event: Disable g-formula-defn; name this event ‘g1188’.

Definition: g-formula-ind (exp, symbols, va, n) = if n ≃ 0 then t

else g-formula-ind (g-arg (0, pr-quote (0), 2),

                    1,

ev (1, list (exp, symbols), va, fa, n), n − 1)

∧ g-formula-ind (g-arg (0, pr-quote (0), 3),

                       1,

ev (1, list (exp, symbols), va, fa, n), n − 1) ∧ g-formula-ind (g-arg (0, pr-quote (1), 3),

                       1,

ev (1, list (exp, symbols), va, fa, n), n − 1) ∧ g-formula-ind (g-arg (0, pr-quote (1), 4),

                       1,

ev (1, list (exp, symbols), va, fa, n), n − 1) endif Event: Disable difference-sub1-n; name this event ‘g1189’.

Event: Disable difference-lessp2; name this event ‘g1190’.

Event: Disable fa; name this event ‘g1191’.

Event: Disable get-sub1-n-nzerop; name this event ‘g1192’.

Event: Disable difference-lessp; name this event ‘g1193’.

Theorem: get-g-formula-defn get (sub1-n (22, 11), fa) = g-formula-defn

Event: Enable difference-sub1-n; name this event ‘g1194’.

Event: Enable difference-lessp2; name this event ‘g1195’.

Event: Enable fa; name this event ‘g1196’.

Event: Enable get-sub1-n-nzerop; name this event ‘g1197’.

Event: Enable difference-lessp; name this event ‘g1198’.

Theorem: g-formula-eval ev (0, g-formula (exp, symbols), va, fa, n) = g-formulan (ev (0, exp, va, fa, n), ev (0, symbols, va, fa, n), n)

Definition: formula-ind (exp, symbols, n) = if n ≃ 0 then t

elseif f-notp (exp) then formula-ind (arg (exp), symbols, n − 1)

elseif f-orp (exp)

then formula-ind (arg1 (exp), symbols, n − 1)

∧ formula-ind (arg2 (exp), symbols, n − 1) elseif forsomep (exp) then formula-ind (body (exp), symbols, n − 1) else t endif

Definition: formula-cnt (exp, symbols)

= if f-notp (exp) then 1 + formula-cnt (arg (exp), symbols)

elseif f-orp (exp)

then 1 + (formula-cnt (arg1 (exp), symbols)

+ formula-cnt (arg2 (exp), symbols))

elseif forsomep (exp) then 1 + formula-cnt (body (exp), symbols)

else 1 + termp-cnt (cdr (exp), 1, symbols) endif

Theorem: g-formulan-gcode (formula-cnt (exp, symbols) < n) → (g-formulan (gcode (exp), gcode (symbols), n)

= bool-fix (formula (exp, symbols)))

Event: Enable g-formula; name this event ‘g1199’.

Event: Enable g-formulan; name this event ‘g1200’.

Event: Enable g-formula-defn; name this event ‘g1201’.

Event: Enable formula-cnt; name this event ‘g1202’.

;;;;;;;Correspondence between G-PAIREQUALS, G-PAIREQUALSN, and PAIREQUALS.

Definition: g-pairequalsn (vars1 , vars2 , exp, n) = if btmp (vars1 ) ∨ btmp (vars2 ) ∨ btmp (exp) ∨ (n ≃ 0) then btm

else pr-ifn (pr-andn (g-typepn (vars1 , 1), g-typepn (vars2 , 1)),

g-f-impliesn (g-f-equaln (g-carn (vars1 ), g-carn (vars2 )), g-pairequalsn (g-cdrn (vars1 ),

g-cdrn (vars2 ), exp, n − 1)),

exp) endif

Event: Disable g-pairequals; name this event ‘g1203’.

Event: Disable g-pairequals-defn; name this event ‘g1204’.

Definition: g-pairequals-ind (vars1 , vars2 , exp, va, n) = if n ≃ 0 then t

else g-pairequals-ind (g-cdr (0), g-cdr (1), ev (1, list (vars1 , vars2 , exp), va, fa, n), n − 1) endif

Theorem: g-pairequals-eval ev (0, g-pairequals (vars1 , vars2 , exp), va, fa, n) = g-pairequalsn (ev (0, vars1 , va, fa, n),

ev (0, vars2 , va, fa, n), ev (0, exp, va, fa, n), n)

Event: Enable pairequals-reduc; name this event ‘g1205’.

Definition: pairequals-ind (vars1 , vars2 , exp, n) = if n ≃ 0 then t

elseif listp (vars1 ) ∧ listp (vars2 )

then pairequals-ind (cdr (vars1 ), cdr (vars2 ), exp, n − 1)

else t endif

Theorem: g-pairequalsn-gcode (length (vars1 ) < n) → (g-pairequalsn (gcode (vars1 ), gcode (vars2 ), gcode (exp), n)

= gcode (pairequals (vars1 , vars2 , exp)))

Event: Enable g-pairequals; name this event ‘g1206’.

Event: Enable g-pairequalsn; name this event ‘g1207’.

Event: Enable g-pairequals-defn; name this event ‘g1208’.

Definition: g-cadrn (x) = g-carn (g-cdrn (x))

Definition: g-caddrn (x) = g-carn (g-cdrn (g-cdrn (x)))

Definition: g-cadddrn (x) = g-carn (g-cdrn (g-cdrn (g-cdrn (x))))

;;;;;;;SUBST-AXIOM correspondence.

Definition: g-subst-axiom-proofn (conc, hints, symbols, n) = pr-andn (g-formulan (g-cadrn (hints), symbols, n),

pr-andn (g-variablen (g-caddrn (hints)), pr-andn (g-termpn (g-cadddrn (hints), gcode (0), symbols, n),

pr-andn (g-free-forn (g-cadrn (hints), g-caddrn (hints), g-cadddrn (hints), gcode (0), n),

pr-equaln (conc,

g-f-impliesn (g-substn (g-cadrn (hints), g-caddrn (hints), g-cadddrn (hints), gcode (0), n),

g-forsomen (g-caddrn (hints), g-cadrn (hints))))))))

Definition: g-degreen (x) = g-fixn (g-cdrn (g-cdrn (x)))

;;;;;;;Function equality axiom correspondence.

Definition: g-fun-equal-axiom-proofn (conc, hints, symbols, n) = pr-andn (g-termpn (g-caddrn (hints), gcode (1), symbols, n),

pr-andn (g-termpn (g-cadddrn (hints), gcode (1), symbols, n), pr-andn (g-functionn (g-cadrn (hints)),

pr-andn (pr-equaln (g-lengthn (g-caddrn (hints), n),

g-degreen (g-cadrn (hints))), pr-andn (pr-equaln (g-lengthn (g-cadddrn (hints),

n), g-degreen (g-cadrn (hints))),

pr-equaln (conc,

g-pairequalsn (g-caddrn (hints), g-cadddrn (hints), g-f-equaln (g-consn (g-cadrn (hints),

g-caddrn (hints)), g-consn (g-cadrn (hints),

g-cadddrn (hints))),

n)))))))

;;;;;;;Predicate equality axiom correspondence.

Definition: g-pred-equal-axiom-proofn (conc, hints, symbols, n) = pr-andn (g-termpn (g-caddrn (hints), gcode (1), symbols, n),

pr-andn (g-termpn (g-cadddrn (hints), gcode (1), symbols, n), pr-andn (g-predicaten (g-cadrn (hints)), pr-andn (pr-equaln (g-lengthn (g-caddrn (hints), n),

g-degreen (g-cadrn (hints))), pr-andn (pr-equaln (g-lengthn (g-cadddrn (hints),

n), g-degreen (g-cadrn (hints))),

pr-equaln (conc,

g-pairequalsn (g-caddrn (hints), g-cadddrn (hints), g-f-impliesn (g-consn (g-cadrn (hints),

g-caddrn (hints)), g-consn (g-cadrn (hints),

g-cadddrn (hints))),

n)))))))

;;;;;;;Correspondence for FOL-AXIOM-PROOF.

Definition: g-fol-axiom-proofn (conc, hints, symbols, n) = pr-ifn (pr-equaln (g-carn (hints), gcode (1)),

pr-andn (g-formulan (g-cadrn (hints), symbols, n),

pr-equaln (conc,

g-f-orn (g-f-notn (g-cadrn (hints)), g-cadrn (hints)))),

pr-ifn (pr-equaln (g-carn (hints), gcode (2)), g-subst-axiom-proofn (conc, hints, symbols, n), pr-ifn (pr-equaln (g-carn (hints), gcode (3)),

pr-andn (g-termpn (g-cadrn (hints), gcode (0), symbols, n),

pr-equaln (conc,

g-f-equaln (g-cadrn (hints),

g-cadrn (hints)))),

pr-ifn (pr-equaln (g-carn (hints), gcode (4)), g-fun-equal-axiom-proofn (conc,

hints, symbols, n),

pr-ifn (pr-equaln (g-carn (hints), gcode (5)), g-pred-equal-axiom-proofn (conc,

hints, symbols, n),

bool-fix (f))))))

Theorem: g-fol-axiom-proof-eval ev (0, g-fol-axiom-proof (conc, hints, symbols), va, fa, n) = g-fol-axiom-proofn (ev (0, conc, va, fa, n),

ev (0, hints, va, fa, n), ev (0, symbols, va, fa, n), n)

Definition: fol-axiom-cnt (hints, symbols) = (1 + (formula-cnt (second (hints), symbols)

+ termp-cnt (fourth (hints), 0, symbols)

+ exp-count (second (hints)) + exp-count (fourth (hints)) + termp-cnt (second (hints), 0, symbols) + termp-cnt (third (hints), 1, symbols) + termp-cnt (fourth (hints), 1, symbols) + length (third (hints)) + length (fourth (hints))))

Event: Disable fol-axiom-proof; name this event ‘g1213’.

Theorem: g-fol-axiom-proofn-gcode (fol-axiom-cnt (hints, symbols) < n) → (g-fol-axiom-proofn (gcode (conc), gcode (hints), gcode (symbols), n)

= bool-fix (fol-axiom-proof (conc, hints, symbols)))

Event: Enable g-fol-axiom-proof; name this event ‘g1214’.

Event: Enable g-fol-axiom-proofn; name this event ‘g1215’.

Event: Enable fol-axiom-proof; name this event ‘g1216’.

Definition: g-expan-rulen (conc, hints, sub-goals, symbols, n) = pr-andn (g-formulan (g-cadrn (hints), symbols, n),

pr-andn (g-formulan (g-carn (sub-goals), symbols, n),

pr-equaln (conc, g-f-orn (g-cadrn (hints), g-carn (sub-goals)))))

Definition: g-contrac-rulen (conc, hints, sub-goals, symbols, n) = pr-andn (g-formulan (g-cadrn (hints), symbols, n),

pr-andn (pr-equaln (sub-goals, g-consn (g-f-orn (g-cadrn (hints),

g-cadrn (hints)), gcode (nil))),

pr-equaln (conc, g-cadrn (hints))))

Definition: g-assoc-rulen (conc, hints, sub-goals, symbols, n) = pr-andn (g-formulan (g-cadrn (hints), symbols, n),

pr-andn (g-formulan (g-caddrn (hints), symbols, n),

pr-andn (g-formulan (g-cadddrn (hints), symbols, n), pr-andn (pr-equaln (sub-goals,

g-consn (g-f-orn (g-cadrn (hints),

g-f-orn (g-caddrn (hints),

g-cadddrn (hints))),

gcode (nil))),

pr-equaln (conc,

g-f-orn (g-f-orn (g-cadrn (hints),

g-caddrn (hints)), g-cadddrn (hints)))))))

Definition: g-cut-rulen (conc, hints, sub-goals, symbols, n) = pr-andn (g-formulan (g-cadrn (hints), symbols, n),

pr-andn (g-formulan (g-caddrn (hints), symbols, n),

pr-andn (g-formulan (g-cadddrn (hints), symbols, n), pr-andn (pr-equaln (sub-goals,

g-consn (g-f-orn (g-cadrn (hints),

g-caddrn (hints)), g-consn (g-f-orn (g-f-notn (g-cadrn (hints)),

g-cadddrn (hints)), gcode (nil)))),

pr-equaln (conc,

g-f-orn (g-caddrn (hints), g-cadddrn (hints)))))))

Definition: g-forsome-intro-rulen (conc, hints, sub-goals, symbols, n) = pr-andn (g-variablen (g-cadrn (hints)),

pr-andn (g-formulan (g-caddrn (hints), symbols, n),

pr-andn (g-formulan (g-cadddrn (hints), symbols, n),

pr-andn (pr-notn (g-membn (g-cadrn (hints),

g-collect-freen (g-cadddrn (hints), gcode (0), n),

n)), pr-andn (pr-equaln (sub-goals,

g-consn (g-f-impliesn (g-caddrn (hints),

g-cadddrn (hints)),

gcode (nil))),

pr-equaln (conc,

g-f-impliesn (g-forsomen (g-cadrn (hints),

g-caddrn (hints)),

g-cadddrn (hints))))))))

;;;;;;;Correspondence for FOL-RULES.

Definition: g-fol-rulesn (conc, hints, sub-goals, symbols, n) = pr-ifn (pr-equaln (g-carn (hints), gcode (1)),

g-expan-rulen (conc, hints, sub-goals, symbols, n), pr-ifn (pr-equaln (g-carn (hints), gcode (2)),

g-contrac-rulen (conc, hints, sub-goals, symbols, n), pr-ifn (pr-equaln (g-carn (hints), gcode (3)),

g-assoc-rulen (conc, hints, sub-goals, symbols, n), pr-ifn (pr-equaln (g-carn (hints), gcode (4)),

g-cut-rulen (conc, hints, sub-goals, symbols, n),

pr-ifn (pr-equaln (g-carn (hints), gcode (5)), g-forsome-intro-rulen (conc,

hints, sub-goals, symbols, n),

bool-fix (f))))))

Event: Disable g-fol-rules; name this event ‘g1217’.

Theorem: g-fol-rules-eval ev (0, g-fol-rules (conc, hints, sub-goals, symbols), va, fa, n) = g-fol-rulesn (ev (0, conc, va, fa, n),

ev (0, hints, va, fa, n), ev (0, sub-goals, va, fa, n), ev (0, symbols, va, fa, n), n)

Event: Enable g-fol-rules; name this event ‘g1218’.

Event: Disable fol-rules; name this event ‘g1219’.

Theorem: g-fol-rulesn-gcode ((formula-cnt (second (hints), symbols) + formula-cnt (third (hints), symbols) + formula-cnt (fourth (hints), symbols) + formula-cnt (car (sub-goals), symbols) + exp-count (fourth (hints))) < n) → (g-fol-rulesn (gcode (conc),

gcode (hints), gcode (sub-goals), gcode (symbols), n)

= bool-fix (fol-rules (conc, hints, sub-goals, symbols)))

Event: Enable fol-rules; name this event ‘g1220’.

Event: Enable g-fol-rules; name this event ‘g1221’.

Event: Enable g-fol-rulesn; name this event ‘g1222’.

Definition: g-isinn (x, y) = g-consn (g-consn (gcode (3), g-consn (gcode (1), gcode (2))),

g-consn (x, g-consn (y, gcode (nil))))

Definition: g-phin = g-consn (g-consn (gcode (2), g-consn (gcode (0), gcode (0))), gcode (nil))

Definition: g-z-pairn (x, y) = g-consn (g-consn (gcode (2), g-consn (gcode (1), gcode (2))),

g-consn (x, g-consn (y, gcode (nil))))

Definition: g-z-unionn (x, y) = g-consn (g-consn (gcode (2), g-consn (gcode (2), gcode (2))),

g-consn (x, g-consn (y, gcode (nil))))

Definition: g-z-intn (x)

= g-consn (g-consn (gcode (3), g-consn (gcode (2), gcode (1))), g-consn (x, gcode (nil)))

Definition: g-z-succn (x) = g-consn (g-consn (gcode (2), g-consn (gcode (3), gcode (1))),

g-consn (x, gcode (nil)))

Definition: g-f-iffn (x, y) = g-f-andn (g-f-impliesn (x, y), g-f-impliesn (y, x))

Theorem: g-f-iff-eval ev (0, g-f-iff (x, y), va, fa, n) = g-f-iffn (ev (0, x, va, fa, n), ev (0, y, va, fa, n))

Event: Disable f-iff; name this event ‘g1223’.

Theorem: g-f-iffn-gcode g-f-iffn (gcode (x), gcode (y)) = gcode (f-iff (x, y))

Event: Enable f-iff; name this event ‘g1224’.

Event: Enable g-f-iff; name this event ‘g1225’.

Event: Enable g-f-iffn; name this event ‘g1226’.

;;;;;;;Correspondence for Z2-AXIOMS.

;;;;;;;Correspondence for Z2-AXIOMS.
(DEFN
 G-Z2-AXIOMSN
 (CONC HINTS SYMBOLS N)
 (PR-IFN
  (PR-EQUALN (G-CARN HINTS) (GCODE 1))
  (PR-ANDN
   (G-VARIABLEN (G-CADDDRN HINTS))
   (PR-ANDN
    (G-TERMPN (G-CADRN HINTS) (GCODE 0) SYMBOLS N)
    (PR-ANDN
     (G-TERMPN (G-CADDRN HINTS) (GCODE 0) SYMBOLS N)
     (PR-ANDN
      (PR-NOTN (G-MEMBN (G-CADDDRN HINTS) (G-COLLECT-FREEN (G-CADRN HINTS) (GCODE 0) N) N))
      (PR-ANDN (PR-NOTN (G-MEMBN (G-CADDDRN HINTS)

         (G-COLLECT-FREEN (G-CADDRN HINTS) (GCODE 0) N)
         N))
(PR-EQUALN CONC
  (G-F-IFFN (G-F-EQUALN (G-CADRN HINTS) (G-CADDRN HINTS))
            (G-FORALLN (G-CADDDRN HINTS)
                       (G-F-IFFN (G-ISINN (G-CADDDRN HINTS)
                                          (G-CADRN HINTS))
                                 (G-ISINN (G-CADDDRN HINTS)
                                          (G-CADDRN HINTS)))))))))))
(PR-IFN
(PR-EQUALN (G-CARN HINTS) (GCODE 2))
(PR-ANDN (G-TERMPN (G-CADRN HINTS) (GCODE 0) SYMBOLS N)
(PR-EQUALN CONC (G-F-NOTN (G-ISINN (G-CADRN HINTS) (G-PHIN)))))
(PR-IFN
(PR-EQUALN (G-CARN HINTS) (GCODE 3))
(PR-ANDN (G-TERMPN (G-CONSN (G-CADRN HINTS)
        (G-CONSN (G-CADDRN HINTS)
                 (G-CONSN (G-CADDDRN HINTS) (GCODE NIL))))
(GCODE 1)
SYMBOLS
N)
(PR-EQUALN CONC
(G-F-IFFN (G-ISINN (G-CADDDRN HINTS)
                   (G-Z-PAIRN (G-CADRN HINTS) (G-CADDRN HINTS)))
          (G-F-ORN (G-F-EQUALN (G-CADDDRN HINTS) (G-CADRN HINTS))
                   (G-F-EQUALN (G-CADDDRN HINTS) (G-CADDRN HINTS))))))
(PR-IFN
(PR-EQUALN (G-CARN HINTS) (GCODE 4))
(PR-ANDN (G-TERMPN (G-CONSN (G-CADRN HINTS)
         (G-CONSN (G-CADDRN HINTS)
                  (G-CONSN (G-CADDDRN HINTS) (GCODE NIL))))
(GCODE 1)
SYMBOLS
N)
(PR-EQUALN CONC
 (G-F-IFFN (G-ISINN (G-CADDDRN HINTS)
                    (G-Z-UNIONN (G-CADRN HINTS) (G-CADDRN HINTS)))
           (G-F-ORN (G-ISINN (G-CADDDRN HINTS) (G-CADRN HINTS))
                    (G-ISINN (G-CADDDRN HINTS) (G-CADDRN HINTS))))))
(PR-IFN
(PR-EQUALN (G-CARN HINTS) (GCODE 5))
(PR-ANDN
(G-VARIABLEN (G-CADDRN HINTS))
(PR-ANDN

        (G-FORMULAN (G-CADRN HINTS) SYMBOLS N)
        (PR-EQUALN
         CONC
         (G-F-IMPLIESN
          (G-F-ANDN (G-SUBSTN (G-CADRN HINTS) (G-CADDRN HINTS) (G-PHIN) (GCODE 0) N)
                    (G-FORALLN (G-CADDRN HINTS)
                               (G-F-IMPLIESN (G-F-ANDN (G-Z-INTN (G-CADDRN HINTS))
                                                       (G-CADRN HINTS))
                                             (G-SUBSTN (G-CADRN HINTS)
                                                       (G-CADDRN HINTS)
                                                       (G-Z-SUCCN (G-CADDRN HINTS))
                                                       (GCODE 0)
                                                       N))))
          (G-FORALLN (G-CADDRN HINTS)
                     (G-F-IMPLIESN (G-Z-INTN (G-CADDRN HINTS)) (G-CADRN HINTS)))))))
      (BOOL-FIX F)))))))

Event: Disable g-z2-axioms; name this event ‘g1238’.

Theorem: g-z2-axioms-eval ev (0, g-z2-axioms (conc, hints, symbols), va, fa, n) = g-z2-axiomsn (ev (0, conc, va, fa, n),

ev (0, hints, va, fa, n), ev (0, symbols, va, fa, n), n)

Event: Disable p; name this event ‘g1239’.

Event: Disable fn; name this event ‘g1240’.

Event: Disable isin; name this event ‘g1241’.

Event: Disable phi; name this event ‘g1242’.

Event: Disable z-pair; name this event ‘g1243’.

Event: Disable z-union; name this event ‘g1244’.

Event: Disable z-int; name this event ‘g1245’.

Event: Disable z-succ; name this event ‘g1246’.

Event: Enable g-z2-axioms; name this event ‘g1247’.

Definition: z2-axioms-cnt (hints, symbols) = (termp-cnt (second (hints), 0, symbols)

+ termp-cnt (third (hints), 0, symbols)

+ exp-count (second (hints)) + exp-count (third (hints)) + termp-cnt (list (second (hints), third (hints), fourth (hints)),

                 1,

symbols) + formula-cnt (second (hints), symbols))

Theorem: g-z2-axiomsn-gcode ((termp-cnt (second (hints), 0, symbols) + termp-cnt (third (hints), 0, symbols) + exp-count (second (hints)) + exp-count (third (hints)) + termp-cnt (list (second (hints), third (hints), fourth (hints)), 1, symbols) + formula-cnt (second (hints), symbols)) < n) → (g-z2-axiomsn (gcode (conc), gcode (hints), gcode (symbols), n)

= bool-fix (z2-axioms (conc, hints, symbols)))

Event: Enable fn; name this event ‘g1248’.

Event: Enable isin; name this event ‘g1249’.

Event: Enable phi; name this event ‘g1250’.

Event: Enable z-pair; name this event ‘g1251’.

Event: Enable z-union; name this event ‘g1252’.

Event: Enable z-int; name this event ‘g1253’.

Event: Enable z-succ; name this event ‘g1254’.

Event: Enable g-z2-axioms; name this event ‘g1255’.

Event: Enable g-z2-axiomsn; name this event ‘g1256’.

Event: Enable z2-axioms; name this event ‘g1257’.

;;;;;;;Correspondence for SET.

Definition: g-setn (x, n) = if btmp (x) ∨ (n ≃ 0) then btm

else pr-ifn (g-typepn (x, 1),

pr-andn (pr-notn (g-membn (g-carn (x), g-cdrn (x), n − 1)),

g-setn (g-cdrn (x), n − 1)),

bool-fix (t)) endif

Event: Disable g-set; name this event ‘g1258’.

Event: Disable g-set-defn; name this event ‘g1259’.

Definition: g-set-ind (x, va, n) = if n ≃ 0 then t

else g-set-ind (g-cdr (0), ev (1, list (x), va, fa, n), n − 1) endif

Theorem: g-set-eval ev (0, g-set (x), va, fa, n) = g-setn (ev (0, x, va, fa, n), n)

Theorem: g-setn-gcode (length (x) < n) → (g-setn (gcode (x), n) = bool-fix (set (x)))

Event: Enable g-set; name this event ‘g1260’.

Event: Enable g-setn; name this event ‘g1261’.

Event: Enable g-set-defn; name this event ‘g1262’.

;;;;;;;Correspondence for ASSOC.

Definition: g-assocn (x, y, n) = if btmp (x) ∨ btmp (y) ∨ (n ≃ 0) then btm

else pr-ifn (g-typepn (y, 1), pr-ifn (pr-equaln (g-carn (g-carn (y)), x), g-cdrn (g-carn (y)), g-assocn (x, g-cdrn (y), n − 1)),

gcode (0)) endif

Event: Disable g-assoc-defn; name this event ‘g1265’.

Definition: g-assoc-ind (x, y, va, n) = if n ≃ 0 then t

else g-assoc-ind (0, g-cdr (1), ev (1, list (x, y), va, fa, n), n − 1) endif

Theorem: g-assoc-eval ev (0, g-assoc (x, y), va, fa, n) = g-assocn (ev (0, x, va, fa, n), ev (0, y, va, fa, n), n)

Theorem: g-assocn-gcode (length (y) < n) → (g-assocn (gcode (x), gcode (y), n) = gcode (assoc (x, y)))

Event: Enable g-assoc; name this event ‘g1266’.

Event: Enable g-assocn; name this event ‘g1267’.

Event: Enable g-assoc-defn; name this event ‘g1268’.

;;;;;;;Correspondence for CONC.

Definition: g-concn (pf , flg, n) = if btmp (pf ) ∨ btmp (flg) ∨ (n ≃ 0) then btm

else pr-ifn (pr-zeropn (flg), g-caddrn (pf ), pr-ifn (g-typepn (pf , 1),

g-consn (g-concn (g-carn (pf ), gcode (0), n − 1),

g-concn (g-cdrn (pf ), gcode (1), n − 1)), gcode (nil))) endif

Event: Disable g-conc; name this event ‘g1269’.

Event: Disable g-conc-defn; name this event ‘g1270’.

Definition: g-conc-ind (pf , flg, va, n) = if n ≃ 0 then t else g-conc-ind (g-car (0),

pr-quote (0),

ev (1, list (pf , flg), va, fa, n), n − 1) ∧ g-conc-ind (g-cdr (0),

pr-quote (1),

ev (1, list (pf , flg), va, fa, n), n − 1) endif

Theorem: g-conc-eval ev (0, g-conc (pf , flg), va, fa, n) = g-concn (ev (0, pf , va, fa, n), ev (0, flg, va, fa, n), n)

Definition: conc-ind (pf , flg, n) = if n ≃ 0 then t

elseif flg ≃ 0 then t

else conc-ind (car (pf ), 0, n − 1) ∧ conc-ind (cdr (pf ), 1, n − 1) endif

Theorem: g-concn-gcode (exp-count (pf ) < n) → (g-concn (gcode (pf ), gcode (flg), n) = gcode (conc (pf , flg)))

Event: Enable g-conc; name this event ‘g1271’.

Event: Enable g-concn; name this event ‘g1272’.

Event: Enable g-conc-defn; name this event ‘g1273’.

;;;;;;;Correspondence for REST-OF.

Definition: g-rest-ofn (sym, symbols, n) = if btmp (sym) ∨ btmp (symbols) ∨ (n ≃ 0) then btm

else pr-ifn (g-typepn (symbols, 1),

pr-ifn (pr-andn (pr-equaln (g-carn (symbols), sym),

pr-notn (g-membn (sym, g-cdrn (symbols), n − 1))),

g-cdrn (symbols),

g-rest-ofn (sym, g-cdrn (symbols), n − 1)), gcode (nil)) endif Event: Disable g-rest-of; name this event ‘g1274’.

Event: Disable g-rest-of-defn; name this event ‘g1275’.

Definition: g-rest-of-ind (sym, symbols, va, n) = if n ≃ 0 then t

else g-rest-of-ind (0, g-cdr (1), ev (1, list (sym, symbols), va, fa, n), n − 1) endif

Theorem: g-rest-of-eval ev (0, g-rest-of (sym, symbols), va, fa, n) = g-rest-ofn (ev (0, sym, va, fa, n), ev (0, symbols, va, fa, n), n)

Event: Disable rest-of; name this event ‘g1276’.

Theorem: g-rest-ofn-gcode ((1 + length (symbols)) < n) → (g-rest-ofn (gcode (sym), gcode (symbols), n)

= gcode (rest-of (sym, symbols)))

Event: Enable rest-of; name this event ‘g1277’.

Event: Enable g-rest-of; name this event ‘g1278’.

Event: Enable g-rest-ofn; name this event ‘g1279’.

Event: Enable g-rest-of-defn; name this event ‘g1280’.

Event: Disable g-symb-defn-proof; name this event ‘g1281’.

;;;;;;;Correspondence for SYMB-DEFN-PROOF.

;;;;;;;Correspondence for SYMB-DEFN-PROOF.
(DEFN
 G-SYMB-DEFN-PROOFN
 (CONC HINTS SUB-GOALS DEFN SYMBOLS N)
 (PR-IFN

(G-PREDICATEN (G-CARN (G-CARN HINTS)))
(PR-ANDN (G-SETN (G-CDRN (G-CARN HINTS)) N)
(PR-ANDN (G-VAR-LISTN (G-CDRN (G-CARN HINTS)) (G-DEGREEN (G-CARN (G-CARN HINTS))) N)
(PR-ANDN (PR-EQUALN CONC (G-F-IFFN (G-CARN HINTS) DEFN))
(PR-ANDN (G-SUBN (G-COLLECT-FREEN DEFN (GCODE 0) N)
             (G-CDRN (G-CARN HINTS))
             N)
     (G-FORMULAN DEFN
                 (G-REST-OFN (G-CARN (G-CARN HINTS))
                             SYMBOLS
                             N)
                 N)))))
(PR-IFN
(G-FUNCTIONN (G-CARN (G-CARN HINTS)))
(PR-ANDN
(G-SETN (G-CONSN (G-CADDDRN HINTS) (G-CONSN (G-CADRN HINTS) (G-CDRN (G-CARN HINTS)))) N)
(PR-ANDN
(G-VAR-LISTN (G-CDRN (G-CARN HINTS)) (G-DEGREEN (G-CARN (G-CARN HINTS))) N)
(PR-ANDN
(G-VARIABLEN (G-CADRN HINTS))
(PR-ANDN
(G-VARIABLEN (G-CADDDRN HINTS))
(PR-ANDN
(G-FORMULAN (G-CADDRN HINTS) (G-REST-OFN (G-CARN (G-CARN HINTS)) SYMBOLS N) N)
(PR-ANDN
(G-SUBN (G-COLLECT-FREEN (G-CADDRN HINTS) (GCODE 0) N)
(G-CONSN (G-CADRN HINTS) (G-CDRN (G-CARN HINTS)))
N)
(PR-ANDN
(G-FREE-FORN (G-CADDRN HINTS) (G-CADRN HINTS) (G-CARN HINTS) (GCODE 0) N)
(PR-ANDN
(G-FREE-FORN (G-CADDRN HINTS) (G-CADRN HINTS) (G-CADDDRN HINTS) (GCODE 0) N)
(PR-ANDN
(PR-EQUALN CONC
(G-SUBSTN (G-CADDRN HINTS)
(G-CADRN HINTS)
(G-CARN HINTS)
(GCODE 0)
N))
(PR-ANDN
(PR-EQUALN CONC DEFN)
(PR-EQUALN
SUB-GOALS
(G-CONSN (G-FORSOMEN (G-CADRN HINTS) (G-CADDRN HINTS))

               (G-CONSN (G-F-IMPLIESN (G-F-ANDN (G-CADDRN HINTS)
                                                (G-SUBSTN (G-CADDRN HINTS)
                                                          (G-CADRN HINTS)
                                                          (G-CADDDRN HINTS)
                                                          (GCODE 0)
                                                          N))
                                      (G-F-EQUALN (G-CADRN HINTS)
                                                  (G-CADDDRN HINTS)))
                        (GCODE NIL))))))))))))))
(BOOL-FIX F))))

Theorem: g-symb-defn-proof-eval ev (0, g-symb-defn-proof (conc, hints, sub-goals, defn, symbols), va, fa, n) = g-symb-defn-proofn (ev (0, conc, va, fa, n),

ev (0, hints, va, fa, n), ev (0, sub-goals, va, fa, n), ev (0, defn, va, fa, n), ev (0, symbols, va, fa, n), n)

Theorem: lazy-pr-andn-reduc3 pr-andn (bool-fix (x), bool-fix (f)) = bool-fix (f)

Definition: g-symb-count (hints, defn, symbols) = if predicate (caar (hints))

then length (cdar (hints))

+ cddaar (hints) + exp-count (defn) + (1 + length (symbols)) + formula-cnt (defn, rest-of (caar (hints), symbols))

else length (cons (fourth (hints), cons (second (hints), cdar (hints)))) + (1 + length (symbols)) + formula-cnt (third (hints),

rest-of (caar (hints), symbols))

+ cddaar (hints) + (1 + exp-count (third (hints))) + (1 + exp-count (second (hints))) + (1 + exp-count (car (hints))) + (1 + exp-count (fourth (hints))) endif

Theorem: g-symb-defn-proofn-gcode (g-symb-count (hints, defn, symbols) < n) → (g-symb-defn-proofn (gcode (conc),

gcode (hints), gcode (sub-goals), gcode (defn), gcode (symbols), n)

= bool-fix (symb-defn-proof (conc, hints, sub-goals, defn, symbols)))

Event: Enable symb-defn-proof; name this event ‘g1290’.

Event: Enable g-symb-defn-proof; name this event ‘g1291’.

Event: Enable g-symb-defn-proofn; name this event ‘g1292’.

;;;;;;;Correspondence for PRF.

;;;;;;;Correspondence for PRF.
(DEFN
G-PRFN
(PF GIVEN DEFNS FLG SYMBOLS N)
(IF
(OR (ZEROP N)
(BTMP PF)
(BTMP GIVEN)
(BTMP DEFNS)
(BTMP FLG)
(BTMP SYMBOLS))
(BTM)
(PR-IFN
(PR-ZEROPN FLG)
(PR-IFN
(G-TYPEPN PF 1)
(PR-IFN
(PR-NOTN (G-FORMULAN (G-CONCN PF (GCODE 0) (SUB1 N)) SYMBOLS (SUB1 N)))
(BOOL-FIX F)
(PR-IFN
(PR-EQUALN (G-CARN PF) (GCODE 1))
(G-FOL-AXIOM-PROOFN (G-CONCN PF (GCODE 0) (SUB1 N)) (G-CADRN PF) SYMBOLS (SUB1 N))
(PR-IFN
 (PR-EQUALN (G-CARN PF) (GCODE 2))
 (PR-ANDN (G-FOL-RULESN (G-CONCN PF (GCODE 0) (SUB1 N))
                        (G-CADRN PF)
                        (G-CONCN (G-CADDDRN PF) (GCODE 1) (SUB1 N))
                        SYMBOLS

(SUB1 N))
(G-PRFN (G-CADDDRN PF) GIVEN DEFNS (GCODE 1) SYMBOLS (SUB1 N)))
(PR-IFN (PR-EQUALN (G-CARN PF) (GCODE 3))
(G-Z2-AXIOMSN (G-CONCN PF (GCODE 0) (SUB1 N)) (G-CADRN PF) SYMBOLS (SUB1 N))
(PR-IFN (PR-EQUALN (G-CARN PF) (GCODE 4))
(PR-ANDN (G-SYMB-DEFN-PROOFN (G-CONCN PF (GCODE 0) (SUB1 N))
(G-CADRN PF)
(G-CONCN (G-CADDDRN PF)
         (GCODE 1)
         (SUB1 N))
(G-ASSOCN (G-CARN (G-CARN (G-CADRN PF)))
          DEFNS
          (SUB1 N))
SYMBOLS
(SUB1 N))
(PR-IFN (G-FUNCTIONN (G-CARN (G-CARN (G-CADRN PF))))
(G-PRFN (G-CADDDRN PF)
GIVEN
DEFNS
(GCODE 1)
(G-REST-OFN (G-CARN (G-CARN (G-CADRN PF)))
        SYMBOLS
        (SUB1 N))
(SUB1 N))
(BOOL-FIX T)))
(PR-IFN (PR-EQUALN (G-CARN PF) (GCODE 5))
(G-MEMBN (G-CONCN PF (GCODE 0) (SUB1 N)) GIVEN (SUB1 N))
(BOOL-FIX F)))))))
(BOOL-FIX F))
(PR-IFN (G-TYPEPN PF 1)
(PR-ANDN (G-PRFN (G-CARN PF) GIVEN DEFNS (GCODE 0) SYMBOLS (SUB1 N))
(G-PRFN (G-CDRN PF) GIVEN DEFNS (GCODE 1) SYMBOLS (SUB1 N)))
(BOOL-FIX T)))))

Event: Disable g-prf-defn; name this event ‘g1293’.

Definition: g-prf-ind (pf , given, defns, flg, symbols, va, n) = if n ≃ 0 then t

else g-prf-ind (g-cadddr (0),

1,
2,

pr-quote (1),

4,

ev (1, list (pf , given, defns, flg, symbols), va, fa, n), n − 1)

∧ g-prf-ind (g-cadddr (0),

1,
2,

pr-quote (1), g-rest-of (g-car (g-car (g-cadr (0))), 4), ev (1,

list (pf , given, defns, flg, symbols), va, fa, n),

n − 1)

∧ g-prf-ind (g-car (0),

1,
2,

pr-quote (0),

4,

ev (1, list (pf , given, defns, flg, symbols), va, fa, n),

n − 1)

∧ g-prf-ind (g-cdr (0),

1,
2,

pr-quote (1),

4,

ev (1, list (pf , given, defns, flg, symbols), va, fa, n),

n − 1) endif

Theorem: g-prf-eval ev (0, g-prf (pf , given, defns, flg, symbols), va, fa, n) = g-prfn (ev (0, pf , va, fa, n),

ev (0, given, va, fa, n), ev (0, defns, va, fa, n), ev (0, flg, va, fa, n), ev (0, symbols, va, fa, n), n)

Event: Disable prf; name this event ‘g1294’.

Event: Enable fol-axiom-cnt; name this event ‘g1296’.

Event: Enable fol-axiom-cnt; name this event ‘g1297’.

Definition: fol-rules-cnt (hints, sub-goals, symbols) = (formula-cnt (second (hints), symbols)

+ formula-cnt (third (hints), symbols) + formula-cnt (fourth (hints), symbols) + formula-cnt (car (sub-goals), symbols) + exp-count (fourth (hints)))

Theorem: g-fol-rulesn-gcode1 (fol-rules-cnt (hints, sub-goals, symbols) < n) → (g-fol-rulesn (gcode (conc),

gcode (hints), gcode (sub-goals), gcode (symbols), n)

= bool-fix (fol-rules (conc, hints, sub-goals, symbols)))

Definition: prf-cnt-part (pf , symbols) = ((1 + formula-cnt (conc (pf , 0), symbols)) + (1 + exp-count (pf )))

Event: Enable fol-rules-cnt; name this event ‘g1298’.

Definition: prf-ind (pf , given, defns, flg, symbols, n) = if n ≃ 0 then t

elseif flg ≃ 0 then if listp (pf )

then if ¬ formula (conc (pf , 0), symbols) then t elseif car (pf ) = 1 then t elseif car (pf ) = 2 then prf-ind (cadddr (pf ), given, defns, 1, symbols, n − 1) elseif car (pf ) = 3 then t elseif car (pf ) = 4 then prf-ind (cadddr (pf ),

given, defns,

            1,

rest-of (caar (cadr (pf )), symbols), n − 1)

else t endif else t endif

elseif listp (pf ) then prf-ind (car (pf ), given, defns, 0, symbols, n − 1)

∧ prf-ind (cdr (pf ), given, defns, 1, symbols, n − 1) else t endif

Event: Enable g-symb-count; name this event ‘g1299’.

Theorem: g-z2-axiomsn-gcode1 (z2-axioms-cnt (hints, symbols) < n) → (g-z2-axiomsn (gcode (conc), gcode (hints), gcode (symbols), n)

= bool-fix (z2-axioms (conc, hints, symbols)))

Event: Enable z2-axioms-cnt; name this event ‘g1300’.

Event: Enable g-z2-axiomsn-gcode; name this event ‘g1301’.

Event: Enable g-fol-rulesn-gcode; name this event ‘g1302’.

Definition: prf-cnt (pf , given, defns, flg, symbols) = if flg ≃ 0

then if listp (pf )

then if ¬ formula (conc (pf , 0), symbols)

then prf-cnt-part (pf , symbols) elseif car (pf ) = 1 then (1 + fol-axiom-cnt (second (pf ), symbols))

+ prf-cnt-part (pf , symbols) elseif car (pf ) = 2 then prf-cnt-part (pf , symbols)

+ (1 + fol-rules-cnt (second (pf ), conc (cadddr (pf ), 1), symbols)) + (1 + prf-cnt (cadddr (pf ), given, defns, 1, symbols))

elseif car (pf ) = 3 then prf-cnt-part (pf , symbols)

+ (1 + z2-axioms-cnt (second (pf ), symbols)) elseif car (pf ) = 4 then prf-cnt-part (pf , symbols)

+ (1 + g-symb-count (second (pf ), assoc (caar (cadr (pf )), defns), symbols))

+ (1 + (1 + length (symbols))) + (1 + length (defns)) + (1 + exp-count (fourth (pf ))) + (1 + prf-cnt (cadddr (pf ),

given, defns,

                                 1,

rest-of (caar (cadr (pf )), symbols)))

else prf-cnt-part (pf , symbols)

+ (1 + length (given)) endif

else prf-cnt-part (pf , symbols) endif elseif listp (pf ) then 1 + ((1 + prf-cnt (car (pf ), given, defns, 0, symbols))

+ (1 + prf-cnt (cdr (pf ), given, defns, 1, symbols)))

else prf-cnt-part (pf , symbols) endif

Theorem: g-prfn-gcode (prf-cnt (pf , given, defns, flg, symbols) < n) → (g-prfn (gcode (pf ),

gcode (given), gcode (defns), gcode (flg), gcode (symbols), n)

= bool-fix (prf (pf , given, defns, flg, symbols)))

Event: Enable g-prf; name this event ‘g1303’.

Event: Enable g-prfn; name this event ‘g1304’.

Event: Enable g-prf-defn; name this event ‘g1305’.

Event: Enable prf-cnt; name this event ‘g1306’.

Event: Enable prf; name this event ‘g1307’.

;;;;;;;Correspondence for PROVES.

Definition: g-provesn (pf , exp, given, defns, symbols, n) = pr-andn (pr-equaln (g-concn (pf , gcode (0), n), exp),

pr-andn (g-formulan (exp, symbols, n), g-prfn (pf , given, defns, gcode (0), symbols, n)))

Event: Disable g-proves; name this event ‘g1308’.

Theorem: g-proves-eval ev (0, g-proves (pf , exp, given, defns, symbols), va, fa, n) = g-provesn (ev (0, pf , va, fa, n),

ev (0, exp, va, fa, n), ev (0, given, va, fa, n), ev (0, defns, va, fa, n), ev (0, symbols, va, fa, n), n)

Event: Disable proves; name this event ‘g1309’.

Theorem: g-provesn-gcode ((exp-count (pf ) + formula-cnt (exp, symbols) + prf-cnt (pf , given, defns, 0, symbols)) < n) → (g-provesn (gcode (pf ),

gcode (exp), gcode (given), gcode (defns), gcode (symbols), n)

= bool-fix (proves (pf , exp, given, defns, symbols)))

Event: Enable proves; name this event ‘g1310’.

Event: Enable g-proves; name this event ‘g1311’.

Event: Enable g-provesn; name this event ‘g1312’.

;;;;;;;Correspondence for NUMERAL.

Definition: g-numeraln (x, n)

= if btmp (x) ∨ (n ≃ 0) then btm

else pr-ifn (pr-zeropn (x), g-phin, g-z-succn (g-numeraln (pr-sub1n (x), n − 1))) endif

Event: Disable g-numeral-defn; name this event ‘g1313’.

Definition: g-numeral-ind (x, va, n) = if n ≃ 0 then t

else g-numeral-ind (pr-sub1 (0), ev (1, list (x), va, fa, n), n − 1) endif

Theorem: g-numeral-eval ev (0, g-numeral (x), va, fa, n) = g-numeraln (ev (0, x, va, fa, n), n)

Definition: numeral-ind (x, n) = if n ≃ 0 then t

elseif x ≃ 0 then t

else numeral-ind (x − 1, n − 1) endif

Event: Disable phi; name this event ‘g1314’.

Event: Disable z-succ; name this event ‘g1315’.

Event: Disable fn; name this event ‘g1316’.

Theorem: g-numeraln-gcode (x < n) → (g-numeraln (gcode (x), n) = gcode (numeral (x)))

Event: Enable phi; name this event ‘g1317’.

Event: Enable z-succ; name this event ‘g1318’.

Event: Enable g-numeral; name this event ‘g1319’.

Event: Enable g-numeraln; name this event ‘g1320’.

Event: Enable g-numeral-defn; name this event ‘g1321’.

Definition: g-z-singn (x) = g-z-pairn (x, x)

Definition: g-z-opairn (x, y) = g-z-pairn (g-z-singn (x), g-z-pairn (x, y))

Theorem: a-ev-good-proof-proves-again (ev-hyps (given, defns, symbols) ∧ variable (trace) ∧ (trace ∉ list (6, 7, 8, 9, 10, 11, 12, 15, 16)) ∧ (¬ btmp (ev (flg, exp, va, fa, n))) ∧ (concl = f-implies (a-ev (ncode (flg),

ncode (exp), ncode (va), ncode (fa),

                         10,

trace), f-equal (10, ncode (ev (flg, exp, va, fa, n))))))

→ proves (a-ev-good-proof (flg, exp, va, fa, n, trace), concl, given, defns, symbols)

Definition: a-ev1 (flg-bar, exp-bar, va-bar, fa-bar, val-bar) = forsome (1, a-ev (flg-bar, exp-bar, va-bar, fa-bar, val-bar, 1))

Event: Enable a-ev; name this event ‘g1323’.

Definition: a-ev1-ok-proof (flg, exp, va, fa, n) = eg-proof (a-ev (ncode (flg),

ncode (exp), ncode (va), ncode (fa), ncode (ev (flg, exp, va, fa, n)), 1),

list (1),

list (graph-trans (ev-graph (flg, exp, va, fa, n))), a-ev-ok-proof (flg, exp, va, fa, n))

Theorem: formula-a-ev-defn-again (variable (trace) ∧ ev-hyps (given, defns, symbols)) → formula (a-ev-defn (trace), symbols)

Event: Disable a-ev-defn-part1; name this event ‘g1324’.

Theorem: parallel-subst-trace-a-ev-defn-part1 parallel-subst (a-ev-defn-part1 (6, 7, 8, 9, 10, 1), list (1), list (trace), 0) = a-ev-defn-part1 (6, 7, 8, 9, 10, trace)

Event: Enable a-ev-defn-part1; name this event ‘g1325’.

Event: Disable a-ev-defn; name this event ‘g1326’.

Theorem: parallel-subst-trace-a-ev-defn parallel-subst (a-ev-defn (1), list (1), list (trace), 0) = a-ev-defn (trace)

Theorem: a-ev1-ok-proof-proves (ev-hyps (given, defns, symbols) ∧ (¬ btmp (ev (flg, exp, va, fa, n))) ∧ (concl = a-ev1 (ncode (flg),

ncode (exp), ncode (va), ncode (fa), ncode (ev (flg, exp, va, fa, n)))))

→ proves (a-ev1-ok-proof (flg, exp, va, fa, n), concl, given, defns, symbols)

Definition: a-ev1-good-proof (flg, exp, va, fa, n) = forsome-intro-proof (1,

a-ev (ncode (flg), ncode (exp), ncode (va), ncode (fa),

                         10,

1), f-equal (10, ncode (ev (flg, exp, va, fa, n))), a-ev-good-proof (flg, exp, va, fa, n, 1))

Theorem: a-ev1-good-proof-proves (ev-hyps (given, defns, symbols) ∧ (¬ btmp (ev (flg, exp, va, fa, n))) ∧ (concl = f-implies (a-ev1 (ncode (flg),

ncode (exp), ncode (va), ncode (fa),

                          10),

f-equal (10, ncode (ev (flg, exp, va, fa, n))))))

→ proves (a-ev1-good-proof (flg, exp, va, fa, n), concl, given, defns, symbols)

Event: Enable a-ev1-ok-proof; name this event ‘g1327’.

Event: Enable a-ev1-good-proof; name this event ‘g1328’.

Event: Enable free-for; name this event ‘g1329’.

Definition: a-ev1-not-good-proof (flg, exp, va, fa, n, val) = tautconseq-proof (list (f-not (f-equal (ncode (val),

ncode (ev (flg, exp, va, fa, n)))),

f-implies (a-ev1 (ncode (flg), ncode (exp), ncode (va), ncode (fa), ncode (val)),

f-equal (ncode (val),

ncode (ev (flg, exp, va, fa, n))))),

f-not (a-ev1 (ncode (flg), ncode (exp), ncode (va), ncode (fa), ncode (val))),

list (ncode-nequal-proof (val, ev (flg, exp, va, fa, n)), subst-rule-proof (f-implies (a-ev1 (ncode (flg),

ncode (exp), ncode (va), ncode (fa),

                                                  10),

f-equal (10,

ncode (ev (flg, exp, va, fa, n)))),

                                    10,

ncode (val),

a-ev1-good-proof (flg, exp, va, fa, n))))

Theorem: a-ev1-not-good-proof-proves (ev-hyps (given, defns, symbols) ∧ (¬ btmp (ev (flg, exp, va, fa, n))) ∧ (¬ ncode-equal (val, ev (flg, exp, va, fa, n))) ∧ (concl = f-not (a-ev1 (ncode (flg),

ncode (exp), ncode (va), ncode (fa), ncode (val)))))

→ proves (a-ev1-not-good-proof (flg, exp, va, fa, n, val), concl, given, defns, symbols)

Definition: a-ev2 (flg, exp, fa, val) = forsome (1,

f-and (isin (z-list (list (ncode (val), ncode (flg), ncode (exp), z-opair (6,

z-opair (7, ncode (gcode (nil)))), ncode (fa))),

1), a-ev-defn (1)))

Theorem: replace-va-a-ev2 subst (subst (a-ev2 (flg, exp, fa, val), 7, ncode (va2 ), 0), 6, ncode (va1 ), 0) = a-ev1 (ncode (flg),

ncode (exp),

z-opair (ncode (va1 ), z-opair (ncode (va2 ), ncode (gcode (nil)))), ncode (fa), ncode (val))

Theorem: replace-va-forall-a-ev2 subst (∀ 6 a-ev2 (flg, exp, fa, val), 7, ncode (va2 ), 0) = ∀ 6 a-ev1 (ncode (flg),

ncode (exp),

z-opair (6, z-opair (ncode (va2 ), ncode (gcode (nil)))), ncode (fa), ncode (val))

Theorem: replace-va1-a-ev2 subst (a-ev1 (ncode (flg),

ncode (exp), z-opair (6, z-opair (ncode (va2 ), ncode (gcode (nil)))), ncode (fa), ncode (val)),

      6,

ncode (va1 ),

      0)

= a-ev1 (ncode (flg), ncode (exp), z-opair (ncode (va1 ), z-opair (ncode (va2 ), ncode (gcode (nil)))), ncode (fa), ncode (val))

Event: Enable a-ev1; name this event ‘g1330’.

Event: Enable a-ev-defn; name this event ‘g1331’.

Event: Enable a-ev; name this event ‘g1332’.

Definition: a-ev2-inst-proof (flg, exp, fa, val, va1 , va2 , pf ) = subst-rule-proof (a-ev1 (ncode (flg),

ncode (exp), z-opair (6,

z-opair (ncode (va2 ), ncode (gcode (nil)))), ncode (fa), ncode (val)),

                  6,

ncode (va1 ),

detach-proof (∀ 6 a-ev1 (ncode (flg), ncode (exp), z-opair (6,

z-opair (ncode (va2 ),

ncode (gcode (nil)))),

ncode (fa), ncode (val)),

a-ev1 (ncode (flg), ncode (exp), z-opair (6,

z-opair (ncode (va2 ),

ncode (gcode (nil)))),

ncode (fa), ncode (val)),

pf , all-elim-proof (6,

a-ev1 (ncode (flg), ncode (exp), z-opair (6,

z-opair (ncode (va2 ),

ncode (gcode (nil)))),

ncode (fa), ncode (val)))))

Theorem: a-ev2-inst-proof-proves (ev-hyps (given, defns, symbols) ∧ proves (pf ,

∀ 6 a-ev1 (ncode (flg), ncode (exp), z-opair (6, z-opair (ncode (va2 ), ncode (gcode (nil)))), ncode (fa), ncode (val)),

given, defns, symbols)

∧ (concl = a-ev1 (ncode (flg), ncode (exp), z-opair (ncode (va1 ),

z-opair (ncode (va2 ), ncode (gcode (nil)))), ncode (fa), ncode (val))))

→ proves (a-ev2-inst-proof (flg, exp, fa, val, va1 , va2 , pf ), concl, given, defns, symbols)

Event: Disable bool-fix; name this event ‘g1333’.

Theorem: ncode-nequal-bool-fix-t-f ¬ ncode-equal (bool-fix (f), bool-fix (t))

Event: Enable bool-fix; name this event ‘g1334’.

;;;;;;;Exponentiation.

Definition: exp (x, y) = if y ≃ 0 then 1

else exp (x, y − 1) ∗ x endif

;;;;;;;Remainder.

Definition: rem (x, y) = if y ≃ 0 then fix (x)

elseif x < y then fix (x) else rem (x − y, y) endif

;;;;;;;Development of number theory leading to Unique Prime factorization theorem.
;;;;;;;Taken from Boyer-Moore's "proveall".

Theorem: plus-right-id2 (y ∉ N) → ((x + y) = fix (x))

Theorem: plus-add1 (x + (1 + y)) = if y ∈ N then 1 + (x + y)

else 1 + x endif

Theorem: commutativity2-of-plus (x + (y + z)) = (y + (x + z))

Theorem: commutativity-of-plus (x + y) = (y + x)

Theorem: associativity-of-plus ((x + y) + z) = (x + (y + z))

Theorem: plus-equal-0 ((a + b) = 0) = ((a ≃ 0) ∧ (b ≃ 0))

Theorem: difference-x-x (x − x) = 0

Theorem: difference-plus (((x + y) − x) = fix (y)) ∧ (((y + x) − x) = fix (y))

Theorem: plus-cancellation ((a + b) = (a + c)) = (fix (b) = fix (c))

Theorem: difference-0 (y ≮ x) → ((x − y) = 0)

Theorem: equal-difference-0 (0 = (x − y)) = (y ≮ x)

Theorem: difference-cancellation-0 (x = (x − y)) = ((x ∈ N) ∧ ((x = 0) ∨ (y ≃ 0)))

Theorem: difference-cancellation-1 ((x − y) = (z − y)) = if x < y then y ≮ z

elseif z < y then y ≮ x else fix (x) = fix (z) endif

Theorem: times-zero2 (y ∉ N) → ((x ∗ y) = 0)

Theorem: distributivity-of-times-over-plus (x ∗ (y + z)) = ((x ∗ y) + (x ∗ z))

Theorem: times-add1 (x ∗ (1 + y)) = if y ∈ N then x + (x ∗ y)

else fix (x) endif

Theorem: commutativity-of-times (x ∗ y) = (y ∗ x)

Theorem: commutativity2-of-times (x ∗ (y ∗ z)) = (y ∗ (x ∗ z))

Theorem: associativity-of-times ((x ∗ y) ∗ z) = (x ∗ (y ∗ z))

Theorem: equal-times-0 ((x ∗ y) = 0) = ((x ≃ 0) ∨ (y ≃ 0))

Theorem: equal-lessp ((x < y) = z) = if x < y then t = z

else f = z endif

Theorem: difference-elim ((y ∈ N) ∧ (y ≮ x)) → ((x + (y − x)) = y)

Theorem: rem-quotient (rem (x, y) + (y ∗ (x ÷ y))) = fix (x)

Theorem: rem-wrt-1 rem (y, 1) = 0 Theorem: rem-wrt-12 (x ∉ N) → (rem (y, x) = fix (y))

Theorem: lessp-rem2 (rem (x, y) < y) = (y ≄ 0)

Theorem: rem-x-x rem (x, x) = 0

Theorem: rem-quotient-elim ((y ≄ 0) ∧ (x ∈ N)) → ((rem (x, y) + (y ∗ (x ÷ y))) = x)

Theorem: lessp-times-1 (i ≄ 0) → ((i ∗ j ) ≮ j )

Theorem: lessp-times-2 (i ≄ 0) → ((j ∗ i) ≮ j )

Theorem: lessp-quotient1 ((i ÷ j ) < i) = ((i ≄ 0) ∧ ((j ≃ 0) ∨ (j ≠ 1)))

Theorem: lessp-rem1 (rem (x, y) < x) = ((y ≄ 0) ∧ (x ≄ 0) ∧ (x ≮ y))

Definition: gcd (x, y) = if x ≃ 0 then fix (y)

elseif y ≃ 0 then x

elseif x < y then gcd (x, y − x)

else gcd (x − y, y) endif

Theorem: numberp-gcd gcd (x, y) ∈ N

Theorem: gcd-equal-0 (gcd (x, y) = 0) = ((x ≃ 0) ∧ (y ≃ 0))

Theorem: gcd-0 gcd (0, y) = fix (y)

Theorem: commutativity-of-gcd gcd (x, y) = gcd (y, x)

Theorem: difference-plus1 ((x + y) − x) = fix (y)

Theorem: difference-plus2 ((y + x) − x) = fix (y)

Theorem: difference-plus-cancelation ((x + y) − (x + z)) = (y − z)

Theorem: times-difference (x ∗ (c − w)) = ((c ∗ x) − (w ∗ x))

Definition: divides (x, y) = (rem (y, x) ≃ 0)

Theorem: divides-times rem (x ∗ z, z) = 0

Theorem: difference-plus3 ((b + (a + c)) − a) = (b + c)

Theorem: difference-add1-cancellation ((1 + (y + z)) − z) = (1 + y)

Theorem: rem-add1 ((y ≄ 0) ∧ (y ≠ 1)) → (rem (1 + (x ∗ y), y) ≠ 0)

Theorem: divides-plus-rewrite1 ((rem (x, z) = 0) ∧ (rem (y, z) = 0)) → (rem (x + y, z) = 0)

Theorem: divides-plus-rewrite2 ((rem (x, z) = 0) ∧ (rem (y, z) ≠ 0)) → (rem (x + y, z) ≠ 0)

Theorem: divides-plus-rewrite (rem (x, z) = 0) → ((rem (x + y, z) = 0) = (rem (y, z) = 0))

Theorem: lessp-plus-cancelation ((x + y) < (x + z)) = (y < z)

Theorem: divides-plus-rewrite-commuted (rem (x, z) = 0) → ((rem (y + x, z) = 0) = (rem (y, z) = 0))

Theorem: euclid (rem (x, z) = 0) → ((rem (y − x, z) = 0)

= if x < y then rem (y, z) = 0 else t endif)

Theorem: lessp-times-cancellation ((x ∗ z) < (y ∗ z)) = ((z ≄ 0) ∧ (x < y))

Theorem: lessp-plus-cancellation3 (y < (x + y)) = (x ≄ 0)

Theorem: distributivity-of-times-over-gcd gcd (x ∗ z, y ∗ z) = (z ∗ gcd (x, y))

Theorem: gcd-divides-both (rem (x, gcd (x, y)) = 0) ∧ (rem (y, gcd (x, y)) = 0)

Theorem: gcd-is-the-greatest ((x ≄ 0) ∧ (y ≄ 0) ∧ divides (z, x) ∧ divides (z, y)) → (z ≤ gcd (x, y))

Definition: prime1 (x, y) = if y ≃ 0 then f

elseif y = 1 then t

else (¬ divides (y, x)) ∧ prime1 (x, y − 1) endif

Definition: prime (x) = ((x ≄ 0) ∧ (x ≠ 1) ∧ prime1 (x, x − 1))

Definition: greatest-factor (x, y) = if (y ≃ 0) ∨ (y = 1) then x

elseif divides (y, x) then y

else greatest-factor (x, y − 1) endif

Theorem: greatest-factor-lessp ((y < x) ∧ (¬ prime1 (x, y)) ∧ (x ≄ 0) ∧ ((x − 1) ≠ 0) ∧ (y ≄ 0)) → (greatest-factor (x, y) < x)

Theorem: greatest-factor-divides ((y < x) ∧ (¬ prime1 (x, y)) ∧ (x ≄ 0) ∧ (x ≠ 1) ∧ (y ≄ 0)) → (rem (x, greatest-factor (x, y)) = 0)

Theorem: greatest-factor-0 (greatest-factor (x, y) = 0) = (((y ≃ 0) ∨ (y = 1)) ∧ (x = 0))

Theorem: rem-0-crock rem (0, y) = 0 Theorem: greatest-factor-1 (greatest-factor (x, y) = 1) = (x = 1)

Theorem: numberp-greatest-factor (greatest-factor (x, y) ∈ N) = (¬ (((y ≃ 0) ∨ (y = 1)) ∧ (x ∉ N)))

Definition: prime-factors (x) = if (x ≃ 0) ∨ ((x − 1) = 0) then nil

elseif prime1 (x, x − 1) then cons (x, nil)

else append (prime-factors (greatest-factor (x, x − 1)), prime-factors (x ÷ greatest-factor (x, x − 1))) endif

Definition: prime-list (l) = if l ≃ nil then t

else prime (car (l)) ∧ prime-list (cdr (l)) endif

Definition: times-list (l) = if l ≃ nil then 1

else car (l) ∗ times-list (cdr (l)) endif

Theorem: times-list-append times-list (append (x, y)) = (times-list (x) ∗ times-list (y))

Theorem: prime-list-append prime-list (append (x, y)) = (prime-list (x) ∧ prime-list (y))

Theorem: prime-list-prime-factors prime-list (prime-factors (x))

Theorem: quotient-times1 ((y ∈ N) ∧ (x ∈ N) ∧ (x ≠ 0) ∧ divides (x, y)) → ((x ∗ (y ÷ x)) = y)

Theorem: quotient-lessp ((x ≄ 0) ∧ (x < y)) → ((y ÷ x) ≠ 0)

Theorem: enough-factors (x ≄ 0) → (times-list (prime-factors (x)) = x)

Theorem: prime-factorization-existence (x ≄ 0) → ((times-list (prime-factors (x)) = x)

∧ prime-list (prime-factors (x)))

Definition: greatereqpr (w, z) = if w ≃ 0 then z ≃ 0

elseif w = z then t

else greatereqpr (w − 1, z) endif

Theorem: times-id-iff-1 (z = (w ∗ z)) = ((z ∈ N) ∧ ((z = 0) ∨ (w = 1)))

Theorem: prime1-basic ((z ≠ 1) ∧ (z ≠ 0) ∧ (z ∈ N) ∧ greatereqpr (u, z)) → (¬ prime1 (w ∗ z, u))

Theorem: greatereqpr-lessp greatereqpr (x, y) = (x ≮ y)

Theorem: greatereqpr-rem ((z ≠ (1 + v)) ∧ divides (z, 1 + v)) → greatereqpr (v, z)

Theorem: prime-basic ((z ≠ 1) ∧ (z ≠ x) ∧ (x ≄ 0) ∧ (x ≠ 1) ∧ divides (z, x)) → (¬ prime1 (x, x − 1))

Theorem: rem-gcd (gcd (b, x) = y) → (rem (b, y) = 0)

Theorem: rem-gcd-1 (rem (b, x) ≠ 0) → (gcd (b, x) ≠ x)

Theorem: divides-times1 (a = (z ∗ y)) → (rem (a, z) = 0)

Theorem: times-identity1 ((y ∈ N) ∧ (y ≠ 1) ∧ (y ≠ 0) ∧ (x ≠ 0)) → (x ≠ (x ∗ y))

Theorem: times-identity (x = (x ∗ y)) = ((x = 0) ∨ ((x ∈ N) ∧ (y = 1)))

Theorem: kludge-bridge (y = (k ∗ x)) → (gcd (y, a ∗ x) = (x ∗ gcd (a, k)))

Theorem: hack1 ((¬ divides (x, a)) ∧ (a = gcd (x ∗ a, b ∗ a))) → ((k ∗ x) ≠ (b ∗ a))

Theorem: prime-gcd ((¬ divides (x, b)) ∧ (x ≄ 0) ∧ ((x − 1) ≠ 0) ∧ prime1 (x, x − 1)) → ((gcd (b, x) = 1) = t)

Theorem: gcd-distributes-over-an-opened-up-times ((x ∈ N) ∧ (x ≠ 0) ∧ (free = (x ∗ z))) → (gcd (b ∗ z, free) = (z ∗ gcd (b, x)))

Theorem: prime-key ((z ∈ N) ∧ prime (x) ∧ (¬ divides (x, z)) ∧ (¬ divides (x, b))) → ((x ∗ k) ≠ (b ∗ z))

Theorem: quotient-divides ((y ∈ N) ∧ ((x ∗ (y ÷ x)) ≠ y)) → (rem (y, x) ≠ 0)

Theorem: little-step (prime (x) ∧ (y ≠ 1) ∧ (x ≠ y)) → (rem (x, y) ≠ 0)

Definition: delete (x, y) = if listp (y)

then if x = car (y) then cdr (y)

else cons (car (y), delete (x, cdr (y))) endif else y endif

Theorem: delete-non-member (x ∉ y) → (delete (x, y) = y)

Theorem: member-delete (x ∈ delete (u, v)) → (x ∈ v)

Theorem: lessp-count-delete (n ∈ l) → (count (delete (n, l)) < count (l))

Definition: perm (a, b) = if a ≃ nil then b ≃ nil

elseif car (a) ∈ b then perm (cdr (a), delete (car (a), b)) else f endif

Theorem: rem-times rem (y ∗ x, y) = 0

Theorem: prime-list-delete prime-list (l2 ) → prime-list (delete (x, l2 ))

Theorem: divides-times-list ((c ≄ 0) ∧ (c ∈ l)) → (rem (times-list (l), c) = 0)

Theorem: quotient-times ((y ∗ x) ÷ y) = if y ≃ 0 then 0

else fix (x) endif

Theorem: distributivity-of-divides ((a ≄ 0) ∧ divides (a, w)) → ((c ∗ (w ÷ a)) = ((c ∗ w) ÷ a))

Theorem: times-list-delete ((c ≄ 0) ∧ (c ∈ l)) → (times-list (delete (c, l)) = (times-list (l) ÷ c))

Theorem: prime-list-times-list (prime (c) ∧ prime-list (l2 ) ∧ (c ∉ l2 )) → (rem (times-list (l2 ), c) ≠ 0)

Theorem: if-times-then-divides ((c ≄ 0) ∧ (¬ divides (c, x))) → ((c ∗ y) ≠ x)

Theorem: times-equal-1 ((a ∗ b) = 1) = ((a ≠ 0)

∧ (b ≠ 0)

∧ (a ∈ N)
∧ (b ∈ N)
∧ ((a − 1) = 0)
∧ ((b − 1) = 0))

Theorem: prime-member (((c ∗ times-list (l1 )) = times-list (l2 )) ∧ prime (c) ∧ prime-list (l2 )) → (c ∈ l2 )

Theorem: divides-implies-times ((a ≄ 0) ∧ (c ∈ N) ∧ ((a ∗ c) = b)) → ((c = (b ÷ a)) = t)

;;;;;;;Two prime factorizations with the same product are permutations of one another.

Theorem: prime-factorization-uniqueness (prime-list (l1 ) ∧ prime-list (l2 ) ∧ (times-list (l1 ) = times-list (l2 ))) → perm (l1 , l2 )

;;;;;;;NUM-TREEP checks if X is constructed from numbers using CONS.

Definition: num-treep (x) = if listp (x) then num-treep (car (x)) ∧ num-treep (cdr (x))

else x ∈ N endif

;;;;;;;DOUBLE multiplies X by 2.  The recursive definition is there to provide an induction
;;;;;;;scheme.

Definition: double (x) = if x ≃ 0 then 0

else 1 + (1 + double (x − 1)) endif

;;;;;;;HALVE integer-divides X by 2.

Definition: halve (x) = if x ≃ 0 then 0

elseif (x − 1) ≃ 0 then 0

else 1 + halve ((x − 1) − 1) endif

Theorem: odd-rem-two rem (1 + double (x), 2) = 1

;;;;;;;NUMCODE is a one-to-one mapping from num-trees to numbers.  A number N is mapped
;;;;;;;to the odd number (2N + 1).  The list (CONS X Y) is mapped to ((x**2)(y**3)),
;;;;;;;if X is mapped to x, and Y to y.  The unique prime factorization theorem is
;;;;;;;needed to decipher the num-tree back from a NUMCODE.

Definition: numcode (x) = if listp (x) then exp (2, numcode (car (x))) ∗ exp (3, numcode (cdr (x)))

else 1 + double (x) endif

Definition: y-x-list (x, y) = if y ≃ 0 then nil

else cons (x, y-x-list (x, y − 1)) endif

Theorem: exp-times-list-y-x-list times-list (y-x-list (x, y)) = exp (x, y)

Definition: perm-y-x-ind (y, z) = if y ≃ 0 then t

elseif z ≃ 0 then t

else perm-y-x-ind (y − 1, z − 1) endif

Theorem: perm-y-x-list-append perm (append (y-x-list (x, y), list1 ), append (y-x-list (x, z), list2 )) = if y < z then perm (list1 , append (y-x-list (x, z − y), list2 ))

else perm (append (y-x-list (x, y − z), list1 ), list2 ) endif Theorem: not-member-y-x-list (x ≠ x1 ) → (x ∉ y-x-list (x1 , y1 ))

Theorem: nequal-perm-y-x-list ((x ≠ x1 ) ∧ (y ≄ 0)) → (¬ perm (append (y-x-list (x, y), list1 ), y-x-list (x1 , y1 )))

Theorem: nequal-perm-y-x-step (listp (y) ∧ (car (y) ∉ x)) → (¬ perm (x, y))

Theorem: nequal-perm-y-x-list-another ((x ≠ x1 ) ∧ (y1 ≄ 0)) → (¬ perm (y-x-list (x, y), append (y-x-list (x1 , y1 ), list1 )))

Theorem: not-perm-numcode ((x ≄ 0) ∧ (x ≠ x1 )) → (¬ perm (append (y-x-list (2, x), y-x-list (3, y)),

append (y-x-list (2, x1 ), y-x-list (3, y1 ))))

Theorem: prime-list-y-x-list prime (x) → prime-list (y-x-list (x, y))

Theorem: rem-rec-reduc ((y ≄ 0) ∧ (y < x)) → (rem (x, y) = rem (x − y, y))

Theorem: rem32 rem (3, 2) = 1

Theorem: prime1-3-2 prime1 (3, 2) = (¬ divides (2, 3))

Theorem: prime-3 prime (3)

Theorem: prime-2 prime (2)

Theorem: times-list-append23-numcode (exp (2, x) ∗ exp (3, y)) = times-list (append (y-x-list (2, x), y-x-list (3, y)))

;;;;;;;The NUMCODEs of two lists are distinct, if the NUMCODEs of the their first elements are.

Theorem: numcode-uniqueness1 ((x ≠ x1 ) ∧ (x ≄ 0)) → ((exp (2, x) ∗ exp (3, y)) ≠ (exp (2, x1 ) ∗ exp (3, y1 )))

Event: Enable times-list-append23-numcode; name this event ‘g1335’.

Theorem: perm-append-x-x perm (append (x, y), append (x, y1 )) = perm (y, y1 )

Theorem: length-delete length (delete (x, y)) = if x ∈ y then length (y) − 1

else length (y) endif

Theorem: member-length (length (y) ≃ 0) → (x ∉ y)

Theorem: perm-length (length (x) ≠ length (y)) → (¬ perm (x, y))

Theorem: length-y-x-list length (y-x-list (x, y)) = fix (y)

Theorem: not-perm-nequal ((y ≠ y1 ) ∧ (y ≄ 0)) → (¬ perm (y-x-list (x, y), y-x-list (x, y1 )))

;;;;;;;The NUMCODEs of two lists are distinct, if the NUMCODEs of their second elements are.

Theorem: numcode-uniqueness2 ((x = x1 ) ∧ (y ≄ 0) ∧ (y ≠ y1 )) → ((exp (2, x) ∗ exp (3, y)) ≠ (exp (2, x1 ) ∗ exp (3, y1 )))

Definition: double-ind (x, y) = if x ≃ 0 then t

elseif y ≃ 0 then t

else double-ind (x − 1, y − 1) endif

Theorem: double-nequal-add1-double double (x) ≠ (1 + double (y))

Theorem: times-2-double (2 ∗ x) = double (x)

Theorem: plus-double (double (x) + double (y)) = double (x + y)

Theorem: times-double (x ∗ double (y)) = double (x ∗ y)

Theorem: numcode-reduc (y ≄ 0) → ((exp (2, y) ∗ z) = double (exp (2, y − 1) ∗ z))

Theorem: numcode-nequal (x1 ≄ 0) → ((1 + double (x)) ≠ (exp (2, x1 ) ∗ y))

Event: Enable numcode-reduc; name this event ‘g1336’.

Event: Enable times-2-double; name this event ‘g1337’.

Event: Enable times-double; name this event ‘g1338’.

;;;;;;;DECIPHER1 is the function that deciphers the num-tree back from a NUMCODE.
;;;;;;;It essentially starts from Y and Z, and works its way down lexicographically
;;;;;;;until it has decomposed X into a pair of NUMCODEs, which it recursively deciphers.
;;;;;;;In the base case, when X is not the NUMCODE of any pair, it halves (SUB1 X).

Definition: decipher1 (x, y, z) = if y ≃ 0 then halve (x − 1)

elseif z ≃ 0 then decipher1 (x, y − 1, x)

elseif (y < x) ∧ (z < x)

then if x = (exp (2, y) ∗ exp (3, z)) then cons (decipher1 (y, y − 1, y − 1), decipher1 (z, z − 1, z − 1)) else decipher1 (x, y, z − 1) endif

else decipher1 (x, y, z − 1) endif

Theorem: lessp-exp ((y ≄ 0) ∧ (1 < x)) → (y < exp (x, y))

Theorem: lessp-times ((1 < x) ∧ (1 < y)) → ((x < (x ∗ y)) ∧ (y < (x ∗ y)))

Theorem: lessp-numcode1 ((x ≄ 0) ∧ (y ≄ 0)) → ((x < (exp (2, x) ∗ exp (3, y)))

∧ (y < (exp (2, x) ∗ exp (3, y))))

Event: Enable times; name this event ‘g1339’.

Event: Enable exp; name this event ‘g1340’.

Theorem: decipher-listp ((x ≄ 0) ∧ (y ≄ 0)) → (decipher1 (exp (2, x) ∗ exp (3, y), x, y)

= cons (decipher1 (x, x − 1, x − 1), decipher1 (y, y − 1, y − 1)))

Definition: decipher-ind (x, y, x1 , y1 ) = if x1 ≃ 0 then t

elseif y1 ≃ 0 then decipher-ind (x, y, x1 − 1, exp (2, x) ∗ exp (3, y)) elseif x < x1 then decipher-ind (x, y, x1 , y1 − 1) elseif y = y1 then t else decipher-ind (x, y, x1 , y1 − 1) endif

Theorem: decipher1-listp-reduc ((x ≄ 0) ∧ (y ≄ 0) ∧ (x ≤ x1 ) ∧ if x = x1 then y ≤ y1

else t endif) → (decipher1 (exp (2, x) ∗ exp (3, y), x1 , y1 )

= decipher1 (exp (2, x) ∗ exp (3, y), x, y))

Theorem: halve-double halve (double (x)) = fix (x)

Theorem: lessp-numcode 0 < numcode (x)

;;;;;;;NUMTREEP is the same as NUM-TREEP.

Definition: numtreep (x) = if listp (x) then numtreep (car (x)) ∧ numtreep (cdr (x))

else x ∈ N endif

Theorem: lessp-sub1-numcode ((x ≄ 0) ∧ (y ≄ 0)) → ((((exp (2, x) ∗ exp (3, y)) − 1) ≮ x)

∧ (((exp (2, x) ∗ exp (3, y)) − 1) ≮ y))

Theorem: lessp-numcode-again numcode (x) ≠ 0

Theorem: lessp-numcode-case ((x ≄ 0) ∧ (y ≄ 0)) → (x ≠ ((exp (2, x) ∗ exp (3, y)) − 1))

Definition: decipher-ind2 (x, y, z) = if y ≃ 0 then t

elseif z ≃ 0 then decipher-ind2 (x, y − 1, 1 + double (x))

else decipher-ind2 (x, y, z − 1) endif

Theorem: decipher1-nlistp decipher1 (1 + double (x), y, z) = fix (x)

;;;;;;;This is the main lemma relating DECIPHER1 and NUMCODE.  It asserts that
;;;;;;;DECIPHER1 applied to (NUMCODE X) (with appropriate values for the Y, Z, arguments)
;;;;;;;returns X.

Theorem: decipher1-numcode numtreep (x) → (decipher1 (numcode (x), numcode (x) − 1, numcode (x) − 1) = x)

;;;;;;;Correspondence proofs for PLUS.

Definition: g-plusn (x, y, n) = if btmp (x) ∨ btmp (y) ∨ (n ≃ 0) then btm

else pr-ifn (pr-zeropn (x), g-fixn (y), pr-add1n (g-plusn (pr-sub1n (x), y, n − 1))) endif

Event: Disable g-plus; name this event ‘g1341’.

Event: Disable g-plus-defn; name this event ‘g1342’.

Definition: g-plus-ind (x, y, va, n) = if n ≃ 0 then t

else g-plus-ind (pr-sub1 (0), 1, ev (1, list (x, y), va, fa, n), n − 1) endif

Theorem: g-plus-eval ev (0, g-plus (x, y), va, fa, n) = g-plusn (ev (0, x, va, fa, n), ev (0, y, va, fa, n), n)

Theorem: pr-add1n-gcode pr-add1n (gcode (x)) = gcode (1 + x)

Event: Enable pr-add1n; name this event ‘g1343’.

Definition: plusn-ind (x, y, n) = if n ≃ 0 then t

elseif x ≃ 0 then t

else plusn-ind (x − 1, y, n − 1) endif Theorem: g-plusn-gcode (x < n) → (g-plusn (gcode (x), gcode (y), n) = gcode (x + y))

Event: Enable g-plus; name this event ‘g1344’.

Event: Enable g-plusn; name this event ‘g1345’.

Event: Enable g-plus-ind; name this event ‘g1346’.

;;;;;;;Correspondence proofs for TIMES.

Definition: g-timesn (x, y, n) = if btmp (x) ∨ btmp (y) ∨ (n ≃ 0) then btm

else pr-ifn (pr-zeropn (x), gcode (0), g-plusn (y, g-timesn (pr-sub1n (x), y, n − 1), n − 1)) endif

Event: Disable g-times; name this event ‘g1347’.

Event: Disable g-times-defn; name this event ‘g1348’.

Theorem: g-times-eval ev (0, g-times (x, y), va, fa, n) = g-timesn (ev (0, x, va, fa, n), ev (0, y, va, fa, n), n)

Theorem: g-timesn-gcode ((1 + (x + y)) < n) → (g-timesn (gcode (x), gcode (y), n) = gcode (x ∗ y))

Event: Enable g-times; name this event ‘g1349’.

Event: Enable g-timesn; name this event ‘g1350’.

Event: Enable g-times-defn; name this event ‘g1351’.

;;;;;;;Correspondence proofs for EXP.

Definition: g-expn (x, y, n) = if btmp (x) ∨ btmp (y) ∨ (n ≃ 0) then btm

else pr-ifn (pr-zeropn (y), gcode (1), g-timesn (x, g-expn (x, pr-sub1n (y), n − 1), n − 1)) endif Event: Disable g-exp; name this event ‘g1373’.

Event: Disable g-exp-defn; name this event ‘g1374’.

Definition: g-exp-ind (x, y, va, n) = if n ≃ 0 then t

else g-exp-ind (0, pr-sub1 (1), ev (1, list (x, y), va, fa, n), n − 1) endif

Theorem: g-exp-eval ev (0, g-exp (x, y), va, fa, n) = g-expn (ev (0, x, va, fa, n), ev (0, y, va, fa, n), n)

Event: Disable exp; name this event ‘g1375’.

Event: Disable times; name this event ‘g1376’.

Theorem: g-expn-gcode ((x ≄ 0) ∧ ((1 + (x + y + exp (x, y))) < n)) → (g-expn (gcode (x), gcode (y), n) = gcode (exp (x, y)))

Event: Enable g-exp; name this event ‘g1377’.

Event: Enable g-expn; name this event ‘g1378’.

Event: Enable g-exp-defn; name this event ‘g1379’.

Event: Enable times; name this event ‘g1380’.

Event: Enable exp; name this event ‘g1381’.

;;;;;;;Correspondence proofs for HALVE.

Definition: g-halven (x, n) = if btmp (x) ∨ (n ≃ 0) then btm

else pr-ifn (pr-zeropn (x), gcode (0), pr-ifn (pr-zeropn (pr-sub1n (x)),

gcode (0),

pr-add1n (g-halven (pr-sub1n (pr-sub1n (x)), n − 1)))) endif Event: Disable g-halve; name this event ‘g1382’.

Event: Disable g-halve-defn; name this event ‘g1383’.

Definition: g-halve-ind (x, va, n) = if n ≃ 0 then t

else g-halve-ind (pr-sub1 (pr-sub1 (0)), ev (1, list (x), va, fa, n), n − 1) endif

Theorem: g-halve-eval ev (0, g-halve (x), va, fa, n) = g-halven (ev (0, x, va, fa, n), n)

Definition: halven-ind (x, n) = if n ≃ 0 then t

elseif x ≃ 0 then t

else halven-ind ((x − 1) − 1, n − 1) endif

Theorem: g-halven-gcode (x < n) → (g-halven (gcode (x), n) = gcode (halve (x)))

Event: Enable g-halve; name this event ‘g1384’.

Event: Enable g-halven; name this event ‘g1385’.

Event: Enable g-halve-defn; name this event ‘g1386’.

;;;;;;;Correspondence proofs for LESSP.

Definition: g-lesspn (x, y, n) = if btmp (x) ∨ btmp (y) ∨ (n ≃ 0) then btm

else pr-ifn (pr-zeropn (y), bool-fix (f), pr-ifn (pr-zeropn (x), bool-fix (t), g-lesspn (pr-sub1n (x), pr-sub1n (y), n − 1))) endif

Event: Disable g-lessp; name this event ‘g1387’.

Event: Disable g-lessp-defn; name this event ‘g1388’.

Definition: g-lessp-ind (x, y, va, n) = if n ≃ 0 then t

else g-lessp-ind (pr-sub1 (0), pr-sub1 (1), ev (1, list (x, y), va, fa, n), n − 1) endif

Theorem: g-lessp-eval ev (0, g-lessp (x, y), va, fa, n) = g-lesspn (ev (0, x, va, fa, n), ev (0, y, va, fa, n), n)

Definition: lesspn-ind (x, y, n) = if n ≃ 0 then t

elseif y ≃ 0 then t elseif x ≃ 0 then t else lesspn-ind (x − 1, y − 1, n − 1) endif

Theorem: g-lesspn-gcode ((x + y) < n) → (g-lesspn (gcode (x), gcode (y), n) = bool-fix (x < y))

Event: Enable g-lessp; name this event ‘g1389’.

Event: Enable g-lesspn; name this event ‘g1390’.

Event: Enable g-lessp-defn; name this event ‘g1391’.

;;;;;;;Correspondence proofs for DECIPHER1.

Definition: g-decipher1n (x, y, z, n) = if btmp (x) ∨ btmp (y) ∨ btmp (z) ∨ (n ≃ 0) then btm

else pr-ifn (pr-zeropn (y), g-halven (pr-sub1n (x), n − 1), pr-ifn (pr-zeropn (z),

g-decipher1n (x, pr-sub1n (y), x, n − 1), pr-ifn (pr-andn (g-lesspn (y, x, n − 1),

g-lesspn (z, x, n − 1)),

pr-ifn (pr-equaln (x,

g-timesn (g-expn (gcode (2), y, n − 1),

g-expn (gcode (3), z, n − 1),

n − 1)),

pr-consn (g-decipher1n (y, pr-sub1n (y), pr-sub1n (y), n − 1),

g-decipher1n (z, pr-sub1n (z), pr-sub1n (z), n − 1)),

g-decipher1n (x, y, pr-sub1n (z), n − 1)),

g-decipher1n (x, y, pr-sub1n (z), n − 1)))) endif

Event: Disable g-decipher1; name this event ‘g1392’.

Event: Disable g-decipher1-defn; name this event ‘g1393’.

Definition: g-decipher1-ind (x, y, z, va, n) = if n ≃ 0 then t

else g-decipher1-ind (0, pr-sub1 (1),

0,

ev (1, list (x, y, z), va, fa, n), n − 1)

∧ g-decipher1-ind (0,

1,

pr-sub1 (2), ev (1, list (x, y, z), va, fa, n), n − 1)

∧ g-decipher1-ind (1, pr-sub1 (1), pr-sub1 (1), ev (1, list (x, y, z), va, fa, n), n − 1)

∧ g-decipher1-ind (2, pr-sub1 (2), pr-sub1 (2), ev (1, list (x, y, z), va, fa, n),

n − 1) endif

Theorem: g-decipher1-eval ev (0, g-decipher1 (x, y, z), va, fa, n) = g-decipher1n (ev (0, x, va, fa, n), ev (0, y, va, fa, n), ev (0, z, va, fa, n), n)

Definition: dec-count (x, y, z) = if y ≃ 0 then 1 + x

elseif z ≃ 0 then 1 + dec-count (x, y − 1, x) elseif (y < x) ∧ (z < x) then if x = (exp (2, y) ∗ exp (3, z))

then 1 + (1 + (x + y + z + exp (2, y) + exp (3, z) + dec-count (y, y − 1, y − 1) + dec-count (z, z − 1, z − 1)))

else 1 + (1 + (x + y + z + exp (2, y) + exp (3, z) + dec-count (x, y, z − 1))) endif

else 1 + (1 + (x + y + z + exp (2, y) + exp (3, z) + dec-count (x, y, z − 1))) endif

Theorem: gcode-halve gcode (halve (x)) = halve (x)

Definition: decipher1n-ind (x, y, z, n) = if n ≃ 0 then t

elseif y ≃ 0 then t elseif z ≃ 0 then decipher1n-ind (x, y − 1, x, n − 1) elseif (y < x) ∧ (z < x) then if x = (exp (2, y) ∗ exp (3, z))

then decipher1n-ind (y, y − 1, y − 1, n − 1)

∧ decipher1n-ind (z, z − 1, z − 1, n − 1) else decipher1n-ind (x, y, z − 1, n − 1) endif

else decipher1n-ind (x, y, z − 1, n − 1) endif Theorem: g-decipher1n-gcode (dec-count (x, y, z) < n) → (g-decipher1n (gcode (x), gcode (y), gcode (z), n) = decipher1 (x, y, z))

Event: Enable g-decipher1; name this event ‘g1394’.

Event: Enable g-decipher1n; name this event ‘g1395’.

Event: Enable g-decipher1-defn; name this event ‘g1396’.

Theorem: num-treep-gcode num-treep (gcode (x))

Definition: g-deciphern (x, n) = g-decipher1n (x, pr-sub1n (x), pr-sub1n (x), n)

;;;;;;;Correspondence proofs for INV-CODE.

Definition: g-inv-coden (x, n) = if btmp (x) ∨ (n ≃ 0) then btm

else pr-ifn (pr-listpn (x),

pr-ifn (pr-equaln (pr-carn (x), 1),

g-consn (g-inv-coden (pr-carn (pr-cdrn (x)),

n − 1), g-inv-coden (pr-cdrn (pr-cdrn (x)), n − 1)),

pr-ifn (pr-equaln (pr-carn (x), 2),

g-f-notn (g-inv-coden (pr-carn (pr-cdrn (x)),

n − 1)),

pr-ifn (pr-equaln (pr-carn (x), 3),

g-f-orn (g-inv-coden (pr-carn (pr-cdrn (x)),

n − 1), g-inv-coden (pr-cdrn (pr-cdrn (x)), n − 1)),

pr-ifn (pr-equaln (pr-carn (x), 4),

g-forsomen (g-inv-coden (pr-carn (pr-cdrn (x)),

n − 1), g-inv-coden (pr-cdrn (pr-cdrn (x)), n − 1)),

pr-ifn (pr-equaln (pr-carn (x),

5),

gcode (t), pr-ifn (pr-equaln (pr-carn (x),

6),

gcode (f),

gcode (nil))))))),

g-fixn (x)) endif

Event: Disable g-inv-code; name this event ‘g1398’.

Event: Disable g-inv-code-defn; name this event ‘g1399’.

Definition: g-inv-code-ind (x, va, n) = if n ≃ 0 then t

else g-inv-code-ind (pr-car (pr-cdr (0)), ev (1, list (x), va, fa, n), n − 1) ∧ g-inv-code-ind (pr-cdr (pr-cdr (0)),

ev (1, list (x), va, fa, n), n − 1) endif

Theorem: g-inv-code-eval ev (0, g-inv-code (x), va, fa, n) = g-inv-coden (ev (0, x, va, fa, n), n)

Theorem: pr-carn-reduc1 (x ∈ N) → (pr-carn (x) = 0)

Theorem: pr-carn-reduc2 pr-carn (cons (x, y)) = x

Theorem: pr-cdrn-reduc1 (x ∈ N) → (pr-cdrn (x) = 0)

Theorem: pr-cdrn-reduc pr-cdrn (cons (x, y)) = y

Theorem: pr-listp-reduc1 (x ∈ N) → (pr-listpn (x) = bool-fix (f))

Theorem: pr-listp-reduc2 pr-listpn (cons (x, y)) = bool-fix (t)

Definition: inv-code (x) = if listp (x)

then if car (x) = 1 then cons (inv-code (cadr (x)), inv-code (cddr (x))) elseif car (x) = 2 then f-not (inv-code (cadr (x))) elseif car (x) = 3 then f-or (inv-code (cadr (x)), inv-code (cddr (x))) elseif car (x) = 4 then forsome (inv-code (cadr (x)), inv-code (cddr (x))) elseif car (x) = 5 then t elseif car (x) = 6 then f else nil endif

else fix (x) endif

Definition: inv-coden-ind (x, n) = if n ≃ 0 then t

elseif listp (x) then if car (x) = 1

then inv-coden-ind (cadr (x), n − 1)

∧ inv-coden-ind (cddr (x), n − 1) elseif car (x) = 2 then inv-coden-ind (cadr (x), n − 1) elseif car (x) = 3 then inv-coden-ind (cadr (x), n − 1)

∧ inv-coden-ind (cddr (x), n − 1) elseif car (x) = 4 then inv-coden-ind (cadr (x), n − 1)

∧ inv-coden-ind (cddr (x), n − 1) else t endif

else t endif

Event: Disable g-fixn; name this event ‘g1400’.

Theorem: g-fixn-reduc (x ∈ N) → (g-fixn (x) = gcode (x))

Event: Enable g-fixn; name this event ‘g1401’.

Event: Disable pr-equaln; name this event ‘g1402’.

Theorem: pr-equaln-reduc2 ((¬ btmp (x)) ∧ (¬ btmp (y))) → (pr-equaln (x, y) = bool-fix (ncode-equal (x, y)))

Event: Enable pr-equaln; name this event ‘g1403’.

Event: Disable g-consn; name this event ‘g1404’.

Event: Disable g-f-notn; name this event ‘g1405’.

Event: Disable g-f-orn; name this event ‘g1406’.

Event: Disable g-forsomen; name this event ‘g1407’.

Theorem: g-consn-numberp ((x ∈ N) ∧ (y ∈ N)) → (g-consn (x, y) = gcode (cons (x, y)))

Theorem: g-f-notn-numberp (x ∈ N) → (g-f-notn (x) = gcode (f-not (x)))

Theorem: g-f-orn-numberp ((x ∈ N) ∧ (y ∈ N)) → (g-f-orn (x, y) = gcode (f-or (x, y)))

Theorem: g-forsomen-numberp ((x ∈ N) ∧ (y ∈ N)) → (g-forsomen (x, y) = gcode (forsome (x, y)))

Event: Enable g-consn; name this event ‘g1408’.

Event: Enable g-f-notn; name this event ‘g1409’.

Event: Enable g-f-orn; name this event ‘g1410’.

Theorem: pr-equaln-reduc3 (num-treep (x) ∧ num-treep (y)) → (pr-equaln (x, y) = bool-fix (ncode-equal (x, y)))

Theorem: g-forsomen-numberp2 (x ∈ N) → (g-forsomen (x, gcode (y)) = gcode (forsome (x, y)))

Event: Enable g-forsomen; name this event ‘g1411’.

Theorem: g-inv-coden-gcode (num-treep (x) ∧ (exp-count (x) < n)) → (g-inv-coden (x, n) = gcode (inv-code (x)))

Theorem: inv-code-gcode gcode (inv-code (gcode (x))) = gcode (x)

Event: Enable g-inv-code; name this event ‘g1412’.

Event: Enable g-inv-coden; name this event ‘g1413’.

Event: Enable g-inv-code-defn; name this event ‘g1414’.

;;;;;;;Correspondence proofs for the "theorem-checker".  There is no Lisp function
;;;;;;;ISTHM (pronounced "is theorem") because it would have to search upwards
;;;;;;;along the enumeration of proofs given by (NUMCODE (GCODE PF)), until it found a
;;;;;;;a proof or a disproof of EXP.  This search might not terminate.
;;;;;;;The function G-ISTHMN however has a stack-counter N which is decremented with
;;;;;;;each recursive call, and hence does terminate.

Definition: g-isthmn (pfn, exp, given, defns, symbols, n) = if btmp (pfn)

∨ btmp (exp) ∨ btmp (given) ∨ btmp (defns) ∨ btmp (symbols) ∨ (n ≃ 0) then btm

else pr-ifn (g-provesn (g-inv-coden (g-deciphern (pfn, n − 1), n − 1), exp, given, defns, symbols, n − 1),

bool-fix (t),

pr-ifn (g-provesn (g-inv-coden (g-deciphern (pfn, n − 1),

n − 1),

g-f-notn (exp), given, defns, symbols, n − 1),

bool-fix (f),

g-isthmn (pr-add1n (pfn), exp, given, defns, symbols, n − 1))) endif

Event: Disable g-isthm; name this event ‘g1415’.

Event: Disable g-isthm-defn; name this event ‘g1416’.

Definition: g-thm-ind (pfn, exp, given, defns, symbols, va, n) = if n ≃ 0 then t

else g-thm-ind (pr-add1 (0),

                 1,
                 2,
                 3,
                 4,

ev (1, list (pfn, exp, given, defns, symbols), va, fa, n), n − 1) endif

Theorem: g-isthm-eval ev (0, g-isthm (pfn, exp, given, defns, symbols), va, fa, n) = g-isthmn (ev (0, pfn, va, fa, n),

ev (0, exp, va, fa, n), ev (0, given, va, fa, n), ev (0, defns, va, fa, n), ev (0, symbols, va, fa, n), n)

;;;;;;;Analogous to G-ISTHMN, we can define G-FIND-PROOFN which locates the number of the
;;;;;;;proof/disproof at which G-ISTHMN terminated.

Definition: g-find-proofn (pfn, exp, given, defns, symbols, n) = if btmp (pfn)

∨ btmp (exp) ∨ btmp (given) ∨ btmp (defns) ∨ btmp (symbols) ∨ (n ≃ 0) then btm

else pr-ifn (g-provesn (g-inv-coden (g-deciphern (pfn, n − 1), n − 1), exp, given, defns, symbols, n − 1),

pfn,

pr-ifn (g-provesn (g-inv-coden (g-deciphern (pfn, n − 1),

n − 1),

g-f-notn (exp), given, defns, symbols, n − 1),

pfn, g-find-proofn (pr-add1n (pfn),

exp,

given,

defns,

symbols,

n − 1))) endif

;;;;;;;DECIPHER is defined in terms of DECIPHER1.

Definition: decipher (x) = decipher1 (x, x − 1, x − 1)

Definition: find-proofn (pfn, exp, given, defns, symbols, n) = if btmp (exp)

∨ btmp (given) ∨ btmp (defns) ∨ btmp (symbols) ∨ (n ≃ 0) then btm

else pr-ifn (g-provesn (g-inv-coden (g-deciphern (gcode (pfn), n − 1),

n − 1),

exp, given, defns, symbols, n − 1),

pfn, pr-ifn (g-provesn (g-inv-coden (g-deciphern (gcode (pfn),

n − 1),

n − 1),

g-f-notn (exp), given, defns, symbols, n − 1),

pfn, find-proofn (1 + pfn,

exp, given, defns, symbols, n − 1))) endif Definition: find-proof-ind (pfn, n) = if n ≃ 0 then t

else find-proof-ind (1 + pfn, n − 1) endif

Event: Disable pr-ifn; name this event ‘g1417’.

Event: Disable bool-fix; name this event ‘g1418’.

Event: Disable pr-andn; name this event ‘g1419’.

Theorem: pr-andn-t-or-f1 ((¬ btmp (pr-andn (x, y))) ∧ (pr-andn (x, y) ≠ bool-fix (f))) → (pr-andn (x, y) = bool-fix (t))

Theorem: pr-andn-t-or-f2 ((¬ btmp (pr-andn (x, y))) ∧ (pr-andn (x, y) ≠ bool-fix (t))) → (pr-andn (x, y) = bool-fix (f))

Event: Enable pr-andn; name this event ‘g1420’.

Event: Disable g-provesn; name this event ‘g1421’.

;;;;;;;If G-PROVESN terminates, it returns either (BOOL-FIX T) or (BOOL-FIX F).

Theorem: g-provesn-t-or-f1 ((¬ btmp (g-provesn (pf , exp, given, defns, symbols, n))) ∧ (g-provesn (pf , exp, given, defns, symbols, n) ≠ bool-fix (f))) → (g-provesn (pf , exp, given, defns, symbols, n) = bool-fix (t))

Theorem: g-provesn-t-or-f2 ((¬ btmp (g-provesn (pf , exp, given, defns, symbols, n))) ∧ (g-provesn (pf , exp, given, defns, symbols, n) ≠ bool-fix (t))) → (g-provesn (pf , exp, given, defns, symbols, n) = bool-fix (f))

Event: Enable g-provesn; name this event ‘g1422’.

Event: Enable bool-fix; name this event ‘g1423’.

Theorem: g-find-proofn-gcode (¬ btmp (g-isthmn (gcode (pfn), exp, given, defns, symbols, n))) → (g-find-proofn (gcode (pfn), exp, given, defns, symbols, n)

= gcode (find-proofn (pfn, exp, given, defns, symbols, n)))

Event: Enable pr-ifn; name this event ‘g1424’.

;;;;;;;DECIPHER1 always returns a num-tree.

Theorem: num-treep-decipher1 num-treep (decipher1 (x, y, z))

;;;;;;;The lemma below essentially says that G-INV-CODEN returns the GCODE of whatever
;;;;;;;INV-CODE returns.

Theorem: inv-code-decipher ((dec-count (x, x − 1, x − 1) + exp-count (decipher (x))) < n) → (g-inv-coden (g-deciphern (gcode (x), n), n)

= gcode (inv-code (decipher (x))))

Event: Enable g-inv-coden; name this event ‘g1425’.

Event: Enable g-deciphern; name this event ‘g1426’.

Event: Enable inv-code; name this event ‘g1427’.

Event: Enable decipher; name this event ‘g1428’.

;;;;;;;G-FINDN returns the value of stack counter N at the point at which G-ISTHMN located
;;;;;;;a proof/disproof.

Definition: g-findn (pfn, exp, given, defns, symbols, n) = if btmp (pfn)

∨ btmp (exp) ∨ btmp (given) ∨ btmp (defns) ∨ btmp (symbols) ∨ (n ≃ 0) then btm

else pr-ifn (g-provesn (g-inv-coden (g-deciphern (pfn, n − 1), n − 1), exp, given, defns, symbols, n − 1),

n − 1,

pr-ifn (g-provesn (g-inv-coden (g-deciphern (pfn, n − 1),

n − 1),

g-f-notn (exp), given, defns, symbols, n − 1),

n − 1, g-findn (pr-add1n (pfn),

exp, given, defns, symbols, n − 1))) endif

;;;;;;;G-FIND-PROOF returns the GCODE of the proof/disproof.

Definition: g-find-proof (pfn, exp, given, defns, symbols, n) = if btmp (pfn)

∨ btmp (exp) ∨ btmp (given) ∨ btmp (defns) ∨ btmp (symbols) ∨ (n ≃ 0) then btm

else pr-ifn (g-provesn (g-inv-coden (g-deciphern (pfn, n − 1), n − 1), exp, given, defns, symbols, n − 1),

g-inv-coden (g-deciphern (pfn, n − 1), n − 1), pr-ifn (g-provesn (g-inv-coden (g-deciphern (pfn, n − 1),

n − 1),

g-f-notn (exp), given, defns, symbols, n − 1),

g-inv-coden (g-deciphern (pfn, n − 1), n − 1), g-find-proof (pr-add1n (pfn),

exp,

given,

defns,

symbols,

n − 1))) endif Event: Disable pr-ifn; name this event ‘g1429’.

Event: Disable bool-fix; name this event ‘g1430’.

;;;;;;;If G-ISTHMN returns (BOOL-FIX T), then G-FIND-PROOF returns the GCODE of a proof.

Theorem: find-proof-proves-t-case (g-isthmn (pfn, exp, given, defns, symbols, n) = bool-fix (t)) → (g-provesn (g-find-proof (pfn, exp, given, defns, symbols, n),

exp, given, defns, symbols, g-findn (pfn, exp, given, defns, symbols, n))

= bool-fix (t))

;;;;;;;If G-ISTHMN returns (BOOL-FIX F), then G-FIND-PROOF returns the GCODE of a disproof.

Theorem: find-proof-proves-f-case (g-isthmn (pfn, exp, given, defns, symbols, n) = bool-fix (f)) → ((g-provesn (g-find-proof (pfn, exp, given, defns, symbols, n),

exp, given, defns, symbols, g-findn (pfn, exp, given, defns, symbols, n))

= bool-fix (f))

∧ (g-provesn (g-find-proof (pfn, exp, given, defns, symbols, n), g-f-notn (exp), given, defns, symbols, g-findn (pfn, exp, given, defns, symbols, n))

= bool-fix (t)))

;;;;;;;This lemma relates G-FIND-PROOF and G-FIND-PROOFN (which returns the proof number).

Theorem: g-find-proof-gcode (¬ btmp (g-isthmn (pfn, exp, given, defns, symbols, n))) → (g-find-proof (pfn, exp, given, defns, symbols, n)

= g-inv-coden (g-deciphern (g-find-proofn (pfn, exp, given, defns, symbols, n),

g-findn (pfn, exp, given, defns, symbols, n)),

g-findn (pfn, exp, given, defns, symbols, n)))

Event: Enable g-find-proof; name this event ‘g1431’.

Event: Enable g-find-proofn; name this event ‘g1432’.

Event: Enable g-findn; name this event ‘g1433’.

Event: Enable find-proofn; name this event ‘g1434’.

Event: Enable dec-count; name this event ‘g1435’.

Definition: dec-countn (x) = dec-count (x, x − 1, x − 1)

Definition: thm-count (pfn, exp, var, term, flg, given, defns, symbols) = ((dec-countn (pfn) + exp-count (decipher (pfn)))

+ exp-count (inv-code (decipher (pfn)))

+ formula-cnt (subst (exp, var, term, flg), symbols)

+ prf-cnt (inv-code (decipher (pfn)), given, defns, 0, symbols))

;;;;;;;The same lemmas as above with PROVES, INV-CODE, and DECIPHER, instead of
;;;;;;;G-PROVESN, G-INV-CODEN, and G-DECIPHERN.

Theorem: find-proof-proves-t-case-gcode (((1 + thm-count (find-proofn (pfn,

gcode (subst (exp, var, term, flg)), gcode (given), gcode (defns), gcode (symbols), n),

exp, var, term, flg, given, defns, symbols))

< g-findn (gcode (pfn), gcode (subst (exp, var, term, flg)), gcode (given), gcode (defns), gcode (symbols), n))

∧ (g-isthmn (gcode (pfn), gcode (subst (exp, var, term, flg)), gcode (given), gcode (defns), gcode (symbols), n)

= bool-fix (t))) → proves (inv-code (decipher (find-proofn (pfn,

gcode (subst (exp, var, term, flg)), gcode (given), gcode (defns), gcode (symbols), n))),

subst (exp, var, term, flg), given, defns, symbols)

Theorem: find-proof-proves-f-case-case (g-isthmn (pfn, exp, given, defns, symbols, n) = bool-fix (f)) → (g-provesn (g-find-proof (pfn, exp, given, defns, symbols, n),

g-f-notn (exp),

given,

defns,

symbols,

g-findn (pfn, exp, given, defns, symbols, n))

= bool-fix (t))

Theorem: lessp-thm-count1 (exp-count (inv-code (decipher (pfn))) + formula-cnt (subst (exp, var, term, flg), symbols) + prf-cnt (inv-code (decipher (pfn)), given, defns, 0, symbols)) < (1 + thm-count (pfn, exp, var, term, flg, given, defns, symbols))

Event: Enable find-proof-proves-f-case; name this event ‘g1436’.

Event: Enable subst-ident; name this event ‘g1437’.

Theorem: lessp-thm-count2 (dec-countn (pfn) + exp-count (decipher (pfn))) < (1 + thm-count (pfn, exp, var, term, flg, given, defns, symbols))

Theorem: find-proof-proves-f-case-gcode (((1 + thm-count (find-proofn (pfn,

gcode (subst (exp, var, term, 0)), gcode (given), gcode (defns), gcode (symbols), n),

f-not (exp), var, term,

0,

given, defns, symbols))

< g-findn (gcode (pfn), gcode (subst (exp, var, term, 0)), gcode (given), gcode (defns), gcode (symbols), n))

∧ (g-isthmn (gcode (pfn), gcode (subst (exp, var, term, 0)), gcode (given), gcode (defns), gcode (symbols), n)

= bool-fix (f))) → proves (inv-code (decipher (find-proofn (pfn,

gcode (subst (exp, var, term, 0)), gcode (given), gcode (defns), gcode (symbols), n))),

f-not (subst (exp, var, term, 0)), given, defns, symbols)

Event: Enable thm-count; name this event ‘g1438’.

;;;;;;;Now we start constructing the undecidable sentence.

Definition: a-undec1 (flg, exp, fa, val) = forsome (1,

f-and (isin (z-list (list (ncode (val), ncode (flg), ncode (exp), z-opair (6, ncode (gcode (nil))), ncode (fa))),

1), a-ev-defn (1)))

Event: Disable a-ev1; name this event ‘g1439’.

Event: Disable a-ev-defn; name this event ‘g1440’.

Event: Disable a-ev; name this event ‘g1441’.

Theorem: replace-va-a-undec1 subst (a-undec1 (flg, exp, fa, val), 6, ncode (va1 ), 0) = a-ev1 (ncode (flg),

ncode (exp),

z-opair (ncode (va1 ), ncode (gcode (nil))), ncode (fa), ncode (val))

Event: Disable a-ev-defn-part1; name this event ‘g1442’.

Theorem: collect-free-a-undec1 (var ∉ collect-free (term, 0)) → (var ∉ collect-free (subst (a-undec1 (flg, exp, fa, val), 6, term, 0), 0))

Event: Enable a-ev-defn-part1; name this event ‘g1443’.

Event: Enable a-ev-defn; name this event ‘g1444’.

Theorem: formula-a-undec1 all-symbs (symbols) → formula (a-undec1 (flg, exp, fa, val), symbols)

Event: Enable a-ev1; name this event ‘g1445’.

Event: Enable a-ev; name this event ‘g1446’.

Event: Enable bool-fix; name this event ‘g1447’.

Event: Enable g-isthm; name this event ‘g1448’.

Event: Enable g-isthmn; name this event ‘g1449’.

Theorem: numeral-gcode numeral (gcode (x)) = numeral (x)

;;;;;;;Correspondence for GC-NCODE.

Definition: gc-ncoden (x, n) = if btmp (x) ∨ (n ≃ 0) then btm

else pr-ifn (pr-listpn (x),

g-z-opairn (gc-ncoden (pr-carn (x), n − 1),

gc-ncoden (pr-cdrn (x), n − 1)),

g-numeraln (x, n − 1)) endif

Event: Disable gc-ncode; name this event ‘g1450’.

Event: Disable gc-ncode-defn; name this event ‘g1451’.

Definition: gc-ncode-ind (x, va, n) = if n ≃ 0 then t

else gc-ncode-ind (pr-car (0), ev (1, list (x), va, fa, n), n − 1) ∧ gc-ncode-ind (pr-cdr (0), ev (1, list (x), va, fa, n), n − 1) endif

Theorem: gc-ncode-eval ev (0, gc-ncode (x), va, fa, n) = gc-ncoden (ev (0, x, va, fa, n), n)

Event: Disable z-opair; name this event ‘g1452’.

Event: Disable z-sing; name this event ‘g1453’.

Event: Disable z-pair; name this event ‘g1454’.

Theorem: z-pairn-gcode g-z-pairn (gcode (x), gcode (y)) = gcode (z-pair (x, y))

Event: Enable z-pair; name this event ‘g1455’. Event: Enable z-pair; name this event ‘g1456’. Event: Enable g-z-pairn; name this event ‘g1457’. Theorem: z-opairn-gcode g-z-opairn (gcode (x), gcode (y)) = gcode (z-opair (x, y)) Event: Enable z-sing; name this event ‘g1458’. Event: Enable g-z-singn; name this event ‘g1459’. Event: Enable z-opair; name this event ‘g1460’. Event: Enable g-z-opairn; name this event ‘g1461’. Event: Disable g-numeraln; name this event ‘g1462’. Event: Disable ncode; name this event ‘g1463’. Event: Disable z-succ; name this event ‘g1464’. Theorem: g-z-succ-gcode g-z-succn (gcode (x)) = gcode (z-succ (x)) Event: Enable z-succ; name this event ‘g1465’. Event: Enable g-z-succn; name this event ‘g1466’. Event: Disable pr-zeropn; name this event ‘g1467’. Event: Disable pr-sub1n; name this event ‘g1468’. Event: Disable pr-add1n; name this event ‘g1469’. Event: Disable phi; name this event ‘g1470’.

Theorem: g-phin-gcode g-phin = gcode (phi)

Event: Enable phi; name this event ‘g1471’.

Event: Enable g-phin; name this event ‘g1472’.

Theorem: g-numeraln-ncode ((x < n) ∧ (x ∈ N)) → (g-numeraln (x, n) = gcode (ncode (x)))

Definition: ncode-cnt (x) = if listp (x) then 1 + (ncode-cnt (car (x)) + ncode-cnt (cdr (x)))

else 1 + fix (x) endif

Definition: ncode-ind (x, n) = if n ≃ 0 then t

elseif listp (x)

then ncode-ind (car (x), n − 1) ∧ ncode-ind (cdr (x), n − 1)

else t endif

Theorem: gc-ncoden-gcode ((ncode-cnt (x) < n) ∧ num-treep (x)) → (gc-ncoden (x, n) = gcode (ncode (x)))

Event: Enable gc-ncode; name this event ‘g1473’.

Event: Enable gc-ncoden; name this event ‘g1474’.

Event: Enable ncode; name this event ‘g1475’.

Theorem: gc-ncoden-gcode-again (ncode-cnt (gcode (x)) < n) → (gc-ncoden (gcode (x), n) = gcode (ncode (gcode (x))))

Event: Enable gc-ncode-defn; name this event ‘g1476’.

;;;;;;;G-UNDEC (when PFN is 0) is the EV analogue of a the metatheoretic statement,
;;;;;;;"There exists a proof of the result of substituting (NCODE (GCODE EXP)) for the
;;;;;;;variable VAR in EXP (from GIVEN, DEFNS, and SYMBOLS)".

Definition: g-undec (pfn, exp, var, given, defns, symbols) = g-isthm (pfn,

g-subst (exp, var, gc-ncode (exp), pr-quote (gcode (0))), given, defns, symbols)

Definition: g-undecn (pfn, exp, var, given, defns, symbols, n) = g-isthmn (pfn,

g-substn (exp, var, gc-ncoden (exp, n), gcode (0), n), given, defns, symbols, n)

Theorem: g-undec-eval ev (0, g-undec (pfn, exp, var, given, defns, symbols), va, fa, n) = g-undecn (ev (0, pfn, va, fa, n),

ev (0, exp, va, fa, n), ev (0, var, va, fa, n), ev (0, given, va, fa, n), ev (0, defns, va, fa, n), ev (0, symbols, va, fa, n), n)

Event: Enable g-undec; name this event ‘g1477’.

;;;;;;;A-UNDEC is the formula from which the undecidable sentence is constructed.
;;;;;;;It is got from A-EV and asserts that the value of G-UNDEC on a particular
;;;;;;;EXP (represented by a free variable, say "y", in A-UNDEC) with GIVEN, DEFNS,
;;;;;;;and SYMBOLS, is (BOOL-FIX F).  This means that it is asserting, "there is
;;;;;;;no proof of the result of substituting (NCODE (GCODE y)) for the variable "y"
;;;;;;;in y, from GIVEN, DEFNS, and SYMBOLS."   The undecidable sentence will be got
;;;;;;;by substituting the formula the NCODE of the GCODE of A-UNDEC for the free "y"
;;;;;;;in A-UNDEC itself.

Definition: a-undec (given, defns, symbols) = a-undec1 (0,

g-undec (pr-quote (gcode (0)),

                    0,

pr-quote (gcode (6)), pr-quote (gcode (given)), pr-quote (gcode (defns)), pr-quote (gcode (symbols))),

fa, bool-fix (f))

Definition: undec-count (exp, var, term, given, defns, symbols, n) = ((1 + thm-count (find-proofn (0,

gcode (subst (exp, var, term, 0)), gcode (given), gcode (defns), gcode (symbols), n),

f-not (exp), var, term,

0,

given, defns, symbols))

+ (1 + thm-count (find-proofn (0, gcode (subst (exp, var, term, 0)), gcode (given), gcode (defns), gcode (symbols), n),

exp, var, term,

    0,

given, defns, symbols))

+ ncode-cnt (gcode (exp)))

Definition: isthm-a-proves-a-proof (pfn, exp, var, term, given, defns, symbols, n) = inv-code (decipher (find-proofn (pfn,

gcode (subst (exp, var, term, 0)), gcode (given), gcode (defns), gcode (symbols), n)))

Definition: findn-count (pfn, exp, var, term, given, defns, symbols, n) = g-findn (gcode (pfn),

gcode (subst (exp, var, term, 0)), gcode (given), gcode (defns), gcode (symbols), n)

Event: Enable gcode; name this event ‘g1478’.

Event: Enable exp-count; name this event ‘g1479’.

;;;;;;;The lemma below begins the first of four important lemmas.
;;;;;;;The undecidable sentence is of the form;
;;;;;;;(SUBST (A-UNDEC GIVEN DEFNS SYMBOLS)
;;;;;;;       6
;;;;;;;       (NCODE (GCODE (A-UNDEC GIVEN DEFNS SYMBOLS))) 0),
;;;;;;;where DEFNS and SYMBOLS will be instantiated by a specific list of
;;;;;;;definitions and symbols, respectively.  The lemma asserts that if
;;;;;;;G-ISTHMN returns (BOOL-FIX T) on the GCODE of the undecidable sentence,
;;;;;;;then the undecidable sentence is provable.  This makes sense because
;;;;;;;G-ISTHMN returns (BOOL-FIX T) when it has found a proof in the enumeration
;;;;;;;of proofs.

Theorem: isthm-a-proves-a ((undec-count (a-undec (given, defns, symbols),

             6,

ncode (gcode (a-undec (given, defns, symbols))), given, defns, symbols, n)

< findn-count (0, a-undec (given, defns, symbols),

                6,

ncode (gcode (a-undec (given, defns, symbols))), given, defns, symbols, n))

∧ (exp-count (a-undec (given, defns, symbols)) < n) ∧ (g-isthmn (gcode (0), g-substn (gcode (a-undec (given, defns, symbols)),

gcode (6), gcode (ncode (gcode (a-undec (given, defns, symbols)))), gcode (0), n),

gcode (given), gcode (defns), gcode (symbols), n)

= bool-fix (t))) → proves (isthm-a-proves-a-proof (0,

a-undec (given, defns, symbols),

6,

ncode (gcode (a-undec (given, defns, symbols))), given, defns, symbols, n),

subst (a-undec (given, defns, symbols),

6,

ncode (gcode (a-undec (given, defns, symbols))), 0),

given, defns, symbols)

;;;;;;;Similarly, if G-ISTHMN returns (BOOL-FIX F), it means that it found a disproof of
;;;;;;;the undecidable sentence, and its negation is therefore provable.

Theorem: not-isthm-a-proves-not-a ((undec-count (a-undec (given, defns, symbols),

6,

ncode (gcode (a-undec (given, defns, symbols))), given, defns, symbols, n)

< findn-count (0, a-undec (given, defns, symbols),

6,

ncode (gcode (a-undec (given, defns, symbols))), given, defns, symbols,

n))

∧ (exp-count (a-undec (given, defns, symbols)) < n) ∧ (g-isthmn (gcode (0),

g-substn (gcode (a-undec (given, defns, symbols)), gcode (6), gcode (ncode (gcode (a-undec (given, defns, symbols)))), gcode (0), n),

gcode (given), gcode (defns), gcode (symbols), n)

= bool-fix (f))) → proves (isthm-a-proves-a-proof (0,

a-undec (given, defns, symbols),

6,

ncode (gcode (a-undec (given, defns, symbols))), given, defns, symbols, n),

f-not (subst (a-undec (given, defns, symbols),

6,

ncode (gcode (a-undec (given, defns, symbols))), 0)),

given, defns, symbols)

Event: Enable isthm-a-proves-a-proof; name this event ‘g1480’.

Event: Enable a-ev1-not-good-proof; name this event ‘g1481’.

Definition: isthm-a-proves-not-a-proof (given, defns, symbols, n) = a-ev1-not-good-proof (0,

g-undec (pr-quote (gcode (0)),

0,

pr-quote (gcode (6)), pr-quote (gcode (given)), pr-quote (gcode (defns)), pr-quote (gcode (symbols))),

cons (gcode (a-undec (given, defns, symbols)),

gcode (nil)), fa, n, bool-fix (f))

;;;;;;;The more surprising pair of facts are that if G-ISTHMN returns (BOOL-FIX T)
;;;;;;;the GCODE of the undecidable sentence, then the negation of the undecidable
;;;;;;;sentence is provable.  This is because the undecidable sentence through the
;;;;;;;fact that it represents some instance of the Lisp interpreter asserts that G-ISTHMN
;;;;;;;returns (BOOL-FIX F) on the undecidable sentence itself, which in this case is false.

Theorem: isthm-a-proves-not-a-proof-proves (ev-hyps (given, defns, symbols) ∧ (ncode-cnt (gcode (a-undec (given, defns, symbols))) < n) ∧ (exp-count (a-undec (given, defns, symbols)) < n) ∧ (g-isthmn (gcode (0),

gcode (subst (a-undec (given, defns, symbols),

                         6,

ncode (gcode (a-undec (given, defns, symbols))), 0)),

gcode (given), gcode (defns), gcode (symbols), n)

= bool-fix (t)) ∧ (concl = f-not (subst (a-undec (given, defns, symbols),

                       6,

ncode (gcode (a-undec (given, defns, symbols))), 0))))

→ proves (isthm-a-proves-not-a-proof (given, defns, symbols, n), concl, given, defns, symbols)

Event: Enable isthm-a-proves-not-a-proof; name this event ‘g1482’.

Definition: not-isthm-a-proves-a-proof (given, defns, symbols, n) = a-ev1-ok-proof (0,

g-undec (pr-quote (gcode (0)),

                        0,

pr-quote (gcode (6)), pr-quote (gcode (given)), pr-quote (gcode (defns)), pr-quote (gcode (symbols))),

cons (gcode (a-undec (given, defns, symbols)), gcode (nil)), fa, n)

;;;;;;;If G-ISTHMN returns (BOOL-FIX F) on the the GCODE of the undecidable sentence,
;;;;;;;then the undecidable sentence is provable.  This is because the undecidable
;;;;;;;sentence through the fact that it represents some instance of the Lisp interpreter
;;;;;;;asserts that G-ISTHMN does return (BOOL-FIX F) on the undecidable sentence itself.

Theorem: not-isthm-a-proves-a-proof-proves (ev-hyps (given, defns, symbols) ∧ (ncode-cnt (gcode (a-undec (given, defns, symbols))) < n) ∧ (exp-count (a-undec (given, defns, symbols)) < n) ∧ (g-isthmn (gcode (0),

gcode (subst (a-undec (given, defns, symbols),

                         6,

ncode (gcode (a-undec (given, defns, symbols))), 0)),

gcode (given), gcode (defns), gcode (symbols), n)

= bool-fix (f)) ∧ (concl = subst (a-undec (given, defns, symbols),

                  6,

ncode (gcode (a-undec (given, defns, symbols))), 0)))

→ proves (not-isthm-a-proves-a-proof (given, defns, symbols, n), concl, given, defns, symbols)

;;;;;;;Now we need to prove that if Z2 is complete, then G-ISTHMN returns either (BOOL-FIX T)
;;;;;;;or (BOOL-FIX F).  Then by the above four lemmas, we have that the undecidable sentence
;;;;;;;is both provable and disprovable.  Therefore, we would have established that Z2 is
;;;;;;;either incomplete or inconsistent.

Event: Enable isthm-a-proves-not-a-proof; name this event ‘g1483’.

Definition: thm-count1 (pfn, exp, given, defns, symbols)

= ((dec-countn (pfn) + exp-count (decipher (pfn))) + exp-count (inv-code (decipher (pfn))) + formula-cnt (exp, symbols) + prf-cnt (inv-code (decipher (pfn)), given, defns, 0, symbols))

Theorem: thm-count1-lessp (dec-count (pfn, pfn − 1, pfn − 1) + exp-count (decipher (pfn))) < (1 + thm-count1 (pfn, exp, given, defns, symbols))

Theorem: thm-count1-lessp1 (exp-count (inv-code (decipher (pfn))) + formula-cnt (exp, symbols) + prf-cnt (inv-code (decipher (pfn)), given, defns, 0, symbols)) < (1 + thm-count1 (pfn, exp, given, defns, symbols))

Event: Enable thm-count1; name this event ‘g1484’.

Definition: comp-count (pf , pfn, exp, given, defns, symbols, extras) = if pf ≤ pfn

then (1 + thm-count1 (pfn, exp, given, defns, symbols))

+ (1 + thm-count1 (pfn, f-not (exp), given, defns, symbols)) + (1 + extras)

elseif proves (inv-code (decipher (pfn)), exp, given, defns, symbols)

then (1 + thm-count1 (pfn, exp, given, defns, symbols))

+ (1 + thm-count1 (pfn, f-not (exp), given, defns, symbols)) + (1 + extras)

elseif proves (inv-code (decipher (pfn)), f-not (exp), given, defns, symbols) then (1 + thm-count1 (pfn, exp, given, defns, symbols))

+ (1 + thm-count1 (pfn, f-not (exp), given, defns, symbols)) + (1 + extras)

else (1 + thm-count1 (pfn, exp, given, defns, symbols))

+ (1 + thm-count1 (pfn, f-not (exp), given, defns, symbols)) + (1 + extras) + (1 + comp-count (pf ,

1 + pfn, exp, given, defns, symbols, extras)) endif

Definition: proves-isthmn-ind (pf , pfn, exp, given, defns, symbols, n)

= if n ≃ 0 then t elseif pf ≤ pfn then t elseif proves (inv-code (decipher (pfn)), exp, given, defns, symbols) then t elseif proves (inv-code (decipher (pfn)), f-not (exp), given, defns, symbols) then t else proves-isthmn-ind (pf , 1 + pfn, exp, given, defns, symbols, n − 1) endif

Event: Disable g-isthmn; name this event ‘g1485’.

Theorem: lessp-comp-count1 thm-count1 (pfn, exp, given, defns, symbols) < comp-count (pf , pfn, exp, given, defns, symbols, extras)

Theorem: lessp-comp-count2 thm-count1 (pfn, f-not (exp), given, defns, symbols) < comp-count (pf , pfn, exp, given, defns, symbols, extras)

Theorem: lessp-extras-comp-count extras < comp-count (pf , pfn, exp, given, defns, symbols, extras)

Event: Enable find-proof-proves-f-case-gcode; name this event ‘g1486’.

Event: Enable find-proof-proves-t-case-gcode; name this event ‘g1487’.

Event: Enable g-provesn-t-or-f1; name this event ‘g1488’.

Event: Enable g-provesn-t-or-f2; name this event ‘g1489’.

Event: Enable pr-ifn; name this event ‘g1490’.

;;;;;;;The lemma below is the crucial one in the final proof of the incompleteness theorem.
;;;;;;;It asserts that if there is a number PF which corresponds to a proof or disproof of EXP,
;;;;;;;then G-ISTHMN (with a large enough stack-counter) when started on a proof-number PFN
;;;;;;;less than or equal to PF, will either find PF or some proof/disproof before it, and
;;;;;;;will therefore either return (BOOL-FIX T) or (BOOL-FIX F).  This with the four lemmas
;;;;;;;above provides enough material to prove the incompleteness theorem, but we still need
;;;;;;;to build up a large enough stack-counter to cover all these five lemmas.

Theorem: proves-t-not-btmp-isthmn ((pfn ∈ N) ∧ (pf ∈ N) ∧ (proves (inv-code (decipher (pf )), exp, given, defns, symbols)

∨ proves (inv-code (decipher (pf )), f-not (exp), given, defns, symbols)) ∧ (pfn ≤ pf ) ∧ (comp-count (pf , pfn, exp, given, defns, symbols, extras) < n)) → ((g-isthmn (gcode (pfn),

gcode (exp), gcode (given), gcode (defns), gcode (symbols), n)

= bool-fix (t)) ∨ (g-isthmn (gcode (pfn),

gcode (exp), gcode (given), gcode (defns), gcode (symbols), n)

= bool-fix (f)))

Event: Enable proves-t-not-btmp-isthmn; name this event ‘g1491’.

Event: Disable find-proofn; name this event ‘g1492’.

Definition: findn (pfn, exp, given, defns, symbols, n) = if btmp (exp)

∨ btmp (given) ∨ btmp (defns) ∨ btmp (symbols) ∨ (n ≃ 0) then btm

else pr-ifn (g-provesn (g-inv-coden (g-deciphern (gcode (pfn), n − 1),

n − 1),

exp, given, defns, symbols, n − 1),

n − 1, pr-ifn (g-provesn (g-inv-coden (g-deciphern (gcode (pfn),

n − 1),

n − 1),

g-f-notn (exp), given, defns, symbols, n − 1),

n − 1,

findn (1 + pfn, exp, given, defns, symbols, n − 1))) endif

Event: Enable pr-ifn; name this event ‘g1493’.

Theorem: lessp-comp-count3 (thm-count1 (pfn, f-not (exp), given, defns, symbols) + thm-count1 (pfn, exp, given, defns, symbols) + extras) < comp-count (pf , pfn, exp, given, defns, symbols, extras)

Theorem: findn-thm-count-lessp ((pfn ∈ N) ∧ (pf ∈ N) ∧ (proves (inv-code (decipher (pf )), exp, given, defns, symbols)

∨ proves (inv-code (decipher (pf )), f-not (exp), given, defns, symbols)) ∧ (pfn ≤ pf ) ∧ ((1 + (1 + comp-count (pf , pfn, exp, given, defns, symbols, extras))) < n)) → (((1 + thm-count1 (find-proofn (pfn,

gcode (exp), gcode (given), gcode (defns), gcode (symbols), n),

f-not (exp), given, defns, symbols))

+ (1 + thm-count1 (find-proofn (pfn, gcode (exp), gcode (given), gcode (defns), gcode (symbols), n),

exp, given, defns, symbols))

+ extras) < findn (pfn,

gcode (exp), gcode (given), gcode (defns), gcode (symbols), n))

Event: Disable g-findn; name this event ‘g1494’.

Theorem: findn-g-findn g-findn (gcode (pfn), exp, given, defns, symbols, n) = findn (pfn, exp, given, defns, symbols, n)

Event: Enable g-findn; name this event ‘g1495’.

Event: Disable thm-count; name this event ‘g1496’.

Event: Disable thm-count1; name this event ‘g1497’.

Theorem: thm-count-thm-count1 thm-count (pfn, exp, var, term, flg, given, defns, symbols) = thm-count1 (pfn, subst (exp, var, term, flg), given, defns, symbols)

Event: Enable thm-count; name this event ‘g1498’.

Event: Enable thm-count1; name this event ‘g1499’.

Event: Disable decipher; name this event ‘g1500’.

Theorem: num-treep-num-treep numtreep (x) = num-treep (x)

Theorem: inv-code-decipher-numcode gcode (inv-code (decipher (numcode (gcode (x))))) = gcode (x)

Event: Enable decipher; name this event ‘g1501’.

Event: Disable bool-fix; name this event ‘g1502’.

Theorem: proves-inv-code-decipher proves (inv-code (decipher (numcode (gcode (pf )))), exp, given, defns, symbols) = proves (pf , exp, given, defns, symbols)

Event: Enable findn; name this event ‘g1503’.

Event: Enable bool-fix; name this event ‘g1504’.

;;;;;;;The undecidable sentence - DEFNS and SYMBOLS will have to be instantiated, but
;;;;;;;GIVEN will be left as a parameter so that for any specific GIVEN, we get a specific
;;;;;;;undecidable sentence.  This would show that the addition of the undecidable sentence
;;;;;;;or any finite list of new axioms will still leave the theory incomplete or inconsistent.

Definition: undec-sent (given, defns, symbols) = subst (a-undec (given, defns, symbols),

         6,

ncode (gcode (a-undec (given, defns, symbols))),

         0)

Definition: final-count (pf , given, defns, symbols) = (1 + ((1 + (1 + comp-count (numcode (gcode (pf )),

                            0,

undec-sent (given, defns, symbols), given, defns, symbols, ncode-cnt (gcode (a-undec (given,

defns,

symbols))))))

+ (1 + ncode-cnt (gcode (a-undec (given, defns, symbols)))) + (1 + exp-count (a-undec (given, defns, symbols)))))

Event: Enable ncode-cnt; name this event ‘g1505’.

Event: Enable proves-is-formula-again; name this event ‘g1506’.

Event: Enable comp-count; name this event ‘g1507’.

Event: Enable numcode; name this event ‘g1508’.

Event: Enable exp-count; name this event ‘g1509’.

Event: Enable findn-thm-count-lessp; name this event ‘g1510’.

Theorem: undec-count-lessp ((pf ∈ N) ∧ (proves (inv-code (decipher (pf )),

subst (exp, var, term, 0), given, defns, symbols)

∨ proves (inv-code (decipher (pf )), f-not (subst (exp, var, term, 0)), given, defns, symbols))

∧ ((1 + (1 + comp-count (pf ,

0,

subst (exp, var, term, 0), given, defns, symbols, ncode-cnt (gcode (exp)))))

< n)) → (undec-count (exp, var, term, given, defns, symbols, n)

< findn (0, gcode (subst (exp, var, term, 0)), gcode (given), gcode (defns), gcode (symbols), n))

Event: Enable undec-count; name this event ‘g1511’.

Event: Enable not-isthm-a-proves-a-proof; name this event ‘g1512’.

Theorem: comp-count-final-count-lessp (1 + (1 + comp-count (numcode (gcode (pf )),

0,

subst (a-undec (given, defns, symbols),

 6,

ncode (gcode (a-undec (given, defns, symbols))), 0),

given, defns, symbols, ncode-cnt (gcode (a-undec (given, defns, symbols))))))

< final-count (pf , given, defns, symbols)

Theorem: lessp-ncode-cnt-final-count ncode-cnt (gcode (a-undec (given, defns, symbols))) < final-count (pf , given, defns, symbols)

Theorem: lessp-exp-count-final-count exp-count (a-undec (given, defns, symbols)) < final-count (pf , given, defns, symbols)

Theorem: lessp-num-final-count 4 < final-count (pf , given, defns, symbols)

;;;;;;;The final list of symbols, THM-SYMBS.

Definition: thm-symbs = list (fn (16, 1),

fn (15, 2), fn (14, 2), fn (13, 2), fn (12, 2), fn (11, 2), fn (10, 1), fn (9, 1), fn (8, 1), fn (7, 1), fn (6, 1), fn (5, 1), fn (4, 1), fn (3, 1), p (2, 1), fn (2, 2), fn (1, 2), p (1, 2), fn (0, 0))

;;;;;;;The final list of function/predicate definitions.

Definition: thm-defns = list (cons (p (2, 1), z-int-defn (0, 1, 2)),

cons (fn (3, 1), f-equal (z-succ (0), z-union (z-sing (0), 0))), cons (fn (4, 1), z-car-defn (0, z-car (0), 1, 2)), cons (fn (5, 1), z-cdr-defn (0, z-cdr (0), 1, 2)), cons (fn (6, 1), z-listp-defn (0, z-listp (0), 1, 2)), cons (fn (7, 1), z-add1-defn (0, z-add1 (0), 1, 2)), cons (fn (8, 1), z-numberp-defn (0, z-numberp (0))), cons (fn (9, 1), z-zerop-defn (0, z-zerop (0))), cons (fn (10, 1), z-sub1-defn (0, z-sub1 (0), 3)), cons (fn (11, 2), z-equal-defn (0, 1, z-equal (0, 1))), cons (fn (12, 2), z-cons-defn (0, 1, z-cons (0, 1))), cons (fn (13, 2), z-apply-subr1-defn (0, 1, z-apply-subr1 (0, 1))), cons (fn (14, 2), z-apply-subr2-defn (0, 1, z-apply-subr2 (0, 1))), cons (fn (15, 2), z-apply-subr-defn (0, 1, z-apply-subr (0, 1))), cons (fn (16, 1), z-subrp-defn (0, z-subrp (0))))

Event: Disable z-subrp-hyps; name this event ‘g1549’. Event: Disable z-apply-subr-hyps; name this event ‘g1550’. Event: Disable z-apply-subr1-hyps; name this event ‘g1551’. Event: Disable z-apply-subr2-hyps; name this event ‘g1552’. Event: Disable z-succ-hyps; name this event ‘g1553’. Event: Disable z-int-hyps; name this event ‘g1554’. Event: Disable z-car-hyps; name this event ‘g1555’. Event: Disable z-cdr-hyps; name this event ‘g1556’. Event: Disable z-listp-hyps; name this event ‘g1557’. Event: Disable z-cons-hyps; name this event ‘g1558’. Event: Disable z-add1-hyps; name this event ‘g1559’. Event: Disable z-sub1-hyps; name this event ‘g1560’. Event: Disable z-equal-hyps; name this event ‘g1561’.

Event: Disable z-numberp-hyps; name this event ‘g1562’.

Event: Disable rest-of; name this event ‘g1563’.

Event: Enable eql-gcode-equal; name this event ‘g1564’.

Theorem: ev-hyps-z-int z-int-hyps (thm-defns, thm-symbs)

Theorem: ev-hyps-z-succ z-succ-hyps (thm-defns, thm-symbs)

Theorem: ev-hyps-z-car z-car-hyps (thm-defns, thm-symbs)

Theorem: ev-hyps-z-cdr z-cdr-hyps (thm-defns, thm-symbs)

Theorem: z-listp-ev-hyps z-listp-hyps (thm-defns, thm-symbs)

Theorem: z-cons-ev-hyps z-cons-hyps (thm-defns, thm-symbs)

Theorem: z-numberp-ev-hyps z-numberp-hyps (thm-defns, thm-symbs)

Theorem: z-equal-ev-hyps z-equal-hyps (thm-defns, thm-symbs)

Theorem: z-add1-ev-hyps z-add1-hyps (thm-defns, thm-symbs)

Theorem: z-sub1-ev-hyps z-sub1-hyps (thm-defns, thm-symbs)

Event: Enable subset-cons; name this event ‘g1565’.

Event: Enable prime-member; name this event ‘g1566’.

Event: Enable member-delete; name this event ‘g1567’.

Theorem: z-apply-subr1-ev-hyps z-apply-subr1-hyps (thm-defns, thm-symbs)

Theorem: z-apply-subr2-ev-hyps z-apply-subr2-hyps (thm-defns, thm-symbs) Theorem: z-apply-subr-ev-hyps z-apply-subr-hyps (thm-defns, thm-symbs) Theorem: z-subrp-ev-hyps z-subrp-hyps (thm-defns, thm-symbs) Event: Enable z-subrp-hyps; name this event ‘g1568’. Event: Enable z-apply-subr-hyps; name this event ‘g1569’. Event: Enable z-apply-subr1-hyps; name this event ‘g1570’. Event: Enable z-apply-subr2-hyps; name this event ‘g1571’. Event: Enable z-succ-hyps; name this event ‘g1572’. Event: Enable z-int-hyps; name this event ‘g1573’. Event: Enable z-car-hyps; name this event ‘g1574’. Event: Enable z-cdr-hyps; name this event ‘g1575’. Event: Enable z-listp-hyps; name this event ‘g1576’. Event: Enable z-cons-hyps; name this event ‘g1577’. Event: Enable z-add1-hyps; name this event ‘g1578’. Event: Enable z-sub1-hyps; name this event ‘g1579’. Event: Enable z-equal-hyps; name this event ‘g1580’. Event: Enable z-numberp-hyps; name this event ‘g1581’. Theorem: subset-thm-symbs subset (list (fn (16, 1),

fn (15, 2), fn (14, 2), fn (13, 2), fn (12, 2), fn (0, 0), fn (3, 1), fn (4, 1), fn (5, 1), fn (6, 1), fn (7, 1), fn (8, 1), fn (9, 1), fn (10, 1), fn (11, 2), fn (1, 2), fn (2, 2), p (2, 1), p (1, 2)),

thm-symbs)

Event: Disable z-zerop-hyps; name this event ‘g1585’.

Theorem: z-zerop-ev-hyps z-zerop-hyps (thm-defns, thm-symbs)

Event: Enable rest-of; name this event ‘g1586’.

Event: Enable thm-defns; name this event ‘g1587’.

Theorem: all-symbs-thm-symbs all-symbs (thm-symbs)

Event: Enable thm-symbs; name this event ‘g1589’.

Theorem: ev-hyps-thm-defns-symbols ev-hyps (given, thm-defns, thm-symbs)

Theorem: all-symbs-termp-ncode all-symbs (symbs) → termp (ncode (x), 0, symbs)

Event: Enable all-symbs; name this event ‘g1591’.

Theorem: formula-undec-sent all-symbs (symbs) → formula (undec-sent (given, defns, symbs), symbs)

;;;;;;;The lemma below is very nearly the final one.  It asserts that if PF is either
;;;;;;;a proof or disproof of the undecidable sentence, then in one of two possible ways
;;;;;;;(as given by the four lemmas above), the undecidable sentence is both provable and
;;;;;;;disprovable.  The observation is that if Z2 was complete, the undecidable sentence
;;;;;;;would either be a provable or disprovable.  PF below could be instantiated with
;;;;;;;the given proof/disproof, yielding the conclusion of the lemma that Z2 is then
;;;;;;;inconsistent.  We still need to show that the undecidable sentence below is a
;;;;;;;Z2 formula and that it contains no free variables.  This is done next.

Theorem: incompleteness-main-part (proves (pf , undec-sent (given, thm-defns, thm-symbs), given, thm-defns, thm-symbs) ∨ proves (pf ,

f-not (undec-sent (given, thm-defns, thm-symbs)), given, thm-defns, thm-symbs))

→ ((proves (isthm-a-proves-a-proof (0, a-undec (given, thm-defns, thm-symbs),

                                6,

ncode (gcode (a-undec (given, thm-defns, thm-symbs))),

given,

thm-defns, thm-symbs, final-count (pf ,

given,

thm-defns, thm-symbs)),

undec-sent (given, thm-defns, thm-symbs), given, thm-defns, thm-symbs)

∧ proves (isthm-a-proves-not-a-proof (given, thm-defns, thm-symbs, final-count (pf ,

given,

thm-defns, thm-symbs)),

f-not (undec-sent (given, thm-defns, thm-symbs)), given, thm-defns, thm-symbs))

∨ (proves (not-isthm-a-proves-a-proof (given, thm-defns, thm-symbs, final-count (pf ,

given,

thm-defns, thm-symbs)),

undec-sent (given, thm-defns, thm-symbs), given, thm-defns, thm-symbs)

∧ proves (isthm-a-proves-a-proof (0,

a-undec (given, thm-defns, thm-symbs),

6,

ncode (gcode (a-undec (given, thm-defns, thm-symbs))),

given, thm-defns, thm-symbs, final-count (pf ,

given,

thm-defns, thm-symbs)),

f-not (undec-sent (given, thm-defns, thm-symbs)), given, thm-defns, thm-symbs)))

Theorem: collect-free-undec-sent var ∉ collect-free (undec-sent (given, defns, symbs), 0)

Event: Enable undec-sent; name this event ‘g1593’.

;;;;;;;The undecidable sentence: UNDEC-SENT with DEFNS and SYMBOLS instantiated.o

Definition: undecidable-sentence (given) = undec-sent (given, thm-defns, thm-symbs)

Definition: some-proof1 (given, pf ) = isthm-a-proves-a-proof (0,

a-undec (given, thm-defns, thm-symbs),

                       6,

ncode (gcode (a-undec (given, thm-defns, thm-symbs))), given, thm-defns, thm-symbs, final-count (pf , given, thm-defns, thm-symbs))

Definition: some-disproof1 (given, pf ) = isthm-a-proves-not-a-proof (given,

thm-defns, thm-symbs, final-count (pf , given, thm-defns, thm-symbs))

Definition: some-proof2 (given, pf ) = not-isthm-a-proves-a-proof (given,

thm-defns, thm-symbs, final-count (pf , given, thm-defns, thm-symbs))

Definition: some-disproof2 (given, pf ) = isthm-a-proves-a-proof (0,

a-undec (given, thm-defns, thm-symbs),

                       6,

ncode (gcode (a-undec (given, thm-defns, thm-symbs))), given, thm-defns, thm-symbs, final-count (pf , given, thm-defns, thm-symbs))

;;;;;;;The final statement of the incompleteness theorem: [1] The undecidable sentence
;;;;;;;is a Z2 formula in a theory whose symbols are from (THM-SYMBS),
;;;;;;;[2] the undecidable sentence is a sentence, i.e., contains no variables VAR free,
;;;;;;;[3] if the undecidable sentence is either provable or disprovable, then it is
;;;;;;;both provable and disprovable.

Theorem: incompleteness-theorem formula (undecidable-sentence (given), thm-symbs) ∧ (var ∉ collect-free (undecidable-sentence (given), 0))

∧ ((proves (pf , undecidable-sentence (given), given, thm-defns, thm-symbs)

∨ proves (pf , f-not (undecidable-sentence (given)), given, thm-defns, thm-symbs))

→ ((proves (some-proof1 (given, pf ), undecidable-sentence (given), given, thm-defns, thm-symbs)

∧ proves (some-disproof1 (given, pf ), f-not (undecidable-sentence (given)), given, thm-defns, thm-symbs))

∨ (proves (some-proof2 (given, pf ), undecidable-sentence (given), given, thm-defns, thm-symbs)

∧ proves (some-disproof2 (given, pf ), f-not (undecidable-sentence (given)), given, thm-defns, thm-symbs))))

Index

a-ev, 342, 344, 381, 384, 385, 393,

483, 484 a-ev-defn, 384–393, 483, 484, 486,

524 a-ev-defn-fun-ok-proof, 279, 283 a-ev-defn-fun-ok-proof-proves, 282 a-ev-defn-good-step-proof, 346, 347,

350, 355, 358, 365 a-ev-defn-good-step-proof-prove

s, 347 a-ev-defn-if-ok-proof, 271, 273 a-ev-defn-if-ok-proof-proves, 272 a-ev-defn-if1-ok-proof, 267, 270, 272 a-ev-defn-if1-ok-proof-proves, 269 a-ev-defn-list-ok-proof, 283, 286 a-ev-defn-list-ok-proof-proves, 285 a-ev-defn-ok-frame-proof2, 315, 317,

328, 331, 334, 339 a-ev-defn-ok-frame-proof2-prove

s, 316 a-ev-defn-ok-frame-proof3, 324, 325,

336 a-ev-defn-ok-frame-proof3-prove

s, 324 a-ev-defn-ok-proof, 326, 328, 331, 334,

336, 339, 341, 343, 344 a-ev-defn-ok-proof-proves, 340 a-ev-defn-ok-proof-proves-again, 343 a-ev-defn-part, 296–301, 321, 323,

375, 376, 378–384, 386–388, 390, 391, 393

a-ev-defn-part-fun-good-proof, 362,

366, 373 a-ev-defn-part-fun-good-proof-p

roves, 365 a-ev-defn-part-good-pftree, 368, 374 a-ev-defn-part-good-proof, 374–381,

387, 389–391, 393 a-ev-defn-part-good-proof-prove

s-fun-case, 379 s-if-case, 377 s-list-case, 375 s-nlist-case, 376 s-quote-case, 374 s-subr-case, 378 s-var-case, 380

a-ev-defn-part-if-good-proof, 352, 356,

371 a-ev-defn-part-if-good-proof-pr

oves, 355 a-ev-defn-part-list-good-proof, 348,

352, 370 a-ev-defn-part-list-good-proof-p

roves, 350 a-ev-defn-part-ok-pftree, 295 a-ev-defn-part-ok-proof, 295, 297, 299–

301, 322 a-ev-defn-part-ok-proof-proves-

fun-case, 301 list-case, 298 nlist-case, 299 subr-case, 300

a-ev-defn-part-ok-proof-proves-i f-case1, 299 f-case2, 300

a-ev-defn-part-ok-proof-proves-q

uote-case, 297 a-ev-defn-part-ok-proof-proves-v

ar-case, 301 a-ev-defn-part-subr-good-proof, 357,

359, 372 a-ev-defn-part-subr-good-proof-p

roves, 358 a-ev-defn-part1, 319, 322, 323, 325–

338, 340, 342–344, 382, 383, 385, 484

a-ev-defn-subr-ok-proof, 274, 276 a-ev-defn-subr-ok-proof-proves, 275 a-ev-fun-part, 277, 283, 292, 297, 362,

366 a-ev-fun-part-body, 360, 363, 365 a-ev-good-proof, 385–389, 391–393,

483, 484 a-ev-good-proof-proves, 393 a-ev-good-proof-proves-again, 483 a-ev-good-reduc-proof, 345, 346, 349,

350, 353, 354, 357, 364 a-ev-good-reduc-proof-proves, 345 a-ev-if-part, 270, 273, 292, 296, 352,

356 a-ev-inst-formals-proof, 321, 327, 328,

331, 333, 334, 336, 339, 340 a-ev-list-part, 285, 286, 292, 296, 351 a-ev-ok-proof, 342, 344, 483 a-ev-ok-proof-proves, 344 a-ev-reduc, 385 a-ev-reduc-proof, 381, 384, 386–388,

390, 391, 393 a-ev-reduc-proof-proves, 384 a-ev-subr-part, 274, 276, 292, 297,

357, 359 a-ev-symb-form, 321, 322, 325–327,

330–333, 336–339 a-ev-symb-form-a-ev-defn-part, 321 a-ev-symb-form-a-ev-defn-part1, 325 a-ev1, 483–488, 524 a-ev1-good-proof, 484, 485 a-ev1-good-proof-proves, 484 a-ev1-not-good-proof, 485, 486, 533 a-ev1-not-good-proof-proves, 486 a-ev1-ok-proof, 483, 484, 534 a-ev1-ok-proof-proves, 484 a-ev2, 486 a-ev2-inst-proof, 487, 488 a-ev2-inst-proof-proves, 488 a-get, 243, 244, 251, 252, 256, 261,

263, 278–281, 320, 360–362, 364

a-get-defn-ok-proof, 239, 241, 242,

244 a-get-defn-ok-proof-proves, 242 a-get-defn-part, 237, 238, 240–244,

250–255 a-get-defn-part-good-proof1, 247, 250,

254, 255 a-get-defn-part-good-proof1-prove

s, 249 a-get-defn-part-ok-proof1, 236, 238,

240, 241 a-get-defn-part-ok-proof1-prove

s, 238 a-get-defn-part-step-proof, 239, 242 a-get-defn-part-step-proof-prove

s, 239 a-get-ev-good-reduc-proof, 360, 362,

365 a-get-ev-good-reduc-proof-prove

s, 361 a-get-ev-reduc-proof, 278, 281 a-get-good-proof, 253, 255, 256, 263,

264, 279 a-get-good-proof-proves, 255 a-get-good-proof-proves-again, 263 a-get-ok-proof-proves, 244 a-get-ok-proof-proves-again, 260 a-get-ok-proof1, 243, 244, 261, 361 a-get-reduc-proof, 251, 252, 254 a-get-reduc-proof-proves, 252 a-get1, 261, 263, 264, 292, 297, 321,

373, 374 a-get1-good-proof, 263, 264, 374 a-get1-good-proof-proves, 264 a-get1-ok-proof, 261, 263 a-get1-ok-proof-proves, 262 a-implies-a, 65 a-undec, 528, 530–534, 540–542, 547–

549 a-undec1, 524, 529 add-hyp-proof, 77, 89, 92, 93 add-hyp-proof-proves, 77 add1-gcode, 447 alist-cons-eval2, 44 all-elim-proof, 54, 67, 68, 70, 80, 81,

119, 144, 488 all-elim-proof-proves, 54 all-elim-proof-proves-again, 68 all-symbs, 383–385, 524, 546, 547 all-symbs-termp-ncode, 546 all-symbs-thm-symbs, 546 and-join, 48 and-join-proof, 48, 147, 150, 200, 206,

229, 244, 272, 275, 282, 285, 343

and-split-proof1, 48 and-split-proof2, 48 and-split1, 48 and-split2, 48 append, 5 append-exp-form-list, 46 append-nil-intersect, 53 append-nil-one, 95 append-nil-two, 95 append-var-list, 62 appendn-ind, 434 apply-subr, 221 apply-subr1, 217–219 apply-subr2, 219–221 arg, 3, 6, 8, 9, 34–36, 40–43, 59, 72,

73, 91, 92, 394, 401, 438, 439, 442, 453, 456, 457

arg-gcode, 401 arg1, 3, 6, 8, 9, 34–36, 40, 42, 43,

59, 72, 73, 91, 92, 394, 401, 438, 439, 442, 453, 456, 457

arg1-gcode, 401 arg2, 3, 6, 8, 9, 34–36, 40, 42, 43,

59, 72, 73, 91, 92, 394, 402, 438, 439, 442, 453, 456, 457

arg2-gcode, 402 assoc, 14 assoc-proof, 21, 29, 32, 33, 40 assoc-proof-proves, 21 associativity-of-plus, 489 associativity-of-times, 490 assum-proof, 19 assum-proof-proves, 19 atomp, 7–9, 34, 110, 145, 450 atomp-atomp1, 34 atomp-covering, 110 atomp-f-equal, 8 atomp-reduc, 8 atomp-z-int, 145 atomp1, 34 bind, 3, 6, 8, 34, 59, 72, 74, 91,

92, 304, 305, 310–313, 394, 402

bind-count, 3 bind-gcode, 402 body-gcode, 402 bool-fix, 186, 187, 191, 193, 204, 205,

217, 219, 221, 260, 395, 396, 398, 399, 401–403, 405, 406, 410–412, 416, 418, 420, 424, 425, 427, 428, 442–446, 448– 450, 454, 457, 460, 461, 463, 464, 468, 469, 474, 475, 478– 481, 488, 506, 507, 511–514, 517, 520, 522, 523, 529, 531– 534, 537

btm, 265, 287, 395–400, 406, 407, 434–436, 440, 443, 445, 447, 451, 454, 455, 457, 469–471, 482, 503–507, 510, 514–516, 518, 519, 525, 537 btmp, 287, 288, 290, 298–301, 341,

343, 344, 375–380, 393, 395– 400, 406, 407, 434–436, 439, 440, 443, 445, 447, 451, 454, 455, 457, 469–471, 482–484, 486, 503–507, 510, 512, 514– 520, 525, 537

cancel-proof, 38

cancel-proof-proves, 38

car-cdr, 208, 209 car-gcode, 401 case-split-proof, 116 case-split-proof-proves, 116 cdr-gcode, 401 chain-iff-proof, 86, 87, 103, 129 chain-iff-proof-proves, 87 chain-or-proof, 135, 143 chain-or-proof-proves, 135 chain-proof, 86–89, 92, 105–107, 109,

112, 117, 118, 122, 123, 129, 130, 133, 138, 139, 153, 160, 171, 177, 181, 183, 234, 239, 242, 246, 282, 303, 313, 314, 316, 324, 345, 365

chain-rule, 86 col-free-z-car, 183 col-free-z-cdr, 184 collect-free, 5, 6, 12, 13, 15, 19–21,

23, 26, 51, 52, 54–57, 60, 61, 63, 66, 68, 70, 82, 87, 94–101, 103, 105, 110, 115, 116, 122, 124–126, 128, 132– 135, 139, 149, 151, 154, 155, 157, 160, 163, 164, 168, 173, 174, 178, 179, 182–184, 187, 189, 190, 192, 193, 196, 198, 200, 205, 228, 233, 262, 264, 302, 344, 351, 355, 359, 365, 367, 375, 377–380, 385, 439, 442, 524, 548, 549

collect-free-a-undec1, 524 collect-free-count, 439 collect-free-f-and, 82 collect-free-f-equal, 94 collect-free-f-if, 115 collect-free-f-iff, 51 collect-free-f-implies, 26 collect-free-flg, 52 collect-free-forall, 70 collect-free-forsome, 70 collect-free-gcode-flg, 439 collect-free-graph-trans, 228 collect-free-isin, 96 collect-free-list-f-and, 82 collect-free-ncode, 164 collect-free-numeral, 135 collect-free-parallel-subst, 60 collect-free-phi, 116 collect-free-subst, 54 collect-free-subst1, 55 collect-free-subst2, 55 collect-free-undec-sent, 548 collect-free-var-list, 302 collect-free-z-int, 190 collect-free-z-opair, 110 collect-free-z-pair, 100 collect-free-z-sing, 103 collect-free-z-sub1-n, 385 collect-free-z-trans, 132 collect-free-z-union, 101 collect-freen-ind, 439 collect-terms-del-pairs, 60 collect-vars, 63, 64 collect-z-int, 151 commut-proof, 25–27, 29, 30, 32, 36,

39, 40 commut-proof-proves, 25 commutativity-of-gcd, 491 commutativity-of-plus, 489 commutativity-of-times, 490 commutativity2-of-plus, 489 commutativity2-of-times, 490 commute-equal-proof, 79 commute-equal-proof-proves, 79 comp-count, 535–538, 540, 541 comp-count-final-count-lessp, 541 compose-car-cadr-proof, 210, 217, 221 compose-car-cadr-proof-proves, 210 compose-car-proof, 209, 210, 217–

221, 370, 372 compose-car-proof-proves, 209 compose-proof, 206–210, 275, 277,

358 compose-proof-proves, 207 conc, 15, 16, 471, 478, 479 conc-ind, 471 contra-pos-proof1, 50, 51, 122, 164,

232 contra-pos-proof2, 50 contra-pos1, 50 contra-pos2, 50 contrac-proof, 21, 26, 30, 32, 38, 39 contrac-proof-proves, 21 covering, 6, 26, 51–57, 61, 62, 66,

68, 70, 82, 96, 100, 101, 104, 110, 116, 125, 128, 149– 151, 157, 184, 442, 443

covering-count, 442 covering-f-and, 82 covering-f-equal, 125 covering-f-if, 116 covering-f-iff, 51 covering-f-implies, 26 covering-flg, 52 covering-forall, 70 covering-forsome, 157 covering-isin, 96 covering-list, 62, 63 covering-list-all, 68 covering-list-exis, 66 covering-numeral, 149 covering-par-subst, 57 covering-phi, 116 covering-z-car, 184 covering-z-cdr, 184 covering-z-int, 150 covering-z-opair, 151 covering-z-pair, 100 covering-z-sing, 104 covering-z-succ, 128 covering-z-union, 101 coveringn-ind, 442 cut-proof, 21, 25, 26, 38–40 cut-proof-proves, 21

dble-neg-list-count, 35 dble-neg-proof, 40, 41 dble-neg-type, 34–36, 41, 43, 44 dec-count, 509, 510, 518, 521, 535 dec-countn, 521, 523, 535 decipher, 516, 518, 521–523, 529, 535–

539, 541 decipher-ind, 502 decipher-ind2, 503 decipher-listp, 502 decipher1, 501–503, 510, 516, 518 decipher1-listp-reduc, 502 decipher1-nlistp, 503 decipher1-numcode, 503 decipher1n-ind, 509 degree, 2, 4, 7, 8, 10, 11, 15, 18–20,

33, 34, 207, 209, 210 degree-fn, 4 degree-p, 4 del, 5–7, 52, 54, 55, 59, 60, 65, 66,

70, 94, 97, 149, 435, 438, 439 del-forall-proof, 105 del-forall-proof-proves, 105 del-forsome-proof, 104, 105, 121 del-forsome-proof-proves, 105 del-pairs, 59, 60, 64, 70, 94, 95, 138 del-pairs-collect-free, 95 del-pairs-del-pairs, 94 del-pairs-elim-free, 94 del-pairs-getsub, 59 delete, 496, 497, 500 delete-delete, 94 delete-non-member, 496 detach-proof, 25–27, 79, 111, 125,

129, 137, 164, 171, 172, 178, 179, 182, 195, 201, 229, 232, 260, 488 detach-proof-proves, 26 detach-rule-corr, 27 difference-0, 489 difference-add1-cancellation, 492 difference-cancellation-0, 490 difference-cancellation-1, 490 difference-elim, 490 difference-lessp, 431 difference-lessp2, 431 difference-plus, 489 difference-plus-cancelation, 492 difference-plus1, 491 difference-plus2, 492 difference-plus3, 492 difference-sub1-n, 431 difference-x-x, 489 disable-nzerop-proof, 201, 202 disable-nzerop-proof-proves, 202 dist-f-implies, 75, 78, 88, 91 dist-f-implies-symmetry-proof, 87, 88,

93 dist-f-implies-symmetry-proof-p

roves, 88 distrib-rule-proof-a, 69, 71, 306, 312,

313 distrib-rule-proof-a-proves, 69 distrib-rule-proof-b, 69, 70, 306, 312,

314 distrib-rule-proof-b-proves, 70 distributivity-of-divides, 497 distributivity-of-times-over-gc

d, 493 distributivity-of-times-over-pl

us, 490 divides, 492–497, 499 divides-implies-times, 497 divides-plus-rewrite, 492 divides-plus-rewrite-commuted, 492 divides-plus-rewrite1, 492 divides-plus-rewrite2, 492 divides-times, 492 divides-times-list, 496 divides-times1, 495 double, 498, 500–503 double-ind, 500 double-nequal-add1-double, 500

e-intro-proof, 53, 54, 65, 69, 80, 81,

117, 118 e-intro-proof-proves, 53 eg-proof, 260, 261, 272, 275, 282,

285, 483 eg-proof-proves, 260 elem-form, 34 elim-args-proof, 74, 75, 89, 93 elim-args-proof-proves, 75 elim-free-terms, 82, 91–94 elim-link-proof, 74, 75 elim-link-proof-proves, 74 enable-nzerop-proof, 200–202 enable-nzerop-proof-proves, 201 enough-factors, 494 eql, 3–5, 7, 8, 10–16, 54, 55, 59, 60,

73, 394, 435, 445 eql-comm, 4 eql-gcode-equal, 394 eql-trans, 60 eql-trans2, 73 eql-trans3, 73 eqn-form, 72, 74 eqn-form-proof, 73, 74, 92, 120–122,

129 eqn-form-proof-proves1, 74 equal-axiom1, 17, 18 equal-axiom1-proof, 17, 18, 89, 100, 128, 207, 225

equal-axiom1-proves, 18 equal-axiom1-z-pair, 100 equal-axiom1-z-succ, 128 equal-axiom1-z-union, 100 equal-axiom2, 17, 19 equal-axiom2-isin, 96 equal-axiom2-proof, 17, 19, 75, 76,

93, 96, 110, 111, 137, 163, 171, 207, 235, 245, 248, 303

equal-axiom2-proves, 19 equal-axiom2-z-int, 163 equal-difference-0, 489 equal-eql, 4 equal-equal-axiom2, 76 equal-isin-imp-proof, 245, 249, 265,

345 equal-isin-proof, 235, 237, 265 equal-isin-proof-proves, 235 equal-lessp, 490 equal-times-0, 490 equal-z-list-isin-imp-proof, 265, 279,

361 equal-z-list-isin-proof, 265, 266 equal-z-list-proof, 231, 232, 237, 249,

265 equal-z-list-proof-proves, 231 equal-z-list-proof-proves1, 232 equal-z-succ-proof, 131, 134 equal-z-succ-proof-proves, 131 euclid, 492 ev, 287–292, 295–301, 321, 326, 328,

329, 332, 334, 335, 337–339, 341–344, 369–381, 386–393, 396–399, 401–407, 413–415, 434–436, 438, 441–448, 450, 452–456, 458, 461, 463, 465, 467, 469–472, 474, 477, 481– 486, 503–509, 511, 515, 525, 528

ev-equal-z-list-isin-proof, 266–268, 272,

275, 281, 284, 285 ev-equal-z-list-isin-proof-prove

s, 266 ev-equal-z-list-proof, 265, 266, 345 ev-equal-z-list-proof-proves, 266 ev-fun-reduc, 288 ev-graph, 288–292, 295–301, 322, 326–

344, 483 ev-hyps, 297–301, 343, 344, 374–380,

393, 483, 484, 486, 488, 533, 534, 546

ev-hyps-thm-defns-symbols, 546 ev-hyps-z-car, 544 ev-hyps-z-cdr, 544 ev-hyps-z-int, 544 ev-hyps-z-succ, 544 ev-if-reduc, 288 ev-list-reduc, 288 ev-list1, 407 ev-list2, 407 ev-subr-reduc, 288 eval, 42–46, 51, 82, 116 eval-f-and, 82 eval-f-if, 116 eval-f-iff, 51 eval-f-implies, 45 eval-fun-zero, 406 eval-fun1, 406 eval-fun2, 406 eval-fun3, 407 eval-g-append, 434 eval-g-del, 435 eval-g-f-not, 404 eval-g-f-or, 404 eval-g-fix, 403 eval-g-forsome, 404 eval-g-free-for, 444 eval-g-func-pred, 405 eval-g-function, 402 eval-g-length, 447 eval-g-predicate, 405 eval-g-variable, 402 eval-make-disjunct, 42 eval-member, 43 eval-pr-if-again, 406 eval-prop-atomp, 42 eval-prop-atomp1, 42 eval-tautconseq, 46 eval-tautconseq-proof-proves, 46 eval-tautologyp, 46 eval-var, 406 exis-fun-intro-proof, 125–127, 156, 161, 169, 197, 198, 205 exis-fun-intro-proof-proves, 126 exp, 488, 498–502, 505, 509 exp-count, 438, 439, 442–444, 454,

461, 464, 468, 471, 474, 478, 480, 481, 513, 518, 521–523, 530, 532–535, 540, 542

exp-count-append, 438 exp-count-del, 438 exp-times-list-y-x-list, 498 expan-proof, 21, 26–30, 102, 224, 228 expan-proof-proves, 21 ext-axiom, 22, 23, 97, 98 ext-axiom-case, 140 ext-axiom-eq-detach, 129 ext-axiom-eq-detach-proof, 128, 129 ext-axiom-eq-elim1, 98 ext-axiom-eq-elim1-proof, 97, 98, 105,

107–109, 130 ext-axiom-eq-elim2, 99 ext-axiom-eq-elim2-proof, 98, 99, 106,

146 ext-axiom-eq-intro-proof, 99 ext-axiom-eql-intro, 99 ext-axiom-proof, 23, 97–99, 129, 133,

139 ext-axiom-proof-proves, 23 ext-case-proof, 140 ext-case1, 139 ext-case1-proof, 139, 140 ext-not-equal-proof, 146, 147, 165,

166, 201 ext-not-equal-proof-proves, 146 ext-subcase-proof2, 140, 143 ext-subcase-proof2-proves, 140

f-and, 9, 12–15, 19, 24, 48, 76, 77, 82, 113, 115, 121–124, 126, 131–134, 136–139, 141–145, 147–149, 155, 160, 161, 166, 185, 194, 195, 197–202, 243, 250–253, 270, 271, 274, 278, 280, 284, 285, 305, 319–321, 342, 347–349, 363, 385, 413, 486, 524

f-equal, 7–10, 13, 15, 17, 19, 22– 24, 75–79, 87–90, 94–112, 125–131, 133, 134, 136, 137, 139–143, 145–148, 151–156, 158–164, 166–168, 170–172, 176–189, 191–207, 209–216, 218–222, 224–229, 231–235, 237–239, 241, 245, 247–250, 253–257, 260, 263, 264, 266– 271, 274, 277–279, 281, 284, 285, 292, 296, 297, 299, 302, 303, 307, 308, 316, 319, 320, 323, 324, 346–359, 362, 364– 368, 370, 371, 373–376, 378– 381, 386–393, 415, 483–485, 542

f-equal-col-free, 125 f-if, 113–116, 123–125, 155, 161, 168,

173, 174, 186, 188, 189, 192, 197, 203, 211, 213, 215, 237, 239, 257, 270–272, 296, 297, 305, 319–321, 353

f-if-elim-proof1, 114, 115, 171, 177,

246 f-if-elim-proof1-proves, 114 f-if-elim-proof2, 115, 171, 177, 246 f-if-elim-proof2-proves, 115 f-if-intro-proof1, 113, 114, 230 f-if-intro-proof1-proves, 114 f-if-intro-proof2, 114, 231 f-if-intro-proof2-proves, 114 f-if-intro-step-proof1, 113 f-if-intro-step-proof2, 113 f-if-intro-step1, 113 f-if-intro-step2, 113 f-iff, 12, 13, 15, 20, 22–24, 47–51,

71–74, 79–82, 85–88, 91– 93, 97–99, 101, 103, 105, 120–122, 128–130, 133, 138– 140, 148, 149, 166, 226, 233, 250, 251, 465

f-iff-distrib-rule-a-proof, 71, 74 f-iff-distrib-rule-a-proof-prove

s, 71 f-iff-mp-proof1, 47 f-iff-mp-proof2, 47, 99, 102, 104, 130,

150, 180, 201, 223, 224, 226, 228, 252, 383

f-iff-mp-proves1, 47 f-iff-mp-proves2, 47 f-implies, 9–12, 14, 15, 17–19, 21,

22, 24, 26, 45, 47, 49–54, 65–70, 74–88, 90, 92, 93, 96–102, 105–119, 121–126, 128, 131–148, 151–156, 158– 161, 163, 166, 168, 169, 171– 173, 176, 177, 185, 194–199, 201–203, 224–227, 233–235, 238–240, 242–256, 263, 264, 278–281, 302, 303, 305–317, 321, 323–325, 329, 335, 340, 342–344, 346–360, 362, 364– 368, 370, 371, 373–376, 378– 385, 393, 414, 483–485

f-not, 2, 4, 8–10, 12, 13, 17, 18, 21, 23, 34–36, 38–40, 43–45, 50– 52, 54, 59, 71, 85, 113–116, 120–123, 125, 136, 141, 146– 148, 156, 161, 163, 164, 166, 167, 169, 170, 173–176, 179, 180, 195, 197, 201, 202, 230, 232, 240, 246, 299, 309, 328, 334, 340, 404, 485, 486, 512, 513, 523, 529, 532, 533, 535– 538, 541, 547, 548, 550

f-notp, 3, 6, 8, 9, 34, 35, 42, 43, 59, 72, 73, 91, 92, 394, 401, 438, 439, 442, 453, 456, 457

f-notp-eql, 4 f-or, 3, 4, 8–13, 17, 18, 21, 23–25,

27–33, 36, 38, 39, 59, 72, 85, 101–103, 108, 109, 112, 113, 115, 117–119, 121, 123, 129–131, 134–137, 139, 141– 143, 145–148, 223, 224, 226, 228, 238, 303, 307, 308, 404, 512, 513

f-orp, 3, 6, 8, 9, 34, 35, 40, 42, 43, 59, 72, 73, 91, 92, 394, 401, 438, 439, 442, 453, 456, 457

f-orp-eql, 4 f-orp-list-count, 35 f-orp-proof, 40 fa, 430–436, 438, 441–448, 450, 452–

456, 458, 461, 463, 467, 469– 472, 474, 477, 481, 482, 503– 509, 511, 515, 525, 528, 529, 533, 534

falsify, 43, 44 falsify-taut, 43–46 final-count, 540, 542, 547–549 find-hi-index, 62, 63, 96 find-hi-index-append, 63 find-proof-ind, 517 find-proof-proves-f-case, 520 find-proof-proves-f-case-case, 522 find-proof-proves-f-case-gcode, 523 find-proof-proves-t-case, 520 find-proof-proves-t-case-gcode, 521 find-proofn, 516, 517, 521–523, 529,

538 findn, 537–539, 541 findn-count, 530, 532 findn-g-findn, 539 findn-thm-count-lessp, 538 fix1, 3 flg-f-implies-equal, 78, 90 flg-proves, 78, 90 flg-termp, 78, 90 flip-equals-proof, 195, 196, 236, 237,

265, 266, 275, 345, 361 flip-equals-proof-proves, 196 flip-not-equals-proof, 232 fn, 2, 4, 12, 23–25, 95, 100–103, 105–

107, 109, 112, 116, 126–128, 130, 131, 134, 135, 138, 143, 144, 146–148, 150–152, 154– 158, 160–164, 167, 179–184, 186–193, 196, 198, 200–205, 208–222, 224–229, 231, 232, 234, 238, 239, 242, 244, 249, 250, 252, 255, 256, 258–260, 262–264, 266, 269, 272, 275, 277, 282, 285, 296–299, 303, 307, 309, 310, 315, 316, 322– 325, 340, 341, 345, 350, 351, 355, 358, 359, 361, 365, 368, 370, 372, 383, 384, 542, 543, 546 fn-p-not-equal, 95 fol-axiom-cnt, 461, 479 fol-axiom-proof, 10, 16, 461 fol-rules, 11, 16, 464, 478 fol-rules-cnt, 478, 479 forall, 9, 13, 14, 22–24, 51, 52, 54,

67–70, 79–82, 87, 97–99, 105, 119–122, 128, 132, 133, 139, 144, 148, 150, 152, 158, 179, 196, 201, 305, 321, 414, 486– 488 forall-distrib-or, 119 forall-distrib-or-proof, 119 forall-forsome, 120 forall-forsome-proof, 120, 122 forall-intro-proof, 51, 52, 70, 87, 105, 119, 133, 153, 159, 196

forall-intro-proof-proves, 51 forall-over-iff-proof, 80, 81, 87 forall-over-iff-proof-proves, 81 forall-over-implies-proof, 79, 80, 122,

153, 159 forall-over-implies-proof-prove

s, 80 form-count, 34, 35 form-equal, 91, 93, 95, 138, 139 form-equal-case-proof, 232, 233, 239,

282, 347 form-equal-case-proof-proves, 233 form-equal-parallel-subst, 95 form-equal-parallel-subst-again, 139 form-equal-proof, 91–93, 138, 233 form-equal-proof-proves, 93 form-equal-proof-proves1, 138 form-equal-subst, 95 form-list, 32, 33, 36–38, 41, 44, 46,

76–78, 83, 90, 91, 93, 138 form-list-append, 36 form-list-append-car, 37 form-list-append-nil, 44 form-list-elim-free-terms, 93 form-list-f-equal, 78 form-symb1, 306, 307, 315, 316, 322,

324 form-symb1-a-ev-symb-form, 322 form-z-if, 174–178, 194, 195, 231, 245–

247, 296, 298, 368 form-z-if-ev-defn-part-again, 368 form-z-if-eval-proof, 177, 178, 245 form-z-if-eval-proof-proves, 177 form-z-if-eval-proof-proves-agai

n, 245 form-z-if-eval-proof-proves1, 178 form-z-if-eval-proof1, 177, 178, 181,

183, 203 form-z-if-exis-proof, 175, 176, 198 form-z-if-exis-proof-proves, 175 form-z-if-exis-proof-proves1, 176 form-z-if-exis-step-proof, 172, 173, 175 form-z-if-exis-step-proof-prove

s, 173 form-z-if-ok-proof, 230, 231, 237, 268,

295 form-z-if-ok-proof-proves, 231 form-z-if-unique-proof, 194, 195, 199 form-z-if-unique-proof-proves, 194 form-z-if-unique-proof-proves1, 195 form-z-if-unique-proves, 193–195 form-z-if-z-ev-defn-part, 296 form-z-if-z-ev-defn-part-again, 298 formlist-formula-make-disj, 32 formula, 9–13, 15–21, 25–32, 36, 46,

51, 53, 54, 65–70, 73–82, 84, 93, 95, 96, 102–105, 113– 115, 117–120, 122, 124, 125, 132, 138–140, 144, 145, 154, 168, 169, 171, 174, 175, 196, 227, 233, 239, 250–252, 260, 278, 303, 306, 307, 322, 323, 347, 374, 376, 380, 385, 457, 478, 479, 483, 524, 547, 549

formula-a-ev-defn, 385

formula-a-ev-defn-again, 483 formula-a-ev-defn-part, 323 formula-a-ev-defn-part1, 322 formula-a-undec1, 524 formula-cnt, 456, 457, 461, 464, 468,

474, 478, 481, 521, 522, 535 formula-f-and, 82 formula-f-equal, 9 formula-f-if, 115 formula-f-iff, 51 formula-f-implies, 26 formula-f-not, 17 formula-f-or, 17 formula-forall, 70 formula-forsome, 17 formula-ind, 456 formula-isin, 96 formula-list-all-quant, 68 formula-list-all-quantify, 278 formula-list-exis, 65 formula-list-f-and, 76 formula-list-implies, 27 formula-list-implies1, 78 formula-make-form, 175 formula-make-form-symb, 307 formula-make-term-z-if, 169 formula-make-term-z-if-again, 171 formula-pairequals, 18 formula-parallel-subst, 138 formula-rest-of, 20 formula-undec-sent, 547 formula-z-int, 145 formula-z-trans, 132 forsome, 3, 4, 8–10, 12, 15, 17–19,

21, 22, 34, 51–54, 59, 64, 69–71, 79–82, 87, 104, 105, 117, 118, 120–126, 152–162, 168, 169, 173, 175, 176, 179– 183, 185–189, 197, 198, 200– 202, 261, 270, 274, 278, 285, 305, 319–321, 344, 348, 404, 483, 486, 512, 513, 524

forsome-collect-free-reduc, 52 forsome-distrib-and-proof, 121–123 forsome-distrib-and-proof-prove

s, 122 forsome-distrib-or-proof-proves

1, 117 2, 118

forsome-distrib-or-proof1, 117 forsome-distrib-or-proof2, 118, 123 forsome-distrib-step-proof, 117, 118 forsome-distrib-step-proof-prove

s, 118 forsome-f-if-case-proof, 124, 125, 156,

161, 169 forsome-f-if-case-proof-proves, 125 forsome-f-if-proof, 123–125, 173 forsome-f-if-proof-proves, 123 forsome-forall, 120 forsome-forall-proof, 120, 179, 180,

201 forsome-intro-proof, 21, 22, 51, 69,

80, 81, 104, 117, 118, 153, 154, 160, 181, 183, 264, 344, 350, 355, 358, 365, 484

forsome-intro-proves, 21 forsome-intro-proves-again, 344 forsomep, 3, 6, 8, 9, 34, 59, 72, 74,

91, 92, 304, 305, 307, 310– 313, 394, 401, 438, 439, 442, 453, 456, 457

forsomep-eql, 4 fourth, 10–13, 15, 16, 461, 464, 468,

474, 478, 480 free-for, 6, 10, 15, 18, 19, 53, 57,

95, 154, 178, 196, 262, 381, 383, 444

free-for-list, 57, 58, 61–64, 67–69,

178, 260, 262, 383 free-for-list-elim, 58 free-for-list-newvars-covering-

list, 62 free-for-list-newvars-exp, 63 free-for-list-nil-list, 262 free-for-list-reduc, 383 free-for-list-step1, 67 free-for-list-step2, 68 free-for-nil, 262 free-for-subst, 54 free-for-x-x, 381 fun-defn-proof, 19, 20, 127, 157, 162,

186, 188, 190, 192, 200, 204, 205, 212, 214, 216, 258

fun-defn-proof-proves, 19 fun-ev-graph, 290 func-pred, 5, 405 function, 2, 4, 5, 7, 10, 15, 16, 18,

19, 33, 207, 209, 210, 402 function-fn, 2

g-append, 406, 407, 409, 410, 434 g-append-defn, 407, 430, 431 g-append-ind, 434 g-appendn, 434, 437, 440, 441 g-appendn-gcode, 434 g-arg, 400–402, 408, 409, 412, 413,

438, 441, 452, 453, 455 g-arg-eval, 401 g-argn, 400–402, 406, 437, 440, 451,

455 g-assoc, 416, 425, 470 g-assoc-defn, 416, 431, 432 g-assoc-eval, 470 g-assoc-ind, 470 g-assoc-rule, 419, 420 g-assoc-rulen, 462, 463 g-assocn, 469, 470 g-assocn-gcode, 470 g-atomp, 413, 450 g-atomp-eval, 450 g-atompn, 450, 455 g-atompn-gcode, 450 g-cadddr, 416–420, 424, 425, 476,

477 g-cadddrn, 458–460, 462, 463 g-caddr, 416–420 g-caddrn, 458–460, 462, 463, 470 g-cadr, 416–420, 424, 425, 477 g-cadrn, 458–463 g-car, 402, 405, 407–413, 415, 416,

418–420, 424, 425, 438, 441, 448, 471, 477

g-carn, 402, 405, 434–437, 440, 443, 445, 447, 448, 450, 452, 454, 457, 458, 460, 461, 463, 469– 471

g-cdr, 402, 407–413, 415–417, 425, 434–436, 438, 441, 445, 447, 448, 454, 457, 469–472, 477

g-cdrn, 406, 434–437, 440, 441, 443, 445, 447, 448, 450, 452, 454, 457–459, 469–471

g-collect-free, 408, 409, 417, 420, 438 g-collect-free-defn, 408, 430, 432 g-collect-free-eval, 438 g-collect-free-ind, 438 g-collect-freen, 436–440, 444, 462 g-collect-freen-gcode, 439 g-conc, 416, 424, 425, 427, 471 g-conc-defn, 416, 431, 432 g-conc-eval, 471 g-conc-ind, 470, 471 g-concn, 470, 471, 481 g-concn-gcode, 471 g-cons, 398, 403, 407–409, 411, 412,

415, 416, 418–421, 428 g-cons-eval, 403 g-consn, 403, 415, 434–436, 440, 446,

452, 459, 460, 462–465, 470, 510, 513

g-consn-gcode, 403 g-consn-numberp, 513 g-contrac-rule, 419, 420 g-contrac-rulen, 461, 463 g-covering, 409, 410, 417, 442 g-covering-defn, 409, 430, 432 g-covering-eval, 442 g-covering-ind, 441, 442 g-coveringn, 440–444 g-coveringn-gcode, 443 g-cut-rule, 419, 420 g-cut-rulen, 462, 463 g-decipher, 427, 428 g-decipher1, 427, 509 g-decipher1-defn, 427, 431, 433 g-decipher1-eval, 509 g-decipher1-ind, 508, 509 g-decipher1n, 507–510 g-decipher1n-gcode, 510 g-deciphern, 510, 514–516, 518, 519,

521, 537 g-degree, 417, 418 g-degreen, 459, 460 g-del, 408, 409, 435 g-del-defn, 408, 430, 432 g-del-ind, 435 g-deln, 435, 437 g-deln-gcode, 435 g-exp, 426, 427, 505 g-exp-defn, 426, 431, 433 g-exp-eval, 505 g-exp-ind, 505 g-expan-rule, 419, 420 g-expan-rulen, 461, 463 g-expn, 504, 505, 507, 508 g-expn-gcode, 505 g-f-and, 413, 421 g-f-and-eval, 413 g-f-andn, 413, 465 g-f-andn-gcode, 413 g-f-equal, 415, 418 g-f-equal-eval, 415 g-f-equaln, 415, 457, 459, 460 g-f-equaln-gcode, 415 g-f-iff, 421, 465 g-f-iff-eval, 465 g-f-iffn, 465 g-f-iffn-gcode, 465 g-f-implies, 414, 415, 417, 418, 420,

421 g-f-implies-eval, 414 g-f-impliesn, 414, 457, 459, 460, 463,

465 g-f-impliesn-gcode, 414 g-f-not, 404, 412–414, 418, 419, 428 g-f-notn, 404, 413, 414, 451, 460,

462, 510, 513–516, 519, 520, 522, 537

g-f-notn-gcode, 404 g-f-notn-numberp, 513 g-f-or, 404, 412–414, 418, 419, 428 g-f-orn, 404, 413, 414, 451, 460–462,

510, 513 g-f-orn-gcode, 404 g-f-orn-numberp, 513 g-find-proof, 519, 520, 522 g-find-proof-gcode, 520 g-find-proofn, 515–517, 521 g-find-proofn-gcode, 517 g-findn, 518–523, 530, 539 g-fix, 403, 404, 411, 413, 417, 426,

428 g-fix-gcode, 403 g-fixn, 403, 404, 448, 450, 459, 503,

511, 512 g-fixn-reduc, 512 g-fol-axiom-proof, 418, 424, 461 g-fol-axiom-proof-eval, 461 g-fol-axiom-proofn, 460, 461 g-fol-axiom-proofn-gcode, 461 g-fol-rules, 420, 425, 463 g-fol-rules-eval, 463 g-fol-rulesn, 463, 464, 478 g-fol-rulesn-gcode, 464 g-fol-rulesn-gcode1, 478 g-forall, 414 g-forall-eval, 414 g-foralln, 414 g-foralln-gcode, 414 g-formula, 413, 417–420, 424, 427,

456 g-formula-defn, 413, 431, 456 g-formula-eval, 456 g-formula-ind, 455 g-formulan, 455–458, 460–462, 481 g-formulan-gcode, 457 g-forsome, 404, 412, 414, 417, 420,

428 g-forsome-intro-rule, 419, 420 g-forsome-intro-rulen, 462, 463 g-forsomen, 404, 414, 451, 459, 463,

510, 513 g-forsomen-gcode, 404 g-forsomen-numberp, 513 g-forsomen-numberp2, 513 g-free-for, 417, 444 g-free-forn, 444, 459 g-free-forn-gcode, 444 g-fun-equal-axiom-proof, 417, 418 g-fun-equal-axiom-proofn, 459, 460 g-func-pred, 405 g-func-predn, 405 g-func-predn-gcode, 405 g-function, 402, 405, 411, 417, 425 g-functionn, 402, 405, 447, 459 g-functionn-gcode, 402 g-halve, 426, 427, 506 g-halve-defn, 426, 431, 433 g-halve-eval, 506 g-halve-ind, 506 g-halven, 505–507 g-halven-gcode, 506 g-inv-code, 428, 511 g-inv-code-defn, 428, 431, 433 g-inv-code-eval, 511 g-inv-code-ind, 511 g-inv-coden, 510, 511, 513–516, 518,

519, 521, 537 g-inv-coden-gcode, 513 g-isin, 420 g-isinn, 464 g-isthm, 428, 515, 528 g-isthm-defn, 428, 431, 433 g-isthm-eval, 515 g-isthmn, 514, 515, 517, 520, 522,

523, 528, 531–534, 537 g-length, 411, 413, 417, 418, 447 g-length-defn, 411, 431, 432 g-length-ind, 447 g-lengthn, 446–448, 450, 459, 460 g-lengthn-gcode, 447 g-lessp, 427, 507 g-lessp-defn, 427, 431, 433 g-lessp-eval, 507 g-lessp-ind, 507 g-lesspn, 506, 507 g-lesspn-gcode, 507 g-memb, 408–412, 416, 420, 425, 436 g-memb-defn, 408, 430, 432 g-memb-eval, 436 g-memb-ind, 436 g-membn, 436, 440, 442, 443, 446,

454, 462, 469, 471 g-membn-gcode, 436 g-membn-gcode-again, 442 g-nil-intersect, 410, 417, 443 g-nil-intersect-defn, 410, 431, 432 g-nil-intersect-eval, 443 g-nil-intersectn, 443, 444 g-nil-intersectn-gcode, 443 g-numeral, 426, 429, 482 g-numeral-defn, 426, 431, 433 g-numeral-eval, 482 g-numeral-ind, 482 g-numeraln, 481, 482, 525, 527 g-numeraln-gcode, 482 g-numeraln-ncode, 527 g-pairequals, 413, 415, 418, 458 g-pairequals-defn, 415, 431, 432 g-pairequals-eval, 458 g-pairequals-ind, 457, 458 g-pairequalsn, 457–460 g-pairequalsn-gcode, 458 g-phi, 420, 426 g-phin, 464, 482, 527 g-phin-gcode, 527 g-plus, 426, 503 g-plus-defn, 426, 431, 433 g-plus-eval, 503 g-plus-ind, 503 g-plusn, 503, 504 g-plusn-gcode, 504 g-pred-equal-axiom-proof, 418 g-pred-equal-axiom-proofn, 459, 460 g-predicate, 405, 413, 418 g-predicaten, 405, 450, 459 g-predicaten-gcode, 405 g-prf, 417, 425, 427, 477 g-prf-defn, 424, 431, 432 g-prf-eval, 477 g-prf-ind, 476, 477 g-prfn, 477, 480, 481 g-prfn-gcode, 480 g-proves, 427, 428, 481 g-proves-eval, 481 g-provesn, 481, 514–520, 522, 537,

538 g-provesn-gcode, 481 g-provesn-t-or-f1, 517 g-provesn-t-or-f2, 517 g-rest-of, 416, 425, 472, 477 g-rest-of-defn, 416, 431, 432 g-rest-of-eval, 472 g-rest-of-ind, 472 g-rest-ofn, 471, 472 g-rest-ofn-gcode, 472 g-set, 415, 416, 469 g-set-defn, 416, 431, 432 g-set-eval, 469 g-set-ind, 469 g-setn, 469 g-setn-gcode, 469 g-sub, 412, 454 g-sub-defn, 412, 431, 432 g-sub-eval, 454 g-sub-ind, 454 g-subn, 454 g-subn-gcode, 454 g-subst, 411, 412, 417, 453, 528 g-subst-axiom-proof, 417, 418 g-subst-axiom-proofn, 458, 460 g-subst-defn, 411, 431, 432 g-subst-eval, 453 g-subst-ind, 452, 453 g-substn, 451–454, 459, 528, 531, 532 g-substn-gcode, 454 g-symb, 411, 413, 446 g-symb-count, 474, 480 g-symb-defn-proof, 425, 474 g-symb-defn-proof-eval, 474 g-symb-defn-proofn, 474, 475 g-symb-defn-proofn-gcode, 474 g-symb-eval, 446 g-symbn, 446, 447, 450 g-symbn-gcode, 446 g-termp, 411, 413, 417, 418, 448 g-termp-defn, 411, 431, 432 g-termp-eval, 448 g-termp-ind, 448 g-termpn, 447–450, 459, 460 g-termpn-gcode, 449 g-thm-ind, 515 g-times, 426, 427, 504 g-times-defn, 426, 431, 433 g-times-eval, 504 g-timesn, 504, 508 g-timesn-gcode, 504 g-typep, 399, 400, 407–413, 415, 416,

424, 425 g-typep-eval, 399 g-typepn, 399–401, 434–437, 440, 443,

445, 447, 448, 451, 452, 454, 455, 457, 469–471

g-typepn-gcode-f-notp, 401 g-typepn-gcode-f-orp, 401 g-typepn-gcode-forsomep, 401 g-typepn-gcode-list, 401 g-undec, 528, 529, 532, 534 g-undec-eval, 528 g-undecn, 528 g-var-list, 410, 445 g-var-list-defn, 410, 431, 432 g-var-list-eval, 445 g-var-list-ind, 445 g-var-listn, 444, 445 g-var-listn-gcode, 445 g-variable, 402, 408, 410, 411, 417,

420 g-variablen, 402, 403, 436, 445, 448,

451, 458, 462 g-variablen-gcode, 403 g-z-int, 421 g-z-intn, 464 g-z-opair, 426, 429 g-z-opairn, 483, 525, 526 g-z-pair, 421, 426 g-z-pairn, 464, 482, 483, 525 g-z-sing, 426 g-z-singn, 482, 483 g-z-succ, 421, 426 g-z-succ-gcode, 526 g-z-succn, 465, 482, 526 g-z-union, 421 g-z-unionn, 464 g-z2-axioms, 425, 467 g-z2-axioms-eval, 467 g-z2-axiomsn, 467, 468, 479 g-z2-axiomsn-gcode, 468 g-z2-axiomsn-gcode1, 479 g0220, 27 g0222, 32 g0227, 27 g0228, 28 g0229, 33 g0231, 29 g0232, 29 g0233, 30 g0234, 30 g0235, 31 g0236, 31 g0240, 35 g0253, 9 g0255, 38 g0256, 37 g0258, 38 g0259, 37 g0275, 41 g0276, 46 g0277, 46 g0282, 46 g0283, 46 g0284, 47 g0285, 47 g0286, 48 g0287, 49 g0288, 49 g0289, 49 g0290, 49 g0291, 49 g0292, 50 g0293, 50 g0294, 50 g0295, 51 g0300, 52 g0306, 53 g0307, 54 g0317, 71 g0318, 71 g0319, 72 g0338, 74 g0344, 26 g0345, 34 g0346, 64 g0347, 63 g0348, 66 g0350, 64 g0351, 64 g0353, 65 g0354, 65 g0355, 66 g0356, 67 g0357, 68 g0358, 69 g0360, 69 g0361, 70 g0362, 110 g0363, 71 g0364, 90 g0365, 76 g0366, 110 g0367, 111 g0368, 76 g0369, 113 g0370, 79 g0371, 79 g0372, 76 g0373, 79 g0374, 23 g0375, 23 g0376, 24 g0377, 24 g0378, 25 g0379, 25 g0380, 25 g0381, 96 g0384, 83 g0386, 87 g0387, 101 g0388, 101 g0389, 104 g0391, 102 g0392, 103 g0393, 104 g0396, 86 g0407, 127 g0408, 128 g0422, 145 g0426, 146 g0427, 146 g0428, 146 g0429, 147 g0430, 148 g0459, 228 g0479, 260 g0488, 227 g0490, 227 g0491, 227 g0499, 74 g0503, 26 g0504, 28 g0505, 37 g0506, 75 g0507, 75 g0508, 77 g0509, 77 g0591, 20 g0592, 21 g0593, 120 g0594, 20 g0595, 20 g0596, 73 g0597, 105 g0598, 73 g0599, 105 g0600, 73 g0601, 116 g0603, 124 g0604, 126 g0605, 135 g0606, 18 g0607, 18 g0608, 151 g0609, 148 g0612, 96 g0613, 149 g0614, 150 g0615, 250 g0616, 5 g0617, 5 g0618, 5 g0619, 5 g0620, 5 g0621, 5 g0622, 5 g0623, 9 g0624, 21 g0625, 21 g0626, 22 g0627, 25 g0628, 151 g0629, 25 g0630, 152 g0631, 99 g0632, 99 g0633, 99 g0634, 100 g0635, 100 g0636, 60 g0637, 154 g0639, 149 g0640, 154 g0643, 102 g0644, 252 g0645, 155 g0646, 156 g0647, 158 g0648, 157 g0649, 157 g0650, 160 g0651, 162 g0652, 106 g0653, 106 g0654, 107 g0655, 163 g0656, 108 g0657, 109 g0658, 164 g0659, 163 g0660, 163 g0663, 113 g0664, 113 g0666, 178 g0668, 117 g0669, 118 g0670, 118 g0671, 178 g0672, 119 g0673, 120 g0674, 120 g0675, 120 g0676, 121 g0677, 127 g0678, 157 g0679, 163 g0680, 178 g0681, 123 g0683, 123 g0684, 124 g0685, 179 g0687, 125 g0690, 126 g0691, 181 g0692, 182 g0693, 180 g0694, 183 g0695, 185 g0696, 184 g0697, 184 g0699, 186 g0700, 195 g0701, 195 g0702, 126 g0703, 187 g0704, 129 g0705, 130 g0706, 187 g0707, 130 g0708, 131 g0709, 132 g0710, 132 g0711, 187 g0712, 189 g0713, 189 g0714, 189 g0715, 132 g0716, 190 g0717, 190 g0718, 133 g0719, 134 g0720, 135 g0721, 135 g0722, 135 g0723, 138 g0724, 138 g0725, 191 g0726, 191 g0727, 191 g0728, 191 g0729, 139 g0730, 139 g0731, 196 g0732, 196 g0733, 196 g0734, 196 g0736, 111 g0737, 141 g0738, 144 g0739, 199 g0740, 204 g0741, 206 g0742, 206 g0743, 247 g0744, 150 g0745, 247 g0746, 251 g0747, 253 g0748, 253 g0749, 256 g0750, 256 g0751, 258 g0752, 258 g0753, 260 g0754, 260 g0755, 261 g0756, 164 g0757, 164 g0758, 167 g0759, 261 g0760, 167 g0761, 169 g0762, 169 g0763, 193 g0764, 193 g0765, 172 g0766, 172 g0767, 193 g0768, 261 g0769, 174 g0770, 175 g0771, 262 g0772, 262 g0773, 261 g0774, 262 g0775, 262 g0776, 263 g0777, 263 g0778, 264 g0781, 265 g0782, 265 g0783, 265 g0784, 176 g0785, 177 g0786, 178 g0787, 200 g0788, 200 g0789, 266 g0790, 201 g0791, 202 g0792, 267 g0793, 203 g0794, 204 g0795, 204 g0796, 205 g0797, 268 g0798, 270 g0799, 274 g0800, 206 g0801, 206 g0802, 276 g0803, 276 g0804, 206 g0805, 207 g0806, 208 g0807, 208 g0808, 209 g0809, 276 g0810, 213 g0811, 213 g0812, 215 g0813, 215 g0814, 217 g0815, 217 g0816, 276 g0817, 277 g0818, 277 g0819, 283 g0820, 219 g0821, 210 g0822, 211 g0823, 286 g0824, 292 g0825, 219 g0826, 219 g0827, 221 g0828, 221 g0829, 222 g0830, 223 g0831, 224 g0832, 225 g0833, 225 g0834, 225 g0835, 225 g0836, 225 g0837, 228 g0838, 230 g0839, 231 g0840, 195 g0841, 196 g0842, 232 g0843, 232 g0844, 292 g0845, 234 g0846, 235 g0847, 238 g0848, 292 g0849, 292 g0850, 239 g0851, 239 g0852, 242 g0853, 243 g0854, 243 g0855, 292 g0856, 245 g0857, 245 g0858, 245 g0859, 307 g0860, 309 g0861, 310 g0862, 315 g0863, 315 g0864, 317 g0865, 323 g0866, 323 g0867, 324 g0868, 148 g0869, 325 g0872, 149 g0873, 45 g0874, 45 g0876, 84 g0877, 84 g0878, 85 g0879, 85 g0880, 85 g0881, 87 g0882, 88 g0883, 88 g0884, 51 g0885, 51 g0886, 53 g0887, 91 g0888, 304 g0890, 325 g0891, 325 g0893, 94 g0894, 94 g0895, 94 g0896, 342 g0897, 342 g0898, 344 g0899, 344 g0900, 346 g0901, 348 g0902, 114 g0903, 114 g0904, 115 g0905, 115 g0906, 150 g0907, 151 g0908, 350 g0909, 116 g0910, 80 g0911, 82 g0912, 82 g0913, 103 g0914, 140 g0915, 140 g0916, 352 g0919, 357 g0920, 357 g0921, 359 g0922, 360 g0923, 360 g0924, 360 g0925, 362 g0926, 366 g0927, 367 g0928, 367 g0929, 368 g0930, 381 g0931, 233 g0932, 381 g0933, 381 g0935, 383 g0940, 383 g0947, 384 g0949, 384 g0950, 385 g0951, 385 g0952, 385 g0953, 385 g0954, 394 g0955, 396 g0956, 396 g0957, 396 g0958, 396 g0959, 397 g0960, 397 g0961, 397 g0962, 397 g0963, 397 g0964, 397 g0965, 397 g0966, 397 g0967, 397 g0968, 397 g0969, 402 g0970, 402 g0971, 402 g0972, 402 g0973, 403 g0976, 403 g0977, 403 g0978, 403 g0979, 403 g0980, 403 g0981, 403 g0982, 403 g0983, 403 g0984, 404 g0985, 404 g0986, 404 g0987, 404 g0988, 404 g0989, 405 g0990, 398 g0991, 399 g0992, 399 g0993, 399 g0994, 405 g0995, 400 g0996, 405 g0997, 400 g0998, 400 g0999, 400 g1000, 401 g1001, 401 g1002, 405 g1003, 401 g1004, 401 g1005, 405 g1006, 405 g1007, 405 g1008, 405 g1009, 406 g1010, 406 g1011, 406 g1012, 407 g1013, 407 g1014, 407 g1015, 407 g1016, 407 g1017, 407 g1018, 408 g1019, 408 g1020, 409 g1021, 410 g1022, 410 g1023, 410 g1024, 410 g1025, 410 g1026, 411 g1027, 411 g1028, 413 g1029, 417 g1035, 427 g1036, 429 g1037, 429 g1038, 429 g1039, 429 g1040, 429 g1041, 429 g1042, 429 g1043, 429 g1044, 429 g1045, 429 g1046, 429 g1047, 429 g1048, 429 g1049, 415 g1050, 415 g1051, 415 g1052, 415 g1053, 415 g1054, 415 g1055, 429 g1056, 429 g1057, 430 g1058, 430 g1059, 430 g1060, 430 g1061, 430 g1062, 430 g1063, 430 g1064, 430 g1065, 430 g1066, 430 g1067, 430 g1068, 430 g1069, 430 g1070, 430 g1072, 431 g1073, 431 g1074, 433 g1075, 433 g1076, 433 g1077, 433 g1078, 434 g1079, 434 g1080, 434 g1081, 434 g1082, 434 g1083, 434 g1084, 435 g1085, 435 g1086, 435 g1087, 435 g1088, 435 g1089, 435 g1090, 435 g1091, 436 g1092, 436 g1093, 436 g1094, 436 g1095, 436 g1096, 437 g1097, 437 g1098, 413 g1099, 413 g1100, 413 g1101, 414 g1102, 414 g1103, 414 g1104, 414 g1105, 414 g1106, 414 g1107, 414 g1108, 414 g1109, 414 g1110, 439 g1111, 439 g1112, 439 g1113, 439 g1114, 441 g1115, 441 g1116, 442 g1117, 442 g1118, 442 g1119, 442 g1120, 443 g1121, 443 g1122, 443 g1123, 443 g1124, 443 g1125, 443 g1126, 444 g1127, 444 g1128, 444 g1129, 444 g1130, 444 g1131, 444 g1132, 444 g1133, 444 g1139, 445 g1140, 445 g1141, 445 g1142, 445 g1143, 445 g1147, 446 g1150, 446 g1151, 446 g1152, 446 g1153, 446 g1154, 446 g1155, 446 g1156, 446 g1157, 446 g1158, 447 g1159, 447 g1160, 447 g1161, 447 g1162, 447 g1163, 448 g1164, 448 g1165, 449 g1166, 449 g1167, 449 g1168, 449 g1169, 449 g1170, 450 g1171, 450 g1172, 450 g1173, 450 g1174, 450 g1175, 450 g1176, 450 g1177, 452 g1178, 452 g1179, 454 g1180, 454 g1181, 454 g1182, 454 g1183, 454 g1184, 454 g1185, 454 g1186, 454 g1187, 455 g1188, 455 g1189, 456 g1190, 456 g1191, 456 g1192, 456 g1193, 456 g1194, 456 g1195, 456 g1196, 456 g1197, 456 g1198, 456 g1199, 457 g1200, 457 g1201, 457 g1202, 457 g1203, 457 g1204, 457 g1205, 458 g1206, 458 g1207, 458 g1208, 458 g1213, 461 g1214, 461 g1215, 461 g1216, 461 g1217, 463 g1218, 463 g1219, 464 g1220, 464 g1221, 464 g1222, 464 g1223, 465 g1224, 465 g1225, 465 g1226, 465 g1238, 467 g1239, 467 g1240, 467 g1241, 467 g1242, 467 g1243, 467 g1244, 467 g1245, 467 g1246, 467 g1247, 468 g1248, 468 g1249, 468 g1250, 468 g1251, 468 g1252, 468 g1253, 468 g1254, 468 g1255, 468 g1256, 469 g1257, 469 g1258, 469 g1259, 469 g1260, 469 g1261, 469 g1262, 469 g1265, 470 g1266, 470 g1267, 470 g1268, 470 g1269, 470 g1270, 470 g1271, 471 g1272, 471 g1273, 471 g1274, 472 g1275, 472 g1276, 472 g1277, 472 g1278, 472 g1279, 472 g1280, 472 g1281, 472 g1286, 424 g1287, 424 g1288, 424 g1290, 475 g1291, 475 g1292, 475 g1293, 476 g1294, 478 g1296, 478 g1297, 478 g1298, 478 g1299, 479 g1300, 479 g1301, 479 g1302, 479 g1303, 480 g1304, 480 g1305, 480 g1306, 480 g1307, 480 g1308, 481 g1309, 481 g1310, 481 g1311, 481 g1312, 481 g1313, 482 g1314, 482 g1315, 482 g1316, 482 g1317, 482 g1318, 482 g1319, 482 g1320, 482 g1321, 482 g1323, 483 g1324, 483 g1325, 484 g1326, 484 g1327, 485 g1328, 485 g1329, 485 g1330, 487 g1331, 487 g1332, 487 g1333, 488 g1334, 488 g1335, 500 g1336, 501 g1337, 501 g1338, 501 g1339, 501 g1340, 501 g1341, 503 g1342, 503 g1343, 503 g1344, 504 g1345, 504 g1346, 504 g1347, 504 g1348, 504 g1349, 504 g1350, 504 g1351, 504 g1373, 505 g1374, 505 g1375, 505 g1376, 505 g1377, 505 g1378, 505 g1379, 505 g1380, 505 g1381, 505 g1382, 506 g1383, 506 g1384, 506 g1385, 506 g1386, 506 g1387, 506 g1388, 506 g1389, 507 g1390, 507 g1391, 507 g1392, 508 g1393, 508 g1394, 510 g1395, 510 g1396, 510 g1398, 511 g1399, 511 g1400, 512 g1401, 512 g1402, 512 g1403, 512 g1404, 512 g1405, 513 g1406, 513 g1407, 513 g1408, 513 g1409, 513 g1410, 513 g1411, 513 g1412, 513 g1413, 514 g1414, 514 g1415, 514 g1416, 515 g1417, 517 g1418, 517 g1419, 517 g1420, 517 g1421, 517 g1422, 517 g1423, 517 g1424, 518 g1425, 518 g1426, 518 g1427, 518 g1428, 518 g1429, 520 g1430, 520 g1431, 521 g1432, 521 g1433, 521 g1434, 521 g1435, 521 g1436, 522 g1437, 522 g1438, 523 g1439, 524 g1440, 524 g1441, 524 g1442, 524 g1443, 524 g1444, 524 g1445, 524 g1446, 524 g1447, 525 g1448, 525 g1449, 525 g1450, 525 g1451, 525 g1452, 525 g1453, 525 g1454, 525 g1455, 526 g1456, 526 g1457, 526 g1458, 526 g1459, 526 g1460, 526 g1461, 526 g1462, 526 g1463, 526 g1464, 526 g1465, 526 g1466, 526 g1467, 526 g1468, 526 g1469, 526 g1470, 526 g1471, 527 g1472, 527 g1473, 527 g1474, 527 g1475, 527 g1476, 527 g1477, 528 g1478, 530 g1479, 530 g1480, 532 g1481, 532 g1482, 533 g1483, 534 g1484, 535 g1485, 536 g1486, 536 g1487, 536 g1488, 536 g1489, 536 g1490, 536 g1491, 537 g1492, 537 g1493, 538 g1494, 539 g1495, 539 g1496, 539 g1497, 539 g1498, 539 g1499, 539 g1500, 539 g1501, 539 g1502, 539 g1503, 540 g1504, 540 g1505, 540 g1506, 540 g1507, 540 g1508, 540 g1509, 540 g1510, 540 g1511, 541 g1512, 541 g1549, 543 g1550, 543 g1551, 543 g1552, 543 g1553, 543 g1554, 543 g1555, 543 g1556, 543 g1557, 543 g1558, 543 g1559, 543 g1560, 543 g1561, 543 g1562, 544 g1563, 544 g1564, 544 g1565, 544 g1566, 544 g1567, 544 g1568, 545 g1569, 545 g1570, 545 g1571, 545 g1572, 545 g1573, 545 g1574, 545 g1575, 545 g1576, 545 g1577, 545 g1578, 545 g1579, 545 g1580, 545 g1581, 545 g1585, 546 g1586, 546 g1587, 546 g1589, 546 g1591, 546 g1593, 548 g2752, 22 g2753, 22 g2754, 22 g2755, 22 g2756, 22 g2757, 22 g2758, 22 g2759, 22 g2760, 22 g2761, 22 g2762, 22 g2763, 22 g2766, 25 g2767, 26 gc-ncode, 428, 429, 525, 528 gc-ncode-defn, 429, 431, 433 gc-ncode-eval, 525 gc-ncode-ind, 525 gc-ncoden, 525, 527, 528 gc-ncoden-gcode, 527 gc-ncoden-gcode-again, 527 gcd, 491, 493, 495, 496 gcd-0, 491 gcd-distributes-over-an-opened-

up-times, 496 gcd-divides-both, 493 gcd-equal-0, 491 gcd-is-the-greatest, 493 gcode, 394, 401–405, 408–416, 419–

421, 426–428, 434–437, 439– 454, 457–465, 468–472, 474, 475, 478–482, 486–488, 503– 507, 509–513, 516–518, 521– 534, 537–542, 547–549

gcode-halve, 509 gcode-p, 446 generalise-proof, 52, 99, 144, 150,

180, 201, 243 generalise-proof-proves, 52 get, 235–240, 242–244, 248–250, 253–

256, 261, 263, 264, 278, 279, 281–283, 287–290, 337–339, 362–366, 380, 392, 406, 407, 431–433, 456

get-g-append-defn, 431 get-g-assoc-defn, 432 get-g-collect-free-defn, 432 get-g-conc-defn, 432 get-g-covering-defn, 432 get-g-decipher1-defn, 433 get-g-del-defn, 432 get-g-exp-defn, 433 get-g-formula-defn, 456 get-g-halve-defn, 433 get-g-inv-code-defn, 433 get-g-isthm-defn, 433 get-g-length-defn, 432 get-g-lessp-defn, 433 get-g-memb-defn, 432 get-g-nil-intersect-defn, 432 get-g-numeral-defn, 433 get-g-pairequals-defn, 432 get-g-plus-defn, 433 get-g-prf-defn, 432 get-g-rest-of-defn, 432 get-g-set-defn, 432 get-g-sub-defn, 432 get-g-subst-defn, 432 get-g-termp-defn, 432 get-g-times-defn, 433 get-g-var-list-defn, 432 get-gc-ncode-defn, 433 get-graph, 236–238, 240–244, 261,

362–365 get-list-f-equal, 94 get-sub1-n-nzerop, 431 getpf, 72, 73, 94, 360 getpf-proves, 72 getsub, 59, 60, 73, 94 getsub-del-pairs, 60 getsub-getpf, 94 getsub-not-memb, 60 getsub-proves, 73 good-frame1-proof, 250, 251, 382 good-frame1-proof-proves, 251 good-frame2-proof, 252–255, 385, 387,

389–391, 393 good-frame2-proof-proves, 252 good-frame2-proof-proves-again, 385 good-frame3-proof, 253, 255, 386–

389, 391–393 good-frame3-proof-proves, 253 graph-trans, 223–228, 236–244, 261,

271–276, 279–286, 295–303, 305, 307–311, 313, 314, 316, 317, 321–344, 362–365, 483

graph-trans-append-proof, 302, 303,

316 graph-trans-append-proof-proves, 303 graph-trans-merge, 227 graph-trans-merge-again, 323 graph-trans-merge-proof, 226, 227,

240, 242, 303, 316, 324, 329, 335, 340

greatereqpr, 495 greatereqpr-lessp, 495 greatereqpr-rem, 495 greatest-factor, 493, 494 greatest-factor-0, 493 greatest-factor-1, 494 greatest-factor-divides, 493 greatest-factor-lessp, 493

hack1, 495 halve, 498, 501, 502, 506, 509 halve-double, 502 halven-ind, 506

ident-axiom, 17 ident-axiom-proof, 17, 19, 75, 89,

102, 104, 110, 111, 125, 130, 137, 145, 171, 179, 182, 187, 189, 191, 193, 200, 204, 206, 208, 217–219, 221, 226, 235, 236, 245, 248, 249, 265–267, 275, 279, 285, 302, 353, 358, 361, 368, 369

ident-axiom-proves, 19 if-ev-graph1, 290 if-ev-graph2, 291 if-times-then-divides, 497 iff-commute-proof, 50, 121 iff-commute-proof-proves, 50 iff-join, 49 iff-join-proof, 49, 71, 78, 104, 105 iff-split-proof1, 49, 71, 105, 106, 109,

121, 122, 129, 130, 136, 139, 147, 198, 308

iff-split-proof2, 49, 71, 133, 138, 145,

238, 303, 309 iff-split1, 49 iff-split2, 49 imp-iff-forsome-proof, 87, 92 imp-iff-forsome-proof-proves, 87 imp-iff-implies-proof, 88, 93 imp-iff-implies-proof-proves, 88 imp-iff-not-proof, 85, 92 imp-iff-not-proof-proves, 85 imp-iff-or-proof, 85, 92 imp-iff-or-proof-proves, 85 implies-implies-proof, 83, 84 implies-implies-proof-proves, 84 in-append-graph-proof1, 307, 309, 313 in-append-graph-proof1-proves, 309 in-append-graph-proof2, 309, 310, 314 in-append-graph-proof2-proves, 310 in-graph-cdr-get-graph, 236 in-graph-cdr-proof, 238, 239, 242, 306,

309, 313, 314 in-graph-cdr-proof-proves, 239 in-graph-proof, 223, 224, 237, 244,

302, 343 in-graph-proof-proves, 224 in-graph-step-proof, 228 in-graph-step-proof-proves, 228 in-graph-trans-proof, 225, 226, 228,

238, 303, 308, 309 in-graph-trans-proof-proves, 226 in-z-succ-proof, 129, 130, 136, 138,

139, 145 in-z-succ-proof-proves, 130 in-z-succ-proof1, 139, 142 in-z-trans-proof, 132, 133 in-z-trans-proof-proves, 133 incompleteness-main-part, 547 incompleteness-theorem, 549 ind-axiom, 24, 25, 144 ind-axiom-case, 144 ind-axiom-case-proof, 144, 145 ind-axiom-proof, 25, 144 ind-axiom-proof-proves, 25 ind-form, 367, 375–380 index, 2, 4 index-fn, 4 index-not-equal, 95 index-p, 4 insert-proof, 29, 30 insert-proof-proves, 29 inst-conditions, 57, 58, 64 inst-formals-proof, 239–241, 322 instance-proof, 64, 66, 68, 204, 205,

212, 214, 216, 258 instance-proof-proves, 64 inv-code, 511–513, 518, 521–523, 529,

535–539, 541 inv-code-decipher, 518 inv-code-decipher-numcode, 539 inv-code-gcode, 513 inv-coden-ind, 512 isin, 12, 13, 22–24, 96–99, 101–109,

128–134, 136–143, 145–148, 223–228, 235, 237–245, 248– 251, 253–255, 267–274, 276– 286, 302, 303, 305, 307–310, 313, 314, 316, 317, 319–321, 323–325, 328, 329, 334, 335, 340–343, 345, 346, 348–357, 359, 360, 362–364, 366–368, 381–383, 385–393, 486, 524

isin-graph-trans-proof, 226, 227 isin-graph-trans-proof-proves, 227 isin-pair1-proof, 102, 106, 107, 146,

147 isin-pair1-proof-proves, 102 isin-pair2-proof, 102, 103, 106, 108,

109 isin-pair2-proof-proves, 103 isin-sing, 103 isin-sing-proof, 103–106, 129, 226 isin-sing1-proof, 104, 105, 147, 223 isin-sing1-proof-proves, 104 isthm-a-proves-a, 530 isthm-a-proves-a-proof, 529, 531, 532,

547–549 isthm-a-proves-not-a-proof, 532, 533,

547, 549 isthm-a-proves-not-a-proof-prove

s, 533

kludge-bridge, 495

lazy-pr-andn-reduc, 450 lazy-pr-andn-reduc2, 450 lazy-pr-andn-reduc3, 474 len-equal, 229, 231, 232, 234, 235 length, 7, 8, 10, 11, 18–20, 33, 34,

55–58, 61–69, 84, 94, 95, 138, 139, 207, 232, 233, 243, 260, 278, 302, 434–436, 439, 442, 443, 446, 447, 449, 454, 458, 461, 469, 470, 472, 474, 480, 500 length-append, 439 length-del, 439 length-delete, 500 length-exp-count, 439 length-listp-cdr, 449 length-make-newvars, 63 length-parallel-subst, 138 length-y-x-list, 500 lessp-comp-count1, 536 lessp-comp-count2, 536 lessp-comp-count3, 538 lessp-count-delete, 496 lessp-exp, 501 lessp-exp-count-final-count, 542 lessp-extras-comp-count, 536 lessp-length-termp-cnt, 449 lessp-list-count, 35 lessp-mk-bnd, 96 lessp-ncode-cnt-final-count, 542 lessp-num-final-count, 542 lessp-numcode, 502 lessp-numcode-again, 502 lessp-numcode-case, 502 lessp-numcode1, 501 lessp-plus-cancelation, 492 lessp-plus-cancellation3, 493 lessp-quotient1, 491 lessp-rem1, 491 lessp-rem2, 491 lessp-sub1-numcode, 502 lessp-symbols-termp-cnt, 449 lessp-thm-count1, 522 lessp-thm-count2, 523 lessp-times, 501 lessp-times-1, 491 lessp-times-2, 491 lessp-times-cancellation, 492 lesspn-ind, 507 lis-not, 45, 46 list-all-elim-proof, 67, 68 list-all-elim-proof-proves, 68 list-all-elim-proof-proves1, 68 list-all-quantify, 67–69, 243, 251, 253–

255, 278, 280, 342, 343, 382, list-and-join-proof, 206 list-and-join-proof-proves, 206 list-commute-equal-proof, 79 list-commute-equal-proof-proves, 79 list-count, 35 list-detach-proof, 26, 27, 45, 207, 231,

235, 245, 248 list-e-intro-proof, 65, 66 list-e-intro-proof-proves, 66 list-e-intro-proof-proves1, 66 list-exis-quantify, 64–67, 260 list-f-and, 76, 77, 82, 83, 89–93, 138,

172, 206, 229, 232–235, 239 list-f-and-member-proof, 76, 77, 83,

89 list-f-and-member-proof-proves, 77 list-f-equal, 77–79, 85, 88, 89, 91–

95, 139, 206, 207, 229, 231– 235, 239

list-f-iff, 71 list-f-implies, 83–85 list-gen-proof, 243, 244, 278, 282,

343 list-gen-proof-proves, 243 list-gen-proof-proves-again, 278 list-implies, 26, 27, 45, 75, 78, 84,

89, 93, 110 list-implies-implies-proof, 84 list-implies-implies-proof-prove

s, 84 list-implies-reduc, 45 list-num-nequal-proof, 163–165, 180 list-num-nequal-proof-proves, 163 list-symmetry-proof1, 84, 85 list-symmetry-proof1-proves, 85 listp-append, 178 listp-cond-proof1, 178–180, 187, 189 listp-cond-proof1-proves, 179 listp-cond-proof2, 182 listp-cond-proof2-proves, 182 listp-dble-neg-proof, 40 listp-eql, 4 listp-nor-type-proof, 38, 39 listp-parallel-subst, 262 little-step, 496

m-proof, 33, 37–39 m-proof-proves, 33 m-proof-proves1, 37 m1-proof, 28, 30, 33 m1-proof-proves, 28 m1-proof-proves1, 28 m2-proof, 30–33, 36 m2-proof-proves, 31 m2-proof-proves1, 31 m2-proof-step, 29, 30 m2-proof-step-proves, 30 m2-proof-step-proves1, 30 m3-proof, 31–33 m3-proof-proves, 32 m3-proof-proves1, 32 make-auxvars, 62, 64 make-chain, 85, 86 make-disjunct, 28, 30–33, 36–42, 44–

46 make-form-symb, 305–307, 311–316,

321, 324, 325 make-form-z-if, 174–178, 194, 195,

230, 231, 245–247 make-iff-chain, 86, 87 make-newvars, 62, 63 make-term-z-if, 168, 169, 171, 172,

184, 185 memb, 4–8, 12–14, 16, 19–21, 23,

24, 51, 53, 56, 60, 64–66, 70, 73, 95, 96, 157, 436, 442

memb-del, 7 memb-fn, 95 memb-member, 19 memb-member-numberp, 51 memb-p, 95 memb-rest-of, 20 member-append, 26 member-del, 52 member-del1, 54 member-delete, 496 member-ev-graph1, 289 member-eval, 42 member-falsify, 44 member-fun-graph, 290 member-get-graph, 236 member-if-graph1, 291 member-if-graph2, 291 member-length, 500 member-list-graph, 291 mk-bnd, 96–99, 128, 129, 140 mk-bnd-nequal, 96 mk-bnd-not-free1, 96 mk-bnd-not-free2, 97 mk-bnd-not-free3, 97

ncode, 164–167, 180–183, 187, 189, 191, 193, 200–205, 208–224, 226–228, 232, 236–238, 240, 241, 243, 244, 247–250, 253– 257, 260, 261, 263–286, 292, 295–303, 307, 308, 316, 319– 321, 323–325, 342, 344–376, 378–393, 483–488, 524, 527, 530–534, 540, 541, 546–549

ncode-cnt, 527, 529, 533, 534, 540–

542 ncode-cons, 265 ncode-equal, 164, 165, 167, 204–206,

221, 267, 269, 273, 287–289, 291, 299, 300, 329, 353, 355, 368, 377, 388, 395, 397–400, 435, 486, 488, 512, 513

ncode-equal-ident-axiom-proof-p

roves, 368 ncode-equal-ncode-equal, 204 ncode-equal-reflex, 435 ncode-gcode-equal, 435 ncode-ind, 527 ncode-nequal-bool-fix-t-f, 488 ncode-nequal-proof, 165–167, 193, 204,

217–219, 221, 236, 247, 267, 299, 353, 369–372, 485

ncode-nequal-proof-proves, 167 ncode-nequal-proof-proves-again, 167 ncode-nequal-proof-proves-case, 299 ncode-nequal-step-proof, 164–166 neg, 34, 36 neg-elem-form, 34 neg-list, 34, 36, 37, 41–44 neg-list-eval, 42 neg-list-eval1, 42 neg-list-proof, 36, 37 neg-list-proof-proves, 36 neg-proof, 36 neg-proof-proves, 36 nequal-perm-y-x-list, 499 nequal-perm-y-x-list-another, 499 nequal-perm-y-x-step, 499 newvar-unchanged-by-parallel-su

bst, 60 newvars-make-newvars, 62 nil-int-a-ev-defn, 385 nil-intersect, 6, 53, 55–57, 61–63, 97,

98, 132–134, 149, 154, 155, 160, 178, 198, 200, 351, 375, 377–380, 385, 443

nil-intersect-append, 55 nil-intersect-cons, 53 nil-intersect-cons2, 56 nil-intersect-del, 97 nil-intersect-ind, 443 nil-intersect-newvars-exp, 63 nil-intersect-newvars-terms, 63 nil-intersect-newvars-vars, 63 nil-intersect-nil, 53 nil-intersect-subst, 55 nil-list-collect-free, 262 nlistp-dble-neg-proof, 39, 40 nlistp-form-equal, 95 nlistp-graph-trans, 228 nlistp-ncode, 232 nlistp-nil-intersect, 178 nlistp-nnumberp-ncode, 355 nlistp-nor-type-proof, 38, 39 nlistp-proves, 22 nlistp-term-equal, 95 nor-proof, 39, 41 nor-type, 35, 40, 43 nor-type-list-count1, 35 nor-type-list-count2, 35 not-eval-prop-atomp, 44 not-falsify-taut, 43 not-free-covering, 54 not-free-del-pairs-parallel-sub

st, 94 not-free-elim-free-terms, 82 not-free-for-list, 178 not-free-free-for, 178 not-free-in-terms-step, 60 not-free-list-all, 68 not-free-list-exis, 66 not-free-parallel-subst, 98 not-free-subst, 154 not-function, 4 not-iff-proof, 71, 73 not-iff-proof-proves, 71 not-int-opair-proof, 148, 163, 191,

193, 202 not-int-opair-proof-proves, 148 not-isthm-a-proves-a-proof, 533, 534,

548, 549 not-isthm-a-proves-a-proof-prove

s, 534 not-isthm-a-proves-not-a, 531 not-length-cdr, 449 not-memb-del, 5 not-memb-del2, 66 not-member-del-pairs, 64 not-member-delete-equals, 65 not-member-delete2, 55 not-member-varlist, 62 not-member-y-x-list, 499 not-perm-nequal, 500 not-perm-numcode, 499 not-predicate, 4 not-taut-false, 44 not-taut-falsify2, 45 null-axiom, 23 null-axiom-proof, 23, 136, 141, 146,

147, 165, 166, 201, 240, 309, 329, 335, 340

null-axiom-proof-proves, 23 num-treep, 497, 510, 513, 518, 527,

539 num-treep-decipher1, 518 num-treep-gcode, 510 num-treep-num-treep, 539 numberp-eql, 4 numberp-fix, 2 numberp-gcd, 491 numberp-gcode, 439 numberp-gcode-equal, 449 numberp-greatest-factor, 494 numberp-ncode-equal, 435 numcode, 498, 502, 503, 539–541 numcode-nequal, 501 numcode-reduc, 501 numcode-uniqueness1, 499 numcode-uniqueness2, 500 numeral, 135–138, 141–143, 149, 150,

163, 164, 179, 180, 191, 232, 482, 525

numeral-gcode, 525 numeral-ind, 482 numeral-not-listp-proof, 179, 180, 182,

187, 189 numeral-not-listp-proof-proves, 180 numtreep, 502, 503, 539 nzerop-ncode-equal, 206 nzerop-z-sub1-ncode-proof, 202

odd-rem-two, 498

opair-equal-proof, 224, 225, 231 opair-equal-proof-proves, 225 or-iff-proof, 72, 73 or-iff-proof-proves, 72 or-memb-append, 7

p, 2, 4, 7, 12, 23–25, 75, 76, 95, 96, 98, 99, 102, 105–107, 109– 112, 127, 129–134, 137, 138, 140, 143, 145–150, 152, 154, 155, 157, 158, 160, 162, 163, 167, 171, 179–183, 187, 189– 193, 198, 200–203, 205, 207, 209, 210, 218, 220, 222, 224, 226–229, 234, 235, 238, 239, 242, 244, 245, 248, 250, 252, 256, 259, 260, 262–264, 266, 269, 272, 275, 277, 282, 285, 296–299, 302, 303, 307, 309, 310, 315, 316, 322–325, 341, 345, 351, 355, 359, 361, 365, 368, 384, 542, 546

pair-axiom, 23 pair-axiom-proof, 23, 24, 101–103,

109, 147 pair-axiom-proof-proves, 24 pairequals, 9–11, 17, 18, 78, 458 pairequals-ind, 458 pairequals-reduc, 78 pairlist, 65 par-subst, 56–58, 61, 64 par-subst-collect-free, 56 par-subst-covering, 56 par-subst-proof, 58, 64 par-subst-proof-proves, 58 par-subst-proof-proves1, 64 parallel-subst, 59–61, 64, 65, 67, 69,

70, 82, 94–96, 98, 100, 101, 104, 115, 116, 125, 127, 138, 139, 151, 184, 196, 232, 233, 260–262, 282, 323, 347, 360, 383, 484

parallel-subst-a-ev-defn-part1, 323 parallel-subst-a-ev-defn-part1-

again, 383 parallel-subst-f-and, 82 parallel-subst-f-equal, 125 parallel-subst-f-if, 115 parallel-subst-f-iff, 98 parallel-subst-f-implies, 65 parallel-subst-forall, 70 parallel-subst-graph-trans, 261 parallel-subst-isin, 96 parallel-subst-list-all-quant, 67 parallel-subst-list-exis-quant, 65 parallel-subst-ncode, 261 parallel-subst-nil, 61 parallel-subst-not-free-var, 61 parallel-subst-phi, 116 parallel-subst-same-as-par-subst, 61 parallel-subst-subst, 61 parallel-subst-subst-case, 196 parallel-subst-trace-a-ev-defn, 484 parallel-subst-trace-a-ev-defn-p

art1, 484 parallel-subst-var, 360 parallel-subst-z-car, 184 parallel-subst-z-cdr, 184 parallel-subst-z-int, 151 parallel-subst-z-list, 262 parallel-subst-z-opair, 151 parallel-subst-z-pair, 100 parallel-subst-z-sing, 104 parallel-subst-z-sub1-n, 282 parallel-subst-z-succ, 127 parallel-subst-z-union, 101 perm, 496–500 perm-append-x-x, 500 perm-length, 500 perm-y-x-ind, 498 perm-y-x-list-append, 498 phi, 12, 13, 23, 24, 116, 135, 136,

141, 144–148, 155, 156, 161, 162, 181, 183, 185–193, 197– 199, 201, 203, 204, 223, 228, 240, 257, 527

phi-in-int-proof, 145, 146, 148 phi-in-int-proof-proves, 145 phi-not-in-opair-proof, 146–148 phi-not-in-opair-proof-proves, 147 plus-add1, 489 plus-cancellation, 489 plus-double, 500 plus-equal-0, 489 plus-right-id2, 489 plusn-ind, 503 pr-add1, 395, 396, 411, 426, 428,

515 pr-add1-eval, 396 pr-add1n, 395, 396, 447, 503, 505,

514, 516, 519 pr-add1n-gcode, 503 pr-and, 398, 410–413, 415–420, 425,

427 pr-and-eval, 398 pr-andn, 398, 443, 445, 448, 450,

454, 455, 457, 459–463, 469, 471, 474, 481, 507, 517

pr-andn-reduc, 398 pr-andn-t-or-f1, 517 pr-andn-t-or-f2, 517 pr-car, 394, 396, 399, 400, 428, 429,

511, 525 pr-car-cdr, 400 pr-car-eval, 396 pr-carn, 395, 396, 399–401, 510, 511,

525 pr-carn-gcode, 401 pr-carn-reduc1, 511 pr-carn-reduc2, 511 pr-cdr, 394, 396, 400, 428, 429, 511,

525 pr-cdr-eval, 396 pr-cdrn, 395, 396, 400, 401, 510, 511,

525 pr-cdrn-gcode, 401 pr-cdrn-reduc, 511 pr-cdrn-reduc1, 511 pr-cons, 394, 396, 398, 404, 427 pr-cons-eval, 396 pr-consn, 395, 396, 403, 404, 508 pr-equal, 394, 396, 399, 402, 405,

408, 411–413, 416–420, 424, 425, 427, 428

pr-equal-eval, 396 pr-equaln, 395, 396, 399, 402, 405,

435, 436, 445, 446, 448, 450, 451, 459–463, 469, 471, 481, 508, 510–513

pr-equaln-reduc, 445 pr-equaln-reduc2, 512 pr-equaln-reduc3, 513 pr-if, 397–400, 403, 406–413, 415,

416, 418, 420, 425–429 pr-if-eval, 397 pr-ifn, 400, 403, 406, 434–437, 440, 441, 443, 445, 447, 448, 451, 452, 454, 455, 457, 460, 463, 469–471, 482, 503–506, 508, 511, 514, 516, 519, 525, 538

pr-ifn-gcode, 406

pr-listp, 395, 397, 428, 429

pr-listp-eval, 397 pr-listp-reduc1, 511 pr-listp-reduc2, 511 pr-listpn, 396, 397, 510, 511, 525 pr-not, 398, 410, 416, 420, 424 pr-not-eval, 398 pr-notn, 398, 399, 443, 445, 462, 469,

471 pr-notn-reduc, 399 pr-numberp, 394, 396, 402, 403 pr-numberp-eval, 396 pr-numberpn, 395, 396, 402, 403 pr-or, 399, 405, 410, 411 pr-or-eval, 399 pr-orn, 399, 405, 445, 446 pr-orn-reduc, 399 pr-quote, 397–400, 402–405, 408–413,

415–421, 424–428, 438, 441, 442, 448, 452, 453, 455, 471, 476, 477, 528, 529, 532–534

pr-quote-eval, 397

pr-sub1, 395, 396, 410, 426, 427, 445, 482, 503, 505–508

pr-sub1-eval, 396

pr-sub1n, 396, 410, 445, 482, 503–

508, 510 pr-sub1n-gcode, 410 pr-zerop, 394, 396, 408–411, 416, 424,

426, 427 pr-zerop-eval, 396 pr-zeropn, 395, 396, 436, 440, 442,

445, 447, 451, 470, 482, 503– 507 pr-zeropn-gcode, 442 pred-defn-proof, 20, 149 pred-defn-proof-proves, 20 predicate, 2, 4, 5, 7, 8, 11, 14, 19, 20, 34, 405, 474 predicate-p, 2 prf, 16, 480 prf-cnt, 479–481, 521, 522, 535 prf-cnt-part, 478–480 prf-ind, 478, 479 prime, 493, 494, 496, 497, 499 prime-2, 499 prime-3, 499 prime-basic, 495 prime-factorization-existence, 494 prime-factorization-uniqueness, 497 prime-factors, 494 prime-gcd, 495 prime-key, 496 prime-list, 494, 496, 497, 499 prime-list-append, 494 prime-list-delete, 496 prime-list-prime-factors, 494 prime-list-times-list, 497 prime-list-y-x-list, 499 prime-member, 497 prime1, 493–495, 499 prime1-3-2, 499 prime1-basic, 495 prop-atom-proof1, 37, 41 prop-atom-proof1-proves, 37 prop-atom-proof2, 38, 41 prop-atom-proof2-proves, 38 prop-atomp, 34 prop-atomp-list, 43–45 prop-atomp-list-eval, 44 prop-axiom, 17 prop-axiom-proof, 17, 18, 25, 36, 38–

40, 65, 67, 104, 105, 153, 156, 160, 161, 181, 183

prop-axiom-proves, 18 proves, 16, 18–33, 36–38, 41, 44, 46–

54, 58, 59, 64–80, 82–88, 90, 93, 96, 98–100, 102–120, 122, 124–135, 138, 140, 144, 146–150, 152, 154–158, 160– 164, 167, 169, 170, 172, 173, 175–183, 185, 187, 189–196, 199–207, 209–211, 213, 215, 217, 219, 221, 222, 224–235, 238, 239, 242, 243, 245–247, 250–253, 256, 258, 260, 261, 263, 264, 266, 267, 269, 270, 273, 274, 276–278, 282, 283, 286, 298–301, 303, 304, 307, 309, 310, 315–317, 323–325, 342, 344, 346, 347, 351, 352, 355, 356, 359, 362, 366–368, 375–381, 384, 385, 394, 481, 483, 484, 486, 488, 522, 523, 531–539, 541, 547, 548, 550

proves-eql, 73

proves-form-z-if-eval, 176–178, 245 proves-form-z-if-exis, 174–176 proves-form-z-if-ok, 230, 231 proves-inv-code-decipher, 539 proves-is-formula, 25 proves-is-formula-again, 25 proves-isthmn-ind, 535, 536 proves-list, 27, 46, 72–75, 78, 79,

84–88, 91, 117, 119, 206, 207, 231, 232

proves-list-form-list, 46 proves-list-nil, 117 proves-list-reduc, 119 proves-rec-form-z-if-eval, 245–247 proves-t-not-btmp-isthmn, 536 proves-z-if, 170, 172

quotient-divides, 496 quotient-lessp, 494 quotient-times, 497 quotient-times1, 494

rec-form-z-if-eval-proof, 246, 247, 249,

355, 374 rec-form-z-if-eval-proof-proves, 246

-again, 247 rem, 489–493, 495–499 rem-0-crock, 493 rem-add1, 492 rem-gcd, 495 rem-gcd-1, 495 rem-quotient, 490 rem-quotient-elim, 491 rem-rec-reduc, 499 rem-times, 496 rem-wrt-1, 490 rem-wrt-12, 491 rem-x-x, 491 rem32, 499 rename-bndvar-proof, 154, 155, 160 rename-bndvar-proof-proves, 154 rename-forall-proof, 196 rename-forall-proof-proves, 196 replace-va-a-ev2, 486 replace-va-a-undec1, 524 replace-va-forall-a-ev2, 486 replace-va1-a-ev2, 486 rest-of, 14–16, 19, 20, 126, 149, 157,

162, 186, 188, 190, 192, 200, 204, 205, 212, 214, 216, 258, 472, 474, 479, 480

rt-assoc-proof, 29, 30, 39 rt-assoc-proof-proves, 29 rt-expan-proof, 27, 28, 30, 38, 39,

102, 130, 145, 223, 226 rt-expan-proof-proves, 27

s-and, 304 s-andp, 304–307, 310–312, 314 s-bind, 304, 306, 310–313 s-body, 304–307, 310–314 s-conc, 304–307, 310–312, 314 s-conj1, 304–307, 310–312, 314 s-conj2, 304–307, 310–312, 314 s-elem, 305–307, 310, 311, 313, 314 s-forall, 304 s-forallp, 304–307, 310–313 s-implies, 304 s-impliesp, 304–307, 310–312, 314 s-isin, 304 s-isinp, 305–307, 310, 311, 313, 314 s-prem, 304, 305, 307, 310, 311 s-set, 305, 307, 310, 311 second, 10–16, 461, 464, 468, 474,

478–480 sentence, 6 set, 14, 15, 19, 20, 469 sing-pair-equal-proof-proves, 107 sing-pair-equal-proof1, 106, 107 sing-pair-equal-proof1-proves, 106 sing-pair-equal-proof2, 106, 107, 109 sing-sing-equal-proof, 105, 107 sing-sing-equal-proof-proves, 105 some-disproof1, 549, 550 some-disproof2, 549, 550 some-proof1, 549, 550 some-proof2, 549, 550 stack-and-implies, 172, 173, 175, 176 sub, 8, 9, 15, 454 sub-rvar-proof, 366, 367, 369–373 sub-rvar-proof-proves, 367 sub-subset, 9 sub1-n, 276–279, 281, 283, 287–290,

337–339, 360–366, 380, 392, 406, 407, 431–433, 456

subr-member-graph, 289

subrp, 258

subset, 8, 9, 19, 20, 23–25, 32, 33, 37, 67, 68, 82, 83, 102, 105– 107, 109, 126, 127, 130, 131, 134, 138, 143, 144, 146–150, 152, 154–158, 160–163, 167, 179–183, 186–193, 198, 200– 205, 208–210, 212–218, 220, 222, 226–229, 234, 238, 239, 242, 244, 250, 252, 256, 258– 260, 262–264, 266, 269, 272, 275, 277, 282, 285, 296–299, 303, 307, 309, 310, 315, 316, 322–325, 341, 345, 351, 355, 359, 361, 365, 368, 384, 546

subset-append, 37 subset-append-car, 37 subset-append-reduc, 126 subset-car, 37 subset-cons, 32 subset-del, 149 subset-elim-free-terms, 82 subset-ident, 37 subset-list-f-and-proof, 83, 92 subset-list-f-and-proof-proves, 83 subset-thm-symbs, 546 subst, 8–10, 13–15, 17–20, 24, 52–

58, 60, 61, 66, 70, 82, 95, 96, 100, 101, 104, 115, 116, 127, 144, 148, 151, 154, 184, 194–196, 261, 454, 486, 487, 521–524, 529–534, 539–541

subst-axiom, 17 subst-axiom-proof, 17, 18, 52, 53,

154 subst-axiom-proves, 18 subst-covering-unchanged, 55 subst-f-and, 82 subst-f-equal, 9 subst-f-if, 115 subst-f-iff, 148 subst-f-implies, 66 subst-flg, 52 subst-forall, 70 subst-formula, 18 subst-graph-trans, 261 subst-ident, 54 subst-ind, 453 subst-isin, 96 subst-length, 18 subst-ncode, 261 subst-parallel-subst, 61 subst-phi, 116 subst-rule-proof, 52, 53, 58, 127, 148,

149, 157, 162, 186, 188, 190, 192, 200, 367, 485, 488

subst-rule-proof-proves, 53 subst-subst, 154 subst-termp, 18 subst-thm-a, 67 subst-thm-a-proof, 66, 67, 104, 125,

179, 182, 201, 260 subst-thm-b, 69 subst-thm-b-proof, 68, 69, 97, 99,

105, 129, 132, 139, 196, 252, 363, 383

subst-var-var, 53 subst-z-car, 184 subst-z-cdr, 184 subst-z-int, 151 subst-z-opair, 151 subst-z-pair, 100 subst-z-sing, 104 subst-z-succ, 127 subst-z-union, 101 symb, 7, 8, 18–20, 95, 100, 207, 209,

210, 446 symb-defn-proof, 14, 16, 475 symb-equals, 95 symb-reduc, 100 symmetry-proof, 78, 79 symmetry-proof1, 75, 76, 78, 79, 84,

88, 89, 106, 109, 111, 112, 131, 165, 166, 181, 183, 195, 201, 232, 302

symmetry-theorem, 79 symmetry-theorem1, 76

taut-conseq, 45, 46 taut-conseq-proves, 46 taut-eval, 42 taut-eval2, 45 taut-proof, 44, 45 taut-proof1, 40, 41, 44 taut-thm1, 41 taut-thm2, 41 tautconseq-proof, 45–52, 54, 71–75,

77, 80, 81, 83–85, 88, 97, 99, 101, 103, 109–126, 131, 133–138, 140–148, 152, 153, 155, 156, 158, 160, 161, 163, 166, 168, 169, 173, 195, 197– 199, 201–203, 225, 226, 233, 234, 238–240, 248, 250, 252, 253, 279, 303, 305, 306, 309– 314, 329, 335, 340, 347, 350, 358, 361, 365, 370, 372, 374, 485 tautologies-are-true, 45 tautology-theorem, 44 tautologyp, 44–46 tautologyp1, 35, 36, 41–45 term-equal, 89–91, 94, 95, 101, 104,

107 term-equal-parallel-subst, 94 term-equal-proof, 89–93 term-equal-proof-proves, 90 term-equal-proof-proves1, 90 term-equal-proof-proves2, 91 term-equal-subst, 95 term-equal-z-opair, 107 term-equal-z-pair, 101 term-equal-z-sing, 104 term-equal-z-union, 101 term-graph-trans-case, 325 term-list, 78, 85, 91, 232, 233 term-list-termp, 233 term-list-var-list, 232 term-ncode-case, 325 term-z-if, 168, 169, 171, 172, 185 term-z-if-exis-proof, 168, 169, 185,

188, 190, 192, 204, 211, 213, 215, 257

term-z-if-exis-proof-proves, 169 term-z-if-exis-proof-proves1, 169 term-z-if-unique-proof, 184, 185, 188,

190, 192, 204, 212, 214, 216, 257

term-z-if-unique-proof-proves, 185 term-z-if-unique-proof-proves1, 185 term-z-sub1-n, 277 termp, 7–11, 13, 18–20, 23, 24, 34,

53, 57, 64, 67, 69, 78, 90, 94–96, 98–101, 103, 105– 107, 109–112, 116, 126–135, 138, 140, 143, 145–149, 152, 154–158, 160, 162–164, 168, 171, 172, 177–179, 182, 184, 187, 189, 190, 192, 198, 200, 204, 205, 207–210, 213, 215, 217, 224–229, 231–234, 239, 245, 247, 250, 252, 256, 258, 260, 263, 264, 266, 269, 277, 303, 307, 309, 310, 322, 323, 325, 345, 347, 367, 368, 449,

546 termp-car-cdr, 234 termp-cnt, 449, 450, 457, 461, 468 termp-covering, 110 termp-del-pairs, 138 termp-graph-trans, 224 termp-if, 247 termp-ind, 448, 449 termp-ncode, 164 termp-numeral, 135 termp-parallel-subst, 138 termp-phi, 116 termp-rest-of, 20 termp-term-list, 78 termp-termp1, 34 termp-z-car, 184 termp-z-car-cdr, 208 termp-z-cdr, 184 termp-z-list, 228 termp-z-opair, 107 termp-z-opair-case, 323 termp-z-pair, 101 termp-z-sing, 103 termp-z-succ, 127 termp-z-union, 101 termp1, 33, 34 third, 10–15, 461, 464, 468, 474, 478 thm-count, 521–523, 529, 539 thm-count-thm-count1, 539 thm-count1, 534–536, 538, 539 thm-count1-lessp, 535 thm-count1-lessp1, 535 thm-defns, 542, 544–550 thm-symbs, 542, 544–550 times-2-double, 500 times-add1, 490 times-difference, 492 times-double, 500 times-equal-1, 497 times-id-iff-1, 495 times-identity, 495 times-identity1, 495 times-list, 494, 496–499 times-list-append, 494 times-list-append23-numcode, 499 times-list-delete, 497 times-zero2, 490 trans-equal-proof-proves, 110 trans-equal-proof1, 110, 111, 152, 158,

195 trans-equal-proof2, 110–112, 126, 142,

199 trans-equal-proof2-proves, 111 trans-equal-proof3, 111, 358, 372 trans-equal-proof3-proves, 111 trans-f-iff-proof, 48, 87 trans-implies-proof, 47, 65, 67, 69,

70, 86, 248, 249 trans-not-equal-proof, 195, 236, 247,

369–372 trans-not-equal-proof-proves, 195 transitivity-of-iff, 48 transitivity-of-implies, 47 truths-are-tautologies, 45 turn-off-lisp-defns, 2

undec-count, 529–531, 541 undec-count-lessp, 541 undec-sent, 540, 547, 548 undecidable-sentence, 548–550 union-axiom, 24 union-axiom-proof, 24, 129, 223, 224,

226 union-axiom-proof-proves, 24 unique-f-if-proof, 124, 156, 162, 184,

194 unique-f-if-proof-proves, 124 unique-fun-intro-proof, 126, 127, 156,

162, 184, 199, 205 unique-fun-intro-proof-proves, 126

v, 2 var-covering-var, 53 var-list, 7, 15, 19, 20, 62, 63, 94,

95, 132, 139, 180, 185, 194, 195, 232, 233, 243, 278, 302, 445

var-list-del, 94 var-list-length, 20 var-list-termp, 20 var-list-var-set, 63 var-listn-ind, 445 var-set, 55–58, 61–69, 132–134, 154–

156, 160, 161, 196, 242, 244, 252, 256, 260, 261, 263, 264, 285, 351, 355, 359, 362, 365, 367, 374–380

var-set-length, 55

var-set-make-newvars-again, 63 var-set-make-newvars-step, 62 variable, 2, 6–8, 10, 12, 13, 15, 18,

19, 21, 23, 25, 33, 51–61, 68–71, 80, 81, 87, 94, 95, 99, 105, 117–120, 122, 123, 125, 126, 139, 144, 145, 148, 149, 154, 157, 169, 173, 175, 176, 201, 202, 272, 275, 344, 347, 381, 383–385, 393, 403, 439, 453, 483

variable-v, 2

variablep-collect-free, 52

weaken-append1, 310, 315, 316, 321 weaken-append1-a-ev-defn-part, 321 weaken-append1-proof, 311–313, 315,

316 weaken-append1-proof-proves, 315 weaken-append2, 311, 315, 316, 321 weaken-append2-a-ev-defn-part, 321 weaken-append2-proof, 313–316 weaken-append2-proof-proves, 315 weaken-isin, 304, 307, 324, 325 weaken-isin-a-ev-defn-part, 325 weaken-isin-proof, 305–307, 324 weaken-isin-proof-proves, 307

x-in-z-succ-x, 130

x-in-z-succ-x-proof, 130, 165, 166, 201

y-x-list, 498–500

z-add1, 188, 189, 213, 214, 220, 543 z-add1-defn, 188, 189, 543 z-add1-defn-proof, 188, 189 z-add1-defn-proof-proves, 189 z-add1-ev-hyps, 544 z-add1-exis-proof, 188 z-add1-hyps, 188, 189, 220, 222, 544 z-add1-ncode-proof, 189, 219 z-add1-ncode-proof-proves, 189 z-add1-unique-proof, 188 z-apply-subr, 215–217, 221, 222, 274,

275, 320, 357, 358, 543 z-apply-subr-all-hyps, 222, 275, 297,

341, 359 z-apply-subr-defn, 215–217, 543 z-apply-subr-defn-proof, 216, 217, 221 z-apply-subr-defn-proof-proves, 216 z-apply-subr-ev-hyps, 545 z-apply-subr-exis-proof, 215, 216 z-apply-subr-hyps, 216–218, 220, 222,

545 z-apply-subr-ncode-proof, 221, 222,

275, 358 z-apply-subr-ncode-proof-proves, 222 z-apply-subr-unique-proof, 215, 216 z-apply-subr1, 211–214, 218–220, 543 z-apply-subr1-defn, 211–213, 543 z-apply-subr1-defn-proof, 212, 213,

218 z-apply-subr1-defn-proof-proves, 212 z-apply-subr1-ev-hyps, 544 z-apply-subr1-exis-proof, 211, 212 z-apply-subr1-hyps, 212, 213, 218,

220, 222, 544 z-apply-subr1-ncode-proof, 217, 219,

220 z-apply-subr1-ncode-proof-prove

s-step, 218 z-apply-subr1-unique-proof, 211, 212 z-apply-subr2, 213–216, 220, 221, 543 z-apply-subr2-defn, 213–215, 543 z-apply-subr2-defn-proof, 214, 215,

220 z-apply-subr2-defn-proof-proves, 214 z-apply-subr2-ev-hyps, 545 z-apply-subr2-exis-proof, 213, 214 z-apply-subr2-hyps, 214, 215, 220,

222, 545 z-apply-subr2-ncode-proof, 219, 221 z-apply-subr2-ncode-proof-prove

s-step, 220 z-apply-subr2-unique-proof, 213, 214 z-car, 151, 157, 180, 181, 183, 184,

208–216, 218, 220, 221, 236, 237, 241, 247–249, 270–272, 274, 275, 277–281, 283–285, 292, 296, 297, 319, 320, 348, 349, 352, 353, 357, 358, 360– 362, 364, 370–372, 542 z-car-cdr, 208, 209, 268–272, 292,

296, 319, 320, 353–355, 371 z-car-cdr-proof, 208–210, 268, 272, 353, 354, 371 z-car-cdr-proof-proves, 209 z-car-defn, 155–157, 542 z-car-defn-proof, 157, 181 z-car-defn-proof-proves, 157 z-car-exis-proof, 155–157 z-car-exis-proof-proves, 156 z-car-hyps, 157, 181, 209, 210, 219,

220, 222, 238, 242, 244, 250, 256, 261, 263, 264, 269, 272, 282, 285, 351, 355, 361, 365, 544

z-car-ncode-proof, 180, 181, 208–210, 218, 236, 248, 275, 279, 284, 349, 358, 361, 371

z-car-ncode-proof-proves, 181

z-car-unique-proof, 107, 108, 112, 152, 165, 181, 229, 234

z-car-unique-proof-proves, 107 z-car-unique-step1-proof, 151–153 z-car-unique-step1-proof-proves, 152 z-car-unique-step2-proof, 152, 154,

155 z-car-unique-step2-proof-proves, 154 z-car-uniqueness-case-proof, 155, 156 z-car-uniqueness-case-proof-prove

s, 155 z-car-uniqueness-proof, 156, 157 z-cdr, 151, 162, 163, 182–184, 208,

210–212, 215, 216, 218, 221, 236, 237, 241, 242, 248, 249, 270–272, 274, 277, 279–281, 284, 285, 319, 320, 348–350, 352, 353, 357, 362–364, 542

z-cdr-defn, 161–163, 542 z-cdr-defn-proof, 162, 163, 183 z-cdr-defn-proof-proves, 162 z-cdr-exis-proof, 161, 162 z-cdr-exis-proof-proves, 161 z-cdr-hyps, 162, 183, 209, 210, 219,

220, 222, 238, 242, 244, 250, 256, 261, 263, 264, 269, 272, 282, 285, 351, 355, 361, 365, 544

z-cdr-ncode-proof, 182, 183, 208, 218, 237, 249, 275, 281, 285, 350, 357, 364

z-cdr-ncode-proof-proves, 183 z-cdr-unique-proof, 111, 112, 158, 165,

183, 229, 234 z-cdr-unique-proof-proves, 112 z-cdr-unique-step, 109 z-cdr-unique-step-proof, 108, 109, 112 z-cdr-unique-step1-proof, 157–159 z-cdr-unique-step1-proof-proves, 158 z-cdr-unique-step2-proof, 158, 160 z-cdr-unique-step2-proof-proves, 160 z-cdr-uniqueness-case-proof, 160–162 z-cdr-uniqueness-case-proof-prove

s, 160 z-cdr-uniqueness-proof, 162 z-cons, 205, 211, 212, 218, 543 z-cons-defn, 205, 543 z-cons-defn-proof, 205, 217 z-cons-defn-proof-proves, 205 z-cons-ev-hyps, 544 z-cons-hyps, 205, 219, 220, 222, 544 z-equal, 203–205, 215, 216, 221, 543 z-equal-defn, 203, 204, 543 z-equal-defn-proof, 203, 204 z-equal-defn-proof-proves, 204 z-equal-ev-hyps, 544 z-equal-hyps, 204, 205, 222, 544 z-equal-ncode-proof, 204, 205, 221 z-equal-ncode-proof-proves, 205 z-ev-defn-part, 292, 295, 296, 298,

368, 374 z-if, 167, 181, 183, 185, 187–193,

197, 204, 211–216, 218, 220, 221, 237, 249, 257, 268, 292, 355 z-if-eval-proof, 170–172 z-if-eval-proof-proves, 172 z-if-eval-proof-proves1, 172 z-if-eval-proof1, 172, 187, 189, 191,

193, 204, 218, 220, 221 z-ifp, 168, 170, 174–177, 184, 193,

194, 230, 245, 246, 304–306, 310, 311, 313 z-int, 12–14, 24, 144–146, 148–151,

163, 166, 189–193, 196–202 z-int-defn, 148, 149, 542 z-int-defn-proof, 149, 166, 198 z-int-defn-proof-proves, 149 z-int-hyps, 149, 150, 163, 167, 179–

183, 187, 189, 191, 193, 198, 200–203, 205, 209, 210, 218, 220, 222, 238, 242, 244, 250, 256, 259, 261, 263, 264, 269, 272, 277, 282, 285, 299, 351, 355, 362, 365, 544 z-int-numeral-proof, 149, 150, 163,

166, 191, 193, 200, 202 z-int-numeral-proof-proves, 150 z-int-numeral-proof-proves-agai

n, 191 z-int-z-succ-equal-proof, 198, 199, 202 z-int-z-succ-equal-proof-proves, 198 z-left, 168, 170, 171, 174–177, 184,

193, 194, 230, 245, 246, 304– 306, 310, 311, 313 z-list, 228, 229, 231–237, 239–244,

248, 250, 251, 253–255, 262, 265–274, 276–286, 319–321, 326, 328, 329, 331, 334, 335, 337, 339–343, 345, 346, 348– 357, 359, 360, 362–364, 366– 368, 381–383, 385–393, 486, 524

z-list-equal-imp-proof, 233–235, 239 z-list-equal-imp-proof-proves, 234 z-list-equal-imp-proof-proves1, 234 z-list-equal-proof, 229 z-list-equal-proof-proves, 229 z-listp, 186, 187, 211, 218, 292, 296,

319, 369, 370, 543 z-listp-defn, 186, 187, 543 z-listp-defn-proof, 186, 187 z-listp-defn-proof-proves, 187 z-listp-ev-hyps, 544 z-listp-exis-proof, 185, 186 z-listp-hyps, 186, 187, 219, 220, 222,

544 z-listp-ncode-proof, 187, 217, 369,

370 z-listp-ncode-proof-proves, 187 z-listp-unique-proof, 185, 186 z-numberp, 190, 191, 215, 216, 221,

543 z-numberp-defn, 189, 190, 543 z-numberp-defn-proof, 190, 191 z-numberp-defn-proof-proves, 190 z-numberp-ev-hyps, 544 z-numberp-exis-proof, 190 z-numberp-hyps, 190, 191, 222, 544 z-numberp-ncode-proof, 191, 221 z-numberp-ncode-proof-proves, 191 z-numberp-unique-proof, 190 z-opair, 107–110, 112, 146–148, 151–

156, 158–164, 179–183, 185– 189, 205, 225, 228, 237, 243, 249, 265, 284, 285, 319, 323, 348–350, 486–488, 524, 526

z-opairn-gcode, 526 z-pair, 12, 13, 23, 24, 100–103, 106–

110, 146, 147, 151, 224, 225, 525

z-pair-elim, 102 z-pair-elim-proof, 101, 102, 107, 109 z-pairn-gcode, 525 z-right, 168–171, 174–177, 184, 194,

230, 231, 246, 304, 305, 307, 310, 311, 313

z-sing, 103–110, 126, 127, 129, 146,

147, 151, 223–226, 542 z-sub1, 196, 199, 200, 202, 203, 213,

214, 220, 236, 237, 241, 242, 248, 249, 276, 543

z-sub1-defn, 196, 199, 200, 543 z-sub1-defn-proof, 199, 200, 203 z-sub1-defn-proof-proves, 200 z-sub1-ev-hyps, 544 z-sub1-exis-proof, 197, 200 z-sub1-expr, 197–199, 203 z-sub1-hyps, 200, 203, 220, 222, 238,

242, 244, 250, 256, 260, 262– 264, 277, 282, 362, 365, 544

z-sub1-n, 276–282, 320, 360–362, 364,

385 z-sub1-n-ncode-proof, 276, 277, 279,

361 z-sub1-n-ncode-proof-proves, 277 z-sub1-ncode-proof, 202, 203, 220,

236, 249, 277 z-sub1-ncode-proof-proves, 203 z-sub1-unique-proof, 199, 200 z-subrp, 256, 258, 260, 292, 297, 320,

372, 543 z-subrp-defn, 256, 258, 543 z-subrp-defn-proof, 257, 258 z-subrp-defn-proof-proves, 258 z-subrp-ev-hyps, 545 z-subrp-exis-proof, 257, 258 z-subrp-expr, 257 z-subrp-hyps, 258, 259, 297, 341, 545 z-subrp-ncode-proof, 260, 372 z-subrp-ncode-proof-proves, 259 z-subrp-unique-proof, 257, 258 z-succ, 12, 13, 24, 126–131, 134–137,

139, 141, 144, 145, 185–193, 197–204, 526, 542

z-succ-col-free, 128 z-succ-defn, 127 z-succ-defn-proof, 126, 127, 129 z-succ-equal-proof, 134, 166, 198 z-succ-equal-proof-proves, 134 z-succ-equal-step, 131 z-succ-equal-step-proof, 130, 131 z-succ-hyps, 126, 127, 130, 131, 134,

138, 143, 145, 148, 150, 163, 167, 179–183, 187, 189, 191, 193, 198, 200–203, 205, 209, 210, 219, 220, 222, 238, 242, 244, 250, 256, 259, 260, 262– 264, 269, 272, 277, 282, 285, 299, 351, 355, 361, 365, 544

z-test, 168–171, 174–177, 184, 193, 194, 230, 245, 246, 304–306, 310, 311

z-trans, 132–134, 148, 149, 164 z-trans-equal-proof1, 133, 134 z-trans-equal-proof1-proves, 133 z-trans-instance-proof, 132, 133 z-trans-instance-proof-proves, 132 z-trans-numeral-proof, 136–138, 150 z-trans-numeral-proof-proves, 138 z-trans1, 132, 150 z-trans2, 164, 166, 198 z-trich, 148, 149, 165 z-trich-numeral-proof, 141, 143, 150 z-trich-numeral-proof-proves, 143 z-trich1, 139, 141, 148, 150 z-trich2, 165, 166, 198 z-union, 12, 13, 24, 100, 101, 126,

127, 129, 223, 542 z-zerop, 192, 193, 213, 214, 220, 236,

237, 241, 247, 249, 292, 296, 319, 370, 543

z-zerop-defn, 192, 543 z-zerop-defn-proof, 192, 193 z-zerop-defn-proof-proves, 192 z-zerop-ev-hyps, 546 z-zerop-exis-proof, 191, 192 z-zerop-hyps, 192, 193, 221, 222, 238,

242, 244, 250, 256, 260, 262– 264, 282, 362, 365, 546 z-zerop-ncode-proof, 193, 219, 236,

247, 370 z-zerop-ncode-proof-proves, 193 z-zerop-unique-proof, 192 z2-axioms, 13, 16, 468, 479 z2-axioms-cnt, 468, 479