#|
Copyright (C) 1994 by Computational Logic, Inc.  All Rights Reserved.
This script is hereby placed in the public domain, and therefore unlimited
editing and redistribution is permitted.
NO WARRANTY
Computational Logic, Inc. 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 Computational Logic, Inc. 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.
|#
; ------------------------------------------------------------
; was lr-eval5-1.events
; ------------------------------------------------------------

Event: Start with the library "app-c-d-e" using the compiled version.

Theorem: axiom-53 subrp (fn) → (formals (fn) = f)

Event: Disable proper-p-statep-restructuring.

;; Function for testing s->r

Definition: change-elements (list) = if listp (list)

then if truep (car (list)) then cons (false, change-elements (cdr (list))) else cons (true, change-elements (cdr (list))) endif elseif truep (list) then false else true endif

Event: Disable deposit.

Event: Disable fetch.

Event: Disable add-addr.

Event: Disable sub-addr.

Event: Disable offset.

Event: Disable area-name.

Event: Disable errorp.

Event: Disable p-current-program.

;; The following is inspired by the lemma length-put of Piton.
;; Now in Piton-basis  A. Flatau  8-Oct-1990
;(prove-lemma MY-LENGTH-PUT (rewrite)
;  (equal (length (put val n lst))
;  (if (lessp n (length lst))
;      (length lst)
;      (add1 n)))
;  ((enable put)))
;
;(disable my-length-put)
;; This is similar to the lemma GET-PUT from Piton, but for the commented
;; out hypothesis.

Theorem: my-get-put ((k ∈ N) ∧ (n ∈ N)) → (get (k, put (val, n, lst))

= if k = n then val else get (k, lst) endif)

Event: Disable my-get-put.

Theorem: listp-cdr-p-frame listp (cdr (p-frame (bindings, ret-pc)))

Theorem: equal-cddr-p-frame-nil cddr (p-frame (bindings, ret-pc)) = nil

#||
;; The following is used to test handling of temp variables
(defn FOO (state name)
  (let ((prog (app name state)))
    (cons state (cons (car prog) (cons (cadr prog) (caddr prog))))))
;(setq ss
;      (logic->s '(change-elements (cons '*1*true (app x y)))
;  '((x . (*1*true *1*true . *1*false))
;    (y . (*1*true . *1*false)))
;   '(change-elements app)))
;(setq lrs (s->lr ss 'main 50 50 50 32))
;(setq foop
;      '(FOO (STATE NAME)
;     ((APP NAME STATE)
;      (CDR ((TEMP-FETCH) (APP NAME STATE))))
;     (CONS STATE
;   (CONS (CAR ((TEMP-EVAL) (APP NAME STATE)))
; (CONS (CAR ((TEMP-EVAL)
;     (CDR ((TEMP-FETCH) (APP NAME STATE)))))
;       (CAR (CDR ((TEMP-FETCH)
;  (CDR ((temp-fetch)
;        (APP NAME STATE)))))))))))
;
;(setq ss1 (s-state (s-expr ss)
;    (s-params ss)
;    (s-temps ss)
;    (s-consts ss)
;    (put-assoc (cdr foop) 'foo (s-progs ss))
;    'run))
;
;(setq ss2 (s-state '(FOO (CHANGE-ELEMENTS (CONS '(ADDR (heap . 4))
; (APP ((temp-eval) X) Y)))
;  ((temp-fetch) X))
;    (s-params ss1)
;    (make-temps-entries '(x))
;    (s-consts ss1)
;    (s-progs ss1)

;    'run))
||#

Definition: s-l-eval-equiv-hyps (flag, s, c) = (s-good-statep (s, c)

∧ good-posp (flag, s-pos (s), s-body (s-prog (s))) ∧ (s-err-flag (s-eval (flag, s, c)) = 'run))

Definition: s-l-eval-flag-run-hyps (flag, s, c) = (s-good-statep (s, c)

∧ s-all-temps-setp (flag, if flag = 'list then s-expr-list (s) else s-expr (s) endif, temp-alist-to-set (s-temps (s)))

∧ s-all-progs-temps-setp (s-progs (s))

∧ if flag = 'list

then f ∉ l-eval (flag, s-expand-temps (flag, s-expr-list (s)), s-params (s), c)

else l-eval (flag, s-expand-temps (flag, s-expr (s)), s-params (s),

c) endif ∧ s-check-temps-setp (s-temps (s)))

;; ***** The LR-level (R for Resource, L for logic).  *****
;; We used to have an LR-STATE shell.  Now we just use a P-STATE shell.
;; However we refer to LR-STATES which are P-STATEs with LR level programs.
;; The function LR->P compiles an LR-STATE to a Piton state, by compiling
;; the programs and converting the P-PC to a Piton PC.
;; We use P-STATE shells instead of LR-STATE shell because we used to have
;; define functions analogous to P-OBJECTP (and functions that called
;; P-OBJECTP) that took LR-STATES or parts thereof.
;; We use the Piton notion of a PROPER state.  It should be the case that
;; all the LR-STATEs we are interested in are PROPER-P-STATEPs after we
;; apply LR->P to them.
;; An LR PC object is a combination of a Piton PC object and an S level
;; S-PNAME and S-POS.  The translation of (s-pname s) and (s-pos s) from
;; the S level is: (TAG 'PC (CONS (S-PNAME S) (S-POS S)))

;; Each element of P-PROG-SEGMENT is a program.  A program is a list
;; of the form:
;;
;; (name (formal1 formal2 ... formaln)
;;       ((temp1 init1)
;;        ...
;;        (tempk initk))
;;       body)
;;
;; The name and each formal and temp is a symbol.  The initial values
;; of the temps are tagged values.  Body is a form similar to that for
;; the S level, but temporary expressions have been replaced the name of
;; a temporary variable added to them
;; e.g. ((S-TEMP-EVAL) <expr>) -> ((S-TEMP-EVAL) <expr> <var>).
;; In the case of (S-TEMP-FETCH) <expr> is never used but we put it
;; in for consistency and so it is easier to convert back to s-states.
;; Also the numbers in the S level quote constructs have been replaced
;; by data-addresses that should contain pointers to the appropriate
;; structure in the heap.
;; Roughly speaking, a function application of FUN binds the formals to
;; the top n elements of the temp-stk (removing them from that stack and
;; building a ctrl-stk frame), binds the temps to the corresponding tagged
;; values (also in the ctrl-stk frame), and executes each instruction.
;; Producing LR-code from S-code.

Definition: lr-undefined-tag = 0

; Used in node to indicate
; uninitialized temporary variable

Definition: lr-init-tag = 1

; Used in initial nodes that have
; not been used

Definition: lr-false-tag = 2

Definition: lr-true-tag = 3

Definition: lr-add1-tag = 4

Definition: lr-cons-tag = 5 Definition: lr-pack-tag = 6 Definition: lr-minus-tag = 7 Definition: lr-heap-name = 'heap Definition: lr-node-size = 4 Definition: lr-undef-addr = tag ('addr, '(heap . 0)) Definition: lr-f-addr = add-addr (lr-undef-addr, lr-node-size) Definition: lr-t-addr = add-addr (lr-f-addr, lr-node-size) Definition: lr-0-addr = add-addr (lr-t-addr, lr-node-size) Definition: lr-fp-addr = tag ('addr, '(free-ptr . 0)) Definition: lr-answer-addr = tag ('addr, '(answer . 0)) Definition: lr-fetch-fp (data-seg) = fetch (lr-fp-addr, data-seg) Definition: lr-minimum-heap-size = offset (add-addr (lr-0-addr, lr-node-size))

;; The heap is a (presumably large) Piton data area.  It contains Nodes
;; which are four words.  One word is for the tag, one for the reference
;; count, and two for the contents.  Some data-types only require one word
;; for the contents (e.g. NUMBERPs) in that case one word is wasted.  Some
;; (user-defined) data-types require more than two words. In this case the
;; second word is a pointer to another node.  This contains up to three
;; words of data, the fourth word (if the data type needs more that four
;; words) is used to link another node with the same format.  The heap is
;; the Piton data area named HEAP.
;; LR-NEW-NODE returns another node to be stuck in memory

Definition: lr-new-node (tag, ref-count, value1 , value2 ) = list (tag, ref-count, value1 , value2 ) Definition: lr-ref-count-offset = 1 Definition: lr-car-offset = 2 Definition: lr-cdr-offset = 3 Definition: lr-unpack-offset = 2 Definition: lr-unbox-nat-offset = 2

Definition: lr-negative-guts-offset = 2

Definition: lr-boundary-offsetp (offset) = ((offset mod lr-node-size) = 0)

Definition: lr-boundary-nodep (node) = lr-boundary-offsetp (offset (node))

Definition: lr-nodep (addr, data-seg) = ((type (addr) = 'addr)

∧ (cddr (addr) = nil)

∧ listp (addr)

∧ adpp (untag (addr), data-seg) ∧ lr-boundary-nodep (addr) ∧ (area-name (addr) = lr-heap-name))

;; LR-GOOD-POINTERP checks that an addr is a node and its ref count field
;; is a natural.

Definition: lr-good-pointerp (addr, data-seg) = (lr-nodep (addr, data-seg)

∧ (type (fetch (add-addr (addr, lr-ref-count-offset), data-seg))

        = 'nat))

Definition: lr-expr (p) = cur-expr (offset (p-pc (p)), program-body (p-current-program (p)))

Event: Disable lr-expr.

Definition: lr-expr-list (p) = restn (car (last (offset (p-pc (p)))),

cur-expr (butlast (offset (p-pc (p))), program-body (p-current-program (p))))

Event: Disable lr-expr-list.

;;; Debugging Stuff.

Definition: mark-instr (instruction-list, n) = if n ≃ 0

then cons (list ('pc->, car (instruction-list)), cdr (instruction-list)) else cons (car (instruction-list),

mark-instr (cdr (instruction-list), n − 1)) endif

Definition: fix-program-segment (programs, pc) = if listp (programs)

then let prog be car (programs)

in

if car (prog) = area-name (pc)

then cons (append (list (car (prog), cadr (prog), caddr (prog)),

mark-instr (program-body (prog), offset (pc))), fix-program-segment (cdr (programs), pc))

else cons (car (prog),

fix-program-segment (cdr (programs), pc)) endif endlet

else nil endif

Definition: fix-data-segment (data-segment) = put-value (append (firstn (offset (lr-fetch-fp (data-segment)),

value (lr-heap-name, data-segment)), length (value (lr-heap-name, data-segment)) − offset (lr-fetch-fp (data-segment))),

lr-heap-name, data-segment)

Definition: find-non-proper-instr (lst, name, p) = if listp (lst)

then if legal-labelp (car (lst))

∧ proper-p-instructionp (unlabel (car (lst)), name, p) then find-non-proper-instr (cdr (lst), name, p) else car (lst) endif

else nil endif

Definition: find-non-proper-programs (progs, p) = if listp (progs)

then if proper-p-programp (car (progs), p) then cons (name (car (progs)),

find-non-proper-programs (cdr (progs), p))

else cons (list ('not, name (car (progs)), find-non-proper-instr (program-body (car (progs)),

name (car (progs)), p)),

find-non-proper-programs (cdr (progs), p)) endif

else nil endif

Definition: pps (state)

= list ('p-state,

p-pc (state), p-ctrl-stk (state), p-temp-stk (state), let p be p-current-program (state) in append (list (name (p), formal-vars (p), temp-var-dcls (p)),

mark-instr (program-body (p), offset (p-pc (state)))) endlet, fix-data-segment (p-data-segment (state)), p-psw (state))

Definition: lr-nodify-tag (tag) = if untag (tag) = lr-false-tag then 'false

elseif untag (tag) = lr-true-tag then 'true elseif untag (tag) = lr-add1-tag then 'add1 elseif untag (tag) = lr-cons-tag then 'cons elseif untag (tag) = lr-pack-tag then 'pack else 'unknown endif

Definition: lr-nodify (number, nodes, final) = if listp (nodes)

then cons (list ('node, number, lr-nodify-tag (car (nodes)), caddr (nodes), cadddr (nodes)),

lr-nodify (number + lr-node-size, cddddr (nodes), final))

else final endif

Definition: lr-fix-data-segment (data-seg) = put-value (lr-nodify (0,

firstn (offset (lr-fetch-fp (data-seg)), value (lr-heap-name, data-seg)), length (value (lr-heap-name, data-seg)) − offset (lr-fetch-fp (data-seg))),

lr-heap-name, data-seg)

Definition: lrps (state) = p-state (p-pc (state),

p-ctrl-stk (state),

p-temp-stk (state),

p-prog-segment (state),

lr-fix-data-segment (p-data-segment (state)), p-max-ctrl-stk-size (state), p-max-temp-stk-size (state), p-word-size (state), p-psw (state))

;; Returns the object denoted by addr in the heap.

Definition: lr-abs (addr, data-seg, n) = if n ≃ 0 then nil

else let tag be untag (fetch (addr, data-seg)) in if tag = lr-false-tag then f elseif tag = lr-true-tag then t elseif tag = lr-add1-tag then untag (fetch (add-addr (addr, lr-unbox-nat-offset),

data-seg))

elseif tag = lr-cons-tag then cons (lr-abs (fetch (add-addr (addr, lr-car-offset),

data-seg), data-seg, n − 1),

lr-abs (fetch (add-addr (addr, lr-cdr-offset),

data-seg), data-seg, n − 1))

elseif tag = lr-pack-tag then pack (lr-abs (fetch (add-addr (addr,

lr-unpack-offset),

data-seg), data-seg, n − 1))

else − untag (fetch (add-addr (addr,

lr-negative-guts-offset),

data-seg)) endif endlet endif

Definition: top-stk (p-or-p-state) = let temp-stk be if p-statep (p-or-p-state)

then p-temp-stk (p-or-p-state)

else p-temp-stk (p-or-p-state) endif,

data-segment be if p-statep (p-or-p-state) then p-data-segment (p-or-p-state) else p-data-segment (p-or-p-state) endif

in

lr-abs (top (temp-stk), data-segment, 1000) endlet

;; This is accessed by the Piton accessors: NAME, FORMAL-VARS, TEMP-VAR-DCLS
;; and PROGRAM-BODY.  Also LOCAL-VARS.

Definition: lr-make-program (name, formals, temps, body) = cons (name, cons (formals, cons (temps, body)))

#||
stolen from matt kaufmann's code for gensym, but modified to probably be
less useful but simplier.
here is a sequence of events for generating a new symbol.
the main function is near the end, and is called gensym.
gensym returns a pair the new symbol and the next number list to try.
here are some examples:
>(r-loop)
trace mode: off   abbreviated output mode:  on
type ? for help.
*(gensym (unpack 'a*) '(49) '(a*0 a*1 a*2 a*3))
 '(a*4 53)
*(gensym (unpack 'a*) '(53) '(a*0 a*1 a*2 a*3 a*4))
 '(a*5 54)
*(gensym (unpack 'a*) '(50) '(a*2))
 '(a*3 52)
*(gensym (unpack 'a*) '(50) '(a*0))
 '(a*2 51)
*(gensym (unpack 'a) '(48) '(a*0 a*1))
 '(a0 49)
*(gensym (unpack 'a) '(48) '(a b))

 '(a0 49)
*(gensym (unpack 'a*2*) '(51) '(a*2*3))
 '(a*2*4 53)
*(gensym (unpack 'b*) '(50) '(a*0 a*1 a*2 a*3))
 '(b*2 51)
*ok
exiting r-loop.
nil
||#

Definition: ascii-0 = 48

Definition: ascii-1 = 49

Definition: ascii-9 = 57

Definition: ascii-dash = 45

Definition: list-ascii-0 = list (ascii-0)

Definition: list-ascii-1 = list (ascii-1)

Definition: increment-numlist (numlist) = if listp (numlist)

then if car (numlist) = ascii-9 then cons (ascii-0, increment-numlist (cdr (numlist))) else cons (1 + car (numlist), cdr (numlist)) endif

else list-ascii-1 endif

Definition: make-symbol (initial, digit-list) = pack (append (append (initial, digit-list), 0))

Event: Disable make-symbol.

Definition: count-codelist1 (numlist) = if listp (numlist)

then car (numlist) + (10 ∗ count-codelist1 (cdr (numlist))) else 0 endif Definition: subseqp (list1 , list2 ) = ((length (list2 ) ≮ length (list1 ))

∧ (firstn (length (list1 ), list2 ) = list1 ))

Event: Disable subseqp.

Definition: count-codelist (initial, ascii-list) = if subseqp (initial, ascii-list)

then count-codelist1 (restn (length (initial), ascii-list))

else 0 endif

Event: Disable count-codelist.

Definition: max-count-codelist (initial, list) = if listp (list)

then max (count-codelist (initial, unpack (car (list))),

max-count-codelist (initial, cdr (list)))

else 0 endif

Theorem: increment-num-list-count-code-list1 count-codelist1 (num-list) < count-codelist1 (increment-numlist (num-list))

Theorem: subseqp-append subseqp (plist (x), append (x, anything))

Theorem: count-codelist-make-symbol (x = make-symbol (initial, num-list)) → (count-codelist (plist (initial), unpack (x))

= count-codelist1 (num-list))

Theorem: member-make-symbol-max-count-code-list (make-symbol (initial, num-list) ∈ atom-list) → (max-count-codelist (plist (initial), atom-list)

≮ count-codelist1 (num-list))

;; Returns a pair, the new symbol and the next number to use

Definition: gensym (initial, num-list, atom-list) = if make-symbol (initial, num-list) ∈ atom-list

then gensym (initial, increment-numlist (num-list), atom-list)

else cons (make-symbol (initial, num-list), increment-numlist (num-list)) endif Theorem: gensym-is-new car (gensym (initial, num-list, atom-list)) ∉ atom-list

;; MAKE-TEMP-NAME-ALIST takes a temps-alist triple a la S-TEMPS and
;; returns an alist with entries of the form:
;; (<temp expression> . <variable>) where <variable> is guaranteed to
;; occur only once in the resulting alist and is guaranteed not to occur
;; in FORMALS.

Definition: lr-make-temp-name-alist-1 (initial, num-list, temp-list, formals) = if listp (temp-list)

then let gensym be gensym (initial, num-list, formals) in cons (cons (car (temp-list), car (gensym)), lr-make-temp-name-alist-1 (initial,

cdr (gensym), cdr (temp-list), formals)) endlet

else nil endif

Definition: lr-make-temp-name-alist (temp-list, formals) = lr-make-temp-name-alist-1 (unpack ('t*), list-ascii-0, temp-list, formals)

Definition: lr-new-cons (car, cdr) = lr-new-node (tag ('nat, lr-cons-tag), tag ('nat, 1), car, cdr)

;; Deposit LIST of objects at ADDR, ADDR+1, ADDR+2, ... in DATA-SEG.

Definition: deposit-a-list (list, addr, data-seg) = if listp (list)

then deposit (car (list), addr, deposit-a-list (cdr (list), add1-addr (addr), data-seg))

else data-seg endif

Definition: lr-init-heap-contents (addr, size) = if size ≃ 0 then list (tag ('nat, lr-init-tag))

else append (lr-new-node (tag ('nat, lr-init-tag), add-addr (addr, lr-node-size), tag ('nat, 0),

tag ('nat, 0)),

lr-init-heap-contents (add-addr (addr, lr-node-size), size − 1)) endif

Definition: lr-add-to-data-seg (data-seg, new-node) = if (length (value (lr-heap-name, data-seg)) − 1)

≮ (offset (fetch (lr-fp-addr, data-seg)) + length (new-node)) then deposit (fetch (add-addr (fetch (lr-fp-addr, data-seg),

lr-ref-count-offset),

data-seg), lr-fp-addr, deposit-a-list (new-node,

fetch (lr-fp-addr, data-seg), data-seg))

else data-seg endif

Definition: lr-init-data-seg (heap-size) = deposit-a-list (list (tag ('nat, lr-false-tag),

tag ('nat, 1), lr-undef-addr, lr-undef-addr),

lr-f-addr,

deposit-a-list (list (tag ('nat, lr-undefined-tag), tag ('nat, 1), lr-undef-addr, lr-undef-addr),

lr-undef-addr,

list (list (area-name (lr-fp-addr), add-addr (lr-f-addr,

lr-node-size)),

list (area-name (lr-answer-addr),

tag ('nat, 0)), cons (lr-heap-name,

lr-init-heap-contents (tag ('addr,

cons (lr-heap-name,

0)),

heap-size)))))

Definition: count-list (flag, object) = if flag = 'list

then if listp (object)

then count-list (t, car (object))

+ count-list ('list, cdr (object)) else 1 endif

elseif listp (object) then 1 + (1 + (count-list (t, car (object))

+ count-list (t, cdr (object))))

elseif object ∈ N then 1 + count (object) else 1 endif

Theorem: not-equal-0-count-list count-list (flag, object) ≠ 0

Theorem: lessp-count-list-cdr-count-list-whole listp (object) → (count-list ('list, cdr (object)) < count-list ('list, object))

Theorem: lessp-count-not-list-car-count-list-whole listp (object) → (count-list (t, car (object)) < count-list ('list, object))

;; LR-COMPILE-QUOTE returns a pair, the new HEAP and the new TABLE.

Definition: lr-compile-quote (flag, object, heap, table) = if flag = 'list

then if listp (object)

then let car-pair be lr-compile-quote (t, car (object), heap, table)

in

lr-compile-quote ('list, cdr (object), car (car-pair), cdr (car-pair)) endlet

else cons (heap, table) endif elseif definedp (object, table) then cons (heap, table) elseif listp (object) then let pair be lr-compile-quote ('list,

list (car (object), cdr (object)), heap, table)

in

cons (lr-add-to-data-seg (car (pair),

lr-new-cons (cdr (assoc (car (object), cdr (pair))), cdr (assoc (cdr (object),

cdr (pair))))),

cons (cons (object, fetch (lr-fp-addr, car (pair))),

cdr (pair))) endlet

elseif object ∈ N then cons (lr-add-to-data-seg (heap,

lr-new-node (tag ('nat, lr-add1-tag), tag ('nat, 1), tag ('nat, object), lr-undef-addr)),

cons (cons (object, fetch (lr-fp-addr, heap)), table))

elseif truep (object) then cons (lr-add-to-data-seg (heap,

lr-new-node (tag ('nat, lr-true-tag), tag ('nat, 1), lr-undef-addr, lr-undef-addr)),

cons (cons (object, fetch (lr-fp-addr, heap)), table))

else cons (heap, cons (cons (object, lr-undef-addr), table)) endif

;; LR-DATA-SEG-TABLE-BODY returns a pair, the CAR is the extension of
;; DATA-SEG with any constants laid down in it, the CDR is an alist
;; mapping objects in the logic to addresses in the new DATA-SEG
;; where they are represented.  The initial TABLE is such an alist

Definition: lr-data-seg-table-body (flag, expr, data-seg, table) = if flag = 'list

then if listp (expr)

then let dst1 be lr-data-seg-table-body (t, car (expr), data-seg, table)

in

lr-data-seg-table-body ('list, cdr (expr), car (dst1 ), cdr (dst1 )) endlet

else cons (data-seg, table) endif elseif listp (expr) then if (car (expr) = s-temp-fetch)

∨ (car (expr) = s-temp-eval) ∨ (car (expr) = s-temp-test)

then lr-data-seg-table-body (t, cadr (expr), data-seg, table) elseif car (expr) = 'quote then lr-compile-quote (t, cadr (expr), data-seg, table) else lr-data-seg-table-body ('list,

cdr (expr), data-seg, table) endif

else cons (data-seg, table) endif

Definition: lr-data-seg-table-list (progs, data-seg, table) = if listp (progs)

then lr-data-seg-table-list (cdr (progs),

car (lr-data-seg-table-body (t, s-body (car (progs)), data-seg, table)),

cdr (lr-data-seg-table-body (t, s-body (car (progs)), data-seg, table)))

else cons (data-seg, table) endif

Definition: lr-init-data-seg-table (params, data-seg, table) = if listp (params)

then let ds-tab be lr-compile-quote (t, cdar (params), data-seg, table) in lr-init-data-seg-table (cdr (params),

car (ds-tab),

cdr (ds-tab)) endlet

else cons (data-seg, table) endif

Definition: lr-data-seg-table (progs, params, heap-size) = let init-ds-table1 be lr-compile-quote ('list,

list (t, 0),

lr-init-data-seg (heap-size), list (cons (f, lr-f-addr)))

in let init-ds-table2 be lr-init-data-seg-table (params,

car (init-ds-table1 ), cdr (init-ds-table1 ))

in lr-data-seg-table-list (progs,

car (init-ds-table2 ),

cdr (init-ds-table2 )) endlet endlet

Definition: pair-formals-with-addresses (formals, table) = if listp (formals)

then cons (cons (caar (formals), cdr (assoc (cdar (formals), table))),

pair-formals-with-addresses (cdr (formals), table))

else nil endif

Definition: lr-make-initial-temps (temp-vars) = if listp (temp-vars)

then cons (cons (car (temp-vars), lr-undef-addr),

lr-make-initial-temps (cdr (temp-vars)))

else nil endif

Definition: lr-initial-cstk (params, temp-alist, table, pc) = list (p-frame (append (pair-formals-with-addresses (params, table),

lr-make-initial-temps (strip-cdrs (temp-alist))), pc))

Definition: lr-compile-body (flag, body, temp-alist, const-table) = if flag = 'list

then if listp (body)

then cons (lr-compile-body (t, car (body), temp-alist, const-table),

lr-compile-body ('list, cdr (body), temp-alist, const-table))

else nil endif elseif listp (body) then if (car (body) = s-temp-fetch)

∨ (car (body) = s-temp-eval) ∨ (car (body) = s-temp-test)

then list (car (body), lr-compile-body (t, cadr (body), temp-alist, const-table), value (cadr (body), temp-alist))

elseif car (body) = 'quote

then list ('quote, value (cadr (body), const-table))

else cons (car (body),

lr-compile-body ('list, cdr (body), temp-alist,

const-table)) endif

else body endif

Definition: lr-make-temp-var-dcls (temp-alist) = if listp (temp-alist)

then cons (list (cdar (temp-alist), lr-undef-addr),

lr-make-temp-var-dcls (cdr (temp-alist)))

else nil endif

Definition: lr-compile-programs (programs, const-table) = if listp (programs)

then let prog be car (programs)

in let temp-alist be lr-make-temp-name-alist (s-temp-list (prog),

s-formals (prog))

in cons (lr-make-program (car (prog),

s-formals (prog),

lr-make-temp-var-dcls (temp-alist), lr-compile-body (t,

s-body (prog), temp-alist, const-table)),

lr-compile-programs (cdr (programs), const-table)) endlet endlet

else nil endif

Definition: lr-p-c-size (flag, expr) = if flag = 'list

then if listp (expr)

then lr-p-c-size (t, car (expr))

+ lr-p-c-size ('list, cdr (expr)) else 0 endif

elseif listp (expr) then if car (expr) = 'if

then lr-p-c-size (t, cadr (expr))

+ lr-p-c-size (t, caddr (expr)) + lr-p-c-size (t, cadddr (expr))

     + 4

elseif car (expr) = s-temp-fetch then 1 elseif car (expr) = s-temp-eval then lr-p-c-size (t, cadr (expr)) + 1 elseif car (expr) = s-temp-test then lr-p-c-size (t, cadr (expr)) + 7 elseif car (expr) = 'quote then 1 else lr-p-c-size ('list, cdr (expr)) + 1 endif

else 1 endif

Definition: lr-p-c-size-list (n, expr-list) = if n ≃ 0 then 0

elseif n < length (expr-list) then lr-p-c-size (t, get (n, expr-list))

+ lr-p-c-size-list (n − 1, expr-list) else lr-p-c-size-list (length (expr-list) − 1, expr-list) endif

;; LR-P-PC-1 returns the number of Piton instructions before the start of
;; the expression denoted by POS in the compilation of EXPR.

Definition: lr-p-pc-1 (expr, pos) = if ¬ listp (pos) then 0

elseif ¬ listp (expr) then 0 elseif car (pos) ≃ 0 then 0 elseif car (expr) = 'if then if car (pos) ≃ 0 then 0

elseif car (pos) = 1 then lr-p-pc-1 (cadr (expr), cdr (pos))

elseif car (pos) = 2

then 3 + lr-p-c-size (t, cadr (expr)) + lr-p-pc-1 (caddr (expr), cdr (pos))

else lr-p-c-size (t, cadr (expr))

+ lr-p-c-size (t, caddr (expr))

+ lr-p-pc-1 (cadddr (expr), cdr (pos))

+ 4 endif

elseif car (expr) = s-temp-fetch then 0 elseif car (expr) = s-temp-eval then lr-p-pc-1 (cadr (expr), cdr (pos)) elseif car (expr) = s-temp-test then lr-p-pc-1 (cadr (expr), cdr (pos)) + 4 elseif car (expr) = 'quote then 0 else lr-p-c-size-list (car (pos) − 1, expr)

+ lr-p-pc-1 (get (car (pos), expr), cdr (pos)) endif

Definition: lr-p-pc (l) = tag ('pc,

cons (area-name (p-pc (l)), lr-p-pc-1 (program-body (p-current-program (l)), offset (p-pc (l)))))

Event: Disable lr-p-pc.

Definition: s->lr1 (s, l, table) = p-state (tag ('pc, cons (s-pname (s), s-pos (s))),

p-ctrl-stk (l), p-temp-stk (l), lr-compile-programs (s-progs (s), table), p-data-segment (l), p-max-ctrl-stk-size (l), p-max-temp-stk-size (l), p-word-size (l), s-err-flag (s))

Event: Disable s->lr1.

;; Returns an P-STATE.
;; FREE-HEAP-SIZE is number of free nodes in resulting P-STATE.

Definition: s->lr (s, fheap-size, max-ctrl, max-temp, word-size) = let temp-alist be lr-make-temp-name-alist (strip-cars (s-temps (s)),

strip-cars (s-params (s))),

dataseg-table be lr-data-seg-table (s-progs (s), s-params (s), fheap-size)

in

let return-pc be tag ('pc,

cons (s-pname (s),

lr-p-pc-1 (lr-compile-body (t, s-body (s-prog (s)), temp-alist, cdr (dataseg-table)),

s-pos (s))))

in

s->lr1 (s,

p-state (nil,

lr-initial-cstk (s-params (s), temp-alist, cdr (dataseg-table), return-pc),

nil, nil, car (dataseg-table), max-ctrl, max-temp, word-size, nil),

cdr (dataseg-table)) endlet endlet

Event: Disable s->lr.

Definition: lr-params (frame, p) = firstn (length (formal-vars (p-current-program (p))), bindings (frame))

Event: Disable lr-params.

Definition: lr-temps (frame, p) = restn (length (formal-vars (p-current-program (p))), bindings (frame))

Event: Disable lr-temps.

Definition: lr-set-expr (s1 , s2 , pos) = p-state (tag ('pc, cons (area-name (p-pc (s2 )), pos)),

p-ctrl-stk (s1 ), p-temp-stk (s1 ), p-prog-segment (s2 ), p-data-segment (s1 ), p-max-ctrl-stk-size (s1 ), p-max-temp-stk-size (s1 ), p-word-size (s1 ), p-psw (s1 ))

Definition: lr-set-error (s, flag) = p-state (p-pc (s),

p-ctrl-stk (s), p-temp-stk (s), p-prog-segment (s), p-data-segment (s), p-max-ctrl-stk-size (s), p-max-temp-stk-size (s), p-word-size (s), flag)

Definition: lr-set-pos (s, pos) = p-state (tag ('pc, cons (area-name (p-pc (s)), pos)),

p-ctrl-stk (s), p-temp-stk (s), p-prog-segment (s), p-data-segment (s), p-max-ctrl-stk-size (s), p-max-temp-stk-size (s), p-word-size (s), p-psw (s))

Definition: lr-set-tstk (s, temp-stk) = p-state (p-pc (s),

p-ctrl-stk (s), temp-stk, p-prog-segment (s), p-data-segment (s), p-max-ctrl-stk-size (s), p-max-temp-stk-size (s), p-word-size (s), p-psw (s))

Definition: lr-pop-tstk (s) = if p-psw (s) = 'run

then if listp (p-temp-stk (s)) then lr-set-tstk (s, pop (p-temp-stk (s))) else lr-set-error (s, 'lr-pop-tstk-empty-stack) endif

else s endif

Definition: lr-push-tstk (s, value) = if p-psw (s) = 'run

then if length (p-temp-stk (s)) < p-max-temp-stk-size (s) then lr-set-tstk (s, push (value, p-temp-stk (s))) else lr-set-error (s, 'lr-push-tstk-full-stack) endif

else s endif

Event: Disable lr-push-tstk.

Definition: lr-if-ok (l) = if p-max-temp-stk-size (l) ≮ (1 + length (p-temp-stk (l))) then l

else lr-set-error (l, 'if-temp-stk-overflow) endif Event: Disable lr-if-ok.

Definition: lr-set-temp (s, value, var-name) = if p-psw (s) = 'run

then p-state (p-pc (s), set-local-var-value (value, var-name, p-ctrl-stk (s)), p-temp-stk (s), p-prog-segment (s), p-data-segment (s), p-max-ctrl-stk-size (s), p-max-temp-stk-size (s), p-word-size (s), p-psw (s))

else s endif

Event: Disable lr-set-temp.

Definition: lr-eval-temp-setp (s) = (local-var-value (caddr (lr-expr (s)), p-ctrl-stk (s)) ≠ lr-undef-addr)

Event: Disable lr-eval-temp-setp.

Definition: lr-do-temp-fetch (s) = if lr-eval-temp-setp (s)

then lr-push-tstk (s, local-var-value (caddr (lr-expr (s)), p-ctrl-stk (s))) else lr-set-error (s, 'temp-fetch-not-set) endif

Event: Disable lr-do-temp-fetch.

Definition: lr-pop-cstk (s) = if p-psw (s) = 'run

then p-state (p-pc (s), pop (p-ctrl-stk (s)), p-temp-stk (s), p-prog-segment (s), p-data-segment (s), p-max-ctrl-stk-size (s), p-max-temp-stk-size (s), p-word-size (s), p-psw (s))

else s endif

Event: Disable lr-pop-cstk.

Definition: lr-type-contents-p (object, tag, contents) = ((type (object) = tag) ∧ (untag (object) = contents))

;; The following functions are used for the Piton code and to compute the LR
;; value for certain classes of functions (e.g. all shell accessors).
;; NOTE: The 'clock' functions get a Piton state.  This is the state just
;; BEFORE the execution of the appropriate CALL instruction.  Therefore
;; to look at the parameters, it is necessary to look at the temp stack.
;; The clock function return the number of Piton instructions necessary to
;; run the CALL and the code for the SUBR.
;; Recognizers

Definition: p-recognizer-code (name, tag) = list (name,

       'nil,
       'nil,
       '(fetch),
       list ('push-constant, tag ('nat, tag)),
       '(eq),
       '(test-bool-and-jump f false),

list ('push-constant, lr-t-addr),

       '(ret),
       list ('dl, 'false, 'nil, list ('push-constant, lr-f-addr)),
       '(ret))

Definition: p-recognizer-clock (p-state, tag) = 7

;; Accessor

Definition: p-accessor-code (name, tag, default, offset) = list (name,

       '(x),
       'nil,
       '(push-local x),

'(fetch),
list ('push-constant, tag ('nat, tag)),
'(eq),
'(test-bool-and-jump t arg1),

list ('push-constant, default),

'(ret),
'(dl arg1 nil (push-local x)),

list ('push-constant, tag ('nat, offset)),

'(add-addr),
'(fetch),
'(ret))

Definition: p-accessor-clock (p, tag) = if fetch (top (p-temp-stk (p)), p-data-segment (p)) = tag ('nat, tag)

then 11 else 8 endif

;; Now comes the actual code and values

Definition: p-car-code = p-accessor-code ('car, lr-cons-tag, lr-0-addr, lr-car-offset)

Definition: p-car-clock (p) = p-accessor-clock (p, lr-cons-tag)

Event: Disable p-car-clock.

Definition: p-cdr-code = p-accessor-code ('cdr, lr-cons-tag, lr-0-addr, lr-cdr-offset)

Definition: p-cdr-clock (p) = p-accessor-clock (p, lr-cons-tag)

Event: Disable p-cdr-clock.

Definition: p-cons-code = list ('cons,

'nil,
'((temp (nat 0))),
'(push-global free-ptr),

list ('push-constant, tag ('nat, lr-cdr-offset)),

'(add-addr),
'(deposit),

'(push-global free-ptr),

list ('push-constant, tag ('nat, lr-car-offset)),

'(add-addr),
'(deposit),
'(push-global free-ptr),
'(push-global free-ptr),

list ('push-constant, tag ('nat, lr-ref-count-offset)),

'(add-addr),
'(set-local temp),
'(fetch),
'(push-constant (nat 1)),
'(push-local temp),
'(deposit),

list ('push-constant, tag ('nat, lr-cons-tag)),

'(push-global free-ptr),
'(deposit),
'(pop-global free-ptr),
'(ret))

Definition: p-cons-clock (p) = 23

Event: Disable p-cons-clock.

Definition: p-false-code = list ('false,

'nil,
'nil,

list ('push-constant, lr-f-addr),

'(ret))

Definition: p-false-clock (p) = 3

Event: Disable p-false-clock.

;; FALSEP TAKES ONE IMPLICIT ARG ON STACK.

Definition: p-falsep-code

= list ('falsep,
'nil,
'nil,

list ('push-constant, lr-f-addr),

'(eq),

       '(test-bool-and-jump t true),

list ('push-constant, lr-f-addr),

       '(ret),
       list ('dl, 'true, 'nil, list ('push-constant, lr-t-addr)),
       '(ret))

Definition: p-falsep-clock (p) = 6

Event: Disable p-falsep-clock.

;; Takes an implicit arg

Definition: p-listp-code = p-recognizer-code ('listp, lr-cons-tag)

Definition: p-listp-clock (p) = p-recognizer-clock (p, lr-cons-tag)

Event: Disable p-listp-clock.

Definition: p-nlistp-code

= list ('nlistp,
       'nil,
       'nil,
       '(fetch),

list ('push-constant, tag ('nat, lr-cons-tag)),

       '(eq),
       '(test-bool-and-jump f true),

list ('push-constant, lr-f-addr),

       '(ret),
       list ('dl, 'true, 'nil, list ('push-constant, lr-t-addr)),
       '(ret))

Definition: p-nlistp-clock (p) = 7

Event: Disable p-nlistp-clock.

Definition: p-true-code

= list ('true, 'nil, 'nil, list ('push-constant, lr-t-addr), '(ret))

Definition: p-true-clock (p) = 3 Event: Disable p-true-clock.

;; The old code for TRUEP is shown below.  I used to ensure that there was
;; only one occurence of TRUE in the data-segment [namely at address
;; (lr-t-addr)], however only TRUEP took advantage of this.  LR-PROPER-HEAPP
;; has been changed to not require only one occurrence, although only one
;; should appear.  However this means we actually have to test the tag, a
;; small performance penalty for some simplicity and freedom in the spec.

Definition: p-truep-code = p-recognizer-code ('truep, lr-true-tag)

;(defn P-TRUEP-CODE ()
;  (list 'truep '() '()
; (list 'PUSH-CONSTANT (lr-t-addr))
; '(EQ)
; '(TEST-BOOL-AND-JUMP T TRUE)
; (list 'PUSH-CONSTANT (lr-f-addr))
; '(RET)
; (list 'DL 'TRUE '() (list 'PUSH-CONSTANT (lr-t-addr)))
; '(RET)))

Definition: p-truep-clock (p) = p-recognizer-clock (p, lr-false-tag)

;(defn P-TRUEP-CLOCK (p) 6)

Event: Disable p-truep-clock.

Definition: p-runtime-support-programs = list (p-car-code,

p-cdr-code, p-cons-code, p-false-code, p-falsep-code, p-listp-code, p-nlistp-code, p-true-code, p-truep-code)

Event: Disable p-runtime-support-programs.

Definition: lr-convert-digit-to-ascii (digit) = (ascii-0 + digit)

Definition: lr-convert-num-to-ascii (number, list) = if number < 10 then cons (lr-convert-digit-to-ascii (number), list)

else lr-convert-num-to-ascii (number ÷ 10,

cons (lr-convert-digit-to-ascii (number mod 10), list)) endif

Definition: lr-make-label (n) = pack (cons (car (unpack ('l)),

cons (ascii-dash, append (lr-convert-num-to-ascii (n, nil), 0))))

Event: Disable lr-make-label.

Definition: label-instrs (instrs, n) = if listp (instrs)

then cons (dl (lr-make-label (n), nil, car (instrs)),

label-instrs (cdr (instrs), 1 + n))

else nil endif

Definition: comp-temp-test (expr, instrs, n) = append (list (list ('push-local, caddr (expr)),

list ('push-constant, lr-undef-addr),

              '(eq),
              list ('test-bool-and-jump,
                  'f,

lr-make-label (n + 6 + length (instrs)))), append (instrs,

list (list ('set-local, caddr (expr)),

list ('jump,

lr-make-label (n + 7 + length (instrs))), list ('push-local, caddr (expr)))))

Definition: comp-if (test-instrs, then-instrs, else-instrs, n) = append (test-instrs,

append (list (list ('push-constant, lr-f-addr),

                     '(eq),
                     list ('test-bool-and-jump,

                't,

lr-make-label (n

                            + 4

+ length (test-instrs) + length (then-instrs)))),

append (then-instrs,

cons (list ('jump,

lr-make-label (n

                                     + 4

+ length (test-instrs) + length (then-instrs) + length (else-instrs))),

else-instrs))))

;; COMP-BODY-1 returns a list of Piton instructions to compile EXPR.
;; N is the number of Piton instructions previously generated, it is used
;; to generate unique labels.

Definition: comp-body-1 (flag, expr, n) = if flag = 'list

then if listp (expr)

then append (comp-body-1 (t, car (expr), n),

comp-body-1 ('list, cdr (expr), n + lr-p-c-size (t, car (expr))))

else nil endif elseif listp (expr) then if car (expr) = 'if

then comp-if (comp-body-1 (t, cadr (expr), n),

comp-body-1 (t, caddr (expr), n + 3 + lr-p-c-size (t, cadr (expr))),

comp-body-1 (t, cadddr (expr), n

                        + 4

+ lr-p-c-size (t, cadr (expr)) + lr-p-c-size (t, caddr (expr))),

n)

elseif car (expr) = s-temp-fetch then list (list ('push-local, caddr (expr))) elseif car (expr) = s-temp-eval then append (comp-body-1 (t, cadr (expr), n),

list (list ('set-local, caddr (expr))))

elseif car (expr) = s-temp-test

then comp-temp-test (expr, comp-body-1 (t, cadr (expr), n + 4), n)

elseif car (expr) = 'quote

then list (list ('push-constant, cadr (expr))) else append (comp-body-1 ('list, cdr (expr), n), if definedp (car (expr),

p-runtime-support-programs)

then list (list ('call, car (expr)))

else list (list ('call,

user-fname (car (expr)))) endif) endif

else list (list ('push-local, expr)) endif

Event: Disable comp-body-1.

Definition: comp-body (body) = label-instrs (append (comp-body-1 (t, body, 0), '((ret))), 0)

Event: Disable comp-body.

Definition: comp-programs-1 (programs) = if listp (programs)

then cons (lr-make-program (name (car (programs)), formal-vars (car (programs)), temp-var-dcls (car (programs)), comp-body (program-body (car (programs)))),

comp-programs-1 (cdr (programs)))

else nil endif

Definition: comp-programs (programs) = cons (lr-make-program (name (car (programs)),

formal-vars (car (programs)), temp-var-dcls (car (programs)), label-instrs (append (comp-body-1 (t,

program-body (car (programs)), 0),

                                         list (list ('set-global,

area-name (lr-answer-addr)),

                                            '(ret))),

0)),

append (comp-programs-1 (cdr (programs)), p-runtime-support-programs))

Event: Disable comp-programs.

Definition: lr-proper-exprp (flag, expr, pnames, formals, temps, table) = if flag = 'list

then if listp (expr)

then lr-proper-exprp (t, car (expr), pnames, formals, temps, table)

∧ lr-proper-exprp ('list, cdr (expr), pnames, formals, temps, table)

else expr = nil endif elseif litatom (expr) then expr ∈ formals elseif expr ≃ nil then f elseif ¬ plistp (expr) then f elseif car (expr) = s-temp-fetch then (caddr (expr) ∈ temps) ∧ (length (expr) = 3) elseif (car (expr) = s-temp-eval) ∨ (car (expr) = s-temp-test) then (caddr (expr) ∈ temps)

∧ (length (expr) = 3)

∧ lr-proper-exprp (t, cadr (expr), pnames, formals, temps, table) elseif car (expr) = 'quote then (type (cadr (expr)) = 'addr)

∧ (cadr (expr) ∈ strip-cdrs (table))

∧ (length (cdr (expr)) = arity (car (expr))) elseif subrp (car (expr)) then (length (cdr (expr)) = arity (car (expr)))

∧ ((car (expr) = 'if)

∨ definedp (car (expr), p-runtime-support-programs)) ∧ (car (expr) ∉ pnames) ∧ lr-proper-exprp ('list,

cdr (expr), pnames, formals, temps, table)

elseif body (car (expr)) then (length (cdr (expr)) = arity (car (expr)))

∧ (car (expr) ∈ pnames) ∧ lr-proper-exprp ('list,

cdr (expr), pnames, formals, temps, table)

else f endif

Definition: all-undef-addrs (list) = if listp (list)

then (car (list) = lr-undef-addr) ∧ all-undef-addrs (cdr (list)) else t endif

Definition: lr-programs-properp-1 (programs, program-names, table) = if listp (programs)

then all-litatoms (formal-vars (car (programs)))

∧ all-litatoms (strip-cars (temp-var-dcls (car (programs)))) ∧ all-undef-addrs (strip-cadrs (temp-var-dcls (car (programs)))) ∧ lr-proper-exprp (t,

program-body (car (programs)),

program-names,

formal-vars (car (programs)),

strip-cars (temp-var-dcls (car (programs))), table)

∧ lr-programs-properp-1 (cdr (programs), program-names, table) else t endif

Event: Disable lr-programs-properp-1.

Definition: lr-programs-properp (l, table) = (definedp (area-name (p-pc (l)), p-prog-segment (l))

∧ (caar (p-prog-segment (l)) = 'main)

∧ all-user-fnamesp (cdr (strip-cars (p-prog-segment (l))))

∧ lr-programs-properp-1 (p-prog-segment (l), strip-logic-fnames (cdr (p-prog-segment (l))), table))

Event: Disable lr-programs-properp.

Theorem: lr-p-c-size-flag-not-list-not-0 (flag ≠ 'list) → (lr-p-c-size (flag, expr) ≠ 0)

Theorem: difference-decreases ((x ≮ y) ∧ (y ≄ 0)) → (((x − y) < x) = t)

Definition: lr->p (p) = p-state (lr-p-pc (p),

p-ctrl-stk (p), p-temp-stk (p), comp-programs (p-prog-segment (p)), p-data-segment (p), p-max-ctrl-stk-size (p), p-max-temp-stk-size (p), p-word-size (p), p-psw (p))

Event: Disable lr->p.

Definition: p-set-pc (p, pc) = p-state (pc,

p-ctrl-stk (p), p-temp-stk (p), p-prog-segment (p), p-data-segment (p), p-max-ctrl-stk-size (p), p-max-temp-stk-size (p), p-word-size (p), p-psw (p))

;; It should be the case that (P-CURRENT-INSTRUCTION p) = (CALL subr)
;; therefore we need to run P one more step than the clock functions
;; below to do the CALL.

Definition: p-run-subr (subr, p) = case on subr:

case = car then p (p, p-car-clock (p)) case = cdr then p (p, p-cdr-clock (p)) case = cons then p (p, p-cons-clock (p)) case = false then p (p, p-false-clock (p)) case = falsep then p (p, p-falsep-clock (p)) case = listp then p (p, p-listp-clock (p)) case = nlistp then p (p, p-nlistp-clock (p)) case = true then p (p, p-true-clock (p)) case = truep then p (p, p-truep-clock (p)) otherwise p-halt (p, 'bad-subr) endcase

Event: Disable p-run-subr.

Definition: lr-return-pc (l) = add-addr (lr-p-pc (l), lr-p-c-size ('list, cdr (lr-expr (l))))

Event: Disable lr-return-pc.

Definition: lr-apply-subr (l, new-l) = let res be p-run-subr (car (lr-expr (l)),

p-set-pc (lr->p (new-l), lr-return-pc (l)))

in

p-state (p-pc (new-l), p-ctrl-stk (res), p-temp-stk (res), p-prog-segment (new-l), p-data-segment (res), p-max-ctrl-stk-size (res), p-max-temp-stk-size (res), p-word-size (res), p-psw (res)) endlet

Event: Disable lr-apply-subr.

Definition: lr-funcall (l, new-l) = let prog be definition (user-fname (car (lr-expr (l))),

p-prog-segment (l)),

newest-l be p-set-pc (lr->p (new-l), lr-return-pc (l)) in if p-call-okp (list ('call, user-fname (car (lr-expr (l)))),

newest-l)

then p-state (tag ('pc, cons (user-fname (car (lr-expr (l))), nil)), push (make-p-call-frame (formal-vars (prog),

p-temp-stk (new-l), temp-var-dcls (prog), add1-addr (p-pc (newest-l))),

p-ctrl-stk (new-l)), popn (length (formal-vars (prog)), p-temp-stk (new-l)), p-prog-segment (new-l), p-data-segment (new-l), p-max-ctrl-stk-size (new-l), p-max-temp-stk-size (new-l), p-word-size (new-l),

               'run)

else p-halt (new-l, x-y-error-msg ('p, 'call)) endif endlet

Event: Disable lr-funcall.

;; The following lemmas are needed to admit LR-EVAL

Theorem: p-accessors-lr-set-expr (p-pc (lr-set-expr (s1 , s2 , pos)) = tag ('pc, cons (area-name (p-pc (s2 )), pos))) ∧ (p-ctrl-stk (lr-set-expr (s1 , s2 , pos)) = p-ctrl-stk (s1 )) ∧ (p-temp-stk (lr-set-expr (s1 , s2 , pos)) = p-temp-stk (s1 )) ∧ (p-prog-segment (lr-set-expr (s1 , s2 , pos)) = p-prog-segment (s2 )) ∧ (p-data-segment (lr-set-expr (s1 , s2 , pos)) = p-data-segment (s1 )) ∧ (p-max-ctrl-stk-size (lr-set-expr (s1 , s2 , pos))

= p-max-ctrl-stk-size (s1 )) ∧ (p-max-temp-stk-size (lr-set-expr (s1 , s2 , pos))

= p-max-temp-stk-size (s1 )) ∧ (p-word-size (lr-set-expr (s1 , s2 , pos)) = p-word-size (s1 )) ∧ (p-psw (lr-set-expr (s1 , s2 , pos)) = p-psw (s1 ))

Event: Disable lr-set-expr.

Theorem: p-accessors-lr-set-tstk (p-pc (lr-set-tstk (s, ts)) = p-pc (s)) ∧ (p-ctrl-stk (lr-set-tstk (s, ts)) = p-ctrl-stk (s)) ∧ (p-temp-stk (lr-set-tstk (s, ts)) = ts) ∧ (p-prog-segment (lr-set-tstk (s, ts)) = p-prog-segment (s)) ∧ (p-data-segment (lr-set-tstk (s, ts)) = p-data-segment (s)) ∧ (p-max-ctrl-stk-size (lr-set-tstk (s, ts)) = p-max-ctrl-stk-size (s)) ∧ (p-max-temp-stk-size (lr-set-tstk (s, ts)) = p-max-temp-stk-size (s)) ∧ (p-word-size (lr-set-tstk (s, ts)) = p-word-size (s)) ∧ (p-psw (lr-set-tstk (s, ts)) = p-psw (s))

Event: Disable lr-set-tstk.

Theorem: p-accessors-lr-set-error (p-pc (lr-set-error (s, flag)) = p-pc (s)) ∧ (p-ctrl-stk (lr-set-error (s, flag)) = p-ctrl-stk (s)) ∧ (p-temp-stk (lr-set-error (s, flag)) = p-temp-stk (s)) ∧ (p-prog-segment (lr-set-error (s, flag)) = p-prog-segment (s)) ∧ (p-data-segment (lr-set-error (s, flag)) = p-data-segment (s)) ∧ (p-max-ctrl-stk-size (lr-set-error (s, flag)) = p-max-ctrl-stk-size (s)) ∧ (p-max-temp-stk-size (lr-set-error (s, flag)) = p-max-temp-stk-size (s)) ∧ (p-word-size (lr-set-error (s, flag)) = p-word-size (s)) ∧ (p-psw (lr-set-error (s, flag)) = flag)

Event: Disable lr-set-error.

Theorem: p-accessors-lr-set-pos (p-pc (lr-set-pos (s, pos)) = tag ('pc, cons (area-name (p-pc (s)), pos))) ∧ (p-ctrl-stk (lr-set-pos (s, pos)) = p-ctrl-stk (s)) ∧ (p-temp-stk (lr-set-pos (s, pos)) = p-temp-stk (s)) ∧ (p-prog-segment (lr-set-pos (s, pos)) = p-prog-segment (s)) ∧ (p-data-segment (lr-set-pos (s, pos)) = p-data-segment (s)) ∧ (p-max-ctrl-stk-size (lr-set-pos (s, pos)) = p-max-ctrl-stk-size (s)) ∧ (p-max-temp-stk-size (lr-set-pos (s, pos)) = p-max-temp-stk-size (s)) ∧ (p-word-size (lr-set-pos (s, pos)) = p-word-size (s)) ∧ (p-psw (lr-set-pos (s, pos)) = p-psw (s))

Event: Disable lr-set-pos.

Theorem: p-accessors-lr-pop-tstk (p-pc (lr-pop-tstk (s)) = p-pc (s)) ∧ (p-ctrl-stk (lr-pop-tstk (s)) = p-ctrl-stk (s)) ∧ (p-prog-segment (lr-pop-tstk (s)) = p-prog-segment (s)) ∧ (p-data-segment (lr-pop-tstk (s)) = p-data-segment (s)) ∧ (p-max-ctrl-stk-size (lr-pop-tstk (s)) = p-max-ctrl-stk-size (s)) ∧ (p-max-temp-stk-size (lr-pop-tstk (s)) = p-max-temp-stk-size (s)) ∧ (p-word-size (lr-pop-tstk (s)) = p-word-size (s))

Theorem: p-temp-stk-lr-pop-tstk p-temp-stk (lr-pop-tstk (s)) = if listp (p-temp-stk (s)) ∧ (p-psw (s) = 'run)

then pop (p-temp-stk (s)) else p-temp-stk (s) endif

Event: Disable lr-pop-tstk.

Theorem: area-name-tag area-name (tag (tag, adp)) = adp-name (adp)

Theorem: offset-tag offset (tag (tag, adp)) = adp-offset (adp)

Theorem: p-current-program-lr-set-expr p-current-program (lr-set-expr (s1 , s2 , pos)) = p-current-program (s2 )

Theorem: p-current-program-lr-set-pos p-current-program (lr-set-pos (s, pos)) = p-current-program (s)

Theorem: lr-expr-lr-set-expr lr-expr (lr-set-expr (s1 , s2 , dv (offset (p-pc (s2 )), n))) = get (n, lr-expr (s2 ))

Theorem: lr-expr-lr-set-pos-t lr-expr (lr-set-pos (s, dv (offset (p-pc (s)), n))) = get (n, lr-expr (s))

Theorem: lr-expr-flag-list-car listp (offset (p-pc (p))) → (car (lr-expr-list (p)) = lr-expr (p))

Theorem: number-cons-lr-expr-t-list (listp (lr-expr-list (p)) ∧ listp (offset (p-pc (p)))) → (number-cons (lr-expr (p)) < number-cons (lr-expr-list (p)))

Theorem: lr-expr-lr-set-expr-nx (listp (offset (p-pc (p))) ∧ listp (lr-expr-list (p))) → (lr-expr-list (lr-set-expr (p1 , p, nx (offset (p-pc (p)))))

= cdr (lr-expr-list (p)))

Theorem: lr-expr-list-lr-set-pos-dv-1 listp (lr-expr (p)) → (lr-expr-list (lr-set-pos (p, dv (offset (p-pc (p)), 1)))

= cdr (lr-expr (p)))

;; If FLAG is 'LIST then state contains a list of expressions,
;; otherwise it is just one.
;; Returns a P-STATE.  The result is left on the temp stack.
;; If the error flag of the resulting state is 'HALT then we terminated
;; normally.  If the flag is 'RUN we have not terminated yet.
;; If the flag is anything else we got an error.

Definition: lr-eval (flag, l, c) = if p-psw (l) ≠ 'run then l

elseif flag = 'list then if offset (p-pc (l)) ≃ nil

then lr-set-error (l, 'bad-list-position) elseif listp (lr-expr-list (l)) then lr-eval ('list,

lr-set-expr (lr-eval (t, l, c), l, nx (offset (p-pc (l)))), c)

else l endif elseif c ≃ 0 then lr-set-error (l, 'out-of-time) elseif litatom (lr-expr (l)) then lr-push-tstk (l, local-var-value (lr-expr (l), p-ctrl-stk (l))) elseif lr-expr (l) ≃ nil then lr-set-error (l, 'bad-expression) elseif car (lr-expr (l)) = 'if then let test be lr-if-ok (lr-eval (t,

lr-set-pos (l,

dv (offset (p-pc (l)), 1)),

c))

in if p-psw (test) = 'run then if top (p-temp-stk (test)) ≠ lr-f-addr

then lr-eval (t,

lr-set-expr (lr-pop-tstk (test), l, dv (offset (p-pc (l)), 2)),

c)

else lr-eval (t,

lr-set-expr (lr-pop-tstk (test), l, dv (offset (p-pc (l)), 3)),

c) endif

else test endif endlet elseif car (lr-expr (l)) = s-temp-eval then let l1 be lr-eval (t, lr-set-pos (l, dv (offset (p-pc (l)), 1)), c)

in lr-set-temp (l1 , top (p-temp-stk (l1 )), caddr (lr-expr (l))) endlet

elseif car (lr-expr (l)) = s-temp-test then let l1 be lr-eval (t, lr-set-pos (l, dv (offset (p-pc (l)), 1)), c)

in if p-max-temp-stk-size (l)

≮ (2 + length (p-temp-stk (l))) then if lr-eval-temp-setp (l) then lr-do-temp-fetch (l)

else lr-set-temp (l1 , top (p-temp-stk (l1 )), caddr (lr-expr (l))) endif

else lr-set-error (l,

                   'lr-temp-setp-temp-stack-overflow) endif endlet

elseif car (lr-expr (l)) = s-temp-fetch then lr-do-temp-fetch (l) elseif car (lr-expr (l)) = 'quote then lr-push-tstk (l, cadr (lr-expr (l))) elseif p-psw (lr-eval ('list, lr-set-pos (l, dv (offset (p-pc (l)), 1)), c))

     ≠ 'run

then lr-eval ('list, lr-set-pos (l, dv (offset (p-pc (l)), 1)), c) elseif subrp (car (lr-expr (l))) then lr-apply-subr (l,

lr-eval ('list, lr-set-pos (l, dv (offset (p-pc (l)), 1)), c))

elseif litatom (car (lr-expr (l))) then let fs be lr-funcall (l,

lr-eval ('list,

lr-set-pos (l,

dv (offset (p-pc (l)), 1)),

c))

in

lr-set-expr (lr-pop-cstk (lr-eval (t, fs, c − 1)), l, offset (p-pc (l))) endlet

else lr-set-error (l, 'bad-instruction) endif

;; Proper LR STATES
;; Sometimes we only need to know that LR-PROPER-P-AREASP holds on
;; a data-segment instead of LR-PROPER-P-DATA-SEGMENTP

Definition: lr-proper-p-areasp (data-seg) = if data-seg ≃ nil then data-seg = nil

else let area be car (data-seg)

in

litatom (car (area)) ∧ listp (cdr (area)) ∧ (¬ definedp (car (area), cdr (data-seg))) ∧ lr-proper-p-areasp (cdr (data-seg)) endlet endif

;; First we prove that LR-EVAL preserves PROPER-P-STATEP.

Theorem: p-accessors-lr-funcall (p-prog-segment (lr-funcall (l, new-l)) = p-prog-segment (new-l)) ∧ (p-data-segment (lr-funcall (l, new-l)) = p-data-segment (new-l))

∧ (p-max-ctrl-stk-size (lr-funcall (l, new-l))

= p-max-ctrl-stk-size (new-l)) ∧ (p-max-temp-stk-size (lr-funcall (l, new-l))

= p-max-temp-stk-size (new-l)) ∧ (p-word-size (lr-funcall (l, new-l)) = p-word-size (new-l))

Theorem: p-accessors-lr-push-tstk (p-pc (lr-push-tstk (s, v)) = p-pc (s)) ∧ (p-ctrl-stk (lr-push-tstk (s, v)) = p-ctrl-stk (s)) ∧ (p-prog-segment (lr-push-tstk (s, v)) = p-prog-segment (s)) ∧ (p-data-segment (lr-push-tstk (s, v)) = p-data-segment (s)) ∧ (p-max-ctrl-stk-size (lr-push-tstk (s, v)) = p-max-ctrl-stk-size (s)) ∧ (p-max-temp-stk-size (lr-push-tstk (s, v)) = p-max-temp-stk-size (s)) ∧ (p-word-size (lr-push-tstk (s, v)) = p-word-size (s))

Theorem: p-accessors-lr-if-ok (p-pc (lr-if-ok (l)) = p-pc (l)) ∧ (p-ctrl-stk (lr-if-ok (l)) = p-ctrl-stk (l)) ∧ (p-temp-stk (lr-if-ok (l)) = p-temp-stk (l)) ∧ (p-prog-segment (lr-if-ok (l)) = p-prog-segment (l)) ∧ (p-data-segment (lr-if-ok (l)) = p-data-segment (l)) ∧ (p-max-ctrl-stk-size (lr-if-ok (l)) = p-max-ctrl-stk-size (l)) ∧ (p-max-temp-stk-size (lr-if-ok (l)) = p-max-temp-stk-size (l)) ∧ (p-word-size (lr-if-ok (l)) = p-word-size (l))

Theorem: p-accessors-lr-set-temp (p-pc (lr-set-temp (s, v, n)) = p-pc (s)) ∧ (p-ctrl-stk (lr-set-temp (s, v, n))

= if p-psw (s) = 'run then set-local-var-value (v, n, p-ctrl-stk (s)) else p-ctrl-stk (s) endif)

∧ (p-temp-stk (lr-set-temp (s, v, n)) = p-temp-stk (s)) ∧ (p-prog-segment (lr-set-temp (s, v, n)) = p-prog-segment (s)) ∧ (p-data-segment (lr-set-temp (s, v, n)) = p-data-segment (s)) ∧ (p-max-ctrl-stk-size (lr-set-temp (s, v, n)) = p-max-ctrl-stk-size (s)) ∧ (p-max-temp-stk-size (lr-set-temp (s, v, n)) = p-max-temp-stk-size (s)) ∧ (p-word-size (lr-set-temp (s, v, n)) = p-word-size (s)) ∧ (p-psw (lr-set-temp (s, v, n)) = p-psw (s))

Theorem: p-accessors-lr-do-temp-fetch (p-pc (lr-do-temp-fetch (s)) = p-pc (s)) ∧ (p-ctrl-stk (lr-do-temp-fetch (s)) = p-ctrl-stk (s)) ∧ (p-prog-segment (lr-do-temp-fetch (s)) = p-prog-segment (s)) ∧ (p-data-segment (lr-do-temp-fetch (s)) = p-data-segment (s)) ∧ (p-max-ctrl-stk-size (lr-do-temp-fetch (s)) = p-max-ctrl-stk-size (s))

∧ (p-max-temp-stk-size (lr-do-temp-fetch (s)) = p-max-temp-stk-size (s)) ∧ (p-word-size (lr-do-temp-fetch (s)) = p-word-size (s))

Theorem: p-accessors-lr-pop-cstk (p-pc (lr-pop-cstk (s)) = p-pc (s)) ∧ (p-ctrl-stk (lr-pop-cstk (s))

= if p-psw (s) = 'run then pop (p-ctrl-stk (s))

else p-ctrl-stk (s) endif)

∧ (p-temp-stk (lr-pop-cstk (s)) = p-temp-stk (s)) ∧ (p-prog-segment (lr-pop-cstk (s)) = p-prog-segment (s)) ∧ (p-data-segment (lr-pop-cstk (s)) = p-data-segment (s)) ∧ (p-max-ctrl-stk-size (lr-pop-cstk (s)) = p-max-ctrl-stk-size (s)) ∧ (p-max-temp-stk-size (lr-pop-cstk (s)) = p-max-temp-stk-size (s)) ∧ (p-word-size (lr-pop-cstk (s)) = p-word-size (s)) ∧ (p-psw (lr-pop-cstk (s)) = p-psw (s))

Theorem: lr-eval-if-p-psw-1 ((flag ≠ 'list) ∧ (p-psw (lr-eval (flag, l, c)) = 'run) ∧ (car (lr-expr (l)) = 'if) ∧ (p-psw (l) = 'run) ∧ (c ≄ 0) ∧ listp (lr-expr (l))) → (p-psw (lr-eval (t, lr-set-pos (l, dv (offset (p-pc (l)), 1)), c)) = 'run)

Event: Disable lr-eval-if-p-psw-1.

Theorem: adp-offset-untag-add-addr adp-offset (untag (add-addr (addr, n))) = (offset (addr) + n)

Theorem: adp-offset-untag-sub-addr adp-offset (untag (sub-addr (addr, n))) = (offset (addr) − n)

Theorem: adp-name-untag-sub-addr adp-name (untag (sub-addr (addr, n))) = adp-name (untag (addr))

Theorem: adp-offset-cons adp-offset (cons (area-name, offset)) = offset

Theorem: p-accessors-lr->p (p-pc (lr->p (l)) = lr-p-pc (l)) ∧ (p-ctrl-stk (lr->p (l)) = p-ctrl-stk (l)) ∧ (p-temp-stk (lr->p (l)) = p-temp-stk (l)) ∧ (p-prog-segment (lr->p (l)) = comp-programs (p-prog-segment (l))) ∧ (p-data-segment (lr->p (l)) = p-data-segment (l))

∧ (p-max-ctrl-stk-size (lr->p (l)) = p-max-ctrl-stk-size (l)) ∧ (p-max-temp-stk-size (lr->p (l)) = p-max-temp-stk-size (l)) ∧ (p-word-size (lr->p (l)) = p-word-size (l)) ∧ (p-psw (lr->p (l)) = p-psw (l))

Theorem: type-lr-p-pc type (lr-p-pc (l)) = 'pc

Theorem: cddr-nil-lr-p-pc cddr (lr-p-pc (l)) = nil

Theorem: listp-untag-lr-p-pc listp (untag (lr-p-pc (l)))

Theorem: numberp-cdr-lr-p-pc cdr (untag (lr-p-pc (l))) ∈ N

Theorem: car-untag-lr-p-pc car (untag (lr-p-pc (p))) = car (untag (p-pc (p)))

Theorem: area-name-lr-p-pc area-name (lr-p-pc (p)) = area-name (p-pc (p))

Theorem: definedp-comp-programs-1-definedp-orig definedp (x, comp-programs-1 (programs)) = definedp (x, programs)

Theorem: definedp-append definedp (x, append (l1 , l2 )) = (definedp (x, l1 ) ∨ definedp (x, l2 ))

Theorem: definedp-comp-programs-definedp-orig definedp (x, programs) → definedp (x, comp-programs (programs))

Theorem: p-accessors-p-halt (p-pc (p-halt (p, psw)) = p-pc (p)) ∧ (p-ctrl-stk (p-halt (p, psw)) = p-ctrl-stk (p)) ∧ (p-temp-stk (p-halt (p, psw)) = p-temp-stk (p)) ∧ (p-prog-segment (p-halt (p, psw)) = p-prog-segment (p)) ∧ (p-data-segment (p-halt (p, psw)) = p-data-segment (p)) ∧ (p-max-ctrl-stk-size (p-halt (p, psw)) = p-max-ctrl-stk-size (p)) ∧ (p-max-temp-stk-size (p-halt (p, psw)) = p-max-temp-stk-size (p)) ∧ (p-word-size (p-halt (p, psw)) = p-word-size (p)) ∧ (p-psw (p-halt (p, psw)) = psw)

Event: Disable p-halt.

Theorem: p-accessors-p-set-pc (p-pc (p-set-pc (p, pc)) = pc) ∧ (p-ctrl-stk (p-set-pc (p, pc)) = p-ctrl-stk (p)) ∧ (p-temp-stk (p-set-pc (p, pc)) = p-temp-stk (p)) ∧ (p-prog-segment (p-set-pc (p, pc)) = p-prog-segment (p)) ∧ (p-data-segment (p-set-pc (p, pc)) = p-data-segment (p)) ∧ (p-max-ctrl-stk-size (p-set-pc (p, pc)) = p-max-ctrl-stk-size (p)) ∧ (p-max-temp-stk-size (p-set-pc (p, pc)) = p-max-temp-stk-size (p)) ∧ (p-word-size (p-set-pc (p, pc)) = p-word-size (p)) ∧ (p-psw (p-set-pc (p, pc)) = p-psw (p))

Event: Disable p-set-pc.

Theorem: p-psw-not-run (p-psw (p-state) ≠ 'run) → (p (p-state, clock) = p-state)

Theorem: p-psw-p-halt-x-y-error-msg p (p-halt (p-state, x-y-error-msg (x, y)), n) = p-halt (p-state, x-y-error-msg (x, y))

Event: Disable p-psw-p-halt-x-y-error-msg.

Theorem: p-accessors-p-run-subr (p-prog-segment (p-run-subr (subr, p)) = p-prog-segment (p)) ∧ (p-max-ctrl-stk-size (p-run-subr (subr, p)) = p-max-ctrl-stk-size (p)) ∧ (p-max-temp-stk-size (p-run-subr (subr, p)) = p-max-temp-stk-size (p)) ∧ (p-word-size (p-run-subr (subr, p)) = p-word-size (p))

Theorem: p-accessors-lr-apply-subr (p-pc (lr-apply-subr (l1 , l2 )) = p-pc (l2 )) ∧ (p-prog-segment (lr-apply-subr (l1 , l2 )) = p-prog-segment (l2 )) ∧ (p-max-ctrl-stk-size (lr-apply-subr (l1 , l2 ))

= p-max-ctrl-stk-size (l2 )) ∧ (p-max-temp-stk-size (lr-apply-subr (l1 , l2 ))

= p-max-temp-stk-size (l2 )) ∧ (p-word-size (lr-apply-subr (l1 , l2 )) = p-word-size (l2 ))

Theorem: p-prog-segment-lr-eval p-prog-segment (lr-eval (flag, l, c)) = p-prog-segment (l)

Theorem: p-max-ctrl-stk-size-lr-eval p-max-ctrl-stk-size (lr-eval (flag, l, c)) = p-max-ctrl-stk-size (l)

Theorem: p-max-temp-stk-size-lr-eval p-max-temp-stk-size (lr-eval (flag, l, c)) = p-max-temp-stk-size (l)

Theorem: p-word-size-lr-eval p-word-size (lr-eval (flag, l, c)) = p-word-size (l)

Theorem: area-name-p-pc-lr-eval area-name (p-pc (lr-eval (flag, l, c))) = area-name (p-pc (l))

Theorem: lr-programs-properp-lr-eval lr-programs-properp (lr-eval (flag, l, c), table) = lr-programs-properp (l, table)

Theorem: definedp-deposit definedp (tag, deposit (anything, addr, data-seg)) = definedp (tag, data-seg)

Theorem: deposit-a-list-cons-opener deposit-a-list (cons (x, list), addr, data-seg) = deposit (x, addr, deposit-a-list (list, add1-addr (addr), data-seg))

Theorem: deposit-a-list-nil deposit-a-list (nil, addr, data-seg) = data-seg

Event: Disable deposit-a-list.

Theorem: assoc-put-assoc-3 assoc (name1 , put-assoc (val, name2 , alist)) = if name1 = name2

then if definedp (name1 , alist) then cons (name1 , val)

else f endif else assoc (name1 , alist) endif

Event: Disable assoc-put-assoc-3.

Theorem: adpp-lessp-offset-deposit ((offset < length (cdr (assoc (name, data-seg)))) ∧ definedp (name, data-seg)) → (offset < length (cdr (assoc (name, deposit (anything, anywhere, data-seg)))))

Theorem: adpp-deposit-anything-at-all adpp (adp, data-seg) → adpp (adp, deposit (anything, addr2 , data-seg))

Event: Disable adpp-lessp-offset-deposit.

Event: Disable adpp-deposit-anything-at-all.

Theorem: adpp-untag-definedp-area-name adpp (untag (addr), data-seg) → definedp (area-name (addr), data-seg)

Event: Disable adpp-untag-definedp-area-name.

Theorem: adpp-cons-pack-definedp-area-name adpp (cons (pack (xxx), offset), data-seg) → definedp (pack (xxx), data-seg)

Theorem: adpp-untag-numberp-offset adpp (untag (addr), data-seg) → (offset (addr) ∈ N)

Event: Disable adpp-untag-numberp-offset.

Theorem: adpp-untag-listp adpp (untag (addr), data-seg) → listp (untag (addr))

Event: Disable adpp-untag-listp.

Theorem: adpp-add-addr-0 (adpp (untag (addr), data-seg) ∧ (cddr (addr) = nil) ∧ (type (addr) = 'addr) ∧ (n ≃ 0)) → (add-addr (addr, n) = addr)

Event: Disable adpp-add-addr-0.

Theorem: adpp-untag-lessp-offset adpp (untag (addr), data-seg) → (offset (addr) < length (cdr (assoc (area-name (addr), data-seg))))

Event: Disable adpp-untag-lessp-offset.

Theorem: adpp-same-signature same-signature (data-seg2 , data-seg1 ) → (adpp (adp, data-seg2 ) = adpp (adp, data-seg1 ))

Event: Disable adpp.

Theorem: p-objectp-similar-p-states (p-objectp (object, p0 ) ∧ same-signature (p-data-segment (p0 ), p-data-segment (p1 )) ∧ (p-prog-segment (p0 ) = p-prog-segment (p1 )) ∧ (p-word-size (p0 ) = p-word-size (p1 ))) → p-objectp (object, p1 )

Theorem: all-p-objectps-lr->p-similar-states (all-p-objectps (lst, p0 ) ∧ (p-word-size (p0 ) = p-word-size (p1 )) ∧ (p-prog-segment (p0 ) = p-prog-segment (p1 )) ∧ same-signature (p-data-segment (p0 ), p-data-segment (p1 ))) → all-p-objectps (lst, p1 )

Theorem: proper-p-data-segmentp-lr->p-similar-states (proper-p-data-segmentp (data-seg, p0 ) ∧ (p-word-size (p0 ) = p-word-size (p1 )) ∧ (p-prog-segment (p0 ) = p-prog-segment (p1 )) ∧ same-signature (p-data-segment (p0 ), p-data-segment (p1 ))) → proper-p-data-segmentp (data-seg, p1 )

Theorem: proper-p-temp-var-dclsp-lr->p-similar-states (proper-p-temp-var-dclsp (temp-var-dcls, p0 ) ∧ (p-word-size (p0 ) = p-word-size (p1 )) ∧ (p-prog-segment (p0 ) = p-prog-segment (p1 )) ∧ same-signature (p-data-segment (p0 ), p-data-segment (p1 ))) → proper-p-temp-var-dclsp (temp-var-dcls, p1 )

Theorem: proper-p-instructionp-similar-p-states (proper-p-instructionp (ins, name, p0 ) ∧ same-signature (p-data-segment (p0 ), p-data-segment (p1 )) ∧ (p-prog-segment (p0 ) = p-prog-segment (p1 )) ∧ (p-word-size (p0 ) = p-word-size (p1 ))) → proper-p-instructionp (ins, name, p1 )

Theorem: proper-labeled-p-instructionsp-lr->p-similar-states (proper-labeled-p-instructionsp (lst, name, p0 ) ∧ same-signature (p-data-segment (p0 ), p-data-segment (p1 )) ∧ (p-prog-segment (p0 ) = p-prog-segment (p1 )) ∧ (p-word-size (p0 ) = p-word-size (p1 ))) → proper-labeled-p-instructionsp (lst, name, p1 )

Theorem: proper-p-prog-segmentp-lr->p-similar-states (proper-p-prog-segmentp (programs, p0 ) ∧ same-signature (p-data-segment (p0 ), p-data-segment (p1 )) ∧ (p-prog-segment (p0 ) = p-prog-segment (p1 )) ∧ (p-word-size (p0 ) = p-word-size (p1 ))) → proper-p-prog-segmentp (programs, p1 )

Theorem: proper-p-temp-stkp-lr->p-similar-states (proper-p-temp-stkp (temp-stk, p0 ) ∧ same-signature (p-data-segment (p0 ), p-data-segment (p1 ))

∧ (p-prog-segment (p0 ) = p-prog-segment (p1 )) ∧ (p-word-size (p0 ) = p-word-size (p1 ))) → proper-p-temp-stkp (temp-stk, p1 )

Theorem: proper-p-alistp-lr->p-similar-states (proper-p-alistp (bindings, p0 ) ∧ same-signature (p-data-segment (p0 ), p-data-segment (p1 )) ∧ (p-prog-segment (p0 ) = p-prog-segment (p1 )) ∧ (p-word-size (p0 ) = p-word-size (p1 ))) → proper-p-alistp (bindings, p1 )

Theorem: proper-p-ctrl-stkp-lr->p-similar-states (proper-p-ctrl-stkp (ctrl-stk, name, p0 ) ∧ same-signature (p-data-segment (p0 ), p-data-segment (p1 )) ∧ (p-prog-segment (p0 ) = p-prog-segment (p1 )) ∧ (p-word-size (p0 ) = p-word-size (p1 ))) → proper-p-ctrl-stkp (ctrl-stk, name, p1 )

;; Now we prove what the result of running the SUBRPs.  We
;; start with a sample state (that the rewriter can match with
;; P-APPLY-SUBR-STATE) and run it.  We are only interested in TEMP-STK and
;; DATA-SEGMENT of the result.  However the running of the Piton code can
;; be a bit tedious, so we try and prove both parts at once with the
;; following function P-GOOD-RESULTP.  This also has the not ERRORP check
;; inside of it so that we should only have one instance of the Piton
;; interpreter (P) in each theorem.  This should hopefully reduce the time
;; (and pain) of proving these theorems.

Definition: p-good-resultp (p, data-seg, temp-stk, ctrl-stk, pc) = if p-psw (p) ≠ 'run then t

else (p-data-segment (p) = data-seg) ∧ (p-temp-stk (p) = temp-stk) ∧ listp (ctrl-stk) ∧ (p-ctrl-stk (p) = ctrl-stk) ∧ (p-pc (p) = pc) endif

Theorem: assoc-append-1 assoc (x, append (list1 , list2 )) = if definedp (x, list1 ) then assoc (x, list1 )

else assoc (x, list2 ) endif

Event: Disable assoc-append-1.

Theorem: lr-programs-properp-1-all-user-fnamesp-not-user-fnamep (all-user-fnamesp (strip-cars (programs)) ∧ (¬ user-fnamep (x))) → (¬ definedp (x, programs))

Theorem: definitions-subrps-lr-programs-properp lr-programs-properp (l, table) → ((assoc ('car, comp-programs (p-prog-segment (l))) = p-car-code)

∧ (assoc ('cdr, comp-programs (p-prog-segment (l)))

= p-cdr-code) ∧ (assoc ('cons, comp-programs (p-prog-segment (l)))

= p-cons-code) ∧ (assoc ('false, comp-programs (p-prog-segment (l)))

= p-false-code) ∧ (assoc ('falsep, comp-programs (p-prog-segment (l)))

= p-falsep-code) ∧ (assoc ('listp, comp-programs (p-prog-segment (l)))

= p-listp-code) ∧ (assoc ('nlistp, comp-programs (p-prog-segment (l)))

= p-nlistp-code) ∧ (assoc ('true, comp-programs (p-prog-segment (l)))

= p-true-code) ∧ (assoc ('truep, comp-programs (p-prog-segment (l)))

= p-truep-code))

Event: Disable lr-programs-properp-1-all-user-fnamesp-not-user-fnamep.

Event: Disable definitions-subrps-lr-programs-properp.

;; and now some openers for p-good-resultp

Theorem: p-good-resultp-p-state-opener p-good-resultp (p-state (pc,

ctrl-stk, temp-stk, prog-seg, data-seg, max-ctrl-stk-size, max-temp-stk-size, word-size,

               'run),

result-data-seg, result-temp-stk, result-ctrl-stk, result-pc)

= ((data-seg = result-data-seg)

∧ (temp-stk = result-temp-stk)

∧ listp (result-ctrl-stk)

∧ (ctrl-stk = result-ctrl-stk)

∧ (pc = result-pc))

Theorem: p-good-resultp-p-halt-errorp-opener (psw ≠ 'run) → p-good-resultp (p-halt (p, psw), data-seg, temp-stk, ctrl-stk, pc)

Event: Disable p-good-resultp.

Theorem: all-p-objectps-bad-type ((get (offset, lst) ≠ list (type (get (offset, lst)), untag (get (offset, lst)))) ∧ (offset ∈ N) ∧ (offset < length (lst))) → (¬ all-p-objectps (lst, p))

Theorem: proper-p-data-segmentp-bad-type ((fetch (addr, data-seg) ≠ list (type (fetch (addr, data-seg)), untag (fetch (addr, data-seg)))) ∧ adpp (untag (addr), data-seg)) → (¬ proper-p-data-segmentp (data-seg, p))

Theorem: p-current-program-p-state p-current-program (p-state (pc,

ctrl-stk, temp-stk, prog-seg, data-seg, max-ctrl-stk-size, max-temp-stk-size, word-size, psw))

= assoc (area-name (pc), prog-seg)

Theorem: p-current-instruction-opener p-current-instruction (p-state (pc,

temp-stk, ctrl-stk, prog-segment, data-segment, max-ctrl-stk-size, max-temp-stk-size, word-size,

psw))

= unlabel (get (offset (pc), program-body (assoc (area-name (pc), prog-segment))))

Event: Disable p-current-instruction-opener.

Theorem: fetch-deposit ((offset (addr1 ) ∈ N) ∧ (offset (addr2 ) ∈ N)) → (fetch (addr1 , deposit (value, addr2 , data-seg))

= if definedp (area-name (addr2 ), data-seg)

then if area-name (addr1 ) = area-name (addr2 )

then if offset (addr1 ) = offset (addr2 ) then value else fetch (addr1 , data-seg) endif

else fetch (addr1 , data-seg) endif else fetch (addr1 , data-seg) endif)

;; add-addr

Theorem: area-name-add-addr area-name (add-addr (addr, n)) = area-name (addr)

Theorem: offset-add-addr offset (add-addr (addr, n)) = (offset (addr) + n)

Theorem: adp-name-untag-add-addr adp-name (untag (add-addr (addr, n))) = area-name (addr)

Theorem: add-addr-of-non-number (n ∉ N) → (add-addr (addr, n) = add-addr (addr, 0))

Theorem: add-addr-add-addr add-addr (add-addr (addr, n), m) = add-addr (addr, n + m)

Theorem: listp-untag-add-addr listp (untag (add-addr (addr, n)))

Theorem: type-add-addr type (add-addr (addr, n)) = type (addr)

Theorem: cddr-add-addr cddr (add-addr (addr, n)) = nil

Theorem: area-name-lr-return-pc area-name (lr-return-pc (l)) = area-name (p-pc (l))

Theorem: listp-untag-lr-return-pc listp (untag (lr-return-pc (l)))

Theorem: type-lr-return-pc type (lr-return-pc (l)) = 'pc

Theorem: cddr-lr-return-pc cddr (lr-return-pc (l)) = nil

Theorem: numberp-offset-return-pc offset (lr-return-pc (l)) ∈ N

Theorem: numberp-cdr-untag-return-pc cdr (untag (lr-return-pc (l))) ∈ N

Theorem: car-untag-lr-return-pc car (untag (lr-return-pc (l))) = car (untag (p-pc (l)))

;; sub-addr

Theorem: area-name-sub-addr area-name (sub-addr (addr, n)) = area-name (addr)

Theorem: cddr-sub-addr cddr (sub-addr (addr, n)) = nil

Theorem: type-sub-addr type (sub-addr (addr, n)) = type (addr)

Theorem: listp-untag-sub-addr listp (untag (sub-addr (addr, n)))

Theorem: offset-sub-addr offset (sub-addr (addr, n)) = (offset (addr) − n)

;; LR-BOUNDARY-NODEP

Theorem: lr-boundary-nodep-sub-addr lr-boundary-nodep (addr) → lr-boundary-nodep (sub-addr (addr, identity (lr-node-size)))

Theorem: lr-boundary-nodep-add-addr-lr-node-size lr-boundary-nodep (addr) → lr-boundary-nodep (add-addr (addr, identity (lr-node-size)))

Event: Disable lr-boundary-nodep.

;; LR-NODEP

Theorem: lr-nodep-opener lr-nodep (addr, data-seg) = ((type (addr) = 'addr)

∧ (cddr (addr) = nil) ∧ listp (addr) ∧ adpp (untag (addr), data-seg) ∧ lr-boundary-nodep (addr) ∧ (area-name (addr) = identity (lr-heap-name)))

Event: Disable lr-nodep.

;; LR-GOOD-POINTERP

Theorem: lr-good-pointerp-opener lr-good-pointerp (addr, data-seg) = ((type (addr) = 'addr)

∧ (cddr (addr) = nil) ∧ listp (addr) ∧ adpp (untag (addr), data-seg) ∧ lr-boundary-nodep (addr) ∧ (area-name (addr) = identity (lr-heap-name)) ∧ (type (fetch (add-addr (addr, identity (lr-ref-count-offset)),

data-seg))

    = 'nat))

Event: Disable lr-good-pointerp.

Theorem: equal-plus-remainder-0-fact (((offset1 mod max) = 0) ∧ ((offset2 mod max) = 0) ∧ (n < max) ∧ (m < max) ∧ (offset1 ∈ N) ∧ (offset2 ∈ N)) → (((n + offset1 ) = (m + offset2 ))

= ((fix (n) = fix (m)) ∧ (offset1 = offset2 )))

Theorem: lr-boundary-offsetp-equal-plus-fact (lr-boundary-offsetp (offset1 ) ∧ lr-boundary-offsetp (offset2 ) ∧ (n < lr-node-size) ∧ (m < lr-node-size)

∧ (offset1 ∈ N) ∧ (offset2 ∈ N)) → (((n + offset1 ) = (m + offset2 ))

= ((fix (n) = fix (m)) ∧ (offset1 = offset2 )))

Theorem: good-posp-list-nx-t-simple (good-posp ('list, pos, body) ∧ listp (pos) ∧ (car (last (pos)) < length (cur-expr (butlast (pos), body)))) → (good-posp ('list, nx (pos), body) ∧ good-posp1 (pos, body))

Theorem: lr-programs-properp-1-lr-proper-exprp (lr-programs-properp-1 (progs, program-names, table) ∧ (prog ∈ progs)) → lr-proper-exprp (t,

program-body (prog), program-names, formal-vars (prog), strip-cars (temp-var-dcls (prog)), table)

Theorem: lr-proper-exprp-list-lr-proper-get-t lr-proper-exprp ('list, expr, pnames, formals, temps, table) → (lr-proper-exprp (t, get (n, expr), pnames, formals, temps, table)

= (n < length (expr)))

Theorem: lr-proper-exprp-t-lr-proper-get-t ((car (expr) ≠ s-temp-fetch) ∧ (car (expr) ≠ s-temp-eval) ∧ (car (expr) ≠ s-temp-test) ∧ (car (expr) ≠ 'quote) ∧ (n ≄ 0) ∧ lr-proper-exprp (t, expr, pnames, formals, temps, table)) → (lr-proper-exprp (t, get (n, expr), pnames, formals, temps, table)

= (n < length (expr)))

Event: Disable lr-proper-exprp-list-lr-proper-get-t.

Theorem: lr-proper-exprp-lr-proper-exprp-cur-expr (lr-proper-exprp (t, body, pnames, formals, temps, table) ∧ good-posp1 (pos, body)) → lr-proper-exprp (t, cur-expr (pos, body), pnames, formals, temps, table)

Theorem: lr-programs-properp-lr-programs-properp-1 (lr-programs-properp (l, table) ∧ (prog-seg = p-prog-segment (l))) → (lr-programs-properp-1 (p-prog-segment (l),

strip-logic-fnames (cdr (prog-seg)),

table)

∧ definedp (area-name (p-pc (l)), prog-seg))

Theorem: lr-programs-properp-lr-proper-exprp-lr-expr (lr-programs-properp (l, table) ∧ good-posp1 (offset (p-pc (l)), program-body (p-current-program (l)))) → lr-proper-exprp (t,

lr-expr (l),

strip-logic-fnames (cdr (p-prog-segment (l))), formal-vars (p-current-program (l)), strip-cars (temp-var-dcls (p-current-program (l))), table)

Theorem: lr-proper-exprp-length-cur-expr (lr-proper-exprp (t, expr, pnames, formals, temps, table) ∧ listp (expr) ∧ (subrp (car (expr)) ∨ body (car (expr))) ∧ (car (expr) ≠ 'quote)) → (length (expr) = (1 + arity (car (expr))))

Theorem: listp-comp-body-1 listp (comp-body-1 (flag, body, n)) = if flag = 'list then listp (body)

else t endif

Theorem: car-append listp (x) → (car (append (x, y)) = car (x))

Theorem: length-cdr-comp-if-comp-body length (comp-if (comp-body-1 (t, test, n1 ),

comp-body-1 (t, then, n2 ), comp-body-1 (t, else, n3 ), n))

= (length (comp-body-1 (t, test, n1 ))

+ length (comp-body-1 (t, then, n2 )) + length (comp-body-1 (t, else, n3 )) + 4)

Theorem: lr-p-c-size-list-0-opener lr-p-c-size-list (0, expr) = 0

Theorem: lr-p-c-size-list-add1-opener ((1 + n) < length (expr)) → (lr-p-c-size-list (1 + n, expr)

= (lr-p-c-size (t, cadr (expr)) + lr-p-c-size-list (n, cdr (expr))))

Theorem: length-comp-body-1-lr-p-c-size length (comp-body-1 (flag, body, n)) = lr-p-c-size (flag, body)

Event: Disable lr-p-c-size-list-add1-opener.

Theorem: length-label-instrs length (label-instrs (instrs, n)) = length (instrs)

Theorem: length-comp-body-lr-p-c-size length (comp-body (body)) = (1 + lr-p-c-size (t, body))

Theorem: lr-p-c-size-flag-list lr-p-c-size ('list, cdr (expr)) = lr-p-c-size-list (length (expr) − 1, expr)

Theorem: lr-proper-exprp-car-if-cadr (lr-proper-exprp (t, body, pnames, formals, temps, table) ∧ listp (body) ∧ (car (body) = 'if)) → lr-proper-exprp (t, cadr (body), pnames, formals, temps, table)

Theorem: lr-proper-exprp-car-if-caddr (lr-proper-exprp (t, body, pnames, formals, temps, table) ∧ listp (body) ∧ (car (body) = 'if)) → lr-proper-exprp (t, caddr (body), pnames, formals, temps, table)

Theorem: lr-proper-exprp-car-if-cadddr (lr-proper-exprp (t, body, pnames, formals, temps, table) ∧ listp (body) ∧ (car (body) = 'if)) → lr-proper-exprp (t, cadddr (body), pnames, formals, temps, table)

Theorem: good-posp-list-t-offset-program-body (good-posp ('list, offset (p-pc (l)), program-body (p-current-program (l))) ∧ listp (lr-expr-list (l)) ∧ listp (offset (p-pc (l)))) → good-posp1 (offset (p-pc (l)), program-body (p-current-program (l)))

Theorem: good-posp-list-nx-offset-program-body (good-posp ('list, offset (p-pc (l)), program-body (p-current-program (l))) ∧ listp (offset (p-pc (l))) ∧ listp (lr-expr-list (l))) → good-posp ('list,

nx (offset (p-pc (l))),

program-body (p-current-program (l)))

Theorem: name-formal-vars-temp-var-dcls-program-body-cons (name (cons (name, rest)) = name) ∧ (formal-vars (cons (name, cons (formal-vars, rest))) = formal-vars) ∧ (temp-var-dcls (cons (name,

cons (formal-vars, cons (temp-var-dcls, program-body))))

= temp-var-dcls) ∧ (program-body (cons (name,

cons (formal-vars, cons (temp-var-dcls, program-body))))

= program-body)

Theorem: program-body-assoc-comp-programs-1 definedp (name, programs) → (program-body (assoc (name, comp-programs-1 (programs)))

= comp-body (program-body (assoc (name, programs))))

Theorem: program-body-assoc-comp-programs definedp (name, programs) → (program-body (assoc (name, comp-programs (programs)))

= if name = name (car (programs))

then label-instrs (append (comp-body-1 (t, program-body (car (programs)), 0), list (identity (list ('set-global,

area-name (lr-answer-addr))),

                                  '(ret))),
                        0)

else comp-body (program-body (assoc (name, cdr (programs)))) endif)

Theorem: definedp-area-name-member-p-current-program definedp (area-name (p-pc (l)), p-prog-segment (l)) → (p-current-program (l) ∈ p-prog-segment (l))

Definition: induct-hint-6 (n, body) = if n < length (body) then induct-hint-6 (1 + n, body)

else t endif

Theorem: lr-p-c-size-list-0 listp (body) → ((lr-p-c-size-list (n, body) = 0) = ((n ≃ 0) ∨ (cdr (body) ≃ nil)))

Event: Disable lr-p-c-size-list-0.

Theorem: lessp-lr-p-c-size-list-lessp-sub1-length (lr-p-c-size-list (n, body) ≠ 0)

→ ((lr-p-c-size-list (n, body) − 1)

< lr-p-c-size-list (length (body) − 1, body))

Theorem: lr-p-pc-1-body-0 lr-p-pc-1 (0, pos) = 0

Theorem: lessp-lr-p-pc-1-lr-p-c-size-helper-1 (listp (body) ∧ (n ≄ 0) ∧ (lr-p-pc-1 (get (n, body), pos) < lr-p-c-size (t, get (n, body))) ∧ (lr-p-pc-1 (get (n, body), pos) ≠ 0)) → (((lr-p-c-size-list (n − 1, body) + lr-p-pc-1 (get (n, body), pos)) − 1)

< lr-p-c-size-list (length (body) − 1, body))

Theorem: lessp-lr-p-pc-1-lr-p-c-size lr-p-pc-1 (body, pos) < lr-p-c-size (t, body)

Event: Disable lessp-lr-p-pc-1-lr-p-c-size-helper-1.

Theorem: not-lessp-p-max-temp-stk-size-lr-push-tstk (p-psw (lr-push-tstk (l, anything)) = 'run) → (p-max-temp-stk-size (l)

≮ length (p-temp-stk (lr-push-tstk (l, anything))))

Theorem: proper-p-temp-stkp-lr->p-lr-push-tstk proper-p-temp-stkp (temp-stkp, lr->p (lr-push-tstk (l, anything))) = proper-p-temp-stkp (temp-stkp, lr->p (l))

Theorem: proper-p-alistp-p-objectp (proper-p-alistp (bindings, l) ∧ definedp (name, bindings)) → p-objectp (cdr (assoc (name, bindings)), l)

Theorem: formal-vars-assoc-comp-programs-1 definedp (name, programs) → (formal-vars (assoc (name, comp-programs-1 (programs)))

= formal-vars (assoc (name, programs)))

Theorem: formal-vars-assoc-comp-programs definedp (name, programs) → (formal-vars (assoc (name, comp-programs (programs)))

= formal-vars (assoc (name, programs)))

Theorem: temp-var-dcls-assoc-comp-programs-1 definedp (name, programs) → (temp-var-dcls (assoc (name, comp-programs-1 (programs)))

= temp-var-dcls (assoc (name, programs)))

Theorem: temp-var-dcls-assoc-comp-programs definedp (name, programs) → (temp-var-dcls (assoc (name, comp-programs (programs)))

= temp-var-dcls (assoc (name, programs)))

Theorem: lr-programs-properp-definedp-car-untag-p-pc lr-programs-properp (l, table) → definedp (car (untag (p-pc (l))), p-prog-segment (l))

Theorem: p-objectp-cdr-assoc-litatom-proper-p-alistp (proper-p-alistp (bindings, lp) ∧ good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ (strip-cars (bindings)

= append (formal-vars (assoc (car (untag (p-pc (l))),

comp-programs-1 (p-prog-segment (l)))),

strip-cars (temp-var-dcls (assoc (car (untag (p-pc (l))),

comp-programs-1 (p-prog-segment (l)))))))

∧ litatom (lr-expr (l))) → p-objectp (cdr (assoc (lr-expr (l), bindings)), lp)

Theorem: proper-p-temp-stkp-lr-push-tstk-assoc-bindings (lr-programs-properp (l, table) ∧ good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ proper-p-alistp (bindings (car (p-ctrl-stk (l))), lr->p (l)) ∧ litatom (lr-expr (l)) ∧ (strip-cars (bindings (car (p-ctrl-stk (l))))

= append (formal-vars (assoc (car (untag (p-pc (l))),

comp-programs-1 (p-prog-segment (l)))),

strip-cars (temp-var-dcls (assoc (car (untag (p-pc (l))),

comp-programs-1 (p-prog-segment (l))))))))

→ (proper-p-temp-stkp (p-temp-stk (lr-push-tstk (l,

cdr (assoc (lr-expr (l),

bindings (car (p-ctrl-stk (l))))))),

lr->p (l)) = proper-p-temp-stkp (p-temp-stk (l), lr->p (l)))

Theorem: lr-p-pc-lr-push-tstk lr-p-pc (lr-push-tstk (l, anything)) = lr-p-pc (l)

Theorem: proper-p-statep-lr->p-lr-push-tstk (proper-p-statep (lr->p (l)) ∧ lr-programs-properp (l, table) ∧ good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ (p-psw (lr-push-tstk (l, cdr (assoc (lr-expr (l),

bindings (car (p-ctrl-stk (l)))))))

     = 'run)

∧ litatom (lr-expr (l))) → proper-p-statep (lr->p (lr-push-tstk (l,

cdr (assoc (lr-expr (l), bindings (car (p-ctrl-stk (l))))))))

Theorem: good-posp1-cons-lessp-4-if-lr-proper-exprp ((car (cur-expr (pos, body)) = 'if) ∧ good-posp1 (pos, body) ∧ lr-proper-exprp (t, body, pnames, formals, temps, table)) → (good-posp1 (dv (pos, 1), body)

∧ good-posp1 (dv (pos, 2), body) ∧ good-posp1 (dv (pos, 3), body))

Theorem: good-posp-cons-lessp-4-if-lr-programs-properp ((car (lr-expr (l)) = 'if) ∧ good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table)) → (good-posp1 (dv (offset (p-pc (l)), 1), program-body (p-current-program (l)))

∧ good-posp1 (dv (offset (p-pc (l)), 2),

program-body (p-current-program (l)))

∧ good-posp1 (dv (offset (p-pc (l)), 3), program-body (p-current-program (l))))

Theorem: proper-p-statep-lr->p-lr-set-pos (lr-programs-properp (l, table) ∧ proper-p-statep (lr->p (l))) → proper-p-statep (lr->p (lr-set-pos (l, pos)))

Theorem: lr-p-pc-lr-pop-tstk lr-p-pc (lr-pop-tstk (l)) = lr-p-pc (l)

Theorem: proper-p-statep-lr->p-lr-pop-tstk proper-p-statep (lr->p (l)) → proper-p-statep (lr->p (lr-pop-tstk (l)))

Theorem: good-posp-dv-1-temps-lr-expr (((car (lr-expr (l)) = s-temp-eval) ∨ (car (lr-expr (l)) = s-temp-test)) ∧ good-posp1 (offset (p-pc (l)), program-body (p-current-program (l)))) → good-posp1 (dv (offset (p-pc (l)), 1), program-body (p-current-program (l)))

Theorem: proper-p-alistp-put-assoc (proper-p-alistp (bindings, l) ∧ p-objectp (object, l)) → proper-p-alistp (put-assoc (object, var-name, bindings), l)

Theorem: listp-p-temp-stk-lr-push-tstk (p-psw (lr-push-tstk (l, object)) = 'run) → listp (p-temp-stk (lr-push-tstk (l, object)))

Theorem: lr-p-pc-lr-set-temp lr-p-pc (lr-set-temp (l, value, var-name)) = lr-p-pc (l)

Theorem: proper-p-statep-lr-set-temp (proper-p-statep (lr->p (l)) ∧ listp (p-temp-stk (l))) → proper-p-statep (lr->p (lr-set-temp (l, car (p-temp-stk (l)), var-name)))

Theorem: p-objectp-cdr-assoc-bindings-proper-p-alistp (proper-p-alistp (bindings, l) ∧ definedp (object, bindings)) → p-objectp (cdr (assoc (object, bindings)), l)

Theorem: definedp-caddr-lr-expr-bindings-ctrl-stk (lr-programs-properp-1 (progs, program-names, table) ∧ definedp (name, progs) ∧ ((car (cur-expr (pos, program-body (assoc (name, progs))))

= s-temp-fetch)

∨ (car (cur-expr (pos, program-body (assoc (name, progs))))

= s-temp-test))

∧ good-posp1 (pos, program-body (assoc (name, progs))) ∧ (strip-cars (bindings)

= append (formal-vars (assoc (name, comp-programs (progs))), strip-cars (temp-var-dcls (assoc (name,

comp-programs (progs)))))))

→ definedp (caddr (cur-expr (pos, program-body (assoc (name, progs)))), bindings)

Theorem: proper-p-temp-stkp-p-temp-stk-lr-do-temp-fetch (proper-p-framep (top (p-ctrl-stk (l1 )), area-name (p-pc (l1 )), l2 ) ∧ lr-programs-properp (l1 , table) ∧ ((car (lr-expr (l1 )) = s-temp-fetch)

∨ (car (lr-expr (l1 )) = s-temp-test)) ∧ good-posp1 (offset (p-pc (l1 )), program-body (p-current-program (l1 ))) ∧ same-signature (p-data-segment (l1 ), p-data-segment (l2 )) ∧ (p-prog-segment (lr->p (l1 )) = p-prog-segment (l2 )) ∧ (p-word-size (l1 ) = p-word-size (l2 ))) → (proper-p-temp-stkp (p-temp-stk (lr-do-temp-fetch (l1 )), l2 )

= proper-p-temp-stkp (p-temp-stk (l1 ), l2 ))

Theorem: length-lr-do-temp-fetch (p-psw (lr-do-temp-fetch (l)) = 'run) → (p-max-temp-stk-size (l) ≮ length (p-temp-stk (lr-do-temp-fetch (l))))

Theorem: lr-p-pc-lr-do-temp-fetch lr-p-pc (lr-do-temp-fetch (l)) = lr-p-pc (l)

Theorem: proper-p-statep-lr-do-temp-fetch ((p-psw (lr-do-temp-fetch (l)) = 'run) ∧ lr-programs-properp (l, table) ∧ ((car (lr-expr (l)) = s-temp-fetch)

∨ (car (lr-expr (l)) = s-temp-test)) ∧ good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ proper-p-statep (lr->p (l))) → proper-p-statep (lr->p (lr-do-temp-fetch (l)))

Theorem: length-lr-push-tstk (p-psw (lr-push-tstk (l, object)) = 'run) → (p-max-temp-stk-size (l)

≮ length (p-temp-stk (lr-push-tstk (l, object))))

Theorem: listp-p-temp-stk-lr-do-temp-fetch (p-psw (lr-do-temp-fetch (l)) = 'run) → listp (p-temp-stk (lr-do-temp-fetch (l)))

Theorem: proper-p-prog-segmentp-append plistp (segment1 ) → (proper-p-prog-segmentp (append (segment1 , segment2 ), p)

= (proper-p-prog-segmentp (segment1 , p) ∧ proper-p-prog-segmentp (segment2 , p)))

Theorem: lr-programs-properp-expr-quote-type-addr (lr-programs-properp (l, table) ∧ good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ listp (lr-expr (l)) ∧ (car (lr-expr (l)) = 'quote)) → (type (cadr (lr-expr (l))) = 'addr)

Theorem: proper-p-instructionp-push-constant-opener proper-p-instructionp (list ('push-constant, object), name, p) = proper-p-push-constant-instructionp (list ('push-constant, object),

name, p)

Theorem: proper-labeled-p-instructionsp-find-labelp-non-litatom (proper-labeled-p-instructionsp (body, name, p) ∧ (¬ litatom (label))) → (find-labelp (label, body) = f)

Theorem: lessp-4-not-zerop-not-1-not-2-3 ((n ≄ 0) ∧ (n ≠ 1) ∧ (n ≠ 2) ∧ (n < 4)) → (n = 3)

Theorem: lessp-4-not-zerop-not-1-not-2-3-get-car-pos ((car (pos) ≄ 0) ∧ (car (pos) ≠ 1) ∧ (car (pos) ≠ 2) ∧ (car (pos) < 4)) → (get (car (pos), body) = cadddr (body))

Event: Disable lessp-4-not-zerop-not-1-not-2-3-get-car-pos.

Theorem: lessp-index-lessp-lr-p-c-size-list lr-p-c-size-list (length (cdr (body)), body) ≮ lr-p-c-size-list (n, body)

Theorem: lessp-plus-lr-p-c-size-lr-p-pc-1-helper (listp (body) ∧ (n ≄ 0) ∧ (lr-p-c-size (t, get (n, body)) ≮ x) ∧ ((n − 1) < length (cdr (body))) ∧ (len = length (cdr (body)))) → (((lr-p-c-size-list (len, body) + 1)

< (lr-p-c-size-list (n − 1, body) + x))

= f)

Theorem: lessp-plus-lr-p-c-size-lr-p-pc-1 (good-posp1 (pos, body) ∧ lr-proper-exprp (t, body, pnames, formals, temps, table)) → (lr-p-c-size (t, body)

≮ (lr-p-pc-1 (body, pos) + lr-p-c-size (t, cur-expr (pos, body))))

Definition: induct-hint-7 (pos, expr, n) = if pos ≃ nil then t

elseif expr ≃ nil then t elseif car (expr) = 'if then let then-n be n + 3 + lr-p-c-size (t, cadr (expr))

in

case on car (pos):

case = 1

then induct-hint-7 (cdr (pos), cadr (expr), n)

case = 2

then induct-hint-7 (cdr (pos), caddr (expr), then-n) otherwise induct-hint-7 (cdr (pos),

cadddr (expr),

                              1

+ then-n

+ lr-p-c-size (t, caddr (expr))) endcase endlet elseif car (expr) = s-temp-fetch then t elseif car (expr) = s-temp-eval then induct-hint-7 (cdr (pos), cadr (expr), n) elseif car (expr) = s-temp-test then induct-hint-7 (cdr (pos), cadr (expr), n + 4) elseif car (expr) = 'quote then t else induct-hint-7 (cdr (pos),

get (car (pos), expr),

n + lr-p-c-size-list (car (pos) − 1, expr)) endif

Theorem: lr-p-c-size-s-temp-test-eval-cadr-not-lessp-fact (listp (expr) ∧ ((car (expr) = s-temp-eval) ∨ (car (expr) = s-temp-test))) → (lr-p-c-size (t, cadr (expr)) < lr-p-c-size (t, expr))

Theorem: length-comp-temp-test (listp (body) ∧ (car (body) = s-temp-test)) → (length (comp-temp-test (any-body, comp-body-1 (t, cadr (body), n), any-n))

= lr-p-c-size (t, body))

Theorem: plistp-comp-temp-test plistp (comp-temp-test (body, instrs, n))

Theorem: length-comp-if-alt (listp (body) ∧ (car (body) = 'if)) → (length (comp-if (comp-body-1 (t, cadr (body), n1 ),

comp-body-1 (t, caddr (body), n2 ), comp-body-1 (t, cadddr (body), n3 ), any-n))

= lr-p-c-size (t, body))

Theorem: plistp-comp-if (plistp (else-instrs) ∧ listp (else-instrs)) → plistp (comp-if (test-intrs, then-instrs, else-instrs, n))

Theorem: plistp-comp-body-1 plistp (comp-body-1 (flag, body, n))

Theorem: lr-p-c-size-list-funcall-not-lessp-fact (listp (expr) ∧ (car (expr) ≠ s-temp-fetch) ∧ (car (expr) ≠ s-temp-eval) ∧ (car (expr) ≠ s-temp-test) ∧ (car (expr) ≠ 'quote) ∧ (car (expr) ≠ 'if)) → (lr-p-c-size-list (length (expr) − 1, expr) < lr-p-c-size (t, expr))

Theorem: lr-p-c-size-nlistp-body (¬ listp (body)) → (lr-p-c-size (t, body) = 1)

Theorem: firstn-lr-p-c-size-restn-lr-p-pc-1-comp-body-1-helper-1 (good-posp1 (pos, cadr (body)) ∧ (car (body) = 'if) ∧ listp (body) ∧ lr-proper-exprp (t, body, pnames, formals, temps, table)) → (firstn (lr-p-c-size (t, cur-expr (pos, cadr (body))),

restn (lr-p-pc-1 (cadr (body), pos),

comp-if (comp-body-1 (t, cadr (body), n), then-instrs, else-instrs, n))) = firstn (lr-p-c-size (t, cur-expr (pos, cadr (body))), restn (lr-p-pc-1 (cadr (body), pos),

comp-body-1 (t, cadr (body), n))))

Theorem: firstn-restn-plus-comp-if-1 ((j = length (test)) ∧ listp (then) ∧ (m < length (then)) ∧ (m ∈ N) ∧ listp (test) ∧ (length (then) ≮ (k + m))) → (firstn (k, restn (3 + j + m, comp-if (test, then, else, n)))

= firstn (k, restn (m, then)))

Theorem: firstn-unlabel-instrs-comp-body-1-lr-p-pc-1-helper-2 (good-posp1 (pos, caddr (body)) ∧ (car (body) = 'if) ∧ listp (body) ∧ lr-proper-exprp (t, body, pnames, formals, temps, table)) → (lr-p-c-size (t, caddr (body))

≮ (lr-p-pc-1 (caddr (body), pos)

+ lr-p-c-size (t, cur-expr (pos, caddr (body)))))

Theorem: firstn-restn-plus-comp-if-2 ((j = length (test)) ∧ (i = length (then)) ∧ listp (then) ∧ (m < length (else)) ∧ (m ∈ N) ∧ listp (test) ∧ listp (else)

∧ (length (else) ≮ (m + k))) → (firstn (k, restn (j + i + m + 4, comp-if (test, then, else, n)))

= firstn (k, restn (m, else)))

Theorem: firstn-unlabel-instrs-comp-body-1-lr-p-pc-1-helper-3 (good-posp1 (pos, cadddr (body)) ∧ (car (body) = 'if) ∧ listp (body) ∧ lr-proper-exprp (t, body, pnames, formals, temps, table)) → (lr-p-c-size (t, cadddr (body))

≮ (lr-p-pc-1 (cadddr (body), pos)

+ lr-p-c-size (t, cur-expr (pos, cadddr (body)))))

Theorem: plus-constant-fact-helper-1 (1 + n + 3 + x + y) = (n + 4 + x + y)

Theorem: firstn-lr-p-c-size-restn-lr-p-pc-1-comp-body-1-helper-4 (good-posp1 (pos, cadr (body)) ∧ listp (body) ∧ (car (body) = s-temp-test) ∧ lr-proper-exprp (t, body, pnames, formals, temps, table)) → (firstn (lr-p-c-size (t, cur-expr (pos, cadr (body))),

restn (lr-p-pc-1 (cadr (body), pos) + 4,

comp-temp-test (body-1 , comp-body-1 (t, cadr (body), n), m)))

= firstn (lr-p-c-size (t, cur-expr (pos, cadr (body))), restn (lr-p-pc-1 (cadr (body), pos),

comp-body-1 (t, cadr (body), n))))

Theorem: firstn-lr-p-c-size-restn-lr-p-pc-1-comp-body-1-helper-5 (4 + x) = (x + 4)

Theorem: good-posp1-lr-proper-exprp-get-cadddr (listp (pos) ∧ listp (body) ∧ (car (body) = 'if) ∧ (car (pos) ≠ 1) ∧ (car (pos) ≠ 2) ∧ (car (pos) ≠ 0) ∧ (car (pos) ∈ N) ∧ lr-proper-exprp (t, body, pnames, formals, temps, table) ∧ ((((car (pos) − 1) − 1) − 1) < length (cdddr (body)))) → (get (car (pos), body) = cadddr (body))

Theorem: lr-proper-exprp-cadr-temps (lr-proper-exprp (t, expr, pnames, formals, temps, table) ∧ ((car (expr) = s-temp-eval) ∨ (car (expr) = s-temp-test))) → lr-proper-exprp (t, cadr (expr), pnames, formals, temps, table)

Theorem: lessp-plus-lr-p-c-size-lr-p-pc-1-temps (good-posp1 (pos, cadr (body)) ∧ listp (body) ∧ ((car (body) = s-temp-eval) ∨ (car (body) = s-temp-test)) ∧ lr-proper-exprp (t, body, pnames, formals, temps, table)) → (lr-p-c-size (t, cadr (body))

≮ (lr-p-pc-1 (cadr (body), pos)

+ lr-p-c-size (t, cur-expr (pos, cadr (body)))))

Theorem: firstn-lr-p-c-size-restn-lr-p-pc-1-comp-body-1-helper-6 (listp (body) ∧ (car (body) ≠ 'if) ∧ (car (body) ≠ s-temp-fetch) ∧ (car (body) ≠ s-temp-eval) ∧ (car (body) ≠ s-temp-test) ∧ (car (body) ≠ 'quote) ∧ lr-proper-exprp (t, body, pnames, formals, temps, table) ∧ (n ≄ 0)) → (lr-p-c-size-list (length (body) − 1, body)

≮ (lr-p-c-size-list (n − 1, body) + lr-p-pc-1 (get (n, body), pos)))

Definition: induct-hint-10 (n, l, x) = if ¬ listp (l) then t

elseif n ≃ 0 then t

elseif listp (cdr (l))

then induct-hint-10 (n − 1, cdr (l), x + lr-p-c-size (t, cadr (l))) else t endif

Theorem: lr-p-c-size-list-car-opener ((n ≄ 0) ∧ (n < length (body))) → (lr-p-c-size-list (n, body)

= (lr-p-c-size (t, cadr (body))

+ lr-p-c-size-list (n − 1, cdr (body))))

Theorem: restn-comp-body-1-list-fact ((lr-p-c-size (t, get (m, cdr (body))) ≮ j ) ∧ (m < length (cdr (body))) ∧ (m ∈ N) ∧ (n ∈ N) ∧ (j ∈ N)) → (restn (lr-p-c-size-list (m, body) + j ,

comp-body-1 ('list, cdr (body), n)) = restn (j ,

comp-body-1 ('list, restn (m, cdr (body)), n + lr-p-c-size-list (m, body))))

Event: Disable lr-p-c-size-list-car-opener.

Theorem: firstn-restn-small-enough-cdr-comp-body-1-list (listp (body) ∧ (lr-p-c-size (t, car (body)) ≮ (j + k))) → (firstn (j , restn (k, comp-body-1 ('list, body, n)))

= firstn (j , restn (k, comp-body-1 (t, car (body), n))))

Theorem: firstn-lr-p-c-size-restn-lr-p-pc-1-comp-body-1-helper-7 (listp (body) ∧ (car (body) ≠ 'if) ∧ (car (body) ≠ s-temp-fetch) ∧ (car (body) ≠ s-temp-eval) ∧ (car (body) ≠ s-temp-test) ∧ (car (body) ≠ 'quote) ∧ (n ∈ N) ∧ lr-proper-exprp (t, body, pnames, formals, temps, table) ∧ (m ≄ 0) ∧ (m < length (body)) ∧ good-posp1 (pos, get (m, body))) → (firstn (lr-p-c-size (t, cur-expr (pos, get (m, body))),

restn (lr-p-c-size-list (m − 1, body) + lr-p-pc-1 (get (m, body), pos), comp-body-1 ('list, cdr (body), n)))

= firstn (lr-p-c-size (t, cur-expr (pos, get (m, body))), restn (lr-p-pc-1 (get (m, body), pos),

comp-body-1 (t, get (m, body), n + lr-p-c-size-list (m − 1, body)))))

Theorem: firstn-lr-p-c-size-restn-lr-p-pc-1-comp-body-1-helper-8 (listp (body) ∧ (car (body) ≠ 'if) ∧ (car (body) ≠ s-temp-fetch) ∧ (car (body) ≠ s-temp-eval) ∧ (car (body) ≠ s-temp-test) ∧ (car (body) ≠ 'quote) ∧ lr-proper-exprp (t, body, pnames, formals, temps, table) ∧ (n ≄ 0) ∧ (n < length (body)) ∧ good-posp1 (pos, get (n, body))) → ((lr-p-c-size-list (length (body) − 1, body)

− (lr-p-c-size-list (n − 1, body) + lr-p-pc-1 (get (n, body), pos))) ≮ lr-p-c-size (t, cur-expr (pos, get (n, body))))

Theorem: firstn-lr-p-c-size-restn-lr-p-pc-1-comp-body-1 (good-posp1 (pos, body) ∧ lr-proper-exprp (t, body, pnames, formals, temps, table) ∧ (n ∈ N)) → (firstn (lr-p-c-size (t, cur-expr (pos, body)),

restn (lr-p-pc-1 (body, pos), comp-body-1 (t, body, n))) = comp-body-1 (t, cur-expr (pos, body), n + lr-p-pc-1 (body, pos)))

Event: Disable firstn-lr-p-c-size-restn-lr-p-pc-1-comp-body-1-helper-5.

Theorem: not-lessp-lr-p-c-size-flag-t-1 lr-p-c-size (t, body1 ) ≮ 1

Theorem: not-lessp-x-x (x < x) = f

Theorem: get-plus get (x + y, list) = get (y, restn (x, list))

Event: Disable get-plus.

Theorem: get-firstn-different-lists ((k < n) ∧ (firstn (n, list1 ) = firstn (n, list2 ))) → (get (k, list1 ) = get (k, list2 ))

Theorem: unlabel-list-label unlabel (list ('dl, lab, comment, instr)) = instr

Theorem: legal-labelp-label-make-label legal-labelp (list ('dl, lr-make-label (n), comment, instr))

Theorem: lr-make-label-not-numberp (n ∉ N) → (lr-make-label (n) = lr-make-label (0))

Definition: induct-hint-9 (m, instrs, n) = if listp (instrs) then induct-hint-9 (m − 1, cdr (instrs), 1 + n)

else t endif

Theorem: get-label-instrs (m < length (instrs)) → (get (m, label-instrs (instrs, n))

= list ('dl, lr-make-label (n + m), nil, get (m, instrs)))

Event: Disable lr-make-label-not-numberp.

Theorem: get-append get (n, append (x, y)) = if n < length (x) then get (n, x)

else get (n − length (x), y) endif

Event: Disable get-append.

Theorem: get-lr-p-c-size-lessp-lr-p-c-size-comp-body-1 (good-posp1 (pos, body) ∧ lr-proper-exprp (t, body, pnames, formals, temps, table) ∧ (n ∈ N) ∧ (m < lr-p-c-size (t, cur-expr (pos, body)))) → (get (lr-p-pc-1 (body, pos) + m, comp-body-1 (t, body, n))

= get (m,

comp-body-1 (t, cur-expr (pos, body), n + lr-p-pc-1 (body, pos))))

Theorem: get-lr-p-pc-1-comp-body-1-cur-expr-comp-body (good-posp1 (offset (p-pc (l)), program-body (prog)) ∧ listp (lr-expr (l)) ∧ (car (lr-expr (l)) = 'quote) ∧ lr-programs-properp (l, table) ∧ (prog = p-current-program (l))) → (get (lr-p-pc-1 (program-body (prog), offset (p-pc (l))),

comp-body (program-body (prog))) = list ('dl,

lr-make-label (lr-p-pc-1 (program-body (prog),

offset (p-pc (l)))),

nil,

list ('push-constant, cadr (lr-expr (l)))))

Theorem: get-lr-p-pc-1-comp-body-1-quote (good-posp1 (offset (p-pc (l)), program-body (car (p-prog-segment (l)))) ∧ listp (lr-expr (l)) ∧ (car (lr-expr (l)) = 'quote) ∧ lr-programs-properp (l, table) ∧ (area-name (p-pc (l)) = caar (p-prog-segment (l)))) → (get (lr-p-pc-1 (program-body (car (p-prog-segment (l))), offset (p-pc (l))),

comp-body-1 (t, program-body (car (p-prog-segment (l))), 0)) = list ('push-constant, cadr (lr-expr (l))))

Theorem: proper-p-temp-stkp-p-temp-stk-lr-push-tstk-quote (lr-programs-properp (l, table) ∧ proper-p-prog-segmentp (comp-programs (p-prog-segment (l)), lr->p (l)) ∧ good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ listp (lr-expr (l)) ∧ (car (lr-expr (l)) = 'quote) ∧ proper-p-temp-stkp (p-temp-stk (l), lr->p (l))) → proper-p-temp-stkp (p-temp-stk (lr-push-tstk (l, cadr (lr-expr (l)))),

lr->p (l))

Theorem: proper-p-statep-lr-push-tstk-quote (proper-p-statep (lr->p (l)) ∧ listp (lr-expr (l)) ∧ (car (lr-expr (l)) = 'quote) ∧ good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ (p-psw (lr-push-tstk (l, cadr (lr-expr (l)))) = 'run)) → proper-p-statep (lr->p (lr-push-tstk (l, cadr (lr-expr (l)))))

Theorem: good-posp-dv-1-funcall-lr-expr (listp (lr-expr (l)) ∧ (car (lr-expr (l)) ≠ 'if) ∧ (car (lr-expr (l)) ≠ s-temp-eval) ∧ (car (lr-expr (l)) ≠ s-temp-test) ∧ (car (lr-expr (l)) ≠ s-temp-fetch) ∧ (car (lr-expr (l)) ≠ 'quote) ∧ good-posp1 (offset (p-pc (l)), program-body (p-current-program (l)))) → good-posp ('list,

dv (offset (p-pc (l)), 1),

program-body (p-current-program (l)))

Theorem: plistp-pairlist plistp (pairlist (x, y))

Theorem: all-p-objectps-append plistp (lst1 ) → (all-p-objectps (append (lst1 , lst2 ), p)

= (all-p-objectps (lst1 , p) ∧ all-p-objectps (lst2 , p)))

Theorem: all-p-objectps-reverse plistp (lst) → (all-p-objectps (reverse (lst), p) = all-p-objectps (lst, p))

Theorem: plistp-first-n plistp (first-n (n, list))

Theorem: proper-p-temp-stkp-all-p-objectps proper-p-temp-stkp (temp-stk, p) → all-p-objectps (temp-stk, p)

Theorem: all-p-objectps-first-n ((length (lst) ≮ n) ∧ all-p-objectps (lst, p)) → all-p-objectps (first-n (n, lst), p)

Theorem: strip-cars-append strip-cars (append (x, y)) = append (strip-cars (x), strip-cars (y))

Event: Disable strip-cars-append.

Theorem: strip-cars-pairlist strip-cars (pairlist (x, y)) = plist (x)

Event: Disable strip-cars-pairlist.

Theorem: strip-cars-pair-temps-with-initial-values strip-cars (pair-temps-with-initial-values (temp-var-decls)) = strip-cars (temp-var-decls)

Theorem: length-popn (length (list) ≮ n) → (length (popn (n, list)) = (length (list) − n))

Theorem: proper-p-temp-stkp-popn ((length (temp-stk) ≮ n) ∧ proper-p-temp-stkp (temp-stk, p)) → proper-p-temp-stkp (popn (n, temp-stk), p)

Theorem: proper-p-prog-segmentp-length-program-body (proper-p-prog-segmentp (prog-segment, p) ∧ definedp (name, prog-segment)) → listp (program-body (assoc (name, prog-segment)))

Theorem: ret-pc-make-p-call-frame ret-pc (make-p-call-frame (f-vars, temp-stk, temp-var-dcls, ret-pc)) = ret-pc

Theorem: bindings-make-p-call-frame bindings (make-p-call-frame (f-vars, temp-stk, temp-var-dcls, ret-pc)) = append (pair-formal-vars-with-actuals (f-vars, temp-stk),

pair-temps-with-initial-values (temp-var-dcls))

Theorem: cddr-nil-make-p-call-frame cddr (make-p-call-frame (f-vars, temp-stk, temp-var-dcls, ret-pc)) = nil

Theorem: listp-cdr-make-p-call-frame listp (cdr (make-p-call-frame (f-vars, temp-stk, temp-var-dcls, ret-pc)))

Theorem: length-pairlist length (pairlist (x, y)) = length (x)

Theorem: length-pair-temps-with-initial-values length (pair-temps-with-initial-values (temp-var-dcls)) = length (temp-var-dcls)

Theorem: not-proper-p-statep-not-listp-p-ctrl-stk (¬ listp (p-ctrl-stk (l))) → (¬ proper-p-statep (lr->p (l)))

Theorem: proper-p-statep-bad-type-1 ((fetch (car (p-temp-stk (l)), p-data-segment (l)) ≠ list (type (fetch (car (p-temp-stk (l)), p-data-segment (l))),

untag (fetch (car (p-temp-stk (l)), p-data-segment (l)))))

∧ adpp (untag (car (p-temp-stk (l))), p-data-segment (l))) → (¬ proper-p-statep (lr->p (l)))

Theorem: p-good-resultp-run-car (proper-p-statep (lr->p (l)) ∧ (p-psw (l) = 'run) ∧ lr-programs-properp (l, table) ∧ (unlabel (get (offset (pc),

program-body (assoc (area-name (pc),

p-prog-segment (lr->p (l))))))

     = '(call car)))

→ p-good-resultp (p (p-set-pc (lr->p (l), pc),

p-car-clock (p-set-pc (lr->p (l), pc))), p-data-segment (l), if fetch (top (p-temp-stk (l)), p-data-segment (l))

= tag ('nat, lr-cons-tag) then cons (fetch (add-addr (top (p-temp-stk (l)),

lr-car-offset),

p-data-segment (l)), cdr (p-temp-stk (l)))

else cons (lr-0-addr, cdr (p-temp-stk (l))) endif, p-ctrl-stk (l), add-addr (pc, 1))

Theorem: p-good-resultp-run-cdr (proper-p-statep (lr->p (l)) ∧ (p-psw (l) = 'run) ∧ lr-programs-properp (l, table) ∧ (unlabel (get (offset (pc),

program-body (assoc (area-name (pc), p-prog-segment (lr->p (l))))))

= '(call cdr)))

→ p-good-resultp (p (p-set-pc (lr->p (l), pc),

p-cdr-clock (p-set-pc (lr->p (l), pc))), p-data-segment (l), if fetch (top (p-temp-stk (l)), p-data-segment (l))

= tag ('nat, lr-cons-tag) then cons (fetch (add-addr (top (p-temp-stk (l)),

lr-cdr-offset),

p-data-segment (l)), cdr (p-temp-stk (l)))

else cons (lr-0-addr, cdr (p-temp-stk (l))) endif, p-ctrl-stk (l), add-addr (pc, 1))

Theorem: p-good-resultp-run-listp (proper-p-statep (lr->p (l)) ∧ (p-psw (l) = 'run) ∧ lr-programs-properp (l, table) ∧ (unlabel (get (offset (pc),

program-body (assoc (area-name (pc),

p-prog-segment (lr->p (l))))))

= '(call listp)))

→ p-good-resultp (p (p-set-pc (lr->p (l), pc),

p-listp-clock (p-set-pc (lr->p (l), pc))), p-data-segment (l), if fetch (car (p-temp-stk (l)), p-data-segment (l))

= tag ('nat, lr-cons-tag) then cons (lr-t-addr, cdr (p-temp-stk (l))) else cons (lr-f-addr, cdr (p-temp-stk (l))) endif, p-ctrl-stk (l), add-addr (pc, 1))

Theorem: p-good-resultp-run-nlistp (proper-p-statep (lr->p (l)) ∧ (p-psw (l) = 'run) ∧ lr-programs-properp (l, table) ∧ (unlabel (get (offset (pc),

program-body (assoc (area-name (pc),

p-prog-segment (lr->p (l))))))

= '(call nlistp)))

→ p-good-resultp (p (p-set-pc (lr->p (l), pc),

p-nlistp-clock (p-set-pc (lr->p (l), pc))), p-data-segment (l), if fetch (car (p-temp-stk (l)), p-data-segment (l))

= tag ('nat, lr-cons-tag) then cons (lr-f-addr, cdr (p-temp-stk (l))) else cons (lr-t-addr, cdr (p-temp-stk (l))) endif, p-ctrl-stk (l), add-addr (pc, 1))

Theorem: p-good-resultp-run-truep (proper-p-statep (lr->p (l)) ∧ (p-psw (l) = 'run) ∧ lr-programs-properp (l, table) ∧ (unlabel (get (offset (pc),

program-body (assoc (area-name (pc),

p-prog-segment (lr->p (l))))))

= '(call truep)))

→ p-good-resultp (p (p-set-pc (lr->p (l), pc),

p-truep-clock (p-set-pc (lr->p (l), pc))), p-data-segment (l), if fetch (car (p-temp-stk (l)), p-data-segment (l))

= tag ('nat, lr-true-tag) then cons (lr-t-addr, cdr (p-temp-stk (l))) else cons (lr-f-addr, cdr (p-temp-stk (l))) endif, p-ctrl-stk (l), add-addr (pc, 1))

Event: Disable proper-p-statep-bad-type-1.

Theorem: p-good-resultp-run-cons (proper-p-statep (lr->p (l)) ∧ (p-psw (l) = 'run) ∧ lr-programs-properp (l, table) ∧ (unlabel (get (offset (pc),

program-body (assoc (area-name (pc),

p-prog-segment (lr->p (l))))))

= '(call cons)))

→ p-good-resultp (p (p-set-pc (lr->p (l), pc),

p-cons-clock (p-set-pc (lr->p (l), pc))), deposit (fetch (add-addr (fetch (lr-fp-addr,

p-data-segment (l)), lr-ref-count-offset),

p-data-segment (l)), lr-fp-addr, deposit-a-list (list (tag ('nat, lr-cons-tag),

tag ('nat, 1),

top1 (p-temp-stk (l)),

top (p-temp-stk (l))), fetch (lr-fp-addr,

p-data-segment (l)), p-data-segment (l))),

cons (fetch (lr-fp-addr, p-data-segment (l)),

cddr (p-temp-stk (l))), p-ctrl-stk (l), add-addr (pc, 1))

Theorem: p-objectp-bad-type (object ≠ list (type (object), untag (object))) → (¬ p-objectp (object, p))

Theorem: proper-p-statep-bad-type-2 ((car (p-temp-stk (l)) ≠ list (type (car (p-temp-stk (l))), untag (car (p-temp-stk (l))))) ∧ listp (p-temp-stk (l))) → (¬ proper-p-statep (lr->p (l)))

Theorem: p-good-resultp-run-falsep (proper-p-statep (lr->p (l)) ∧ (p-psw (l) = 'run) ∧ lr-programs-properp (l, table) ∧ (unlabel (get (offset (pc),

program-body (assoc (area-name (pc),

p-prog-segment (lr->p (l))))))

= '(call falsep)))

→ p-good-resultp (p (p-set-pc (lr->p (l), pc),

p-falsep-clock (p-set-pc (lr->p (l), pc))), p-data-segment (l), if car (p-temp-stk (l)) = lr-f-addr then cons (lr-t-addr, cdr (p-temp-stk (l))) else cons (lr-f-addr, cdr (p-temp-stk (l))) endif, p-ctrl-stk (l), add-addr (pc, 1))

Event: Disable proper-p-statep-bad-type-2.

Theorem: p-good-resultp-run-false (proper-p-statep (lr->p (l)) ∧ (p-psw (l) = 'run) ∧ lr-programs-properp (l, table) ∧ (unlabel (get (offset (pc),

program-body (assoc (area-name (pc), p-prog-segment (lr->p (l))))))

= '(call false)))

→ p-good-resultp (p (p-set-pc (lr->p (l), pc),

p-false-clock (p-set-pc (lr->p (l), pc))), p-data-segment (l), cons (lr-f-addr, p-temp-stk (l)), p-ctrl-stk (l), add-addr (pc, 1))

Theorem: p-good-resultp-run-true (proper-p-statep (lr->p (l)) ∧ (p-psw (l) = 'run) ∧ lr-programs-properp (l, table) ∧ (unlabel (get (offset (pc),

program-body (assoc (area-name (pc),

p-prog-segment (lr->p (l))))))

= '(call true)))

→ p-good-resultp (p (p-set-pc (lr->p (l), pc),

p-true-clock (p-set-pc (lr->p (l), pc))), p-data-segment (l), cons (lr-t-addr, p-temp-stk (l)), p-ctrl-stk (l), add-addr (pc, 1))

Theorem: p-temp-stk-p-ctrl-stk-p-data-segment-run-car (proper-p-statep (lr->p (l)) ∧ (p-psw (l) = 'run) ∧ (p-psw (p (p-set-pc (lr->p (l), pc), p-car-clock (p-set-pc (lr->p (l), pc))))

= 'run)

∧ lr-programs-properp (l, table) ∧ (unlabel (get (offset (pc),

program-body (assoc (area-name (pc),

p-prog-segment (lr->p (l))))))

= '(call car)))

→ ((p-temp-stk (p (p-set-pc (lr->p (l), pc),

p-car-clock (p-set-pc (lr->p (l), pc))))

= if fetch (top (p-temp-stk (l)), p-data-segment (l))

= tag ('nat, lr-cons-tag) then cons (fetch (add-addr (top (p-temp-stk (l)), lr-car-offset),

p-data-segment (l)), cdr (p-temp-stk (l)))

else cons (lr-0-addr, cdr (p-temp-stk (l))) endif) ∧ (p-ctrl-stk (p (p-set-pc (lr->p (l), pc),

p-car-clock (p-set-pc (lr->p (l), pc))))

= p-ctrl-stk (l))

∧ (p-data-segment (p (p-set-pc (lr->p (l), pc),

p-car-clock (p-set-pc (lr->p (l), pc))))

= p-data-segment (l)))

Theorem: p-temp-stk-p-ctrl-stk-p-data-segment-run-cdr (proper-p-statep (lr->p (l)) ∧ (p-psw (l) = 'run) ∧ (p-psw (p (p-set-pc (lr->p (l), pc), p-cdr-clock (p-set-pc (lr->p (l), pc))))

    = 'run)

∧ lr-programs-properp (l, table) ∧ (unlabel (get (offset (pc),

program-body (assoc (area-name (pc),

p-prog-segment (lr->p (l))))))

    = '(call cdr)))

→ ((p-temp-stk (p (p-set-pc (lr->p (l), pc),

p-cdr-clock (p-set-pc (lr->p (l), pc))))

= if fetch (top (p-temp-stk (l)), p-data-segment (l))

= tag ('nat, lr-cons-tag) then cons (fetch (add-addr (top (p-temp-stk (l)), lr-cdr-offset),

p-data-segment (l)), cdr (p-temp-stk (l)))

else cons (lr-0-addr, cdr (p-temp-stk (l))) endif) ∧ (p-ctrl-stk (p (p-set-pc (lr->p (l), pc),

p-cdr-clock (p-set-pc (lr->p (l), pc))))

= p-ctrl-stk (l)) ∧ (p-data-segment (p (p-set-pc (lr->p (l), pc),

p-cdr-clock (p-set-pc (lr->p (l), pc))))

= p-data-segment (l)))

Theorem: p-temp-stk-p-ctrl-stk-p-data-segment-run-cons let fp-addr be fetch (lr-fp-addr, p-data-segment (l)) in (proper-p-statep (lr->p (l)) ∧ (p-psw (l) = 'run) ∧ (p-psw (p (p-set-pc (lr->p (l), pc),

p-cons-clock (p-set-pc (lr->p (l), pc))))

    = 'run)

∧ lr-programs-properp (l, table) ∧ (unlabel (get (offset (pc),

program-body (assoc (area-name (pc),

p-prog-segment (lr->p (l))))))

    = '(call cons)))

→ ((p-temp-stk (p (p-set-pc (lr->p (l), pc), p-cons-clock (p-set-pc (lr->p (l), pc))))

= cons (fetch (lr-fp-addr, p-data-segment (l)),

cddr (p-temp-stk (l)))) ∧ (p-ctrl-stk (p (p-set-pc (lr->p (l), pc),

p-cons-clock (p-set-pc (lr->p (l), pc))))

= p-ctrl-stk (l)) ∧ (p-data-segment (p (p-set-pc (lr->p (l), pc),

p-cons-clock (p-set-pc (lr->p (l), pc))))

= deposit (fetch (add-addr (fetch (lr-fp-addr,

p-data-segment (l)), lr-ref-count-offset),

p-data-segment (l)), lr-fp-addr, deposit-a-list (list (tag ('nat,

lr-cons-tag), tag ('nat, 1), top1 (p-temp-stk (l)), top (p-temp-stk (l))),

fetch (lr-fp-addr,

p-data-segment (l)), p-data-segment (l))))) endlet

Theorem: p-temp-stk-p-ctrl-stk-p-data-segment-run-false (proper-p-statep (lr->p (l)) ∧ (p-psw (l) = 'run) ∧ (p-psw (p (p-set-pc (lr->p (l), pc), p-false-clock (p-set-pc (lr->p (l), pc))))

    = 'run)

∧ lr-programs-properp (l, table) ∧ (unlabel (get (offset (pc),

program-body (assoc (area-name (pc),

p-prog-segment (lr->p (l))))))

    = '(call false)))

→ ((p-temp-stk (p (p-set-pc (lr->p (l), pc),

p-false-clock (p-set-pc (lr->p (l), pc))))

= cons (lr-f-addr, p-temp-stk (l))) ∧ (p-ctrl-stk (p (p-set-pc (lr->p (l), pc),

p-false-clock (p-set-pc (lr->p (l), pc))))

= p-ctrl-stk (l)) ∧ (p-data-segment (p (p-set-pc (lr->p (l), pc),

p-false-clock (p-set-pc (lr->p (l), pc))))

= p-data-segment (l)))

Theorem: p-temp-stk-p-ctrl-stk-p-data-segment-run-falsep (proper-p-statep (lr->p (l)) ∧ (p-psw (l) = 'run)

∧ (p-psw (p (p-set-pc (lr->p (l), pc), p-falsep-clock (p-set-pc (lr->p (l), pc))))

    = 'run)

∧ lr-programs-properp (l, table) ∧ (unlabel (get (offset (pc),

program-body (assoc (area-name (pc),

p-prog-segment (lr->p (l))))))

    = '(call falsep)))

→ ((p-temp-stk (p (p-set-pc (lr->p (l), pc),

p-falsep-clock (p-set-pc (lr->p (l), pc))))

= if car (p-temp-stk (l)) = lr-f-addr then cons (lr-t-addr, cdr (p-temp-stk (l))) else cons (lr-f-addr, cdr (p-temp-stk (l))) endif)

∧ (p-ctrl-stk (p (p-set-pc (lr->p (l), pc),

p-falsep-clock (p-set-pc (lr->p (l), pc))))

= p-ctrl-stk (l)) ∧ (p-data-segment (p (p-set-pc (lr->p (l), pc),

p-falsep-clock (p-set-pc (lr->p (l), pc))))

= p-data-segment (l)))

Theorem: p-temp-stk-p-ctrl-stk-p-data-segment-run-listp (proper-p-statep (lr->p (l)) ∧ (p-psw (l) = 'run) ∧ (p-psw (p (p-set-pc (lr->p (l), pc), p-listp-clock (p-set-pc (lr->p (l), pc))))

    = 'run)

∧ lr-programs-properp (l, table) ∧ (unlabel (get (offset (pc),

program-body (assoc (area-name (pc),

p-prog-segment (lr->p (l))))))

    = '(call listp)))

→ ((p-temp-stk (p (p-set-pc (lr->p (l), pc),

p-listp-clock (p-set-pc (lr->p (l), pc))))

= if fetch (car (p-temp-stk (l)), p-data-segment (l))

= tag ('nat, lr-cons-tag) then cons (lr-t-addr, cdr (p-temp-stk (l))) else cons (lr-f-addr, cdr (p-temp-stk (l))) endif)

∧ (p-ctrl-stk (p (p-set-pc (lr->p (l), pc),

p-listp-clock (p-set-pc (lr->p (l), pc))))

= p-ctrl-stk (l)) ∧ (p-data-segment (p (p-set-pc (lr->p (l), pc),

p-listp-clock (p-set-pc (lr->p (l), pc))))

= p-data-segment (l)))

Theorem: p-temp-stk-p-ctrl-stk-p-data-segment-run-nlistp (proper-p-statep (lr->p (l))

∧ (p-psw (l) = 'run) ∧ (p-psw (p (p-set-pc (lr->p (l), pc), p-nlistp-clock (p-set-pc (lr->p (l), pc))))

    = 'run)

∧ lr-programs-properp (l, table) ∧ (unlabel (get (offset (pc),

program-body (assoc (area-name (pc),

p-prog-segment (lr->p (l))))))

    = '(call nlistp)))

→ ((p-temp-stk (p (p-set-pc (lr->p (l), pc),

p-nlistp-clock (p-set-pc (lr->p (l), pc))))

= if fetch (car (p-temp-stk (l)), p-data-segment (l))

= tag ('nat, lr-cons-tag) then cons (lr-f-addr, cdr (p-temp-stk (l))) else cons (lr-t-addr, cdr (p-temp-stk (l))) endif)

∧ (p-ctrl-stk (p (p-set-pc (lr->p (l), pc),

p-nlistp-clock (p-set-pc (lr->p (l), pc))))

= p-ctrl-stk (l)) ∧ (p-data-segment (p (p-set-pc (lr->p (l), pc),

p-nlistp-clock (p-set-pc (lr->p (l), pc))))

= p-data-segment (l)))

Theorem: p-temp-stk-p-ctrl-stk-p-data-segment-run-true (proper-p-statep (lr->p (l)) ∧ (p-psw (l) = 'run) ∧ (p-psw (p (p-set-pc (lr->p (l), pc), p-true-clock (p-set-pc (lr->p (l), pc))))

    = 'run)

∧ lr-programs-properp (l, table) ∧ (unlabel (get (offset (pc),

program-body (assoc (area-name (pc),

p-prog-segment (lr->p (l))))))

    = '(call true)))

→ ((p-temp-stk (p (p-set-pc (lr->p (l), pc),

p-true-clock (p-set-pc (lr->p (l), pc))))

= cons (lr-t-addr, p-temp-stk (l))) ∧ (p-ctrl-stk (p (p-set-pc (lr->p (l), pc),

p-true-clock (p-set-pc (lr->p (l), pc))))

= p-ctrl-stk (l)) ∧ (p-data-segment (p (p-set-pc (lr->p (l), pc),

p-true-clock (p-set-pc (lr->p (l), pc))))

= p-data-segment (l)))

Theorem: p-temp-stk-p-ctrl-stk-p-data-segment-run-truep (proper-p-statep (lr->p (l)) ∧ (p-psw (l) = 'run)

∧ (p-psw (p (p-set-pc (lr->p (l), pc), p-truep-clock (p-set-pc (lr->p (l), pc))))

    = 'run)

∧ lr-programs-properp (l, table) ∧ (unlabel (get (offset (pc),

program-body (assoc (area-name (pc),

p-prog-segment (lr->p (l))))))

    = '(call truep)))

→ ((p-temp-stk (p (p-set-pc (lr->p (l), pc),

p-truep-clock (p-set-pc (lr->p (l), pc))))

= if fetch (car (p-temp-stk (l)), p-data-segment (l))

= tag ('nat, lr-true-tag) then cons (lr-t-addr, cdr (p-temp-stk (l))) else cons (lr-f-addr, cdr (p-temp-stk (l))) endif)

∧ (p-ctrl-stk (p (p-set-pc (lr->p (l), pc),

p-truep-clock (p-set-pc (lr->p (l), pc))))

= p-ctrl-stk (l)) ∧ (p-data-segment (p (p-set-pc (lr->p (l), pc),

p-truep-clock (p-set-pc (lr->p (l), pc))))

= p-data-segment (l)))

Theorem: get-last-funcall-cur-expr (listp (expr) ∧ (car (expr) ≠ 'if) ∧ (car (expr) ≠ s-temp-eval) ∧ (car (expr) ≠ s-temp-test) ∧ (car (expr) ≠ s-temp-fetch) ∧ (car (expr) ≠ 'quote)) → (get (lr-p-c-size-list (length (expr) − 1, expr), comp-body-1 (t, expr, n))

= if definedp (car (expr), p-runtime-support-programs) then list ('call, car (expr)) else list ('call, user-fname (car (expr))) endif)

Theorem: not-listp-p-prog-segment-lr-expr (¬ listp (p-prog-segment (l))) → (¬ listp (lr-expr (l)))

Theorem: get-offset-return-pc-program-body-assoc-comp-programs (good-posp1 (offset (p-pc (l)),

program-body (assoc (area-name (p-pc (l)), p-prog-segment (l))))

∧ lr-programs-properp (l, table) ∧ (car (lr-expr (l)) ≠ 'if) ∧ (car (lr-expr (l)) ≠ s-temp-eval) ∧ (car (lr-expr (l)) ≠ s-temp-test) ∧ (car (lr-expr (l)) ≠ s-temp-fetch) ∧ (car (lr-expr (l)) ≠ 'quote) ∧ listp (lr-expr (l)))

→ (get (offset (lr-return-pc (l)),

program-body (assoc (area-name (p-pc (l)),

comp-programs (p-prog-segment (l)))))

= list ('dl, lr-make-label (offset (lr-return-pc (l))), nil, if definedp (car (lr-expr (l)), p-runtime-support-programs) then list ('call, car (lr-expr (l))) else list ('call, user-fname (car (lr-expr (l)))) endif))

Theorem: listp-p-temp-stk-proper-ctrl-stk-p-run-subr (good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (new-l, table) ∧ lr-programs-properp (l, table) ∧ listp (lr-expr (l)) ∧ proper-p-statep (lr->p (new-l)) ∧ (p-psw (new-l) = 'run) ∧ (p-psw (p-run-subr (car (lr-expr (l)),

p-set-pc (lr->p (new-l), lr-return-pc (l))))

    = 'run)

∧ (p-prog-segment (l) = p-prog-segment (new-l))) → (listp (p-temp-stk (p-run-subr (car (lr-expr (l)),

p-set-pc (lr->p (new-l), lr-return-pc (l)))))

∧ (p-ctrl-stk (p-run-subr (car (lr-expr (l)),

p-set-pc (lr->p (new-l), lr-return-pc (l))))

= p-ctrl-stk (new-l)))

Theorem: listp-p-temp-stk-proper-ctrl-stk-lr-apply-subr (good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ lr-programs-properp (new-l, table) ∧ listp (lr-expr (l)) ∧ subrp (car (lr-expr (l))) ∧ (p-psw (lr-apply-subr (l, new-l)) = 'run) ∧ proper-p-statep (lr->p (new-l)) ∧ (p-psw (new-l) = 'run) ∧ (p-prog-segment (l) = p-prog-segment (new-l))) → (listp (p-temp-stk (lr-apply-subr (l, new-l)))

∧ (p-ctrl-stk (lr-apply-subr (l, new-l)) = p-ctrl-stk (new-l)))

Theorem: cur-expr-nlistp-pos (pos ≃ nil) → (cur-expr (pos, body) = body)

Theorem: proper-p-statep-p-run-subr (proper-p-statep (p) ∧ (p-psw (p-run-subr (subr, p)) = 'run)) → proper-p-statep (p-run-subr (subr, p))

Theorem: same-signature-commutative same-signature (x, y) = same-signature (y, x)

Theorem: same-signature-p-run-subr (proper-p-statep (p) ∧ (p-psw (p-run-subr (subr, p)) = 'run) ∧ (data-seg = p-data-segment (p))) → same-signature (data-seg, p-data-segment (p-run-subr (subr, p)))

Theorem: proper-p-framep-lr->p-similar-states (proper-p-framep (frame, name, p0 ) ∧ same-signature (p-data-segment (p0 ), p-data-segment (p1 )) ∧ (p-prog-segment (p0 ) = p-prog-segment (p1 )) ∧ (p-word-size (p0 ) = p-word-size (p1 ))) → proper-p-framep (frame, name, p1 )

Theorem: car-untag-p-pc-lr-eval car (untag (p-pc (lr-eval (flag, l, c)))) = car (untag (p-pc (l)))

Theorem: lessp-cdr-untag-lr-return-pc-lr-p-c-size (good-posp1 (offset (p-pc (l)),

program-body (assoc (car (untag (p-pc (l))), p-prog-segment (l))))

∧ lr-programs-properp (l, table) ∧ (subrp (car (lr-expr (l))) ∨ litatom (car (lr-expr (l)))) ∧ (car (lr-expr (l)) ≠ 'if) ∧ (car (lr-expr (l)) ≠ 'quote) ∧ (name = area-name (p-pc (l)))) → (cdr (untag (lr-return-pc (l)))

< length (program-body (assoc (name, comp-programs (p-prog-segment (l))))))

Theorem: proper-p-statep-lr-apply-subr-state (proper-p-statep (lr->p (new-l)) ∧ good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ listp (lr-expr (l)) ∧ subrp (car (lr-expr (l))) ∧ (car (lr-expr (l)) ≠ 'if) ∧ (p-prog-segment (l) = p-prog-segment (new-l)) ∧ (area-name (p-pc (l)) = area-name (p-pc (new-l)))) → proper-p-statep (p-set-pc (lr->p (new-l), lr-return-pc (l)))

Theorem: same-signature-lr-apply-subr (proper-p-statep (lr->p (new-l)) ∧ good-posp1 (offset (p-pc (l)), program-body (p-current-program (l)))

∧ lr-programs-properp (l, table) ∧ listp (lr-expr (l)) ∧ subrp (car (lr-expr (l))) ∧ (car (lr-expr (l)) ≠ 'if) ∧ (p-prog-segment (l) = p-prog-segment (new-l)) ∧ (area-name (p-pc (l)) = area-name (p-pc (new-l))) ∧ (p-psw (lr-apply-subr (l, new-l)) = 'run) ∧ (data-seg = p-data-segment (new-l))) → same-signature (data-seg, p-data-segment (lr-apply-subr (l, new-l)))

Theorem: p-current-program-lr-apply-subr ((area-name (p-pc (new-l)) = area-name (p-pc (l))) ∧ (p-prog-segment (new-l) = p-prog-segment (l))) → (p-current-program (lr-apply-subr (l, new-l)) = p-current-program (l))

Theorem: p-current-program-lr-eval p-current-program (lr-eval (flag, l, c)) = p-current-program (l)

Theorem: proper-p-framep-lr-apply-subr (proper-p-statep (lr->p (new-l)) ∧ good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ listp (lr-expr (l)) ∧ subrp (car (lr-expr (l))) ∧ (car (lr-expr (l)) ≠ 'if) ∧ (p-prog-segment (l) = p-prog-segment (new-l)) ∧ (area-name (p-pc (l)) = area-name (p-pc (new-l))) ∧ (p-psw (lr-apply-subr (l, new-l)) = 'run) ∧ (name = area-name (p-pc (new-l)))) → proper-p-framep (car (p-ctrl-stk (new-l)),

name,

lr->p (lr-apply-subr (l, new-l)))

Theorem: proper-p-statep-lr->p-lessp-ctrl-stk-size (proper-p-statep (lr->p (l)) ∧ (max = p-max-ctrl-stk-size (l))) → ((max < p-ctrl-stk-size (p-ctrl-stk (l))) = f)

Event: Disable proper-p-statep-lr->p-lessp-ctrl-stk-size.

Theorem: proper-p-statep-lr->p-numberp-max-ctrl-stk-size proper-p-statep (lr->p (l)) → (p-max-ctrl-stk-size (l) ∈ N)

Event: Disable proper-p-statep-lr->p-numberp-max-ctrl-stk-size.

Theorem: proper-p-statep-lr->p-numberp-max-temp-stk-size proper-p-statep (lr->p (l)) → (p-max-temp-stk-size (l) ∈ N)

Event: Disable proper-p-statep-lr->p-numberp-max-temp-stk-size.

Theorem: proper-p-statep-lr->p-numberp-word-size proper-p-statep (lr->p (l)) → (p-word-size (l) ∈ N)

Event: Disable proper-p-statep-lr->p-numberp-word-size.

Theorem: proper-p-statep-lr->p-lessp-max-ctrl-stk-size proper-p-statep (lr->p (l)) → ((p-max-ctrl-stk-size (l) < exp (2, p-word-size (l))) = t)

Event: Disable proper-p-statep-lr->p-lessp-max-ctrl-stk-size.

Theorem: proper-p-statep-lr->p-lessp-max-temp-stk-size proper-p-statep (lr->p (l)) → ((p-max-temp-stk-size (l) < exp (2, p-word-size (l))) = t)

Event: Disable proper-p-statep-lr->p-lessp-max-temp-stk-size.

Theorem: proper-p-statep-lr->p-equal-word-size-0 proper-p-statep (lr->p (l)) → (p-word-size (l) ≠ 0)

Event: Disable proper-p-statep-lr->p-equal-word-size-0.

Theorem: proper-p-ctrl-stkp-lr-apply-subr (proper-p-statep (lr->p (new-l)) ∧ good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ listp (lr-expr (l)) ∧ subrp (car (lr-expr (l))) ∧ (car (lr-expr (l)) ≠ 'if) ∧ (p-prog-segment (l) = p-prog-segment (new-l)) ∧ (area-name (p-pc (l)) = area-name (p-pc (new-l))) ∧ (p-psw (lr-apply-subr (l, new-l)) = 'run)) → proper-p-ctrl-stkp (cdr (p-ctrl-stk (new-l)),

area-name (ret-pc (car (p-ctrl-stk (new-l)))), lr->p (lr-apply-subr (l, new-l)))

Theorem: proper-p-prog-segmentp-lr-apply-subr (proper-p-statep (lr->p (new-l))

∧ good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ listp (lr-expr (l)) ∧ subrp (car (lr-expr (l))) ∧ (car (lr-expr (l)) ≠ 'if) ∧ (p-prog-segment (l) = p-prog-segment (new-l)) ∧ (area-name (p-pc (l)) = area-name (p-pc (new-l))) ∧ (p-psw (lr-apply-subr (l, new-l)) = 'run) ∧ (progs = p-prog-segment (new-l))) → proper-p-prog-segmentp (comp-programs (progs),

lr->p (lr-apply-subr (l, new-l)))

Theorem: proper-p-state-p-p-run-subr-opener-1 (proper-p-statep (p) ∧ (p-psw (p-run-subr (subr, p)) = 'run)) → proper-p-temp-stkp (p-temp-stk (p-run-subr (subr, p)), p-run-subr (subr, p))

Theorem: proper-p-temp-stkp-lr-apply-subr (proper-p-statep (lr->p (new-l)) ∧ good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ listp (lr-expr (l)) ∧ subrp (car (lr-expr (l))) ∧ (car (lr-expr (l)) ≠ 'if) ∧ (p-prog-segment (l) = p-prog-segment (new-l)) ∧ (area-name (p-pc (l)) = area-name (p-pc (new-l))) ∧ (p-psw (lr-apply-subr (l, new-l)) = 'run)) → proper-p-temp-stkp (p-temp-stk (lr-apply-subr (l, new-l)),

lr->p (lr-apply-subr (l, new-l)))

Theorem: proper-p-state-p-p-run-subr-opener-2 (proper-p-statep (p) ∧ (p-psw (p-run-subr (subr, p)) = 'run)) → (p-max-temp-stk-size (p) ≮ length (p-temp-stk (p-run-subr (subr, p))))

Theorem: not-lessp-length-p-temp-stk-lr-apply-subr (proper-p-statep (lr->p (new-l)) ∧ good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ listp (lr-expr (l)) ∧ subrp (car (lr-expr (l))) ∧ (car (lr-expr (l)) ≠ 'if) ∧ (p-prog-segment (l) = p-prog-segment (new-l)) ∧ (area-name (p-pc (l)) = area-name (p-pc (new-l))) ∧ (p-psw (lr-apply-subr (l, new-l)) = 'run) ∧ (p-max-temp-stk-size (l) = p-max-temp-stk-size (new-l))) → (p-max-temp-stk-size (l)

≮ length (p-temp-stk (lr-apply-subr (l, new-l))))

Theorem: proper-p-state-p-p-run-subr-opener-3 (proper-p-statep (p) ∧ (p-psw (p-run-subr (subr, p)) = 'run)) → proper-p-data-segmentp (p-data-segment (p-run-subr (subr, p)),

p-run-subr (subr, p))

Theorem: proper-p-data-segmentp-lr-apply-subr (proper-p-statep (lr->p (new-l)) ∧ good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ listp (lr-expr (l)) ∧ subrp (car (lr-expr (l))) ∧ (car (lr-expr (l)) ≠ 'if) ∧ (p-prog-segment (l) = p-prog-segment (new-l)) ∧ (area-name (p-pc (l)) = area-name (p-pc (new-l))) ∧ (p-psw (lr-apply-subr (l, new-l)) = 'run)) → proper-p-data-segmentp (p-data-segment (lr-apply-subr (l, new-l)),

lr->p (lr-apply-subr (l, new-l)))

Theorem: lr-programs-properp-lr-set-pos lr-programs-properp (lr-set-pos (l, pos), table) = lr-programs-properp (l, table)

Theorem: proper-p-statep-lr-apply-subr (listp (lr-expr (l)) ∧ subrp (car (lr-expr (l))) ∧ (car (lr-expr (l)) ≠ 'if) ∧ proper-p-statep (lr->p (l)) ∧ proper-p-statep (lr->p (lr-eval ('list, lr-set-pos (l, pos), c))) ∧ good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ (p-psw (lr-eval ('list, lr-set-pos (l, pos), c)) = 'run) ∧ (p-psw (lr-apply-subr (l, lr-eval ('list, lr-set-pos (l, pos), c)))

    = 'run))

→ proper-p-statep (lr->p (lr-apply-subr (l,

lr-eval ('list, lr-set-pos (l, pos), c))))

Theorem: cdr-untag-lr-p-pc-lr-funcall (p-psw (lr-funcall (l, new-l)) = 'run) → (cdr (untag (lr-p-pc (lr-funcall (l, new-l)))) = 0)

Theorem: listp-p-ctrl-stk-lr-funcall listp (p-ctrl-stk (new-l)) → listp (p-ctrl-stk (lr-funcall (l, new-l)))

Theorem: proper-p-framep-top-p-ctrl-stk-lr-funcall (p-psw (lr-funcall (l, new-l)) = 'run) → (listp (car (p-ctrl-stk (lr-funcall (l, new-l))))

∧ listp (cdr (car (p-ctrl-stk (lr-funcall (l, new-l))))) ∧ (cddr (car (p-ctrl-stk (lr-funcall (l, new-l)))) = nil) ∧ (ret-pc (car (p-ctrl-stk (lr-funcall (l, new-l)))) = add-addr (lr-return-pc (l), 1)))

Theorem: car-untag-p-pc-lr-funcall (p-psw (lr-funcall (l, new-l)) = 'run) → (car (untag (p-pc (lr-funcall (l, new-l))))

= user-fname (car (lr-expr (l))))

Theorem: area-name-p-pc-lr-funcall (p-psw (lr-funcall (l, new-l)) = 'run) → (area-name (p-pc (lr-funcall (l, new-l))) = user-fname (car (lr-expr (l))))

Theorem: strip-cars-bindings-top-p-ctrl-stk-lr-funcall (p-psw (lr-funcall (l, new-l)) = 'run) → (strip-cars (bindings (car (p-ctrl-stk (lr-funcall (l, new-l)))))

= append (formal-vars (assoc (user-fname (car (lr-expr (l))),

p-prog-segment (l))), strip-cars (temp-var-dcls (assoc (user-fname (car (lr-expr (l))),

p-prog-segment (l))))))

Theorem: formal-vars-assoc-comp-programs-lr-programs-properp (definedp (name, cdr (p-prog-segment (l))) ∧ lr-programs-properp (l, table)) → (formal-vars (assoc (name, comp-programs (p-prog-segment (l))))

= formal-vars (assoc (name, p-prog-segment (l))))

Theorem: temp-var-dcls-assoc-comp-programs-lr-programs-properp (definedp (name, cdr (p-prog-segment (l))) ∧ lr-programs-properp (l, table)) → (temp-var-dcls (assoc (name, comp-programs (p-prog-segment (l))))

= temp-var-dcls (assoc (name, p-prog-segment (l))))

Theorem: definedp-comp-programs-definedp-lr-programs-properp (definedp (name, cdr (p-prog-segment (l))) ∧ lr-programs-properp (l, table)) → definedp (name, comp-programs (p-prog-segment (l)))

Theorem: definedp-lr-funcall-prog-segment (listp (lr-expr (l)) ∧ (¬ subrp (car (lr-expr (l)))) ∧ (car (lr-expr (l)) ≠ 'quote) ∧ litatom (car (lr-expr (l))) ∧ good-posp1 (offset (p-pc (l)), program-body (p-current-program (l)))

∧ lr-programs-properp (l, table) ∧ (progs = cdr (p-prog-segment (l)))) → definedp (user-fname (car (lr-expr (l))), progs)

Theorem: pop-p-ctrl-stk-lr-funcall (p-psw (lr-funcall (l, new-l)) = 'run) → (cdr (p-ctrl-stk (lr-funcall (l, new-l))) = p-ctrl-stk (new-l))

Theorem: proper-p-alistp-lr-funcall (lr-programs-properp (l, table) ∧ definedp (user-fname (car (lr-expr (l))), cdr (p-prog-segment (new-l))) ∧ proper-p-prog-segmentp (comp-programs (p-prog-segment (new-l)),

lr->p (new-l))

∧ proper-p-temp-stkp (p-temp-stk (new-l), lr->p (new-l)) ∧ (p-psw (lr-funcall (l, new-l)) = 'run) ∧ (p-prog-segment (l) = p-prog-segment (new-l))) → proper-p-alistp (bindings (car (p-ctrl-stk (lr-funcall (l, new-l)))),

lr->p (lr-funcall (l, new-l)))

Theorem: proper-p-ctrl-stkp-lr-funcall (proper-p-ctrl-stkp (cdr (ctrl-stk),

area-name (ret-pc (car (ctrl-stk))), lr->p (new-l))

∧ proper-p-framep (top (ctrl-stk), name, lr->p (new-l)) ∧ listp (ctrl-stk)) → proper-p-ctrl-stkp (ctrl-stk, name, lr->p (lr-funcall (l, new-l)))

Theorem: not-lessp-p-max-ctrl-stk-size-lr-funcall (listp (lr-expr (l)) ∧ (¬ subrp (car (lr-expr (l)))) ∧ (car (lr-expr (l)) ≠ 'quote) ∧ litatom (car (lr-expr (l))) ∧ good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ (p-psw (lr-funcall (l, new-l)) = 'run) ∧ (p-max-ctrl-stk-size (l) = p-max-ctrl-stk-size (new-l)) ∧ (p-prog-segment (l) = p-prog-segment (new-l))) → (p-max-ctrl-stk-size (l)

≮ p-ctrl-stk-size (p-ctrl-stk (lr-funcall (l, new-l))))

Theorem: offset-p-pc-lr-funcall (p-psw (lr-funcall (l, new-l)) = 'run) → (offset (p-pc (lr-funcall (l, new-l))) = nil)

Theorem: lr-eval-t-lr-funcall-p-psw-run (p-psw (lr-eval (t, lr-funcall (l, new-l), c)) = 'run) → (p-psw (lr-funcall (l, new-l)) = 'run)

Theorem: proper-p-temp-stkp-lr-funcall (listp (lr-expr (l)) ∧ (¬ subrp (car (lr-expr (l)))) ∧ (car (lr-expr (l)) ≠ 'quote) ∧ litatom (car (lr-expr (l))) ∧ good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ (p-psw (lr-funcall (l, new-l)) = 'run) ∧ proper-p-temp-stkp (p-temp-stk (new-l), lr->p (new-l)) ∧ (p-prog-segment (l) = p-prog-segment (new-l))) → proper-p-temp-stkp (p-temp-stk (lr-funcall (l, new-l)),

lr->p (lr-funcall (l, new-l)))

Theorem: popn-nlistp (¬ listp (x)) → (¬ listp (popn (n, x)))

Theorem: length-popn-lessp-fact length (list) ≮ length (popn (n, list))

Event: Disable popn-nlistp.

Theorem: not-lessp-p-max-temp-stk-size-lr-funcall ((p-max-temp-stk-size (l) ≮ length (p-temp-stk (new-l))) ∧ (p-max-temp-stk-size (l) = p-max-temp-stk-size (new-l))) → (p-max-temp-stk-size (l) ≮ length (p-temp-stk (lr-funcall (l, new-l))))

Theorem: listp-label-instrs listp (label-instrs (list, n)) = listp (list)

Theorem: listp-comp-body listp (comp-body (body))

Theorem: lessp-offset-lr-return-pc-lr-p-c-size-good-posp (good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ (subrp (car (lr-expr (l))) ∨ litatom (car (lr-expr (l)))) ∧ (car (lr-expr (l)) ≠ 'if) ∧ (car (lr-expr (l)) ≠ 'quote)) → ((1 + offset (lr-return-pc (l)))

< length (program-body (assoc (area-name (p-pc (l)), comp-programs (p-prog-segment (l))))))

Theorem: proper-p-statep-lr-funcall (proper-p-statep (lr->p (lr-eval ('list, lr-set-pos (l, pos), c))) ∧ listp (lr-expr (l))

∧ (¬ subrp (car (lr-expr (l)))) ∧ (car (lr-expr (l)) ≠ 'quote) ∧ (car (lr-expr (l)) ≠ 'if) ∧ litatom (car (lr-expr (l))) ∧ good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ (p-psw (lr-eval ('list, lr-set-pos (l, pos), c)) = 'run) ∧ (p-psw (lr-funcall (l, lr-eval ('list, lr-set-pos (l, pos), c))) = 'run)) → proper-p-statep (lr->p (lr-funcall (l,

lr-eval ('list, lr-set-pos (l, pos), c))))

Theorem: proper-p-statep-lr-set-expr-lr-pop-cstk let l2 be lr-eval (t, lr-funcall (l, new-l), c − 1) in (definedp (area-name (p-pc (l)), p-prog-segment (l)) ∧ (cdr (p-ctrl-stk (l2 )) = p-ctrl-stk (new-l)) ∧ (cdr (p-ctrl-stk (new-l)) = cdr (p-ctrl-stk (l))) ∧ (strip-cars (bindings (car (p-ctrl-stk (new-l))))

= strip-cars (bindings (car (p-ctrl-stk (l))))) ∧ proper-p-statep (lr->p (l2 )) ∧ proper-p-statep (lr->p (new-l)) ∧ (p-psw (l2 ) = 'run) ∧ same-signature (p-data-segment (new-l), p-data-segment (l2 )) ∧ (p-prog-segment (new-l) = p-prog-segment (l)) ∧ (area-name (p-pc (new-l)) = area-name (p-pc (l))) ∧ (pos = offset (p-pc (l)))) → proper-p-statep (lr->p (lr-set-expr (lr-pop-cstk (l2 ), l, pos))) endlet

Theorem: p-psw-lr-eval-flag-list-flag-t ((p-psw (lr-eval ('list, lr-set-expr (lr-eval (t, l, c), l, pos), c)) = 'run) ∧ listp (offset (p-pc (l))) ∧ listp (lr-expr-list (l))) → (p-psw (lr-eval (t, l, c)) = 'run)

Theorem: lr-programs-properp-lr-set-expr lr-programs-properp (lr-set-expr (l1 , l2 , pos), table) = lr-programs-properp (l2 , table)

Theorem: lr-programs-properp-lr-pop-tstk lr-programs-properp (lr-pop-tstk (l), table) = lr-programs-properp (l, table)

Theorem: lr-programs-properp-lr-funcall (listp (lr-expr (l)) ∧ (¬ subrp (car (lr-expr (l)))) ∧ (car (lr-expr (l)) ≠ 'quote)

∧ litatom (car (lr-expr (l))) ∧ good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table)) → lr-programs-properp (lr-funcall (l, lr-eval ('list, lr-set-pos (l, pos), c)),

table)

Theorem: proper-p-statep-lr->p-lr-set-expr (lr-programs-properp (l2 , table) ∧ lr-programs-properp (l1 , table) ∧ proper-p-statep (lr->p (l2 )) ∧ proper-p-statep (lr->p (l1 )) ∧ (cdr (p-ctrl-stk (l1 )) = cdr (p-ctrl-stk (l2 ))) ∧ (strip-cars (bindings (car (p-ctrl-stk (l1 ))))

= strip-cars (bindings (car (p-ctrl-stk (l2 ))))) ∧ (p-prog-segment (l1 ) = p-prog-segment (l2 )) ∧ (p-word-size (l1 ) = p-word-size (l2 )) ∧ (p-max-ctrl-stk-size (l1 ) = p-max-ctrl-stk-size (l2 )) ∧ (p-max-temp-stk-size (l1 ) = p-max-temp-stk-size (l2 ))) → proper-p-statep (lr->p (lr-set-expr (l1 , l2 , pos)))

Theorem: lr-programs-properp-lr-if-ok lr-programs-properp (lr-if-ok (l), table) = lr-programs-properp (l, table)

Theorem: proper-p-statep-lr-if-ok proper-p-statep (lr->p (lr-if-ok (l))) = proper-p-statep (lr->p (l))

Theorem: lr-eval-preserves-proper-p-statep-lr->p (proper-p-statep (lr->p (l)) ∧ good-posp (flag, offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ (p-psw (lr-eval (flag, l, c)) = 'run)) → (proper-p-statep (lr->p (lr-eval (flag, l, c)))

∧ (strip-cars (bindings (car (p-ctrl-stk (lr-eval (flag, l, c)))))

= strip-cars (bindings (car (p-ctrl-stk (l))))) ∧ (cdr (p-ctrl-stk (lr-eval (flag, l, c))) = cdr (p-ctrl-stk (l))) ∧ ((flag = 'list) ∨ listp (p-temp-stk (lr-eval (flag, l, c)))) ∧ same-signature (p-data-segment (l),

p-data-segment (lr-eval (flag, l, c))))

Theorem: lr-params-lr-eval lr-params (frame, lr-eval (flag, l, c)) = lr-params (frame, l)

Theorem: lr-temps-lr-eval lr-temps (frame, lr-eval (flag, l, c)) = lr-temps (frame, l)

;; Later LR-FREE-LIST-NODES will filter out those nodes that are
;; part of for example pack's or user-defined types that are larger than one
;; node (i.e. have more than two accessors).

Definition: lr-free-list-nodes (addr, data-seg) = if offset (addr) < lr-node-size then nil

else let sub-addr be sub-addr (addr, lr-node-size)

in

if type (fetch (add-addr (sub-addr, lr-ref-count-offset),

data-seg))

          = 'addr

then cons (sub-addr,

lr-free-list-nodes (sub-addr, data-seg)) else lr-free-list-nodes (sub-addr, data-seg) endif endlet endif

Theorem: length-delete-member (addr ∈ node-list) → (length (delete (addr, node-list)) = (length (node-list) − 1))

;; Returns smallest address such that the address is too large to be
;; a pointer to a node in DATA-SEG.

Definition: lr-max-node (data-seg) = tag ('addr,

cons (lr-heap-name, length (value (lr-heap-name, data-seg)) − 1))

Definition: lr-check-free-nodes (addr, node-list, data-seg, max-addr) = if addr ∈ node-list

then lr-check-free-nodes (fetch (add-addr (addr, lr-ref-count-offset), data-seg), delete (addr, node-list), data-seg, max-addr)

else addr = max-addr endif

Definition: lr-proper-free-listp (data-seg) = (adpp (untag (lr-fp-addr), data-seg)

∧ lr-check-free-nodes (lr-fetch-fp (data-seg),

lr-free-list-nodes (lr-max-node (data-seg), data-seg),

data-seg,

lr-max-node (data-seg)))

Event: Disable lr-proper-free-listp.

Definition: lr-check-f-addrp (addr, data-seg) = (addr = lr-f-addr)

Event: Disable lr-check-f-addrp.

Definition: lr-check-undef-addrp (addr, data-seg) = (addr = lr-undef-addr)

Event: Disable lr-check-undef-addrp.

Definition: lr-check-numberp-addrp (addr, data-seg) = ((type (fetch (add-addr (addr, lr-unbox-nat-offset), data-seg)) = 'nat)

∧ lr-good-pointerp (fetch (add-addr (addr, 3), data-seg), data-seg)

∧ (untag (fetch (add-addr (addr, lr-unbox-nat-offset), data-seg)) ∈ N))

Event: Disable lr-check-numberp-addrp.

Definition: lr-check-listp-addrp (addr, data-seg) = (lr-good-pointerp (fetch (add-addr (addr, lr-car-offset), data-seg),

data-seg)

∧ lr-good-pointerp (fetch (add-addr (addr, lr-cdr-offset), data-seg), data-seg))

Event: Disable lr-check-listp-addrp.

Definition: lr-proper-heapp-nodep (addr, data-seg) = if ¬ lr-nodep (addr, data-seg) then f

elseif type (fetch (add-addr (addr, lr-ref-count-offset), data-seg))

         = 'addr

then offset (addr) ≮ (lr-node-size + offset (lr-f-addr))

elseif type (fetch (add-addr (addr, lr-ref-count-offset), data-seg))

≠ 'nat then f elseif type (fetch (addr, data-seg)) ≠ 'nat then f elseif untag (fetch (addr, data-seg)) = lr-undefined-tag then lr-check-undef-addrp (addr, data-seg) elseif untag (fetch (addr, data-seg)) = lr-false-tag then lr-check-f-addrp (addr, data-seg) elseif offset (addr) < offset (lr-t-addr) then f elseif untag (fetch (addr, data-seg)) = lr-true-tag then t elseif untag (fetch (addr, data-seg)) = lr-add1-tag then lr-check-numberp-addrp (addr, data-seg) elseif untag (fetch (addr, data-seg)) = lr-cons-tag then lr-check-listp-addrp (addr, data-seg) else f endif

Event: Disable lr-proper-heapp-nodep.

Definition: lr-proper-heapp2 (addr, data-seg) = if offset (addr) < lr-node-size then t

else let sub-addr be sub-addr (addr, lr-node-size) in lr-proper-heapp-nodep (sub-addr, data-seg) ∧ lr-proper-heapp2 (sub-addr, data-seg) endlet endif

Definition: lr-valp (value, addr, data-seg) = if lr-good-pointerp (addr, data-seg)

then let tag be untag (fetch (addr, data-seg))

in

if listp (value)

then (tag = lr-cons-tag)

∧ lr-valp (car (value),

fetch (add-addr (addr, lr-car-offset),

data-seg), data-seg)

∧ lr-valp (cdr (value),

fetch (add-addr (addr, lr-cdr-offset),

data-seg), data-seg) elseif truep (value) then tag = lr-true-tag elseif falsep (value) then tag = lr-false-tag elseif value ∈ N then (tag = lr-add1-tag)

∧ (value = untag (fetch (add-addr (addr,

lr-unbox-nat-offset),

data-seg)))

else f endif endlet else f endif

Definition: lr-proper-heapp1 (addr, data-seg) = (lr-proper-heapp2 (addr, data-seg)

∧ lr-valp (t, lr-t-addr, data-seg) ∧ lr-valp (0, lr-0-addr, data-seg))

Event: Disable lr-proper-heapp1.

;; This is the minimum heap that allows all the predefineds to be defined.

Definition: lr-minimum-heapp (data-seg) = (adpp (untag (lr-undef-addr), data-seg)

∧ adpp (untag (lr-f-addr), data-seg) ∧ adpp (untag (lr-t-addr), data-seg) ∧ adpp (untag (lr-0-addr), data-seg) ∧ adpp (untag (add-addr (lr-0-addr, lr-node-size)), data-seg))

Event: Disable lr-minimum-heapp.

;; This needs to be augmented to test that the word-size is big enough to
;; hold piton tags.

Definition: lr-proper-heapp (data-seg) = (lr-minimum-heapp (data-seg)

∧ lr-nodep (lr-max-node (data-seg), data-seg)

∧ lr-proper-free-listp (data-seg)

∧ lr-proper-heapp1 (lr-max-node (data-seg), data-seg))

Event: Disable lr-proper-heapp.

Definition: lr-check-result1 (value, temp-stk, data-seg) = if listp (value)

then lr-valp (car (value), top (temp-stk), data-seg)

∧ lr-check-result1 (cdr (value), pop (temp-stk), data-seg) else t endif

Definition: lr-check-result (flag, value, temp-stk, data-seg, orig-temp-stk) = ((orig-temp-stk = if flag = 'list

then restn (length (value), temp-stk) else cdr (temp-stk) endif)

∧ if flag = 'list then lr-check-result1 (reverse (value), temp-stk, data-seg) else lr-valp (value, top (temp-stk), data-seg) endif

∧ lr-proper-heapp (data-seg))

Event: Disable lr-check-result.

Definition: lr-s-similar-params (s-params, lr-params, data-seg) = if listp (s-params)

then if listp (lr-params)

then (caar (s-params) = caar (lr-params))

∧ lr-valp (cdar (s-params), cdar (lr-params), data-seg) ∧ lr-s-similar-params (cdr (s-params),

cdr (lr-params), data-seg)

else f endif else lr-params ≃ nil endif

Definition: lr-s-similar-temps (s-temps, lr-temps, data-seg) = if listp (s-temps)

then if listp (lr-temps)

then if cdar (lr-temps) = lr-undef-addr then ¬ cadar (s-temps)

else cadar (s-temps)

∧ lr-valp (caddar (s-temps), cdar (lr-temps), data-seg) endif

∧ lr-s-similar-temps (cdr (s-temps), cdr (lr-temps), data-seg)

else f endif else lr-temps ≃ nil endif

Definition: lr-s-similar-const-table (table, data-seg) = if listp (table)

then lr-valp (caar (table), cdar (table), data-seg)

∧ lr-s-similar-const-table (cdr (table), data-seg) else t endif

Definition: lr-s-similar-statesp (s-params, s-temps, l, table) = (lr-s-similar-params (s-params,

lr-params (top (p-ctrl-stk (l)), l),

p-data-segment (l))

∧ lr-s-similar-temps (s-temps, lr-temps (top (p-ctrl-stk (l)), l), p-data-segment (l))

∧ lr-s-similar-const-table (table, p-data-segment (l)))

Event: Disable lr-s-similar-statesp.

Theorem: p-accessors-s->lr1 (p-pc (s->lr1 (s, l, table)) = tag ('pc, cons (s-pname (s), s-pos (s)))) ∧ (p-ctrl-stk (s->lr1 (s, l, table)) = p-ctrl-stk (l)) ∧ (p-temp-stk (s->lr1 (s, l, table)) = p-temp-stk (l)) ∧ (p-prog-segment (s->lr1 (s, l, table))

= lr-compile-programs (s-progs (s), table)) ∧ (p-data-segment (s->lr1 (s, l, table)) = p-data-segment (l)) ∧ (p-max-ctrl-stk-size (s->lr1 (s, l, table)) = p-max-ctrl-stk-size (l)) ∧ (p-max-temp-stk-size (s->lr1 (s, l, table)) = p-max-temp-stk-size (l)) ∧ (p-word-size (s->lr1 (s, l, table)) = p-word-size (l)) ∧ (p-psw (s->lr1 (s, l, table)) = s-err-flag (s))

Theorem: s-eval-err-flag-not-run-fact (s-err-flag (s) ≠ 'run) → (s-eval (flag, s, clock) = s)

;; OFFSET

Theorem: offset-tag-cons offset (tag (tag, cons (area, offset))) = offset

;; ADP-NAME

Theorem: adp-name-cons adp-name (cons (x, y)) = x

;; OFFSET-SUB-ADDR -- see above

;; LR-PROPER-P-AREASP

Theorem: definedp-litatom-lr-proper-p-areas ((¬ litatom (name)) ∧ lr-proper-p-areasp (data-seg)) → (¬ definedp (name, data-seg))

Event: Disable definedp-litatom-lr-proper-p-areas.

Theorem: member-lr-free-list-nodes-type-addr (type (fetch (add-addr (addr, lr-ref-count-offset), data-seg)) ≠ 'addr) → (addr ∉ lr-free-list-nodes (max-addr, data-seg))

Event: Disable member-lr-free-list-nodes-type-addr.

Theorem: lessp-length-deposit length (cdr (assoc (name, deposit (any, addr, data-seg)))) ≮ length (cdr (assoc (name, data-seg)))

;; GET

Theorem: definedp-listp-cdr-assoc-lr-proper-p-areasp lr-proper-p-areasp (data-seg) → (listp (cdr (assoc (area-name, data-seg)))

= definedp (area-name, data-seg))

Event: Disable definedp-listp-cdr-assoc-lr-proper-p-areasp.

;; LR-MINIMUM-HEAPP

Theorem: lr-minimum-heapp-opener-adpp-lr-f-addr lr-minimum-heapp (data-seg) → adpp (identity (untag (lr-f-addr)), data-seg)

Theorem: lr-minimum-heapp-opener-adpp-lr-t-addr lr-minimum-heapp (data-seg) → adpp (identity (untag (lr-t-addr)), data-seg)

Theorem: lr-minimum-heapp-opener-adpp-lr-0-addr lr-minimum-heapp (data-seg) → adpp (identity (untag (lr-0-addr)), data-seg)

Theorem: lr-minimum-heapp-opener-adpp-lr-undef-addr lr-minimum-heapp (data-seg) → adpp (identity (untag (lr-undef-addr)), data-seg)

Theorem: lr-boundary-offsetp-sub1-length-heap-name lr-boundary-nodep (lr-max-node (data-seg)) → lr-boundary-offsetp (length (cdr (assoc (identity (lr-heap-name), data-seg))) − 1)

Theorem: lessp-lr-boundary-offsetp-nodep-plus-node-size-fact-2 (lr-boundary-offsetp (offset1 ) ∧ lr-boundary-offsetp (offset2 ) ∧ (n < lr-node-size)) → (((n + offset1 ) < offset2 ) = (offset1 < offset2 ))

Theorem: lr-boundary-offsetp-times-lr-node-size-anything lr-boundary-offsetp (identity (lr-node-size) ∗ x)

Theorem: lr-boundary-offsetp-difference-not-equal-lessp-fact-2 (lr-boundary-offsetp (x) ∧ lr-boundary-offsetp (y) ∧ (x ∈ N) ∧ (x < y)) → (((y − lr-node-size) < x) = f)

Theorem: lr-minimum-heapp-opener-2 lr-minimum-heapp (data-seg) → (identity (lr-minimum-heap-size)

< length (cdr (assoc (identity (lr-heap-name), data-seg))))

Event: Disable lr-minimum-heapp-opener-2.

Theorem: lr-minimum-heapp-opener-3 lr-minimum-heapp (data-seg) → definedp (identity (lr-heap-name), data-seg)

Event: Disable lr-minimum-heapp-opener-3.

;; LR-PROPER-FREE-LISTP

Definition: lr-node-listp (list, data-seg) = if listp (list)

then lr-nodep (car (list), data-seg)

∧ lr-node-listp (cdr (list), data-seg) else t endif

Event: Disable lr-node-listp.

Theorem: adpp-adpp-sub-addr adpp (untag (addr), data-seg) → adpp (untag (sub-addr (addr, n)), data-seg)

Theorem: lr-node-listp-lr-free-list-nodes (lr-boundary-nodep (addr) ∧ (area-name (addr) = lr-heap-name) ∧ adpp (untag (addr), data-seg2 ) ∧ (type (addr) = 'addr)) → lr-node-listp (lr-free-list-nodes (addr, data-seg1 ), data-seg2 )

Theorem: lr-nodep-member-lr-node-listp (lr-node-listp (list, data-seg) ∧ (node ∈ list)) → ((type (node) = 'addr)

∧ (cddr (node) = nil)

∧ listp (node)

∧ adpp (untag (node), data-seg) ∧ lr-boundary-nodep (node) ∧ (area-name (node) = lr-heap-name))

Event: Disable lr-nodep-member-lr-node-listp.

Theorem: lr-max-node-lr-nodep-opener-facts (type (lr-max-node (data-seg)) = 'addr) ∧ (cddr (lr-max-node (data-seg)) = nil) ∧ (area-name (lr-max-node (data-seg)) = lr-heap-name)

Theorem: lr-max-node-adpp-definedp-lr-heap-name lr-proper-p-areasp (data-seg) → (adpp (untag (lr-max-node (data-seg)), data-seg)

= definedp (lr-heap-name, data-seg))

Theorem: offset-lr-max-node offset (lr-max-node (data-seg)) = (length (cdr (assoc (identity (lr-heap-name), data-seg))) − 1)

Event: Disable lr-max-node.

Theorem: lr-proper-free-listp-opener-1 lr-proper-free-listp (data-seg) → adpp (identity (untag (lr-fp-addr)), data-seg)

Theorem: lr-proper-free-listp-opener-2 (lr-proper-free-listp (data-seg) ∧ adpp (untag (lr-max-node (data-seg)), data-seg) ∧ lr-boundary-nodep (lr-max-node (data-seg))) → ((type (fetch (identity (lr-fp-addr), data-seg)) = 'addr)

∧ (cddr (fetch (identity (lr-fp-addr), data-seg)) = nil)

∧ listp (fetch (identity (lr-fp-addr), data-seg))

∧ adpp (untag (fetch (identity (lr-fp-addr), data-seg)), data-seg) ∧ lr-boundary-nodep (fetch (identity (lr-fp-addr), data-seg)) ∧ (area-name (fetch (identity (lr-fp-addr), data-seg))

= lr-heap-name))

Theorem: lr-proper-free-listp-opener-2-adpp-untag-numberp-offset (lr-proper-free-listp (data-seg) ∧ adpp (untag (lr-max-node (data-seg)), data-seg) ∧ lr-boundary-nodep (lr-max-node (data-seg))) → (offset (fetch (identity (lr-fp-addr), data-seg)) ∈ N)

Theorem: lr-proper-free-listp-opener-2-adpp-untag-listp (lr-proper-free-listp (data-seg) ∧ adpp (untag (lr-max-node (data-seg)), data-seg) ∧ lr-boundary-nodep (lr-max-node (data-seg))) → listp (untag (fetch (identity (lr-fp-addr), data-seg)))

Theorem: plus-times-fact-1 (n ≄ 0) → (((n + (n ∗ w)) < (d ∗ n)) = ((1 + w) < d))

Event: Disable plus-times-fact-1.

Theorem: lessp-difference-fact-1 (((x mod n) = 0) ∧ ((y mod n) = 0) ∧ (x < y) ∧ (x ∈ N)) → ((x < (y − n)) = (x ≠ (y − n)))

Theorem: lessp-difference-lr-boundary-offsetp-fact-1 ((offset ∈ N) ∧ lr-boundary-offsetp (offset) ∧ lr-boundary-offsetp (y) ∧ (offset < y)) → ((offset < (y − identity (lr-node-size)))

= (offset ≠ (y − identity (lr-node-size))))

Theorem: lessp-lr-node-on-boundaryp-node-size (lr-boundary-nodep (addr) ∧ (offset (addr) ∈ N)) → ((offset (addr) < identity (lr-node-size)) = (offset (addr) = 0))

Theorem: lessp-difference-node-size-sub-addr ((offset (addr) < offset (max-addr)) ∧ (area-name (addr) = area-name (max-addr)) ∧ lr-boundary-nodep (max-addr) ∧ (type (max-addr) = 'addr) ∧ (offset (max-addr) ∈ N) ∧ (cddr (max-addr) = nil) ∧ lr-boundary-nodep (addr) ∧ (type (addr) = 'addr) ∧ (offset (addr) ∈ N) ∧ (cddr (addr) = nil) ∧ listp (untag (addr))) → ((offset (addr) < (offset (max-addr) − identity (lr-node-size)))

= (sub-addr (max-addr, identity (lr-node-size)) ≠ addr))

Theorem: lr-nodep-lr-proper-heapp-nodep (lr-proper-heapp2 (max-addr, data-seg) ∧ (offset (addr) < offset (max-addr)) ∧ lr-nodep (max-addr, data-seg) ∧ lr-nodep (addr, data-seg)) → lr-proper-heapp-nodep (addr, data-seg)

Event: Disable lessp-difference-node-size-sub-addr.

Theorem: adpp-area-name-offset-same (listp (untag (addr1 )) ∧ (offset (addr1 ) ∈ N) ∧ (cddr (addr1 ) = nil) ∧ listp (untag (addr2 )) ∧ (offset (addr2 ) ∈ N) ∧ (cddr (addr2 ) = nil) ∧ (type (addr1 ) = type (addr2 ))) → ((addr1 = addr2 )

= ((offset (addr1 ) = offset (addr2 )) ∧ (area-name (addr1 ) = area-name (addr2 ))))

Theorem: lr-proper-heapp-nodep-tag-cons ((untag (fetch (addr, data-seg)) = lr-cons-tag) ∧ (type (fetch (add-addr (addr, lr-ref-count-offset), data-seg)) = 'nat) ∧ lr-proper-heapp-nodep (addr, data-seg) ∧ ((offset = lr-car-offset) ∨ (offset = lr-cdr-offset))) → lr-good-pointerp (fetch (add-addr (addr, offset), data-seg), data-seg)

Theorem: adpp-add-addr-fact-2 (adpp (untag (addr1 ), data-seg) ∧ adpp (untag (add-addr (addr1 , n)), data-seg) ∧ adpp (untag (addr2 ), data-seg) ∧ (¬ adpp (untag (add-addr (addr2 , n)), data-seg)) ∧ (area-name (addr1 ) = area-name (addr2 ))) → (offset (addr1 ) < offset (addr2 ))

Theorem: fetch-lr-nodep-add-addr ((¬ adpp (untag (add-addr (addr, n)), data-seg)) ∧ lr-nodep (addr, data-seg)) → (fetch (add-addr (addr, n), data-seg) = 0)

Event: Disable fetch-lr-nodep-add-addr.

Theorem: untag-addr-addr-tag untag (add-addr (tag (tag, adp), n)) = cons (car (adp), cdr (adp) + n)

Theorem: lr-good-pointerp-lessp-offset-max-heap-node (adpp (untag (addr), data-seg) ∧ lr-boundary-nodep (addr) ∧ listp (addr) ∧ (cddr (addr) = nil) ∧ (type (addr) = 'addr) ∧ (area-name (addr) = 'heap) ∧ (type (fetch (add-addr (addr, lr-ref-count-offset), data-seg)) = 'nat)

∧ adpp (untag (lr-max-node (data-seg)), data-seg) ∧ lr-boundary-nodep (lr-max-node (data-seg))) → (offset (addr)

< (length (cdr (assoc (identity (lr-heap-name), data-seg))) − 1))

Event: Disable lr-good-pointerp-lessp-offset-max-heap-node.

Theorem: lr-proper-heapp-opener-1 lr-proper-heapp (data-seg) → (lr-minimum-heapp (data-seg) ∧ lr-proper-free-listp (data-seg))

Theorem: lr-proper-heapp-opener-3 ((addr = lr-max-node (data-seg)) ∧ lr-proper-heapp (data-seg)) → lr-proper-heapp2 (addr, data-seg)

Theorem: deposit-free-ptr-preserves-lr-valp (adpp (untag (lr-fp-addr), data-seg) ∧ lr-valp (value, addr, data-seg)) → lr-valp (value, addr, deposit (anything, identity (lr-fp-addr), data-seg))

Theorem: lr-proper-p-areasp-deposit-anything-anywhere lr-proper-p-areasp (data-seg) → lr-proper-p-areasp (deposit (anything, addr, data-seg))

Theorem: lr-node-listp-delete lr-node-listp (list, data-seg) → lr-node-listp (delete (anything, list), data-seg)

Event: Disable lr-node-listp-delete.

Theorem: lr-node-listp-deposit-anything-at-all lr-node-listp (addr, data-seg) → lr-node-listp (addr, deposit (anything, addr2 , data-seg))

Event: Disable lr-node-listp-deposit-anything-at-all.

Theorem: cdr-assoc-member-strip-cdrs definedp (name, list) → (cdr (assoc (name, list)) ∈ strip-cdrs (list))

Event: Disable cdr-assoc-member-strip-cdrs.

Theorem: lr-set-error-lr->p lr->p (lr-set-error (p, flag)) = lr-set-error (lr->p (p), flag)

Theorem: lr-params-lr-set-expr ((area-name (p-pc (l)) = area-name (p-pc (l2 ))) ∧ (p-prog-segment (l) = p-prog-segment (l2 ))) → (lr-params (frame, lr-set-expr (l, l2 , pos)) = lr-params (frame, l))

Theorem: lr-temps-lr-set-expr ((area-name (p-pc (l)) = area-name (p-pc (l2 ))) ∧ (p-prog-segment (l) = p-prog-segment (l2 ))) → (lr-temps (frame, lr-set-expr (l, l2 , pos)) = lr-temps (frame, l))

Theorem: p-current-program-lr-push-tstk p-current-program (lr-push-tstk (l, any)) = p-current-program (l)

Theorem: p-current-program-lr-set-temp p-current-program (lr-set-temp (l, value, var)) = p-current-program (l)

Theorem: p-current-program-lr-pop-tstk p-current-program (lr-pop-tstk (l)) = p-current-program (l)

Theorem: p-current-program-lr-do-temp-fetch p-current-program (lr-do-temp-fetch (l)) = p-current-program (l)

Theorem: strip-cars-restn strip-cars (restn (n, list)) = restn (n, strip-cars (list))

Event: Disable strip-cars-restn.

Theorem: strip-cars-firstn strip-cars (firstn (n, list)) = firstn (n, strip-cars (list))

Event: Disable strip-cars-firstn.

Theorem: lr-params-lr-pop-tstk lr-params (frame, lr-pop-tstk (l)) = lr-params (frame, l)

Theorem: lr-temps-lr-pop-tstk lr-temps (frame, lr-pop-tstk (l)) = lr-temps (frame, l)

Theorem: lr-minimum-heapp-same-signature same-signature (data-seg1 , data-seg2 ) → (lr-minimum-heapp (data-seg2 ) = lr-minimum-heapp (data-seg1 ))

Event: Disable lr-minimum-heapp-same-signature.

Theorem: put-not-listp ((¬ listp (list1 )) ∧ (¬ listp (list2 ))) → (put (val, n, list1 ) = put (val, n, list2 ))

Theorem: put-zero put (val, n, 0) = put (val, n, nil)

Event: Disable put-zero.

Theorem: put-put ((offset1 ∈ N) ∧ (offset2 ∈ N)) → (put (val1 , offset1 , put (val2 , offset2 , list))

= if offset1 = offset2 then put (val1 , offset1 , list) else put (val2 , offset2 , put (val1 , offset1 , list)) endif)

Theorem: proper-p-data-segmentp-implies-lr-proper-p-areasp proper-p-data-segmentp (data-seg, p) → lr-proper-p-areasp (data-seg)

Theorem: proper-p-statep-lr->p-implies-lr-proper-p-areasp proper-p-statep (lr->p (l)) → lr-proper-p-areasp (p-data-segment (l))

Event: Disable proper-p-data-segmentp-implies-lr-proper-p-areasp.

Theorem: lr-proper-free-listp-type-fetch-free-ptr (lr-proper-free-listp (data-seg) ∧ adpp (untag (lr-max-node (data-seg)), data-seg) ∧ lr-boundary-nodep (lr-max-node (data-seg)) ∧ lr-proper-p-areasp (data-seg)) → (type (fetch (add-addr (fetch (identity (lr-fp-addr), data-seg),

identity (lr-ref-count-offset)),

data-seg))

     ≠ 'nat)

Theorem: put-assoc-put-assoc-1 put-assoc (val1 , name, put-assoc (val2 , name, alist)) = put-assoc (val1 , name, alist)

Theorem: put-assoc-put-assoc-2 put-assoc (val1 , name1 , put-assoc (val2 , name2 , alist)) = if name1 = name2 then put-assoc (val1 , name1 , alist)

else put-assoc (val2 , name2 , put-assoc (val1 , name1 , alist)) endif

Theorem: deposit-deposit ((offset (addr1 ) ∈ N) ∧ (offset (addr2 ) ∈ N))

→ (deposit (value1 , addr1 , deposit (value2 , addr2 , data-seg))

= if (area-name (addr1 ) = area-name (addr2 ))

∧ (offset (addr1 ) = offset (addr2 )) then deposit (value1 , addr1 , data-seg) else deposit (value2 ,

addr2 ,

deposit (value1 , addr1 , data-seg)) endif)

Theorem: deposit-ref-count-move-outward (offset (addr) ∈ N) → (deposit (value1 ,

addr,

deposit (value2 , add-addr (addr, identity (lr-ref-count-offset)), data-seg))

= deposit (value2 , add-addr (addr, lr-ref-count-offset), deposit (value1 , addr, data-seg)))

Definition: ihint-2 (flag, s, l, table, c) = if s-err-flag (s) ≠ 'run then t

elseif flag = 'list then if s-pos (s) ≃ nil then t

elseif listp (s-expr-list (s)) then ihint-2 (t, s, l, table, c) ∧ ihint-2 ('list,

s-set-expr (s-eval (t, s, c), s, nx (s-pos (s))), lr-eval (t, s->lr1 (s, l, table), c), table, c)

else t endif elseif c ≃ 0 then t elseif litatom (s-expr (s)) then t elseif s-expr (s) ≃ nil then t elseif car (s-expr (s)) = 'if then let lrtest be lr-if-ok (lr-eval (t,

s->lr1 (s-set-pos (s,

dv (s-pos (s), 1)),

l, table),

c)), stest be s-eval (t, s-set-pos (s, dv (s-pos (s), 1)), c) in if p-psw (lrtest) = 'run then if top (p-temp-stk (lrtest)) ≠ lr-f-addr

then ihint-2 (t, s-set-pos (s, dv (s-pos (s), 1)), l, table, c) ∧ ihint-2 (t,

s-set-expr (stest, s, dv (s-pos (s), 2)),

lr-pop-tstk (lrtest), table, c)

else ihint-2 (t, s-set-pos (s, dv (s-pos (s), 1)), l, table, c) ∧ ihint-2 (t,

s-set-expr (stest, s, dv (s-pos (s), 3)),

lr-pop-tstk (lrtest), table,

c) endif

else ihint-2 (t, s-set-pos (s, dv (s-pos (s), 1)), l, table,

c) endif endlet

elseif car (s-expr (s)) = s-temp-eval then ihint-2 (t, s-set-pos (s, dv (s-pos (s), 1)), l, table, c) elseif car (s-expr (s)) = s-temp-test then if p-max-temp-stk-size (l) ≮ (2 + length (p-temp-stk (l)))

then if lr-eval-temp-setp (s->lr1 (s, l, table)) then t

else ihint-2 (t, s-set-pos (s, dv (s-pos (s), 1)), l, table, c) endif else t endif

elseif car (s-expr (s)) = s-temp-fetch then t elseif car (s-expr (s)) = 'quote then t elseif s-err-flag (s-eval ('list, s-set-pos (s, dv (s-pos (s), 1)), c))

     ≠ 'run

then ihint-2 ('list, s-set-pos (s, dv (s-pos (s), 1)), l, table, c) elseif subrp (car (s-expr (s))) then ihint-2 ('list, s-set-pos (s, dv (s-pos (s), 1)), l, table, c) elseif litatom (car (s-expr (s))) then let s-arg-s be s-eval ('list, s-set-pos (s, dv (s-pos (s), 1)), c),

lr-arg-s be lr-eval ('list,

s->lr1 (s-set-pos (s, dv (s-pos (s), 1)), l, table),

c)

in

ihint-2 ('list, s-set-pos (s, dv (s-pos (s), 1)), l, table, c) ∧ ihint-2 (t,

s-fun-call-state (s-arg-s, car (s-expr (s))), lr-funcall (s->lr1 (s, l, table), lr-arg-s), table, c − 1) endlet

else t endif

Definition: induct-hint-4 (x, temp-stk) = if listp (x) then induct-hint-4 (cdr (x), cdr (temp-stk))

else t endif

Theorem: lr-check-result1-append lr-check-result1 (append (x, y), temp-stk, data-seg) = (lr-check-result1 (x, temp-stk, data-seg)

∧ lr-check-result1 (y, restn (length (x), temp-stk), data-seg))

Theorem: lr-proper-heapp-opener-4 lr-proper-heapp (data-seg) → (adpp (untag (lr-max-node (data-seg)), data-seg)

∧ lr-boundary-nodep (lr-max-node (data-seg)))

Theorem: length-strip-cars length (strip-cars (temp-vars)) = length (temp-vars)

Theorem: definedp-lr-compile-programs definedp (name, lr-compile-programs (progs, const-table)) = definedp (name, progs)

Theorem: lr-valp-deposit-fetch-free-pointer-offset-helper-1 ((type (fetch (add-addr (addr, identity (lr-ref-count-offset)), data-seg))

  = 'nat)

∧ lr-good-pointerp (addr, data-seg) ∧ lr-nodep (free-addr, data-seg)

∧ (offset (addr) = offset (free-addr))) → (type (fetch (add-addr (free-addr, identity (lr-ref-count-offset)),

data-seg))

    = 'nat)

Theorem: lr-boundary-nodep-equal-plus-fact-zero ((type (addr1 ) = 'addr) ∧ (cddr (addr1 ) = nil) ∧ listp (addr1 ) ∧ listp (untag (addr1 )) ∧ (offset (addr1 ) ∈ N) ∧ lr-boundary-nodep (addr1 ) ∧ (type (addr2 ) = 'addr) ∧ (cddr (addr2 ) = nil) ∧ listp (addr2 ) ∧ listp (untag (addr2 )) ∧ (offset (addr2 ) ∈ N) ∧ lr-boundary-nodep (addr2 ) ∧ (area-name (addr2 ) = area-name (addr1 )) ∧ (m < lr-node-size)) → ((offset (addr1 ) = (m + offset (addr2 )))

= ((m ≃ 0) ∧ (addr1 = addr2 )))

Theorem: lr-boundary-nodep-equal-plus-fact ((type (addr1 ) = 'addr) ∧ (cddr (addr1 ) = nil) ∧ listp (addr1 ) ∧ listp (untag (addr1 )) ∧ (offset (addr1 ) ∈ N) ∧ lr-boundary-nodep (addr1 ) ∧ (type (addr2 ) = 'addr) ∧ (cddr (addr2 ) = nil) ∧ listp (addr2 ) ∧ listp (untag (addr2 )) ∧ (offset (addr2 ) ∈ N) ∧ lr-boundary-nodep (addr2 ) ∧ (n < lr-node-size) ∧ (m < lr-node-size) ∧ (area-name (addr1 ) = area-name (addr2 ))) → (((n + offset (addr1 )) = (m + offset (addr2 )))

= ((fix (n) = fix (m)) ∧ (addr1 = addr2 )))

Theorem: lr-valp-deposit-fetch-free-pointer-offset ((type (fetch (add-addr (free-addr, lr-ref-count-offset), data-seg)) ≠ 'nat) ∧ lr-nodep (free-addr, data-seg)

∧ (n < lr-node-size) ∧ lr-valp (value, addr, data-seg)) → lr-valp (value, addr, deposit (anything, add-addr (free-addr, n), data-seg))

Event: Disable lr-valp-deposit-fetch-free-pointer-offset.

Event: Disable lr-valp-deposit-fetch-free-pointer-offset-helper-1.

Theorem: lr-valp-deposit-fetch-free-pointer ((type (fetch (add-addr (free-addr, lr-ref-count-offset), data-seg)) ≠ 'nat) ∧ lr-nodep (free-addr, data-seg) ∧ lr-valp (value, addr, data-seg)) → lr-valp (value, addr, deposit (anything, free-addr, data-seg))

Event: Disable lr-valp-deposit-fetch-free-pointer.

Theorem: not-equal-x-add1-add1-x (x = (1 + (1 + x))) = f

Theorem: not-equal-x-add1-x (x = (1 + x)) = f

Theorem: p-run-subr-preserves-lr-valp (good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ lr-programs-properp (new-l, table) ∧ listp (lr-expr (l)) ∧ proper-p-statep (lr->p (new-l)) ∧ lr-proper-free-listp (p-data-segment (new-l)) ∧ adpp (untag (lr-max-node (p-data-segment (new-l))), p-data-segment (new-l)) ∧ lr-boundary-nodep (lr-max-node (p-data-segment (new-l))) ∧ (p-psw (new-l) = 'run) ∧ (p-psw (p-run-subr (car (lr-expr (l)),

p-set-pc (lr->p (new-l), lr-return-pc (l))))

    = 'run)

∧ lr-valp (value, addr, p-data-segment (new-l)) ∧ (p-prog-segment (l) = p-prog-segment (new-l))) → lr-valp (value,

addr,

p-data-segment (p-run-subr (car (lr-expr (l)),

p-set-pc (lr->p (new-l), lr-return-pc (l)))))

Theorem: numberp-offset-sub-addr offset (sub-addr (addr, n)) ∈ N

Theorem: lr-free-list-nodes-deposit-non-ref-count (lr-nodep (addr, data-seg) ∧ lr-nodep (max-addr, data-seg) ∧ (offset ≠ lr-ref-count-offset) ∧ (offset ∈ N) ∧ (offset < lr-node-size)) → (lr-free-list-nodes (max-addr,

deposit (anything, add-addr (addr, offset), data-seg))

= lr-free-list-nodes (max-addr, data-seg))

Theorem: lr-nodep-member-lr-node-listp-adpp-untag-listp (lr-node-listp (list, data-seg) ∧ (node ∈ list)) → listp (untag (node))

Event: Disable lr-nodep-member-lr-node-listp-adpp-untag-listp.

Theorem: lr-nodep-member-lr-node-listp-adpp-untag-numberp-offset (lr-node-listp (list, data-seg) ∧ (node ∈ list)) → (offset (node) ∈ N)

Theorem: lr-nodep-member-lr-node-listp-lr-boundaryp-offsetp (lr-node-listp (list, data-seg) ∧ (node ∈ list)) → lr-boundary-offsetp (offset (node))

Theorem: lr-check-free-nodes-deposit-non-ref-count (lr-nodep (addr2 , data-seg) ∧ lr-nodep (max-addr, data-seg) ∧ (offset ≠ lr-ref-count-offset) ∧ (offset ∈ N) ∧ (offset < lr-node-size) ∧ lr-node-listp (node-list, data-seg)) → (lr-check-free-nodes (addr1 ,

node-list,

deposit (anything, add-addr (addr2 , offset), data-seg), max-addr)

= lr-check-free-nodes (addr1 , node-list, data-seg, max-addr))

Event: Disable lr-nodep-member-lr-node-listp-adpp-untag-numberp-offset.

Theorem: adpp-deposit-other-area (adp-name (adp) ≠ area-name (addr)) → (adpp (adp, deposit (anything, addr, data-seg)) = adpp (adp, data-seg))

Event: Disable adpp-deposit-other-area.

Theorem: length-deposit length (cdr (assoc (name, deposit (anything, addr, data-seg)))) = if definedp (area-name (addr), data-seg)

then if area-name (addr) = name

then if offset (addr) < length (cdr (assoc (name, data-seg))) then length (cdr (assoc (name, data-seg))) else 1 + offset (addr) endif

else length (cdr (assoc (name, data-seg))) endif else length (cdr (assoc (name, data-seg))) endif

Theorem: same-signature-deposit (adpp (untag (addr), segment2 ) ∧ lr-proper-p-areasp (segment2 )) → (same-signature (segment1 , deposit (anything, addr, segment2 ))

= same-signature (segment1 , segment2 ))

Theorem: lr-max-node-same-signature same-signature (data-seg1 , data-seg2 ) → (lr-max-node (data-seg2 ) = lr-max-node (data-seg1 ))

Event: Disable lr-max-node-same-signature.

Theorem: lr-max-node-deposit (adpp (untag (addr), data-seg) ∧ lr-proper-p-areasp (data-seg)) → (lr-max-node (deposit (anything, addr, data-seg))

= lr-max-node (data-seg))

Theorem: not-adpp-untag-node-not-definedp-lr-heap-name (¬ definedp (area-name (addr), data-seg)) → (¬ adpp (untag (addr), data-seg))

Theorem: sub-addr-area-name-offset-same (listp (untag (addr1 )) ∧ (offset (addr1 ) ∈ N) ∧ (cddr (addr1 ) = nil) ∧ (type (addr1 ) = type (addr2 ))) → ((addr1 = sub-addr (addr2 , n))

= ((offset (addr1 ) = (offset (addr2 ) − n)) ∧ (area-name (addr1 ) = area-name (addr2 ))))

Theorem: lr-free-list-nodes-member-greater-offset (offset (addr) ≮ offset (max-addr)) → (addr ∉ lr-free-list-nodes (max-addr, data-seg))

Theorem: lr-free-list-nodes-deposit-lr-ref-count-offset ((type (addr) = 'addr)

∧ (cddr (addr) = nil) ∧ adpp (untag (addr), data-seg) ∧ lr-boundary-nodep (addr) ∧ (area-name (addr) = 'heap) ∧ (type (max-addr) = 'addr) ∧ adpp (untag (max-addr), data-seg) ∧ lr-boundary-nodep (max-addr) ∧ (area-name (max-addr) = 'heap) ∧ (type (ref-count) = 'nat) ∧ (untag (ref-count) ∈ N)) → (lr-free-list-nodes (max-addr,

deposit (ref-count,

add-addr (addr,

identity (lr-ref-count-offset)),

data-seg)) = delete (addr, lr-free-list-nodes (max-addr, data-seg)))

Event: Disable lr-free-list-nodes-member-greater-offset.

Event: Disable not-adpp-untag-node-not-definedp-lr-heap-name.

Definition: no-duplicatesp (list) = if listp (list)

then if car (list) ∈ cdr (list) then f

else no-duplicatesp (cdr (list)) endif else t endif

Theorem: not-member-occurences-0 (x ∉ z) → (occurrences (x, z) = 0)

Event: Disable not-member-occurences-0.

Theorem: no-duplicatesp-occurences-1 (no-duplicatesp (list) ∧ (e ∈ list)) → (occurrences (e, list) = 1)

Theorem: no-duplicatesp-lr-free-list-nodes no-duplicatesp (lr-free-list-nodes (addr, data-seg))

Theorem: member-area-name-offset-same ((addr1 ∈ node-list) ∧ (offset (addr1 ) ∈ N) ∧ (cddr (addr1 ) = nil)

∧ listp (untag (addr1 )) ∧ listp (untag (addr2 )) ∧ (offset (addr2 ) ∈ N) ∧ (cddr (addr2 ) = nil) ∧ (type (addr1 ) = type (addr2 )) ∧ (area-name (addr1 ) = area-name (addr2 )) ∧ (offset (addr2 ) = offset (addr1 ))) → (addr2 ∈ node-list)

Theorem: lr-check-free-nodes-delete-deposit (lr-check-free-nodes (addr2 , node-list, data-seg, max-addr) ∧ (addr1 ∉ node-list) ∧ lr-nodep (addr1 , data-seg) ∧ lr-node-listp (node-list, data-seg) ∧ (type (ref-count) = 'nat) ∧ (untag (ref-count) ∈ N)) → lr-check-free-nodes (addr2 ,

node-list,

deposit (ref-count,

add-addr (addr1 ,

identity (lr-ref-count-offset)),

data-seg), max-addr)

Event: Disable lr-check-free-nodes-delete-deposit.

Event: Disable member-area-name-offset-same.

Theorem: lr-check-free-nodes-deposit-free-ptr (adpp (identity (untag (lr-fp-addr)), data-seg) ∧ lr-node-listp (node-list, data-seg)) → (lr-check-free-nodes (addr,

node-list,

deposit (anything, identity (lr-fp-addr), data-seg), max-addr)

= lr-check-free-nodes (addr, node-list, data-seg, max-addr))

Theorem: lr-free-list-nodes-deposit-free-ptr (lr-nodep (max-addr, data-seg) ∧ adpp (identity (untag (lr-fp-addr)), data-seg)) → (lr-free-list-nodes (max-addr,

deposit (anything, identity (lr-fp-addr), data-seg))

= lr-free-list-nodes (max-addr, data-seg))

Theorem: deposit-ref-count-move-inward-2 (lr-nodep (addr, data-seg) ∧ (offset ≠ lr-ref-count-offset) ∧ (offset ≄ 0) ∧ (offset < lr-node-size)) → (deposit (any1 ,

add-addr (addr, identity (lr-ref-count-offset)), deposit (any2 , add-addr (addr, offset), data-seg))

= deposit (any2 , add-addr (addr, offset), deposit (any1 ,

add-addr (addr, identity (lr-ref-count-offset)), data-seg)))

Event: Disable deposit-ref-count-move-inward-2.

Theorem: lr-free-list-nodes-deposit-lr-nodep (lr-nodep (addr, data-seg) ∧ lr-nodep (max-addr, data-seg)) → (lr-free-list-nodes (max-addr, deposit (anything, addr, data-seg))

= lr-free-list-nodes (max-addr, data-seg))

Theorem: lr-check-free-nodes-deposit-lr-nodep (lr-nodep (addr2 , data-seg) ∧ lr-nodep (max-addr, data-seg) ∧ lr-node-listp (node-list, data-seg)) → (lr-check-free-nodes (addr1 ,

node-list,

deposit (anything, addr2 , data-seg), max-addr)

= lr-check-free-nodes (addr1 , node-list, data-seg, max-addr))

Theorem: same-signature-cons same-signature (data-seg1 , cons (x, data-seg2 )) = if listp (data-seg1 )

then (signature (car (data-seg1 )) = signature (x))

∧ same-signature (cdr (data-seg1 ), data-seg2 ) else f endif

Theorem: same-signature-nil (data-seg1 ≃ nil) → (same-signature (data-seg1 , data-seg2 ) = (data-seg2 ≃ nil))

Theorem: listp-put-assoc listp (put-assoc (val, name, alist)) = listp (alist)

Theorem: not-same-signature-deposit-too-large-addr (definedp (area-name (addr), data-seg2 ) ∧ lr-proper-p-areasp (data-seg2 ) ∧ (offset (addr) ≮ length (value (area-name (addr), data-seg1 )))) → (¬ same-signature (data-seg1 , deposit (any, addr, data-seg2 )))

Event: Disable same-signature-cons.

Event: Disable same-signature-nil.

Theorem: adpp-deposit-a-list adpp (adp, data-seg) → adpp (adp, deposit-a-list (list, addr2 , data-seg))

Theorem: lr-proper-p-areasp-deposit-a-list lr-proper-p-areasp (data-seg) → lr-proper-p-areasp (deposit-a-list (list, addr, data-seg))

Theorem: definedp-deposit-a-list definedp (tag, deposit-a-list (list, addr, data-seg)) = definedp (tag, data-seg)

Theorem: sub1-plus-not-zerop-fact-1 (x ≄ 0) → ((((y + x) − 1) < y) = f)

Theorem: not-adpp-untag-add-addr-adpp-untag adpp (untag (addr), data-seg) → (adpp (untag (add-addr (addr, n)), data-seg)

= ((offset (addr) + n)

< length (cdr (assoc (area-name (addr), data-seg)))))

Theorem: not-same-signature-deposit-a-list-too-large-addr (definedp (area-name (addr), data-seg2 ) ∧ lr-proper-p-areasp (data-seg2 ) ∧ (offset (addr) ≮ length (value (area-name (addr), data-seg1 )))) → (same-signature (data-seg1 , deposit-a-list (list, addr, data-seg2 ))

= if listp (list) then f else same-signature (data-seg1 , data-seg2 ) endif)

Theorem: same-signature-deposit-a-list (adpp (untag (addr), data-seg2 ) ∧ lr-proper-p-areasp (data-seg2 ) ∧ same-signature (data-seg1 , data-seg2 )) → (same-signature (data-seg1 , deposit-a-list (list, addr, data-seg2 ))

= ((offset (addr) + (length (list) − 1)) < length (cdr (assoc (area-name (addr), data-seg1 )))))

Event: Disable not-same-signature-deposit-too-large-addr.

Event: Disable not-same-signature-deposit-a-list-too-large-addr.

Theorem: deposit-good-node-preserves-lr-proper-free-listp (lr-proper-free-listp (data-seg) ∧ lr-proper-p-areasp (data-seg) ∧ adpp (untag (lr-max-node (data-seg)), data-seg) ∧ lr-boundary-nodep (lr-max-node (data-seg)) ∧ (offset (fetch (lr-fp-addr, data-seg))

< (((length (cdr (assoc (lr-heap-name, data-seg))) − 1) − 1) − 1)) ∧ (type (tag) = 'nat) ∧ (type (ref-count) = 'nat) ∧ (untag (ref-count) ∈ N)) → lr-proper-free-listp (deposit (fetch (add-addr (fetch (identity (lr-fp-addr),

data-seg), identity (lr-ref-count-offset)),

data-seg), identity (lr-fp-addr), deposit-a-list (list (tag, ref-count, x, y),

fetch (identity (lr-fp-addr),

data-seg), data-seg)))

Theorem: p-run-subr-preserves-lr-proper-free-listp (good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ lr-programs-properp (new-l, table) ∧ listp (lr-expr (l)) ∧ proper-p-statep (lr->p (new-l)) ∧ lr-proper-free-listp (p-data-segment (new-l)) ∧ adpp (untag (lr-max-node (p-data-segment (new-l))), p-data-segment (new-l)) ∧ lr-boundary-nodep (lr-max-node (p-data-segment (new-l))) ∧ (p-psw (new-l) = 'run) ∧ (p-psw (p-run-subr (car (lr-expr (l)),

p-set-pc (lr->p (new-l), lr-return-pc (l))))

    = 'run)

∧ (p-prog-segment (l) = p-prog-segment (new-l)) ∧ (area-name (p-pc (l)) = area-name (p-pc (new-l)))) → lr-proper-free-listp (p-data-segment (p-run-subr (car (lr-expr (l)),

p-set-pc (lr->p (new-l), lr-return-pc (l)))))

Event: Disable same-signature-deposit.

Theorem: lr-apply-subr-preserves-lr-proper-free-listp let new-l be lr-eval ('list, lr-set-pos (l, pos), c) in (good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ listp (lr-expr (l)) ∧ subrp (car (lr-expr (l))) ∧ (car (lr-expr (l)) ≠ 'if) ∧ proper-p-statep (lr->p (new-l)) ∧ lr-proper-free-listp (p-data-segment (new-l)) ∧ adpp (untag (lr-max-node (p-data-segment (new-l))),

p-data-segment (new-l))

∧ lr-boundary-nodep (lr-max-node (p-data-segment (new-l))) ∧ (p-psw (new-l) = 'run) ∧ (p-psw (lr-apply-subr (l, new-l)) = 'run)) → lr-proper-free-listp (p-data-segment (lr-apply-subr (l, new-l))) endlet

Theorem: lr-eval-preserves-proper-p-statep-lr->p-rewrite (proper-p-statep (lr->p (l)) ∧ good-posp (flag, offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ (p-psw (lr-eval (flag, l, c)) = 'run)) → proper-p-statep (lr->p (lr-eval (flag, l, c)))

Theorem: lr-eval-preserves-cdr-p-ctrl-stk (proper-p-statep (lr->p (l)) ∧ good-posp (flag, offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ (p-psw (lr-eval (flag, l, c)) = 'run)) → (cdr (p-ctrl-stk (lr-eval (flag, l, c))) = cdr (p-ctrl-stk (l)))

Theorem: lr-eval-preserves-strip-cars-bindings-car-p-ctrl-stk (proper-p-statep (lr->p (l)) ∧ good-posp (flag, offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ (p-psw (lr-eval (flag, l, c)) = 'run)) → (strip-cars (bindings (car (p-ctrl-stk (lr-eval (flag, l, c)))))

= strip-cars (bindings (car (p-ctrl-stk (l)))))

Theorem: lr-eval-preserves-lr-max-node (proper-p-statep (lr->p (l)) ∧ good-posp (flag, offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ (p-psw (lr-eval (flag, l, c)) = 'run)) → (lr-max-node (p-data-segment (lr-eval (flag, l, c)))

= lr-max-node (p-data-segment (l)))

Theorem: lr-eval-preserves-adpp (proper-p-statep (lr->p (l)) ∧ good-posp (flag, offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ (p-psw (lr-eval (flag, l, c)) = 'run)) → (adpp (adp, p-data-segment (lr-eval (flag, l, c)))

= adpp (adp, p-data-segment (l)))

Theorem: lr-eval-preserves-length-assoc-data-segment (proper-p-statep (lr->p (l)) ∧ good-posp (flag, offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ (p-psw (lr-eval (flag, l, c)) = 'run)) → (length (cdr (assoc (name, p-data-segment (lr-eval (flag, l, c)))))

= length (cdr (assoc (name, p-data-segment (l)))))

Theorem: lr-eval-preserves-proper-p-statep-lr->p-lr-set-pos (proper-p-statep (lr->p (l)) ∧ good-posp (flag, pos, program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ (p-psw (lr-eval (flag, lr-set-pos (l, pos), c)) = 'run)) → proper-p-statep (lr->p (lr-eval (flag, lr-set-pos (l, pos), c)))

Theorem: lr-eval-preserves-strip-cars-bindings-car-p-ctrl-stk-lr-set-pos (proper-p-statep (lr->p (l)) ∧ good-posp1 (pos, program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ (p-psw (lr-eval (t, lr-set-pos (l, pos), c)) = 'run)) → (strip-cars (bindings (car (p-ctrl-stk (lr-eval (t, lr-set-pos (l, pos), c)))))

= strip-cars (bindings (car (p-ctrl-stk (l)))))

Theorem: lr-eval-preserves-cdr-p-ctrl-stk-lr-set-pos (proper-p-statep (lr->p (l)) ∧ good-posp1 (pos, program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ (p-psw (lr-eval (t, lr-set-pos (l, pos), c)) = 'run)) → (cdr (p-ctrl-stk (lr-eval (t, lr-set-pos (l, pos), c)))

= cdr (p-ctrl-stk (l)))

Theorem: lr-eval-preserves-adpp-lr-set-pos (proper-p-statep (lr->p (l)) ∧ good-posp (flag, pos, program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ (p-psw (lr-eval (flag, lr-set-pos (l, pos), c)) = 'run)) → (adpp (adp, p-data-segment (lr-eval (flag, lr-set-pos (l, pos), c)))

= adpp (adp, p-data-segment (l)))

Theorem: lr-eval-preserves-lr-max-node-lr-set-pos (proper-p-statep (lr->p (l)) ∧ good-posp (flag, pos, program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ (p-psw (lr-eval (flag, lr-set-pos (l, pos), c)) = 'run)) → (lr-max-node (p-data-segment (lr-eval (flag, lr-set-pos (l, pos), c)))

= lr-max-node (p-data-segment (l)))

Theorem: lr-eval-preserves-lr-proper-free-listp (proper-p-statep (lr->p (l)) ∧ good-posp (flag, offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ (p-psw (lr-eval (flag, l, c)) = 'run) ∧ adpp (untag (lr-max-node (p-data-segment (l))), p-data-segment (l)) ∧ lr-boundary-nodep (lr-max-node (p-data-segment (l))) ∧ lr-proper-free-listp (p-data-segment (l))) → lr-proper-free-listp (p-data-segment (lr-eval (flag, l, c)))

Theorem: lr-apply-subr-preserves-lr-valp let new-l be lr-eval ('list, lr-set-pos (l, pos), c) in (good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ listp (lr-expr (l)) ∧ subrp (car (lr-expr (l))) ∧ (car (lr-expr (l)) ≠ 'if) ∧ proper-p-statep (lr->p (new-l)) ∧ lr-proper-free-listp (p-data-segment (new-l)) ∧ adpp (untag (lr-max-node (p-data-segment (new-l))),

p-data-segment (new-l))

∧ lr-boundary-nodep (lr-max-node (p-data-segment (new-l))) ∧ (p-psw (new-l) = 'run) ∧ (p-psw (lr-apply-subr (l, new-l)) = 'run) ∧ lr-valp (value, addr, p-data-segment (new-l))) → lr-valp (value, addr, p-data-segment (lr-apply-subr (l, new-l))) endlet

Theorem: lr-eval-preserves-lr-proper-free-listp-lr-set-pos (proper-p-statep (lr->p (l)) ∧ good-posp (flag, pos, program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ (p-psw (lr-eval (flag, lr-set-pos (l, pos), c)) = 'run) ∧ adpp (untag (lr-max-node (p-data-segment (l))), p-data-segment (l)) ∧ lr-boundary-nodep (lr-max-node (p-data-segment (l))) ∧ lr-proper-free-listp (p-data-segment (l))) → lr-proper-free-listp (p-data-segment (lr-eval (flag, lr-set-pos (l, pos), c)))

Theorem: lr-eval-preserves-lr-valp (proper-p-statep (lr->p (l)) ∧ good-posp (flag, offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ (p-psw (lr-eval (flag, l, c)) = 'run) ∧ lr-proper-free-listp (p-data-segment (l)) ∧ adpp (untag (lr-max-node (p-data-segment (l))), p-data-segment (l)) ∧ lr-boundary-nodep (lr-max-node (p-data-segment (l))) ∧ lr-valp (value, addr, p-data-segment (l))) → lr-valp (value, addr, p-data-segment (lr-eval (flag, l, c)))

Theorem: lr-check-f-addrp-deposit-anything-anywhere lr-check-f-addrp (addr, deposit (anything, anywhere, data-seg)) = lr-check-f-addrp (addr, data-seg)

Theorem: lr-check-undef-addrp-deposit-anything-anywhere lr-check-undef-addrp (addr, deposit (anything, anywhere, data-seg)) = lr-check-undef-addrp (addr, data-seg)

Theorem: lr-check-listp-addrp-deposit-free-ptr-0 lr-check-listp-addrp (addr, deposit (any, identity (lr-fp-addr), data-seg)) = lr-check-listp-addrp (addr, data-seg)

Theorem: lr-check-numberp-addrp-deposit-free-ptr-0 lr-check-numberp-addrp (addr, deposit (any, identity (lr-fp-addr), data-seg)) = lr-check-numberp-addrp (addr, data-seg)

Theorem: lr-proper-heapp-nodep-deposit-free-ptr-0 lr-proper-heapp-nodep (addr, deposit (any, identity (lr-fp-addr), data-seg)) = lr-proper-heapp-nodep (addr, data-seg)

Theorem: lr-proper-heapp2-deposit-free-ptr-0 lr-proper-heapp2 (addr, deposit (any, identity (lr-fp-addr), data-seg)) = lr-proper-heapp2 (addr, data-seg)

Theorem: lr-boundary-offsetp-equal-plus-fact-zero (lr-boundary-offsetp (offset1 ) ∧ lr-boundary-offsetp (offset2 ) ∧ (n < lr-node-size) ∧ (offset1 ∈ N) ∧ (offset2 ∈ N)) → (((n + offset1 ) = offset2 )

= ((n ≃ 0) ∧ (offset1 = offset2 )))

Theorem: fetch-add-addr-deposit-a-list-node (adpp (untag (max-addr), data-seg) ∧ lr-boundary-nodep (max-addr) ∧ adpp (untag (addr), data-seg) ∧ lr-boundary-nodep (addr) ∧ (area-name (addr) = area-name (max-addr)) ∧ (n < lr-node-size)) → (fetch (add-addr (max-addr, n),

deposit-a-list (list (x0 , x1 , x2 , x3 ), addr, data-seg)) = if offset (addr) = offset (max-addr) then get (n, list (x0 , x1 , x2 , x3 )) else fetch (add-addr (max-addr, n), data-seg) endif)

Theorem: fetch-deposit-a-list-node (adpp (untag (max-addr), data-seg) ∧ lr-boundary-nodep (max-addr) ∧ adpp (untag (addr), data-seg) ∧ lr-boundary-nodep (addr) ∧ (area-name (addr) = area-name (max-addr))) → (fetch (max-addr, deposit-a-list (list (x0 , x1 , x2 , x3 ), addr, data-seg))

= if offset (addr) = offset (max-addr) then x0 else fetch (max-addr, data-seg) endif)

Event: Disable lr-boundary-offsetp-equal-plus-fact-zero.

Theorem: lr-check-f-addrp-deposit-a-list lr-check-f-addrp (addr, deposit-a-list (list, anywhere, data-seg)) = lr-check-f-addrp (addr, data-seg)

Theorem: lr-check-undef-addrp-deposit-a-list lr-check-undef-addrp (addr, deposit-a-list (list, anywhere, data-seg)) = lr-check-undef-addrp (addr, data-seg)

Theorem: lr-check-numberp-addrp-deposit-a-list-cons ((offset (addr) ≠ offset (max-addr)) ∧ (type (max-addr) = 'addr) ∧ (cddr (max-addr) = nil) ∧ listp (max-addr) ∧ adpp (untag (max-addr), data-seg) ∧ lr-boundary-nodep (max-addr) ∧ (area-name (max-addr) = lr-heap-name) ∧ (type (addr) = 'addr) ∧ (cddr (addr) = nil) ∧ listp (addr) ∧ adpp (untag (addr), data-seg)

∧ lr-boundary-nodep (addr) ∧ (area-name (addr) = lr-heap-name) ∧ lr-check-numberp-addrp (max-addr, data-seg) ∧ (type (tag) = 'nat) ∧ (untag (tag) ∈ N)) → lr-check-numberp-addrp (max-addr,

deposit-a-list (list (x0 , tag, x2 , x3 ), addr, data-seg))

Theorem: lr-check-listp-addrp-deposit-a-list-cons (lr-good-pointerp (good-pointer1 , data-seg) ∧ lr-good-pointerp (good-pointer2 , data-seg) ∧ adpp (untag (addr), data-seg) ∧ lr-boundary-nodep (addr) ∧ adpp (untag (max-addr), data-seg) ∧ lr-boundary-nodep (max-addr) ∧ (area-name (addr) = lr-heap-name) ∧ (area-name (max-addr) = lr-heap-name) ∧ (type (tag) = 'nat) ∧ (untag (tag) ∈ N) ∧ (offset (addr) = offset (max-addr))) → lr-check-listp-addrp (max-addr,

deposit-a-list (list (identity (tag ('nat,

lr-cons-tag)),

tag,

good-pointer1 , good-pointer2 ),

addr, data-seg))

Theorem: lr-check-listp-addrp-deposit-a-list-other-place (adpp (untag (addr), data-seg) ∧ lr-boundary-nodep (addr) ∧ adpp (untag (max-addr), data-seg) ∧ lr-boundary-nodep (max-addr) ∧ (area-name (addr) = lr-heap-name) ∧ (area-name (max-addr) = lr-heap-name) ∧ lr-check-listp-addrp (max-addr, data-seg) ∧ (offset (addr) ≠ offset (max-addr)) ∧ (type (ref-count) = 'nat)) → lr-check-listp-addrp (max-addr,

deposit-a-list (list (x0 , ref-count, x2 , x3 ), addr, data-seg))

Theorem: lr-proper-heapp-nodep-deposit-a-list-cons (lr-nodep (max-addr, data-seg) ∧ lr-nodep (addr, data-seg) ∧ lr-proper-heapp-nodep (max-addr, data-seg) ∧ (type (fetch (add-addr (addr, lr-ref-count-offset), data-seg)) ≠ 'nat) ∧ lr-good-pointerp (good-pointer1 , data-seg) ∧ lr-good-pointerp (good-pointer2 , data-seg) ∧ (type (tag) = 'nat) ∧ (untag (tag) ∈ N)) → lr-proper-heapp-nodep (max-addr,

deposit-a-list (list (identity (tag ('nat,

lr-cons-tag)),

tag,

good-pointer1 , good-pointer2 ),

addr, data-seg))

Theorem: lr-proper-heapp2-deposit-a-list-cons (lr-nodep (max-addr, data-seg) ∧ lr-nodep (addr, data-seg) ∧ lr-proper-heapp2 (max-addr, data-seg) ∧ (type (fetch (add-addr (addr, lr-ref-count-offset), data-seg)) ≠ 'nat) ∧ lr-good-pointerp (good-pointer1 , data-seg) ∧ lr-good-pointerp (good-pointer2 , data-seg) ∧ (type (tag) = 'nat) ∧ (untag (tag) ∈ N)) → lr-proper-heapp2 (max-addr,

deposit-a-list (list (identity (tag ('nat, lr-cons-tag)), tag, good-pointer1 , good-pointer2 ),

addr, data-seg))

Theorem: not-psw-run-lr-eval (p-psw (l) ≠ 'run) → (lr-eval (flag, l, c) = l)

Theorem: program-body-assoc-lr-compile-programs program-body (assoc (name, lr-compile-programs (progs, table))) = lr-compile-body (t,

s-body (assoc (name, progs)),

lr-make-temp-name-alist (s-temp-list (assoc (name, progs)),

s-formals (assoc (name, progs))),

table)

Theorem: listp-lr-compile-body listp (lr-compile-body (flag, body, temp-name-alist, table)) = listp (body)

Theorem: car-lr-compile-body (flag ≠ 'list) → (car (lr-compile-body (flag, body, temp-name-alist, table)) = car (body))

Theorem: good-posp1-expand-list-temps (((temp = s-temp-eval) ∨ (temp = s-temp-test)) ∧ listp (pos)) → (good-posp1 (pos, list (temp, body, name))

= ((car (pos) = 1) ∧ good-posp1 (cdr (pos), body)))

Theorem: length-lr-compile-body-list length (lr-compile-body ('list, body, temp-name-alist, table)) = length (body)

Theorem: get-lr-compile-body-list get (n, lr-compile-body ('list, body, temp-name-alist, table)) = lr-compile-body (t, get (n, body), temp-name-alist, table)

Theorem: get-lr-compile-body (listp (body) ∧ (car (body) ≠ s-temp-fetch) ∧ (car (body) ≠ s-temp-eval) ∧ (car (body) ≠ s-temp-test) ∧ (car (body) ≠ 'quote) ∧ (n ≄ 0)) → (get (n, lr-compile-body (t, body, temp-name-alist, table))

= lr-compile-body (t, get (n, body), temp-name-alist, table))

Theorem: length-lr-compile-body-t (listp (body) ∧ (car (body) ≠ s-temp-fetch) ∧ (car (body) ≠ s-temp-eval) ∧ (car (body) ≠ s-temp-test) ∧ (car (body) ≠ 'quote)) → (length (lr-compile-body (t, body, temp-name-alist, table))

= length (body))

Theorem: good-posp1-lr-compile-body good-posp1 (pos, lr-compile-body (t, body, temp-name-alist, table)) = good-posp1 (pos, body)

Theorem: cur-expr-lr-compile-body-t good-posp1 (pos, body) → (cur-expr (pos, lr-compile-body (t, body, temp-name-alist, table))

= lr-compile-body (t, cur-expr (pos, body), temp-name-alist, table))

Theorem: lr-check-result1-singleton-list-opener lr-check-result1 (list (x), temp-stk, data-seg) = lr-valp (x, car (temp-stk), data-seg)

Theorem: proper-p-temp-stkp-plistp-p-temp-stk proper-p-temp-stkp (temp-stk, p) → plistp (temp-stk)

Theorem: proper-p-statep-lr->p-plistp-p-temp-stk proper-p-statep (lr->p (l)) → plistp (p-temp-stk (l))

Theorem: proper-p-statep-lr->p-not-0-p-temp-stk proper-p-statep (lr->p (l)) → (p-temp-stk (l) ≠ 0)

Theorem: plistp-lastcdr-nil plistp (list) → (lastcdr (list) = nil)

Theorem: lr-eval-preserves-lr-valp-lr-set-expr (proper-p-statep (lr->p (l)) ∧ proper-p-statep (lr->p (lr-set-expr (l1 , l, pos))) ∧ good-posp (flag, pos, program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ (p-psw (lr-eval (flag, lr-set-expr (l1 , l, pos), c)) = 'run) ∧ lr-proper-free-listp (p-data-segment (l)) ∧ lr-proper-free-listp (p-data-segment (l1 )) ∧ adpp (untag (lr-max-node (p-data-segment (l))), p-data-segment (l)) ∧ lr-boundary-nodep (lr-max-node (p-data-segment (l))) ∧ adpp (untag (lr-max-node (p-data-segment (l1 ))), p-data-segment (l1 )) ∧ lr-boundary-nodep (lr-max-node (p-data-segment (l1 ))) ∧ lr-valp (value, addr, p-data-segment (l1 )) ∧ (length (cdr (assoc (lr-heap-name, p-data-segment (l1 ))))

= length (cdr (assoc (lr-heap-name, p-data-segment (l)))))) → lr-valp (value,

addr,

p-data-segment (lr-eval (flag, lr-set-expr (l1 , l, pos), c)))

Theorem: lr-eval-preserves-proper-p-statep-lr->p-lr-set-expr (proper-p-statep (lr->p (l)) ∧ good-posp (flag, pos, program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ (p-psw (lr-eval (flag, lr-set-expr (l1 , l, pos), c)) = 'run) ∧ lr-programs-properp (l1 , table) ∧ proper-p-statep (lr->p (l1 )) ∧ (cdr (p-ctrl-stk (l1 )) = cdr (p-ctrl-stk (l))) ∧ (strip-cars (bindings (car (p-ctrl-stk (l1 ))))

= strip-cars (bindings (car (p-ctrl-stk (l)))))

∧ (p-prog-segment (l1 ) = p-prog-segment (l)) ∧ (p-word-size (l1 ) = p-word-size (l)) ∧ (p-max-ctrl-stk-size (l1 ) = p-max-ctrl-stk-size (l)) ∧ (p-max-temp-stk-size (l1 ) = p-max-temp-stk-size (l))) → proper-p-statep (lr->p (lr-eval (flag, lr-set-expr (l1 , l, pos), c)))

Theorem: lr-check-result-flag-list-cons-value let l2 be lr-eval ('list, lr-set-expr (lr-eval (t, l, c), l, nx (pos)), c) in (good-posp ('list, pos, program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ proper-p-statep (lr->p (l)) ∧ listp (lr-expr-list (l)) ∧ listp (offset (p-pc (l))) ∧ lr-proper-heapp (p-data-segment (l)) ∧ lr-check-result (t,

value1 ,

p-temp-stk (lr-eval (t, l, c)), p-data-segment (lr-eval (t, l, c)), p-temp-stk (l))

∧ lr-check-result ('list, value2 , p-temp-stk (l2 ), p-data-segment (l2 ), p-temp-stk (lr-eval (t, l, c)))

∧ (p-psw (l2 ) = 'run) ∧ (pos = offset (p-pc (l))) ∧ (temp-stk = p-temp-stk (l))) → lr-check-result ('list,

cons (value1 , value2 ), p-temp-stk (l2 ), p-data-segment (l2 ), temp-stk) endlet

Theorem: lr-check-result-nil lr-proper-heapp (data-seg) → lr-check-result ('list, nil, temp-stk, data-seg, temp-stk)

Theorem: litatom-lr-compile-body litatom (lr-compile-body (t, body, temp-name-alist, table)) = litatom (body)

Theorem: lr-params-lr-push-tstk lr-params (frame, lr-push-tstk (l, anything)) = lr-params (frame, l)

Theorem: lr-temps-lr-push-tstk lr-temps (frame, lr-push-tstk (l, anything)) = lr-temps (frame, l)

Theorem: program-body-p-current-program-s->lr1 program-body (p-current-program (s->lr1 (s, l, table))) = lr-compile-body (t,

s-body (s-prog (s)),

lr-make-temp-name-alist (s-temp-list (s-prog (s)),

s-formals (s-prog (s))),

table)

Theorem: name-car-lr-compile-programs-progs name (car (lr-compile-programs (s-progs (s), table))) = caar (s-progs (s))

Theorem: car-car-lr-compile-programs-progs caar (lr-compile-programs (s-progs (s), table)) = caar (s-progs (s))

Theorem: s-good-statep-program-body-car-lr-compile-programs s-good-statep (s, c) → (program-body (car (lr-compile-programs (s-progs (s), table)))

= lr-compile-body (t, s-body (car (s-progs (s))), lr-make-temp-name-alist (s-temp-list (car (s-progs (s))),

s-formals (car (s-progs (s)))),

table))

Theorem: good-posp-lr-compile-body good-posp (flag, pos, lr-compile-body (t, body, temp-name-alist, table)) = good-posp (flag, pos, body)

Theorem: strip-cars-lr-compile-programs strip-cars (lr-compile-programs (progs, table)) = strip-cars (progs)

Theorem: listp-lr-expr-list-s->lr1 good-posp ('list, s-pos (s), s-body (s-prog (s))) → (listp (lr-expr-list (s->lr1 (s, l, table))) = listp (s-expr-list (s)))

Theorem: formal-vars-lr-compile-programs formal-vars (assoc (name, lr-compile-programs (progs, table))) = s-formals (assoc (name, progs))

Theorem: formal-vars-p-current-program-s->lr1 formal-vars (p-current-program (s->lr1 (s, l, table))) = s-formals (s-prog (s))

Theorem: temp-var-dcls-lr-compile-programs definedp (name, progs) → (temp-var-dcls (assoc (name, lr-compile-programs (progs, table)))

= lr-make-temp-var-dcls (lr-make-temp-name-alist (s-temp-list (assoc (name,

progs)),

s-formals (assoc (name, progs)))))

Theorem: temp-var-dcls-assoc-p-current-program-s->lr1 definedp (s-pname (s), s-progs (s)) → (temp-var-dcls (p-current-program (s->lr1 (s, l, table)))

= lr-make-temp-var-dcls (lr-make-temp-name-alist (s-temp-list (s-prog (s)), s-formals (s-prog (s)))))

Theorem: lr-set-expr-s->lr1-s-set-expr s->lr1 (s-set-expr (s-eval (t, s, c), s, nx (s-pos (s))),

lr-eval (t, s->lr1 (s, l, table), c), table)

= lr-set-error (lr-set-expr (lr-eval (t, s->lr1 (s, l, table), c), s->lr1 (s, l, table), nx (s-pos (s))),

s-err-flag (s-eval (t, s, c)))

Theorem: p-current-program-lr-set-error p-current-program (lr-set-error (l, err-flag)) = p-current-program (l)

Theorem: lr-set-error-lr-set-error lr-set-error (lr-set-error (l, err-flag1 ), err-flag2 ) = lr-set-error (l, err-flag2 )

Theorem: proper-p-statep-lr-set-error proper-p-statep (lr-set-error (l, err-flag)) = proper-p-statep (l)

Theorem: lr-params-lr-set-error lr-params (frame, lr-set-error (l, err-flag)) = lr-params (frame, l)

Theorem: lr-temps-lr-set-error lr-temps (frame, lr-set-error (l, err-flag)) = lr-temps (frame, l)

Theorem: lr-s-similar-statesp-lr-set-error lr-s-similar-statesp (params, temps, lr-set-error (l, err-flag), table) = lr-s-similar-statesp (params, temps, l, table)

Theorem: lr-s-similar-statesp-lr-set-expr ((area-name (p-pc (l1 )) = area-name (p-pc (l2 ))) ∧ (p-prog-segment (l1 ) = p-prog-segment (l2 ))) → (lr-s-similar-statesp (params, temps, lr-set-expr (l1 , l2 , pos), table)

= lr-s-similar-statesp (params, temps, l1 , table))

Theorem: lr-eval-zerop-clock ((c ≃ 0) ∧ (flag ≠ 'list) ∧ (p-psw (l) = 'run)) → (lr-eval (flag, l, c) = lr-set-error (l, 'out-of-time))

Theorem: litatom-lr-expr-s->lr1 (good-posp1 (s-pos (s), s-body (s-prog (s))) ∧ litatom (s-expr (s))) → (lr-expr (s->lr1 (s, l, table)) = s-expr (s))

Theorem: lr-eval-litatom-opener (good-posp1 (s-pos (s), s-body (s-prog (s))) ∧ (flag ≠ 'list) ∧ (c ≄ 0) ∧ litatom (s-expr (s)) ∧ (s-err-flag (s) = 'run)) → (lr-eval (flag, s->lr1 (s, l, table), c)

= lr-push-tstk (s->lr1 (s, l, table), local-var-value (s-expr (s), p-ctrl-stk (l))))

Theorem: lr-s-similar-statesp-lr-push-tstk-litatom lr-s-similar-statesp (s-params, s-temps, lr-push-tstk (l, value), table) = lr-s-similar-statesp (s-params, s-temps, l, table)

Theorem: lr-s-similar-params-assoc-definedp (lr-s-similar-params (s-params, lr-params, data-seg) ∧ definedp (name, lr-params)) → lr-valp (cdr (assoc (name, s-params)), cdr (assoc (name, lr-params)), data-seg)

Theorem: proper-p-statep-lr->p-strip-cars-bindings-ctrl-stk (proper-p-statep (lr->p (l)) ∧ definedp (area-name (p-pc (l)), p-prog-segment (l))) → (strip-cars (bindings (car (p-ctrl-stk (l))))

= append (formal-vars (assoc (area-name (p-pc (l)), p-prog-segment (l))), strip-cars (temp-var-dcls (assoc (area-name (p-pc (l)),

p-prog-segment (l))))))

Definition: induct-hint-11 (v, y) = if listp (v)

then if listp (y) then induct-hint-11 (cdr (v), cdr (y))

else t endif else t endif

Theorem: equal-append-same-length-fact (length (v) = length (y)) → ((append (strip-cars (v), w) = append (y, z))

= ((strip-cars (v) = plist (y)) ∧ (w = z)))

Theorem: definedp-strip-cars-append-member-x (strip-cars (x) = append (y, z)) → ((e ∈ y) = definedp (e, firstn (length (y), x)))

Theorem: proper-p-statep-lr->p-member-formals-definedp-bindings (proper-p-statep (lr->p (s->lr1 (s, l, table))) ∧ definedp (s-pname (s), s-progs (s)) ∧ (x ∈ s-formals (assoc (s-pname (s), s-progs (s))))) → definedp (x,

firstn (length (s-formals (assoc (s-pname (s), s-progs (s)))), bindings (car (p-ctrl-stk (l)))))

Theorem: lr-valp-addr-0 ¬ lr-valp (addr, 0, data-seg)

Theorem: lr-valp-cdr-assoc-firstn-cdr-assoc lr-valp (addr, cdr (assoc (name, firstn (n, list))), data-seg) → lr-valp (addr, cdr (assoc (name, list)), data-seg)

Theorem: lr-s-similar-statesp-lr-s-similar-params-opener (lr-s-similar-statesp (s-params, s-temps, l, table) ∧ (frame = car (p-ctrl-stk (l))) ∧ (data-seg = p-data-segment (l))) → lr-s-similar-params (s-params, lr-params (frame, l), data-seg)

Theorem: lr-s-similar-statesp-lr-s-similar-temps-opener (lr-s-similar-statesp (s-params, s-temps, l, table) ∧ (frame = car (p-ctrl-stk (l))) ∧ (data-seg = p-data-segment (l))) → lr-s-similar-temps (s-temps, lr-temps (frame, l), data-seg)

Theorem: strip-cars-lr-make-temp-var-dcls strip-cars (lr-make-temp-var-dcls (temp-alist)) = strip-cdrs (temp-alist)

Theorem: lr-check-result-lr-push-tstk let value be cdr (assoc (s-expr (s), bindings (car (p-ctrl-stk (l))))) in (good-posp1 (s-pos (s), s-body (s-prog (s))) ∧ definedp (s-pname (s), s-progs (s)) ∧ (s-err-flag (s) = 'run) ∧ litatom (s-expr (s)) ∧ proper-p-statep (lr->p (s->lr1 (s, l, table))) ∧ lr-proper-heapp (p-data-segment (l)) ∧ lr-programs-properp (s->lr1 (s, l, table), table) ∧ (p-psw (lr-push-tstk (s->lr1 (s, l, table), value)) = 'run) ∧ lr-s-similar-statesp (s-params (s),

s-temps (s),

s->lr1 (s, l, table), table))

→ lr-check-result (t, cdr (assoc (s-expr (s), s-params (s))), p-temp-stk (lr-push-tstk (s->lr1 (s, l, table),

value)),

p-data-segment (l), p-temp-stk (l)) endlet

Theorem: s->lr1-s-set-pos-lr-set-pos s->lr1 (s-set-pos (s, pos), l, table) = lr-set-pos (s->lr1 (s, l, table), pos)

Theorem: lr-params-lr-set-pos lr-params (frame, lr-set-pos (l, pos)) = lr-params (frame, l)

Theorem: lr-temps-lr-set-pos lr-temps (frame, lr-set-pos (l, pos)) = lr-temps (frame, l)

Theorem: lr-s-similar-statesp-lr-s-set-pos lr-s-similar-statesp (s-params, s-temps, lr-set-pos (l, pos), table) = lr-s-similar-statesp (s-params, s-temps, l, table)

Theorem: lr-set-expr-s->lr1-s-set-expr-lr-pop-tstk s->lr1 (s-set-expr (s-eval (t, s-set-pos (s, pos), c), s, dv (s-pos (s), n)),

lr-pop-tstk (lr-if-ok (lr-eval (t, lr-set-pos (s->lr1 (s, l, table), pos), c))), table)

= lr-set-error (lr-set-expr (lr-pop-tstk (lr-if-ok (lr-eval (t,

lr-set-pos (s->lr1 (s, l, table),

pos),

c))),

s->lr1 (s, l, table), dv (s-pos (s), n)), s-err-flag (s-eval (t, s-set-pos (s, pos), c)))

Theorem: lr-s-similar-statesp-lr-pop-tstk lr-s-similar-statesp (s-params, s-temps, lr-pop-tstk (l), table) = lr-s-similar-statesp (s-params, s-temps, l, table)

Theorem: listp-lr-expr-s->lr1 good-posp1 (s-pos (s), s-body (s-prog (s))) → (listp (lr-expr (s->lr1 (s, l, table))) = listp (s-expr (s)))

Theorem: litatom-lr-expr-s->lr1-s-expr good-posp1 (s-pos (s), s-body (s-prog (s))) → (litatom (lr-expr (s->lr1 (s, l, table))) = litatom (s-expr (s)))

Theorem: car-lr-expr-s->lr1 good-posp1 (s-pos (s), s-body (s-prog (s))) → (car (lr-expr (s->lr1 (s, l, table))) = car (s-expr (s)))

Theorem: equal-p-psw-lr-eval-run-lr-eval-lr-set-error (p-psw (l) = 'run) → (lr-eval (flag, lr-set-error (l, 'run), c) = lr-eval (flag, l, c))

Theorem: lr-proper-heapp-lr-good-pointerp-lr-proper-heapp-nodep (lr-good-pointerp (addr, data-seg) ∧ lr-proper-p-areasp (data-seg) ∧ lr-proper-heapp (data-seg)) → lr-proper-heapp-nodep (addr, data-seg)

Theorem: lr-check-result-f-not-lr-f-addr ((car (temp-stk) ≠ lr-f-addr) ∧ lr-proper-p-areasp (data-seg) ∧ listp (temp-stk)) → (lr-check-result (t, f, temp-stk, data-seg, orig-temp-stk) = f)

Theorem: lr-check-result-t-chain ((flag ≠ 'list) ∧ lr-check-result (t, ans, temp-stk2 , data-seg2 , cdr (temp-stk1 )) ∧ lr-check-result (t, anything, temp-stk1 , data-seg1 , temp-stk0 )) → lr-check-result (flag, ans, temp-stk2 , data-seg2 , temp-stk0 )

Theorem: lr-check-result-not-f-lr-f-addr ((car (temp-stk) = lr-f-addr) ∧ listp (temp-stk) ∧ lr-proper-p-areasp (data-seg) ∧ (ans ≠ f)) → (lr-check-result (t, ans, temp-stk, data-seg, orig-temp-stk) = f)

Theorem: lr-eval-leaves-listp-p-temp-stk (proper-p-statep (lr->p (l)) ∧ good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ (flag ≠ 'list) ∧ lr-programs-properp (l, table) ∧ (p-psw (lr-eval (flag, l, c)) = 'run)) → listp (p-temp-stk (lr-eval (flag, l, c)))

Theorem: lr-eval-s->lr1-if-opener-1 let lr-test be lr-if-ok (lr-eval (t,

lr-set-pos (s->lr1 (s, l, table), dv (s-pos (s), 1)), in (good-posp1 (s-pos (s), s-body (s-prog (s))) ∧ listp (s-expr (s)) ∧ (car (s-expr (s)) = 'if) ∧ (flag ≠ 'list) ∧ (p-psw (lr-test) = 'run) ∧ (top (p-temp-stk (lr-test)) ≠ lr-f-addr)) → (lr-eval (flag, s->lr1 (s, l, table), c)

= lr-eval (t,

lr-set-expr (lr-pop-tstk (lr-test), s->lr1 (s, l, table), dv (s-pos (s), 2)),

c)) endlet

Theorem: lr-eval-s->lr1-if-opener-2 let lr-test be lr-if-ok (lr-eval (t,

lr-set-pos (s->lr1 (s, l, table),

dv (s-pos (s), 1)),

c))

in (good-posp1 (s-pos (s), s-body (s-prog (s))) ∧ listp (s-expr (s)) ∧ (car (s-expr (s)) = 'if) ∧ (flag ≠ 'list) ∧ (p-psw (lr-test) = 'run) ∧ (top (p-temp-stk (lr-test)) = lr-f-addr)) → (lr-eval (flag, s->lr1 (s, l, table), c)

= lr-eval (t,

lr-set-expr (lr-pop-tstk (lr-test), s->lr1 (s, l, table), dv (s-pos (s), 3)),

c)) endlet

Theorem: lr-eval-s->lr1-if-opener-3 (good-posp1 (s-pos (s), s-body (s-prog (s))) ∧ (flag ≠ 'list) ∧ listp (s-expr (s)) ∧ (car (s-expr (s)) = 'if) ∧ (c ≄ 0) ∧ s-good-statep (s, c) ∧ (p-psw (lr-if-ok (lr-eval (t,

lr-set-pos (s->lr1 (s, l, table), dv (s-pos (s), 1)), c)))

    ≠ 'run))

→ (lr-eval (flag, s->lr1 (s, l, table), c)

= lr-if-ok (lr-eval (t, lr-set-pos (s->lr1 (s, l, table), dv (s-pos (s), 1)), c)))

Theorem: lr-eval-s->lr1-temp-eval-opener (good-posp1 (s-pos (s), s-body (s-prog (s))) ∧ (car (s-expr (s)) = s-temp-eval) ∧ (flag ≠ 'list) ∧ (c ≄ 0) ∧ listp (s-expr (s)) ∧ s-good-statep (s, c)) → (lr-eval (flag, s->lr1 (s, l, table), c)

= lr-set-temp (lr-eval (t,

lr-set-pos (s->lr1 (s, l, table),

dv (s-pos (s), 1)),

c), top (p-temp-stk (lr-eval (t,

lr-set-pos (s->lr1 (s, l, table), dv (s-pos (s), 1)),

c))),

caddr (lr-expr (s->lr1 (s, l, table)))))

Theorem: lr-eval-s->lr1-temp-test-opener (good-posp1 (s-pos (s), s-body (s-prog (s))) ∧ (car (s-expr (s)) = s-temp-test) ∧ (flag ≠ 'list) ∧ (c ≄ 0) ∧ listp (s-expr (s)) ∧ s-good-statep (s, c)) → (lr-eval (flag, s->lr1 (s, l, table), c)

= if p-max-temp-stk-size (l) ≮ (2 + length (p-temp-stk (l)))

then if lr-eval-temp-setp (s->lr1 (s, l, table)) then lr-do-temp-fetch (s->lr1 (s, l, table)) else lr-set-temp (lr-eval (t,

lr-set-pos (s->lr1 (s, l, table), dv (s-pos (s), 1)),

c), top (p-temp-stk (lr-eval (t, lr-set-pos (s->lr1 (s,

l, table),

dv (s-pos (s), 1)),

c))),

caddr (lr-expr (s->lr1 (s, l, table)))) endif

else lr-set-error (s->lr1 (s, l, table),

                      'lr-temp-setp-temp-stack-overflow) endif)

Theorem: lr-eval-s->lr1-temp-fetch-opener (good-posp1 (s-pos (s), s-body (s-prog (s))) ∧ (car (s-expr (s)) = s-temp-fetch) ∧ (flag ≠ 'list) ∧ (c ≄ 0) ∧ listp (s-expr (s)) ∧ s-good-statep (s, c)) → (lr-eval (flag, s->lr1 (s, l, table), c)

= lr-do-temp-fetch (s->lr1 (s, l, table)))

Theorem: lr-eval-s->lr1-quote-opener (good-posp1 (s-pos (s), s-body (s-prog (s))) ∧ (car (s-expr (s)) = 'quote) ∧ (flag ≠ 'list) ∧ (c ≄ 0) ∧ listp (s-expr (s)) ∧ s-good-statep (s, c)) → (lr-eval (flag, s->lr1 (s, l, table), c)

= lr-push-tstk (s->lr1 (s, l, table), cadr (lr-expr (s->lr1 (s, l, table)))))

Theorem: lr-params-lr-set-temp lr-params (frame, lr-set-temp (l, value, var-name)) = lr-params (frame, l)

Theorem: lr-temps-lr-set-temp lr-temps (frame, lr-set-temp (l, value, var-name)) = lr-temps (frame, l)

Theorem: firstn-put-assoc firstn (n, put-assoc (val, name, alist)) = put-assoc (val, name, firstn (n, alist))

Theorem: strip-cars-nil-fact (nil = strip-cars (y)) = (¬ listp (y))

Definition: induct-hint-13 (e, x, y)

= if listp (x)

then if listp (y)

then if e = caar (x) then t

else induct-hint-13 (e, cdr (x), cdr (y)) endif else t endif

else t endif

Theorem: strip-cars-equal-definedp-equal (strip-cars (x) = strip-cars (y)) → (definedp (e, x) = definedp (e, y))

Theorem: lr-eval-preserves-definedp-firstn-bindings-car-p-ctrl-stk (proper-p-statep (lr->p (l)) ∧ good-posp (flag, offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ (p-psw (lr-eval (flag, l, c)) = 'run)) → (definedp (x, firstn (n, bindings (car (p-ctrl-stk (lr-eval (flag, l, c))))))

= definedp (x, firstn (n, bindings (car (p-ctrl-stk (l))))))

Definition: disjointp (list1 , list2 ) = if listp (list1 )

then (car (list1 ) ∉ list2 ) ∧ disjointp (cdr (list1 ), list2 )

else t endif

Theorem: member-disjointp-non-member-1 (disjointp (x, y) ∧ (e ∈ x)) → (e ∉ y)

Theorem: lr-eval-preserves-definedp-fn-bindings-car-ctrl-stk-set-pos (proper-p-statep (lr->p (l)) ∧ good-posp1 (pos, program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ (p-psw (lr-eval (t, lr-set-pos (l, pos), c)) = 'run)) → (definedp (x,

firstn (n,

bindings (car (p-ctrl-stk (lr-eval (t, lr-set-pos (l, pos), c))))))

= definedp (x, firstn (n, bindings (car (p-ctrl-stk (l))))))

Theorem: lr-params-p-frame-not-definedp-put-assoc-anything (proper-p-statep (lr->p (l)) ∧ good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ good-posp1 (pos, program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ disjointp (formal-vars (p-current-program (l)),

strip-cars (temp-var-dcls (p-current-program (l))))

∧ listp (lr-expr (l)) ∧ ((car (lr-expr (l)) = s-temp-eval)

∨ (car (lr-expr (l)) = s-temp-test)) ∧ (p-psw (lr-eval (t, lr-set-pos (l, pos), c)) = 'run)) → (lr-params (p-frame (put-assoc (anything,

caddr (lr-expr (l)),

bindings (car (p-ctrl-stk (lr-eval (t,

lr-set-pos (l,

pos),

c))))),

ret-pc), l)

= lr-params (car (p-ctrl-stk (lr-eval (t, lr-set-pos (l, pos), c))), l))

Definition: induct-hint-14 (s-temps, lr-temps, temp-alist) = if listp (s-temps)

then if listp (lr-temps)

then if listp (temp-alist)

then if cdar (lr-temps) = lr-undef-addr then induct-hint-14 (cdr (s-temps),

cdr (lr-temps), cdr (temp-alist))

else induct-hint-14 (cdr (s-temps), cdr (lr-temps), cdr (temp-alist)) endif

else t endif else t endif

else t endif

Theorem: put-assoc-opener-1 ((name ≠ caar (alist)) ∧ listp (alist)) → (put-assoc (val, name, alist)

= cons (car (alist), put-assoc (val, name, cdr (alist))))

Theorem: put-assoc-opener-2 (listp (alist3 ) ∧ (caar (alist3 ) ∉ strip-cars (cdr (alist3 ))) ∧ definedp (s-expr, alist1 ) ∧ (strip-cars (alist1 ) = strip-cars (alist2 )) ∧ (strip-cdrs (alist2 ) = strip-cars (cdr (alist3 )))) → (put-assoc (val, cdr (assoc (s-expr, alist2 )), alist3 )

= cons (car (alist3 ), put-assoc (val, cdr (assoc (s-expr, alist2 )), cdr (alist3 ))))

Theorem: not-lr-valp-lr-undef-addr (lr-proper-heapp (data-seg) ∧ lr-proper-p-areasp (data-seg)) → (¬ lr-valp (value, identity (lr-undef-addr), data-seg))

Theorem: lr-s-similar-temps-put-assoc-put-assoc-helper-1 (listp (s-temps) ∧ listp (lr-temps) ∧ lr-s-similar-temps (s-temps, lr-temps, data-seg) ∧ lr-valp (value, addr, data-seg) ∧ lr-proper-heapp (data-seg) ∧ lr-proper-p-areasp (data-seg) ∧ (name1 = caar (s-temps)) ∧ (name2 = caar (lr-temps))) → lr-s-similar-temps (put-assoc (list (t, value), name1 , s-temps),

put-assoc (addr, name2 , lr-temps), data-seg)

Theorem: lr-s-similar-temps-put-assoc-put-assoc-helper (lr-s-similar-temps (s-temps, lr-temps, data-seg) ∧ lr-valp (value, addr, data-seg) ∧ lr-proper-heapp (data-seg) ∧ lr-proper-p-areasp (data-seg) ∧ (strip-cars (temp-alist) = strip-cars (s-temps)) ∧ (strip-cdrs (temp-alist) = strip-cars (lr-temps)) ∧ no-duplicatesp (strip-cars (lr-temps)) ∧ definedp (s-expr, s-temps)) → lr-s-similar-temps (put-assoc (list (t, value), s-expr, s-temps),

put-assoc (addr, cdr (assoc (s-expr, temp-alist)), lr-temps),

data-seg)

Theorem: disjointp-cons-arg2 (disjointp (list1 , list2 ) ∧ (x ∉ list1 )) → disjointp (list1 , cons (x, list2 ))

Theorem: disjointp-nlistp-arg2 (list2 ≃ nil) → disjointp (list1 , list2 )

Theorem: disjointp-lr-make-temp-name-alist-1 disjointp (formals,

strip-cdrs (lr-make-temp-name-alist-1 (initial, num-list, temp-list, formals)))

Theorem: lr-s-similar-statesp-s-change-temp-helper-2 let lr-eval be lr-eval (t, lr-set-pos (s->lr1 (s, l, table), pos), c) in (proper-p-statep (lr->p (s->lr1 (s, l, table))) ∧ good-posp1 (s-pos (s), s-body (s-prog (s))) ∧ good-posp1 (pos, s-body (s-prog (s))) ∧ lr-s-similar-statesp (s-params, s-temps (s-eval), lr-eval, table) ∧ lr-programs-properp (s->lr1 (s, l, table), table) ∧ s-good-statep (s, c) ∧ listp (s-expr (s)) ∧ ((car (s-expr (s)) = s-temp-eval)

∨ (car (s-expr (s)) = s-temp-test)) ∧ (p-psw (lr-eval) = 'run) ∧ (lr-expr = caddr (lr-expr (s->lr1 (s, l, table))))) → (lr-s-similar-statesp (s-params,

s-temps (s-change-temp (s-eval, s-expr, value)),

lr-set-temp (lr-eval, addr, lr-expr), table) = lr-s-similar-temps (put-assoc (list (t, value),

s-expr,

s-temps (s-eval)), lr-temps (p-frame (put-assoc (addr,

lr-expr,

bindings (car (p-ctrl-stk (lr-eval)))),

ret-pc (car (p-ctrl-stk (lr-eval)))), s->lr1 (s, l, table)), p-data-segment (lr-eval))) endlet

Theorem: good-posp1-dv-1-temps-lr-expr (((car (s-expr (s)) = s-temp-eval) ∨ (car (s-expr (s)) = s-temp-test)) ∧ listp (s-expr (s)) ∧ good-posp1 (s-pos (s), s-body (assoc (s-pname (s), s-progs (s))))) → good-posp1 (dv (s-pos (s), 1), s-body (assoc (s-pname (s), s-progs (s))))

Theorem: put-assoc-restn (¬ definedp (name, firstn (n, alist))) → (put-assoc (val, name, restn (n, alist))

= restn (n, put-assoc (val, name, alist)))

Theorem: disjointp-plist-arg-2 disjointp (x, plist (y)) = disjointp (x, y)

Theorem: not-disjointp-member-arg1-cons-arg2 (v ∈ y) → (¬ disjointp (y, cons (v, z)))

Theorem: member-disjointp-cons-arg2 (v ∉ y) → (disjointp (y, cons (v, z)) = disjointp (y, z))

Theorem: disjointp-commutative disjointp (x, y) = disjointp (y, x)

Theorem: disjointp-lr-make-temp-name-alist-2 disjointp (strip-cdrs (lr-make-temp-name-alist-1 (initial,

num-list, temp-list, formals)),

formals)

Theorem: proper-p-statep-lr->p-s->lr1-strip-cars-bindings-ctrl-stk (proper-p-statep (lr->p (s->lr1 (s, l, table))) ∧ definedp (s-pname (s), s-progs (s))) → (strip-cars (bindings (car (p-ctrl-stk (l))))

= append (s-formals (assoc (s-pname (s), s-progs (s))),

strip-cdrs (lr-make-temp-name-alist (s-temp-list (assoc (s-pname (s),

s-progs (s))),

s-formals (assoc (s-pname (s), s-progs (s)))))))

Theorem: lr-programs-properp-lr->p-s->lr1-definedp-s-pname (¬ definedp (s-pname (s), s-progs (s))) → (¬ lr-programs-properp (s->lr1 (s, l, table), table))

Theorem: lr-temps-p-frame-put-assoc (proper-p-statep (lr->p (s->lr1 (s, l, table))) ∧ lr-programs-properp (s->lr1 (s, l, table), table) ∧ definedp (s-pname (s), s-progs (s)) ∧ listp (s-expr (s)) ∧ ((car (s-expr (s)) = s-temp-eval)

∨ (car (s-expr (s)) = s-temp-test)) ∧ good-posp1 (s-pos (s), s-body (s-prog (s))) ∧ (p-psw (lr-eval (t, l2 , c)) = 'run) ∧ (lr-expr = caddr (lr-expr (s->lr1 (s, l, table)))) ∧ (l2 = lr-set-pos (s->lr1 (s, l, table), dv (s-pos (s), 1)))) → (lr-temps (p-frame (put-assoc (val,

lr-expr,

bindings (car (p-ctrl-stk (lr-eval (t, l2 , c))))),

ret-pc), s->lr1 (s, l, table))

= put-assoc (val, caddr (lr-expr (s->lr1 (s, l, table))), lr-temps (car (p-ctrl-stk (lr-eval (t, l2 , c))), s->lr1 (s, l, table))))

Theorem: strip-cars-lr-temps-strip-cars-temp-var-dcls (s-good-statep (s, c) ∧ proper-p-statep (lr->p (s->lr1 (s, l, table))) ∧ (frame = top (p-ctrl-stk (s->lr1 (s, l, table))))) → (strip-cars (lr-temps (frame, s->lr1 (s, l, table)))

= strip-cdrs (lr-make-temp-name-alist (s-temp-list (assoc (s-pname (s),

s-progs (s))),

s-formals (assoc (s-pname (s), s-progs (s))))))

Event: Disable proper-p-statep-lr->p-s->lr1-strip-cars-bindings-ctrl-stk.

Theorem: lr-s-similar-statesp-s-change-temp-helper-1 (good-posp1 (s-pos (s), s-body (s-prog (s))) ∧ listp (s-expr (s)) ∧ ((car (s-expr (s)) = s-temp-eval)

∨ (car (s-expr (s)) = s-temp-test) ∨ (car (s-expr (s)) = s-temp-fetch)))

→ (caddr (lr-expr (s->lr1 (s, l, table)))

= cdr (assoc (cadr (s-expr (s)),

lr-make-temp-name-alist (s-temp-list (s-prog (s)), s-formals (s-prog (s))))))

Theorem: lr-s-similar-statesp-s->lr1-lr-similar-temps lr-s-similar-statesp (s-params, s-temps, l, table) → lr-s-similar-temps (s-temps,

lr-temps (top (p-ctrl-stk (l)), l), p-data-segment (l))

Theorem: count-codelist1-cons count-codelist1 (cons (x, y)) = (x + (10 ∗ count-codelist1 (y)))

Theorem: equal-append-initial (append (x, y) = append (x, z)) = (y = z)

Theorem: plist-listp-x-append-x-not-0 plistp (x) → ((append (x, 0) = 0) = (x = nil))

Theorem: equal-append-final-0 (append (y, 0) = append (z, 0)) = (plist (y) = plist (z))

Theorem: count-codelist1-append-non-listp (¬ listp (z)) → (count-codelist1 (append (num-list, z)) = count-codelist1 (num-list))

Theorem: not-equal-make-symbol-car-gensym (count-codelist1 (num-list1 ) < count-codelist1 (num-list2 )) → (make-symbol (initial, num-list1 )

≠ car (gensym (initial, num-list2 , atom-list)))

Theorem: count-codelist1-cdr-gensym (count-codelist1 (num-list1 ) < count-codelist1 (num-list2 )) → (count-codelist1 (num-list1 )

< count-codelist1 (cdr (gensym (initial, num-list2 , atom-list))))

Theorem: not-member-make-symbol-lr-make-temp-name-alist-1-incr (count-codelist1 (num-list1 ) < count-codelist1 (num-list2 )) → ((make-symbol (initial, num-list1 )

∈ strip-cdrs (lr-make-temp-name-alist-1 (initial, num-list2 , temp-list, formals)))

= f)

Theorem: not-member-car-gensym-lr-make-temp-name-alist-1-cdr (car (gensym (initial, num-list, atoms)) ∈ strip-cdrs (lr-make-temp-name-alist-1 (initial,

cdr (gensym (initial, num-list, atoms)),

temp-list, formals)))

= f

Theorem: no-duplicatesp-strip-cdrs-lr-make-temp-name-alist-1 no-duplicatesp (strip-cdrs (lr-make-temp-name-alist-1 (initial,

num-list, temp-list, formals)))

Theorem: no-duplicatesp-strip-cdrs-lr-make-temp-name-alist no-duplicatesp (strip-cdrs (lr-make-temp-name-alist (temp-list, formals)))

Theorem: definedp-s-temps-s-eval (s-err-flag (s-eval (flag, s, c)) = 'run) → (definedp (x, s-temps (s-eval (flag, s, c))) = definedp (x, s-temps (s)))

Theorem: strip-cars-lr-make-temp-name-alist-1 strip-cars (lr-make-temp-name-alist-1 (initial, num-list, temp-list, formals)) = plist (temp-list)

Theorem: strip-cars-lr-make-temp-name-alist strip-cars (lr-make-temp-name-alist (temp-list, formals)) = plist (temp-list)

Theorem: lr-eval-preserves-strip-cars-lr-temps-car-p-ctrl-stk (proper-p-statep (lr->p (l)) ∧ good-posp (flag, offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ (p-psw (lr-eval (flag, l, c)) = 'run)) → (strip-cars (lr-temps (car (p-ctrl-stk (lr-eval (flag, l, c))), l2 ))

= strip-cars (lr-temps (car (p-ctrl-stk (l)), l2 )))

Theorem: lr-s-similar-statesp-s-change-temp let s-l be s->lr1 (s, l, table),

lr-eval be lr-eval (t, lr-set-pos (s->lr1 (s, l, table), pos), c) in (proper-p-statep (lr->p (s->lr1 (s, l, table))) ∧ lr-s-similar-statesp (s-params, s-temps (s-eval), lr-eval, table) ∧ good-posp1 (s-pos (s), s-body (s-prog (s))) ∧ lr-programs-properp (s->lr1 (s, l, table), table) ∧ s-good-statep (s, c) ∧ listp (p-temp-stk (lr-eval)) ∧ lr-check-result (t,

s-ans (s-eval),

p-temp-stk (lr-eval), p-data-segment (lr-eval), orig-temp-stk)

∧ listp (s-expr (s)) ∧ ((car (s-expr (s)) = s-temp-eval)

∨ (car (s-expr (s)) = s-temp-test)) ∧ (p-psw (lr-eval) = 'run) ∧ (s-err-flag (s-eval) = 'run) ∧ (s-eval = s-eval (t, s-set-pos (s, pos), c)) ∧ (value = caddr (lr-expr (s-l))) ∧ (pos = dv (s-pos (s), 1))) → lr-s-similar-statesp (s-params,

s-temps (s-change-temp (s-eval, cadr (s-expr (s)), s-ans (s-eval))),

lr-set-temp (lr-eval, car (p-temp-stk (lr-eval)), value),

table) endlet

Event: Disable lr-s-similar-statesp-s-change-temp-helper-2.

Theorem: lr-temps-lr-do-temp-fetch lr-temps (frame, lr-do-temp-fetch (l)) = lr-temps (frame, l)

Theorem: lr-params-lr-do-temp-fetch lr-params (frame, lr-do-temp-fetch (l)) = lr-params (frame, l)

Theorem: lr-s-simlar-statesp-lr-do-temp-fetch lr-s-similar-statesp (s-params, s-temps, lr-do-temp-fetch (l), table) = lr-s-similar-statesp (s-params, s-temps, l, table)

Theorem: not-member-no-duplicates-cdr-assoc-helper (no-duplicatesp (list) ∧ (strip-cdrs (alist) = list) ∧ (name ∉ list) ∧ definedp (s-expr, alist)) → (cdr (assoc (s-expr, alist)) ≠ name)

Theorem: not-member-no-duplicates-cdr-assoc (no-duplicatesp (list) ∧ (strip-cdrs (alist1 ) = list) ∧ (name ∉ list) ∧ definedp (s-expr, alist2 ) ∧ (strip-cars (alist2 ) = strip-cars (alist1 ))) → (cdr (assoc (s-expr, alist1 )) ≠ name)

Theorem: not-equal-lr-s-eval-temp-setp-not-lr-s-similar-temps ((lr-expr = cdr (assoc (s-expr, temp-alist))) ∧ lr-proper-heapp (data-seg) ∧ lr-proper-p-areasp (data-seg) ∧ lr-s-similar-temps (s-temps, lr-temps, data-seg) ∧ (strip-cars (temp-alist) = strip-cars (s-temps)) ∧ (strip-cdrs (temp-alist) = strip-cars (lr-temps)) ∧ no-duplicatesp (strip-cars (lr-temps)) ∧ definedp (s-expr, s-temps)) → ((cdr (assoc (lr-expr, lr-temps)) ≠ lr-undef-addr)

↔ cadr (assoc (s-expr, s-temps)))

Theorem: definedp-strip-cars-append-member-x-2 (strip-cars (x) = append (y, z)) → ((e ∈ z) = definedp (e, restn (length (y), x)))

Theorem: not-iff-lr-s-temp-setp-not-lr-s-similar-statesp-helper ((x ∈ strip-cdrs (lr-make-temp-name-alist (s-temp-list (assoc (s-pname (s),

s-progs (s))),

s-formals (assoc (s-pname (s),

s-progs (s))))))

∧ proper-p-statep (lr->p (s->lr1 (s, l, table))) ∧ definedp (s-pname (s), s-progs (s))) → (cdr (assoc (x, lr-temps (car (p-ctrl-stk (l)), s->lr1 (s, l, table))))

= cdr (assoc (x, bindings (car (p-ctrl-stk (l))))))

Theorem: lr-programs-properp-member-lr-expr-temps (good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ ((car (lr-expr (l)) = s-temp-fetch)

∨ (car (lr-expr (l)) = s-temp-eval) ∨ (car (lr-expr (l)) = s-temp-test)))

→ (caddr (lr-expr (l))

∈ strip-cars (temp-var-dcls (p-current-program (l))))

Theorem: not-iff-lr-s-temp-setp-not-lr-s-similar-statesp (proper-p-statep (lr->p (s->lr1 (s, l, table))) ∧ lr-proper-heapp (p-data-segment (l)) ∧ good-posp1 (s-pos (s), s-body (s-prog (s))) ∧ lr-programs-properp (s->lr1 (s, l, table), table) ∧ listp (s-expr (s)) ∧ ((car (s-expr (s)) = s-temp-test)

∨ (car (s-expr (s)) = s-temp-fetch)) ∧ (¬ (lr-eval-temp-setp (s->lr1 (s, l, table))

↔ s-temp-setp (cadr (s-expr (s)), s-temps (s)))) ∧ s-good-statep (s, c)) → (¬ lr-s-similar-statesp (s-params, s-temps (s), s->lr1 (s, l, table), table))

Theorem: lr-valp-lr-s-eval-lr-s-similar-temps ((lr-expr = cdr (assoc (s-expr, temp-alist))) ∧ lr-proper-heapp (data-seg) ∧ lr-proper-p-areasp (data-seg) ∧ lr-s-similar-temps (s-temps, lr-temps, data-seg) ∧ (strip-cars (temp-alist) = strip-cars (s-temps)) ∧ (strip-cdrs (temp-alist) = strip-cars (lr-temps)) ∧ no-duplicatesp (strip-cars (lr-temps)) ∧ definedp (s-expr, s-temps) ∧ (cdr (assoc (lr-expr, lr-temps)) ≠ lr-undef-addr)) → lr-valp (caddr (assoc (s-expr, s-temps)),

cdr (assoc (lr-expr, lr-temps)), data-seg)

Theorem: member-cdr-assoc-strip-cdrs-definedp definedp (x, alist) → (cdr (assoc (x, alist)) ∈ strip-cdrs (alist))

Theorem: definedp-pairlist definedp (x, pairlist (temp-list, anything)) = (x ∈ temp-list)

Theorem: definedp-lr-make-temp-name-alist-1 definedp (x, lr-make-temp-name-alist-1 (initial, num-list, temp-list, formals)) = (x ∈ temp-list)

Theorem: definedp-lr-make-temp-name-alist definedp (x, lr-make-temp-name-alist (temp-list, formals)) = (x ∈ temp-list)

Theorem: p-temp-stk-lr-do-temp-fetch-p-psw-run (p-psw (lr-do-temp-fetch (l)) = 'run) → (p-temp-stk (lr-do-temp-fetch (l))

= push (local-var-value (caddr (lr-expr (l)), p-ctrl-stk (l)), p-temp-stk (l)))

Theorem: lr-check-result-lr-do-temp-fetch (proper-p-statep (lr->p (s->lr1 (s, l, table))) ∧ good-posp1 (s-pos (s), s-body (s-prog (s))) ∧ s-good-statep (s, c) ∧ (c ≄ 0) ∧ listp (s-expr (s)) ∧ ((car (s-expr (s)) = s-temp-test)

∨ (car (s-expr (s)) = s-temp-fetch)) ∧ lr-proper-heapp (p-data-segment (l)) ∧ lr-s-similar-statesp (s-params (s), s-temps (s), s->lr1 (s, l, table), table) ∧ lr-eval-temp-setp (s->lr1 (s, l, table)) ∧ (value = caddr (lr-expr (s->lr1 (s, l, table))))) → lr-check-result (t,

caddr (assoc (cadr (s-expr (s)), s-temps (s))),

cons (cdr (assoc (value, bindings (car (p-ctrl-stk (l))))),

p-temp-stk (l)), p-data-segment (l), p-temp-stk (l))

Theorem: lr-do-temp-fetch-run-lr-eval-temp-setp (p-psw (lr-do-temp-fetch (l)) = 'run) → lr-eval-temp-setp (l)

Theorem: lr-s-similar-const-table-lr-valp-assoc (definedp (value, table) ∧ lr-s-similar-const-table (table, data-seg)) → lr-valp (value, cdr (assoc (value, table)), data-seg)

Theorem: lr-proper-exprp-list-quote-opener (flag ≠ 'list) → (lr-proper-exprp (flag,

list ('quote, addr), program-names, formals, temps, table)

= ((type (addr) = 'addr) ∧ (addr ∈ strip-cdrs (table))))

Theorem: lr-check-result-lr-push-tstk-quote (good-posp1 (s-pos (s), s-body (s-prog (s))) ∧ listp (s-expr (s)) ∧ (car (s-expr (s)) = 'quote) ∧ lr-programs-properp (s->lr1 (s, l, table), table) ∧ lr-s-similar-statesp (s-params (s), s-temps (s), s->lr1 (s, l, table), table) ∧ s-good-statep (s, c) ∧ lr-proper-heapp (p-data-segment (l)) ∧ (p-psw (lr-push-tstk (s->lr1 (s, l, table),

cadr (lr-expr (s->lr1 (s, l, table)))))

    = 'run))

→ lr-check-result (t, cadr (s-expr (s)), p-temp-stk (lr-push-tstk (s->lr1 (s, l, table),

cadr (lr-expr (s->lr1 (s, l, table))))),

p-data-segment (l), p-temp-stk (l))

Theorem: lr-eval-subrp-user-funcall-opener let lr-eval-list be lr-eval ('list,

lr-set-pos (s->lr1 (s, l, table), dv (s-pos (s), 1)), c)

in ((flag ≠ 'list) ∧ (c ≄ 0) ∧ listp (s-expr (s)) ∧ (car (s-expr (s)) ≠ 'if) ∧ (car (s-expr (s)) ≠ s-temp-eval) ∧ (car (s-expr (s)) ≠ s-temp-test) ∧ (car (s-expr (s)) ≠ s-temp-fetch) ∧ (car (s-expr (s)) ≠ 'quote) ∧ good-posp1 (s-pos (s), s-body (s-prog (s))) ∧ s-good-statep (s, c)) → (lr-eval (flag, s->lr1 (s, l, table), c)

= if p-psw (lr-eval-list) ≠ 'run then lr-eval-list elseif subrp (car (s-expr (s))) then lr-apply-subr (s->lr1 (s, l, table), lr-eval-list) elseif litatom (car (s-expr (s))) then lr-set-expr (lr-pop-cstk (lr-eval (t,

lr-funcall (s->lr1 (s, l, table),

lr-eval-list),

c − 1)),

s->lr1 (s, l, table), s-pos (s))

else lr-set-error (s->lr1 (s, l, table),

                  'bad-instruction) endif) endlet

Theorem: length-cdr-lr-expr-funcall (good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ listp (lr-expr (l)) ∧ (subrp (car (lr-expr (l))) ∨ litatom (car (lr-expr (l))))) → (length (cdr (lr-expr (l))) = arity (car (lr-expr (l))))

Definition: induct-hint-8 (n, value, temp-stk) = if n ≃ 0 then t

else induct-hint-8 (n − 1, cdr (value), cdr (temp-stk)) endif

Theorem: lr-check-result1-lr-valp-get-n-lessp-length (lr-check-result1 (values, temp-stk, data-seg) ∧ (n < length (values))) → lr-valp (get (n, values), get (n, temp-stk), data-seg)

Theorem: lr-valp-lr-good-pointerp lr-valp (value, addr, data-seg) → lr-good-pointerp (addr, data-seg)

Theorem: lr-check-result1-lr-good-pointerp-get-n-lessp-car (lr-check-result1 (values, temp-stk, data-seg) ∧ (length (values) ≮ 1)) → ((type (car (temp-stk)) = 'addr)

∧ (cddr (car (temp-stk)) = nil) ∧ listp (car (temp-stk)) ∧ adpp (untag (car (temp-stk)), data-seg) ∧ lr-boundary-nodep (car (temp-stk)) ∧ (area-name (car (temp-stk)) = identity (lr-heap-name)) ∧ (type (fetch (add-addr (car (temp-stk),

identity (lr-ref-count-offset)),

data-seg))

    = 'nat))

Theorem: lr-check-result1-lr-good-pointerp-get-n-lessp-cadr (lr-check-result1 (values, temp-stk, data-seg) ∧ (length (values) ≮ 2)) → ((type (cadr (temp-stk)) = 'addr)

∧ (cddr (cadr (temp-stk)) = nil)

∧ listp (cadr (temp-stk))

∧ adpp (untag (cadr (temp-stk)), data-seg) ∧ lr-boundary-nodep (cadr (temp-stk)) ∧ (area-name (cadr (temp-stk)) = identity (lr-heap-name)) ∧ (type (fetch (add-addr (cadr (temp-stk),

identity (lr-ref-count-offset)),

data-seg))

        = 'nat))

Theorem: p-run-subr-preserves-lr-proper-heapp2 (good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ lr-programs-properp (new-l, table) ∧ listp (lr-expr (l)) ∧ proper-p-statep (lr->p (new-l)) ∧ lr-proper-free-listp (p-data-segment (new-l)) ∧ adpp (untag (lr-max-node (p-data-segment (new-l))), p-data-segment (new-l)) ∧ lr-boundary-nodep (lr-max-node (p-data-segment (new-l))) ∧ (p-psw (new-l) = 'run) ∧ (p-psw (p-run-subr (car (lr-expr (l)),

p-set-pc (lr->p (new-l), lr-return-pc (l))))

    = 'run)

∧ lr-proper-heapp2 (addr, p-data-segment (new-l)) ∧ lr-nodep (addr, p-data-segment (new-l)) ∧ (p-prog-segment (l) = p-prog-segment (new-l)) ∧ lr-check-result ('list,

value,

p-temp-stk (new-l), p-data-segment (new-l), p-temp-stk (l))

∧ (length (value) = length (cdr (lr-expr (l))))) → lr-proper-heapp2 (addr,

p-data-segment (p-run-subr (car (lr-expr (l)),

p-set-pc (lr->p (new-l), lr-return-pc (l)))))

Theorem: lr-apply-subr-preserves-lr-proper-heapp2 let new-l be lr-eval ('list, lr-set-pos (l, pos), c) in (good-posp1 (offset (p-pc (l)), program-body (p-current-program (l)))

∧ good-posp ('list, pos, program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ listp (lr-expr (l)) ∧ subrp (car (lr-expr (l))) ∧ (car (lr-expr (l)) ≠ 'if) ∧ proper-p-statep (lr->p (l)) ∧ lr-proper-free-listp (p-data-segment (l)) ∧ lr-proper-heapp2 (addr, p-data-segment (new-l)) ∧ adpp (untag (lr-max-node (p-data-segment (l))), p-data-segment (l)) ∧ lr-boundary-nodep (lr-max-node (p-data-segment (l))) ∧ lr-nodep (addr, p-data-segment (l)) ∧ lr-check-result ('list,

value,

p-temp-stk (new-l), p-data-segment (new-l), p-temp-stk (l))

∧ (length (value) = length (cdr (lr-expr (l)))) ∧ (p-psw (new-l) = 'run) ∧ (p-psw (lr-apply-subr (l, new-l)) = 'run)) → lr-proper-heapp2 (addr, p-data-segment (lr-apply-subr (l, new-l))) endlet

Definition: induct-hint-15 (s, c) = if listp (s-pos (s))

then if listp (s-expr-list (s)) then induct-hint-15 (s-set-expr (s-eval (t, s, c), s, nx (s-pos (s))), c) else t endif

else t endif

Theorem: length-s-eval-list (listp (s-pos (s)) ∧ (s-err-flag (s-eval ('list, s, c)) = 'run)) → (length (s-ans (s-eval ('list, s, c))) = length (s-expr-list (s)))

Theorem: plistp-lr-compile-body listp (body) → plistp (lr-compile-body (flag, body, temp-alist, const-alist))

Theorem: plistp-lr-expr-s->lr1 (good-posp1 (s-pos (s), s-body (s-prog (s))) ∧ listp (s-expr (s))) → plistp (lr-expr (s->lr1 (s, l, table)))

Theorem: length-cdr-lr-expr-funcall-s->lr1 (good-posp1 (s-pos (s), s-body (s-prog (s))) ∧ lr-programs-properp (s->lr1 (s, l, table), table) ∧ listp (s-expr (s)) ∧ (car (s-expr (s)) ≠ 'quote)

∧ (subrp (car (s-expr (s))) ∨ litatom (car (s-expr (s))))) → (length (cdr (lr-expr (s->lr1 (s, l, table)))) = length (cdr (s-expr (s))))

Theorem: adpp-same-signature-lr-apply-subr same-signature (p-data-segment (new-l), p-data-segment (lr-apply-subr (l, new-l))) → (adpp (adp, p-data-segment (lr-apply-subr (l, new-l)))

= adpp (adp, p-data-segment (new-l)))

Theorem: lr-apply-subr-preserves-lr-proper-heapp let new-l be lr-eval ('list, lr-set-pos (s->lr1 (s, l, table), pos), c) in (good-posp1 (s-pos (s), s-body (s-prog (s))) ∧ definedp (s-pname (s), s-progs (s)) ∧ lr-programs-properp (s->lr1 (s, l, table), table) ∧ listp (s-expr (s)) ∧ (car (s-expr (s)) ≠ s-temp-eval) ∧ (car (s-expr (s)) ≠ s-temp-test) ∧ (car (s-expr (s)) ≠ s-temp-fetch) ∧ (car (s-expr (s)) ≠ 'quote) ∧ subrp (car (s-expr (s))) ∧ (car (s-expr (s)) ≠ 'if) ∧ proper-p-statep (lr->p (s->lr1 (s, l, table))) ∧ lr-check-result ('list,

s-ans (s-eval ('list, s-set-pos (s, pos), c)), p-temp-stk (new-l), p-data-segment (new-l), p-temp-stk (l))

∧ (p-psw (new-l) = 'run) ∧ (p-psw (lr-apply-subr (s->lr1 (s, l, table), new-l)) = 'run) ∧ lr-proper-heapp (p-data-segment (new-l)) ∧ lr-proper-heapp (p-data-segment (l)) ∧ (s-err-flag (s-eval ('list, s-set-pos (s, pos), c)) = 'run) ∧ (pos = dv (s-pos (s), 1))) → lr-proper-heapp (p-data-segment (lr-apply-subr (s->lr1 (s, l, table),

new-l))) endlet

Theorem: lr-s-similar-params-lr-apply-subr let new-l be lr-eval ('list, lr-set-pos (l, pos), c) in (good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ listp (lr-expr (l)) ∧ subrp (car (lr-expr (l))) ∧ (car (lr-expr (l)) ≠ 'if) ∧ proper-p-statep (lr->p (new-l))

∧ lr-proper-heapp (p-data-segment (new-l)) ∧ (p-psw (new-l) = 'run) ∧ (p-psw (lr-apply-subr (l, new-l)) = 'run) ∧ lr-s-similar-params (s-params, lr-params, p-data-segment (new-l))) → lr-s-similar-params (s-params,

lr-params,

p-data-segment (lr-apply-subr (l, new-l))) endlet

Theorem: lr-params-lr-apply-subr ((area-name (p-pc (new-l)) = area-name (p-pc (l))) ∧ (p-prog-segment (new-l) = p-prog-segment (l))) → (lr-params (frame, lr-apply-subr (l, new-l)) = lr-params (frame, l))

Theorem: lr-temps-lr-apply-subr ((area-name (p-pc (new-l)) = area-name (p-pc (l))) ∧ (p-prog-segment (new-l) = p-prog-segment (l))) → (lr-temps (frame, lr-apply-subr (l, new-l)) = lr-temps (frame, l))

Theorem: lr-s-similar-temps-lr-apply-subr let new-l be lr-eval ('list, lr-set-pos (l, pos), c) in (good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ listp (lr-expr (l)) ∧ subrp (car (lr-expr (l))) ∧ (car (lr-expr (l)) ≠ 'if) ∧ proper-p-statep (lr->p (new-l)) ∧ lr-proper-heapp (p-data-segment (new-l)) ∧ (p-psw (new-l) = 'run) ∧ (p-psw (lr-apply-subr (l, new-l)) = 'run) ∧ lr-s-similar-temps (s-temps, lr-temps, p-data-segment (new-l))) → lr-s-similar-temps (s-temps,

lr-temps,

p-data-segment (lr-apply-subr (l, new-l))) endlet

Theorem: lr-s-similar-const-table-lr-apply-subr let new-l be lr-eval ('list, lr-set-pos (l, pos), c) in (good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table1 ) ∧ listp (lr-expr (l)) ∧ subrp (car (lr-expr (l))) ∧ (car (lr-expr (l)) ≠ 'if) ∧ proper-p-statep (lr->p (new-l)) ∧ lr-proper-heapp (p-data-segment (new-l))

∧ (p-psw (new-l) = 'run) ∧ (p-psw (lr-apply-subr (l, new-l)) = 'run) ∧ lr-s-similar-const-table (table2 , p-data-segment (new-l))) → lr-s-similar-const-table (table2 ,

p-data-segment (lr-apply-subr (l, new-l))) endlet

Theorem: lr-s-similar-statesp-lr-apply-subr let new-l be lr-eval ('list, lr-set-pos (l, pos), c) in (good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ listp (lr-expr (l)) ∧ subrp (car (lr-expr (l))) ∧ (car (lr-expr (l)) ≠ 'if) ∧ proper-p-statep (lr->p (new-l)) ∧ lr-proper-heapp (p-data-segment (new-l)) ∧ (p-psw (new-l) = 'run) ∧ (p-psw (lr-apply-subr (l, new-l)) = 'run) ∧ lr-s-similar-statesp (s-params, s-temps, new-l, table)) → lr-s-similar-statesp (s-params,

s-temps,

lr-apply-subr (l, new-l), table) endlet

Theorem: proper-p-statep-lr->p-lr-eval-list-helper let cur-expr be cur-expr (offset (p-pc (l)),

program-body (p-current-program (l)))

in ((length (cur-expr) < 1) ∧ good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ listp (cur-expr) ∧ (car (cur-expr) ≠ 'if) ∧ (car (cur-expr) ≠ 'quote) ∧ (litatom (car (cur-expr)) ∨ subrp (car (cur-expr))) ∧ proper-p-statep (lr->p (l)) ∧ lr-programs-properp (l, table) ∧ (p-psw (lr-eval ('list, lr-set-pos (l, pos), c)) = 'run) ∧ (pos = dv (offset (p-pc (l)), 1))) → proper-p-statep (lr->p (lr-eval ('list, lr-set-pos (l, pos), c))) endlet

Theorem: proper-p-statep-lr->p-lr-eval-list (good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ listp (lr-expr (l)) ∧ (car (lr-expr (l)) ≠ 'if) ∧ (car (lr-expr (l)) ≠ 'quote)

∧ (subrp (car (lr-expr (l))) ∨ litatom (car (lr-expr (l)))) ∧ proper-p-statep (lr->p (l)) ∧ lr-programs-properp (l, table) ∧ (p-psw (lr-eval ('list, lr-set-pos (l, pos), c)) = 'run) ∧ (pos = dv (offset (p-pc (l)), 1))) → proper-p-statep (lr->p (lr-eval ('list, lr-set-pos (l, pos), c)))

Event: Disable proper-p-statep-lr->p-lr-eval-list-helper.

Theorem: not-listp-p-temp-stk-not-lr-check-result1 lr-check-result1 (value, temp-stk, data-seg) → (length (temp-stk) ≮ length (value))

Theorem: restn-add1-opener-alt restn (1 + n, list) = if listp (list) then restn (n, cdr (list))

else list endif

Theorem: cdr-p-temp-stk-p-run-subr let new-l be lr-eval ('list, lr-set-pos (l, pos), c) in (listp (lr-expr (l)) ∧ (car (lr-expr (l)) ≠ 'if) ∧ subrp (car (lr-expr (l))) ∧ (p-temp-stk (l)

= restn (length (cdr (lr-expr (l))), p-temp-stk (new-l))) ∧ lr-check-result1 (value,

p-temp-stk (new-l), p-data-segment (new-l))

∧ (length (value) = length (cdr (lr-expr (l)))) ∧ proper-p-statep (lr->p (l)) ∧ good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ (p-psw (p-run-subr (car (lr-expr (l)),

p-set-pc (lr->p (new-l), lr-return-pc (l))))

    = 'run)

∧ (p-psw (new-l) = 'run) ∧ (pos = dv (offset (p-pc (l)), 1))) → (cdr (p-temp-stk (p-run-subr (car (lr-expr (l)),

p-set-pc (lr->p (new-l),

lr-return-pc (l)))))

= p-temp-stk (l)) endlet

Event: Disable restn-add1-opener-alt.

Theorem: cdr-p-temp-stk-lr-apply-subr let new-l be lr-eval ('list, lr-set-pos (l, pos), c) in (listp (lr-expr (l)) ∧ (car (lr-expr (l)) ≠ 'if) ∧ subrp (car (lr-expr (l))) ∧ (p-temp-stk (l)

= restn (length (cdr (lr-expr (l))), p-temp-stk (new-l))) ∧ lr-check-result1 (value,

p-temp-stk (new-l), p-data-segment (new-l))

∧ (length (value) = length (cdr (lr-expr (l)))) ∧ proper-p-statep (lr->p (l)) ∧ good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ (p-psw (new-l) = 'run) ∧ (p-psw (lr-apply-subr (l, new-l)) = 'run) ∧ (pos = dv (offset (p-pc (l)), 1))) → (cdr (p-temp-stk (lr-apply-subr (l, new-l))) = p-temp-stk (l)) endlet

Theorem: lr-check-result1-reverse-length-1-opener (length (values) = 1) → (lr-check-result1 (reverse (values), temp-stk, data-seg)

= (lr-valp (car (values), car (temp-stk), data-seg) ∧ lr-good-pointerp (car (temp-stk), data-seg)))

Theorem: lr-check-result1-reverse-length-2-opener (length (values) = 2) → (lr-check-result1 (reverse (values), temp-stk, data-seg)

= (lr-valp (cadr (values), car (temp-stk), data-seg) ∧ lr-good-pointerp (cadr (temp-stk), data-seg) ∧ lr-valp (car (values), cadr (temp-stk), data-seg) ∧ lr-good-pointerp (car (temp-stk), data-seg)))

Theorem: lr-valp-fetch-tag-cons-lr-valp-car-cdr (lr-valp (value, addr, data-seg) ∧ (fetch (addr, data-seg) = tag ('nat, lr-cons-tag))) → (lr-valp (car (value),

fetch (add-addr (addr, identity (lr-car-offset)), data-seg), data-seg) ∧ lr-valp (cdr (value),

fetch (add-addr (addr, identity (lr-cdr-offset)), data-seg), data-seg))

Theorem: lr-good-pointerp-type-tag-nat (lr-proper-heapp (data-seg) ∧ lr-good-pointerp (addr, data-seg)) → (type (fetch (addr, data-seg)) = 'nat)

Theorem: lr-proper-heapp-lr-valp-f-helper (lr-proper-heapp-nodep (lr-f-addr, data-seg) ∧ lr-proper-heapp-nodep (addr, data-seg) ∧ lr-nodep (addr, data-seg) ∧ lr-minimum-heapp (data-seg) ∧ lr-proper-p-areasp (data-seg)) → (lr-valp (f, addr, data-seg) = (addr = lr-f-addr))

Theorem: lr-proper-heapp-lr-valp-f (lr-proper-heapp (data-seg) ∧ lr-proper-p-areasp (data-seg)) → (lr-valp (f, addr, data-seg) = (addr = lr-f-addr))

Theorem: lr-valp-equal-value-fact (lr-valp (value1 , addr, data-seg) ∧ lr-valp (value2 , addr, data-seg)) → (value1 = value2 )

Theorem: lr-proper-heapp-lr-valp-0 lr-proper-heapp (data-seg) → (lr-valp (value, identity (lr-0-addr), data-seg) = (value = 0))

Theorem: lr-proper-heapp-lr-valp-lr-f-addr (lr-proper-heapp (data-seg) ∧ lr-proper-p-areasp (data-seg)) → (lr-valp (value, identity (lr-f-addr), data-seg) = (value = f))

Theorem: lr-proper-heapp-lr-valp-lr-t-addr lr-proper-heapp (data-seg) → (lr-valp (value, identity (lr-t-addr), data-seg) = (value = t))

Theorem: lr-valp-fetch-tag-not-cons-lr-valp-car-cdr-0 (proper-p-statep (lr->p (l)) ∧ lr-proper-heapp (p-data-segment (l)) ∧ (fetch (car (p-temp-stk (l)), p-data-segment (l))

≠ tag ('nat, lr-cons-tag)) ∧ ((car (value) ≠ 0) ∨ (cdr (value) ≠ 0))) → (¬ lr-valp (value, car (p-temp-stk (l)), p-data-segment (l)))

Theorem: lr-valp-not-tag-cons-not-listp ((¬ listp (value)) ∧ (fetch (addr, data-seg) = tag ('nat, lr-cons-tag))) → (¬ lr-valp (value, addr, data-seg))

Theorem: lr-valp-fetch-tag-not-cons-lr-valp-listp (proper-p-statep (lr->p (l)) ∧ lr-proper-heapp (p-data-segment (l))

∧ (fetch (car (p-temp-stk (l)), p-data-segment (l))

≠ tag ('nat, lr-cons-tag)) ∧ listp (value)) → (¬ lr-valp (value, car (p-temp-stk (l)), p-data-segment (l)))

Theorem: lr-valp-cons lr-valp (cons (x, y), addr, data-seg) = if lr-good-pointerp (addr, data-seg)

then (untag (fetch (addr, data-seg)) = lr-cons-tag)

∧ lr-valp (x, fetch (add-addr (addr, lr-car-offset), data-seg), data-seg)

∧ lr-valp (y, fetch (add-addr (addr, lr-cdr-offset), data-seg), data-seg)

else f endif

Theorem: lr-valp-deposit-a-list-cons (lr-proper-free-listp (data-seg) ∧ lr-proper-p-areasp (data-seg) ∧ lr-nodep (lr-max-node (data-seg), data-seg) ∧ lr-minimum-heapp (data-seg) ∧ lr-boundary-nodep (lr-max-node (data-seg)) ∧ lr-valp (value, addr, data-seg) ∧ lr-proper-p-areasp (data-seg) ∧ (fp-addr = fetch (identity (lr-fp-addr), data-seg))) → lr-valp (value, addr, deposit-a-list (list (x0 , x1 , x2 , x3 ), fp-addr, data-seg))

Theorem: lr-valp-car-p-temp-stk-p-run-subr-cons-helper (lr-proper-heapp (data-seg) ∧ lr-valp (car, car-addr, data-seg) ∧ lr-valp (cdr, cdr-addr, data-seg) ∧ lr-proper-p-areasp (data-seg) ∧ (type (ref-count) = 'nat)) → lr-valp (cons (car, cdr),

fetch (identity (lr-fp-addr), data-seg),

deposit-a-list (list (identity (tag ('nat, lr-cons-tag)), ref-count, car-addr, cdr-addr),

fetch (identity (lr-fp-addr), data-seg), data-seg))

Event: Disable lr-valp-cons.

Theorem: lr-valp-not-tag-true-not-listp ((¬ truep (value)) ∧ (fetch (addr, data-seg) = tag ('nat, lr-true-tag))) → (¬ lr-valp (value, addr, data-seg))

Theorem: lr-valp-fetch-tag-not-true-lr-valp-listp (proper-p-statep (lr->p (l)) ∧ lr-proper-heapp (p-data-segment (l)) ∧ (fetch (car (p-temp-stk (l)), p-data-segment (l))

≠ tag ('nat, lr-true-tag))) → (¬ lr-valp (t, car (p-temp-stk (l)), p-data-segment (l)))

Theorem: lr-valp-car-p-temp-stk-p-run-subr (lr-proper-heapp (p-data-segment (l)) ∧ lr-check-result1 (reverse (values), p-temp-stk (l), p-data-segment (l)) ∧ (length (values) = arity (subr)) ∧ proper-p-statep (lr->p (l)) ∧ lr-programs-properp (l, table) ∧ (p-psw (p-run-subr (subr, p-set-pc (lr->p (l), pc))) = 'run) ∧ (p-psw (l) = 'run) ∧ (area-name (pc) = area-name (p-pc (l))) ∧ (unlabel (get (offset (pc),

program-body (assoc (area-name (pc),

p-prog-segment (lr->p (l))))))

= list ('call, subr))) → lr-valp (apply-subr (subr, values),

car (p-temp-stk (p-run-subr (subr, p-set-pc (lr->p (l), pc)))), p-data-segment (p-run-subr (subr, p-set-pc (lr->p (l), pc))))

Theorem: lr-programs-properp-not-definedp-subrp-runtime-support (subrp (car (s-expr (s))) ∧ listp (s-expr (s)) ∧ (car (s-expr (s)) ≠ 'if) ∧ (¬ definedp (car (s-expr (s)), p-runtime-support-programs)) ∧ good-posp1 (s-pos (s), s-body (s-prog (s)))) → (¬ lr-programs-properp (s->lr1 (s, l, table), table))

Theorem: lr-valp-apply-subr-lr-apply-subr let new-l be lr-eval ('list, lr-set-pos (s->lr1 (s, l, table), pos), c) in (listp (s-expr (s)) ∧ (car (s-expr (s)) ≠ 'if) ∧ (car (s-expr (s)) ≠ 'quote) ∧ (car (s-expr (s)) ≠ s-temp-eval) ∧ (car (s-expr (s)) ≠ s-temp-test) ∧ (car (s-expr (s)) ≠ s-temp-fetch)

∧ subrp (car (s-expr (s))) ∧ lr-proper-heapp (p-data-segment (new-l)) ∧ lr-check-result1 (reverse (values),

p-temp-stk (new-l), p-data-segment (new-l))

∧ (length (values) = length (cdr (lr-expr (s->lr1 (s, l, table))))) ∧ proper-p-statep (lr->p (s->lr1 (s, l, table))) ∧ good-posp1 (s-pos (s), s-body (s-prog (s))) ∧ lr-programs-properp (s->lr1 (s, l, table), table) ∧ s-good-statep (s, c) ∧ (p-psw (new-l) = 'run) ∧ (p-psw (lr-apply-subr (s->lr1 (s, l, table), new-l)) = 'run) ∧ (pos = dv (s-pos (s), 1))) → lr-valp (apply-subr (car (s-expr (s)), values),

car (p-temp-stk (lr-apply-subr (s->lr1 (s, l, table), new-l))), p-data-segment (lr-apply-subr (s->lr1 (s, l, table), new-l))) endlet

Event: Disable lr-programs-properp-not-definedp-subrp-runtime-support.

Theorem: lr-check-result-lr-apply-subr let new-l be lr-eval ('list,

lr-set-pos (s->lr1 (s, l, table), dv (s-pos (s), 1)), c),

pos be dv (s-pos (s), 1) in (listp (s-expr (s)) ∧ (car (s-expr (s)) ≠ 'if) ∧ (car (s-expr (s)) ≠ 'quote) ∧ (car (s-expr (s)) ≠ s-temp-eval) ∧ (car (s-expr (s)) ≠ s-temp-test) ∧ (car (s-expr (s)) ≠ s-temp-fetch) ∧ subrp (car (s-expr (s))) ∧ lr-check-result ('list,

s-ans (s-eval ('list, s-set-pos (s, pos), c)), p-temp-stk (new-l), p-data-segment (new-l), p-temp-stk (l))

∧ proper-p-statep (lr->p (s->lr1 (s, l, table))) ∧ lr-proper-heapp (p-data-segment (l)) ∧ good-posp1 (s-pos (s), s-body (s-prog (s))) ∧ lr-programs-properp (s->lr1 (s, l, table), table) ∧ s-good-statep (s, c) ∧ (p-psw (new-l) = 'run) ∧ (p-psw (lr-apply-subr (s->lr1 (s, l, table), new-l)) = 'run)

∧ (s-err-flag (s-eval ('list, s-set-pos (s, dv (s-pos (s), 1)), c))

    = 'run))

→ lr-check-result (t,

apply-subr (car (s-expr (s)),

s-ans (s-eval ('list, s-set-pos (s, pos), c))),

p-temp-stk (lr-apply-subr (s->lr1 (s, l, table),

new-l)),

p-data-segment (lr-apply-subr (s->lr1 (s, l, table),

new-l)),

p-temp-stk (l)) endlet

Theorem: s->lr1-lr-funcall-s-fun-call-state (listp (s-expr (s)) ∧ (¬ subrp (car (s-expr (s)))) ∧ (car (s-expr (s)) ≠ 'quote) ∧ (car (s-expr (s)) ≠ 'if) ∧ litatom (car (s-expr (s))) ∧ good-posp1 (s-pos (s), s-body (s-prog (s))) ∧ (p-psw (lr-funcall (s->lr1 (s, l, table), lr-eval)) = 'run) ∧ (s-progs (s-eval) = s-progs (s)) ∧ (p-prog-segment (lr-eval) = p-prog-segment (s->lr1 (s, l, table)))) → (s->lr1 (s-fun-call-state (s-eval, car (s-expr (s))),

lr-funcall (s->lr1 (s, l, table), lr-eval), table)

= lr-funcall (s->lr1 (s, l, table), lr-eval))

Theorem: lr-params-lr-funcall ((p-psw (lr-funcall (l1 , l2 )) = 'run) ∧ (p-prog-segment (l1 ) = p-prog-segment (l2 ))) → (lr-params (car (p-ctrl-stk (lr-funcall (l1 , l2 ))), lr-funcall (l1 , l2 ))

= pair-formal-vars-with-actuals (formal-vars (assoc (user-fname (car (lr-expr (l1 ))),

p-prog-segment (l1 ))),

p-temp-stk (l2 )))

Theorem: lr-temps-lr-funcall ((p-psw (lr-funcall (l1 , l2 )) = 'run) ∧ (p-prog-segment (l1 ) = p-prog-segment (l2 ))) → (lr-temps (car (p-ctrl-stk (lr-funcall (l1 , l2 ))), lr-funcall (l1 , l2 ))

= pair-temps-with-initial-values (temp-var-dcls (assoc (user-fname (car (lr-expr (l1 ))), p-prog-segment (l1 )))))

Theorem: listp-pairlist listp (pairlist (x, y)) = listp (x)

Theorem: car-reverse-last car (reverse (list)) = car (last (list))

Theorem: get-sub1-length-car-last (listp (list) ∧ (n = (length (list) − 1))) → (get (n, list) = car (last (list)))

Theorem: car-last-first-n-add1-get car (last (first-n (1 + n, list))) = get (n, list)

Theorem: length-butlast length (butlast (x)) = (length (x) − 1)

Definition: induct-hint-1 (x, y, z) = if listp (x)

then if listp (y)

then if listp (z) then induct-hint-1 (cdr (x), butlast (y), butlast (z)) else t endif

else t endif else t endif

Theorem: lr-check-result1-append-2 (length (values) = length (temp-stk1 )) → (lr-check-result1 (values, append (temp-stk1 , temp-stk2 ), data-seg)

= lr-check-result1 (values, temp-stk1 , data-seg))

Theorem: lr-check-result1-butlast (lr-check-result1 (values, temp-stk, data-seg) ∧ (length (temp-stk) = length (values)) ∧ listp (temp-stk) ∧ listp (values)) → lr-check-result1 (butlast (values), butlast (temp-stk), data-seg)

Theorem: reverse-butlast listp (x) → (reverse (butlast (x)) = cdr (reverse (x)))

Theorem: lr-s-similar-params-lr-valp-get ((n < length (s-params)) ∧ (strip-cars (s-params) = strip-cars (lr-params)) ∧ lr-s-similar-params (s-params, lr-params, data-seg)) → lr-valp (cdr (get (n, s-params)), cdr (get (n, lr-params)), data-seg)

Theorem: lr-s-similar-params-lr-funcall-helper-1 (lr-s-similar-params (pairlist (cdr (formals), cdr (reverse (values))),

pairlist (cdr (formals), cdr (reverse (temp-stk))), data-seg)

∧ listp (formals) ∧ listp (values) ∧ listp (temp-stk) ∧ lr-check-result1 (values, temp-stk, data-seg) ∧ ((1 + length (cdr (formals))) = length (temp-stk)) ∧ (length (temp-stk) = length (values))) → lr-valp (car (last (values)), car (last (temp-stk)), data-seg)

Theorem: lr-s-similar-params-lr-funcall (lr-check-result1 (values, temp-stk, data-seg) ∧ (length (temp-stk) = length (values)) ∧ (length (temp-stk) = length (formals))) → lr-s-similar-params (pairlist (formals, reverse (values)),

pairlist (formals, reverse (temp-stk)), data-seg)

Theorem: append-first-n-restn (length (l) ≮ i) → (append (first-n (i, l), restn (i, l)) = l)

Theorem: lr-check-result1-first-n-temp-stk (length (p-temp-stk (l)) ≮ length (values)) → (lr-check-result1 (values, p-temp-stk (l), data-seg)

= lr-check-result1 (values, first-n (length (values), p-temp-stk (l)), data-seg))

Theorem: lr-push-tstk-length (p-psw (lr-push-tstk (l, object)) = 'run) → (length (p-temp-stk (lr-push-tstk (l, object)))

= (1 + length (p-temp-stk (l))))

Theorem: length-add1-add1-cddr-fact (length (x) = (1 + (1 + length (y)))) → (length (cddr (x)) = length (y))

Theorem: length-p-temp-stk-p-run-subr-helper-1 (length (p-temp-stk (lr-eval ('list, lr-set-pos (l, pos), c))) = (1 + (1 + length (p-temp-stk (l))))) → (length (cddr (p-temp-stk (lr-eval ('list, lr-set-pos (l, pos), c))))

= length (p-temp-stk (l)))

Theorem: length-p-temp-stk-p-run-subr let new-l be lr-eval ('list, lr-set-pos (l, pos), c) in (listp (lr-expr (l)) ∧ (car (lr-expr (l)) ≠ 'if) ∧ subrp (car (lr-expr (l))) ∧ (length (p-temp-stk (new-l))

= (length (p-temp-stk (l)) + arity (car (lr-expr (l))))) ∧ proper-p-statep (lr->p (l)) ∧ good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ (p-psw (p-run-subr (car (lr-expr (l)),

p-set-pc (lr->p (new-l), lr-return-pc (l))))

    = 'run)

∧ (p-psw (new-l) = 'run) ∧ (pos = dv (offset (p-pc (l)), 1))) → (length (p-temp-stk (p-run-subr (car (lr-expr (l)),

p-set-pc (lr->p (new-l),

lr-return-pc (l)))))

= (1 + length (p-temp-stk (l)))) endlet

Theorem: length-p-temp-stk-lr-apply-subr let new-l be lr-eval ('list, lr-set-pos (l, pos), c) in (listp (lr-expr (l)) ∧ (car (lr-expr (l)) ≠ 'if) ∧ subrp (car (lr-expr (l))) ∧ (length (p-temp-stk (new-l))

= (length (p-temp-stk (l)) + arity (car (lr-expr (l))))) ∧ proper-p-statep (lr->p (l)) ∧ good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ (p-psw (new-l) = 'run) ∧ (p-psw (lr-apply-subr (l, new-l)) = 'run) ∧ (pos = dv (offset (p-pc (l)), 1))) → (length (p-temp-stk (lr-apply-subr (l, new-l)))

= (1 + length (p-temp-stk (l)))) endlet

Definition: lr-proper-formalsp (programs) = if listp (programs)

then ((logic-fname (name (car (programs))) = 'quote)

∨ (length (formal-vars (car (programs)))

= arity (logic-fname (name (car (programs)))))) ∧ lr-proper-formalsp (cdr (programs))

else t endif Theorem: length-formal-vars-lr-proper-formalsp-arity (definedp (name, programs) ∧ (logic-fname (name) ≠ 'quote) ∧ lr-proper-formalsp (programs)) → (length (formal-vars (assoc (name, programs)))

= arity (logic-fname (name)))

Theorem: arity-formals-not-quote (formals (name) ∧ (name ≠ 'quote)) → (arity (name) = length (formals (name)))

Theorem: lr-proper-formalsp-lr-compile-programs s-programs-okp (programs) → lr-proper-formalsp (lr-compile-programs (programs, table))

Event: Disable arity-formals-not-quote.

Event: Disable lr-proper-formalsp.

Theorem: lr-programs-properp-funcall-not-caar-prog-seg (listp (lr-expr (l)) ∧ (car (lr-expr (l)) ≠ 'if) ∧ (car (lr-expr (l)) ≠ 'quote) ∧ (¬ subrp (car (lr-expr (l)))) ∧ litatom (car (lr-expr (l))) ∧ listp (p-prog-segment (l)) ∧ (user-fname (car (lr-expr (l))) = caar (p-prog-segment (l))) ∧ good-posp1 (offset (p-pc (l)), program-body (p-current-program (l)))) → (¬ lr-programs-properp (l, table))

Theorem: length-p-temp-stk-lr-funcall (listp (lr-expr (l)) ∧ (car (lr-expr (l)) ≠ 'if) ∧ (car (lr-expr (l)) ≠ 'quote) ∧ (p-psw (new-l) = 'run) ∧ (¬ subrp (car (lr-expr (l)))) ∧ litatom (car (lr-expr (l))) ∧ (length (p-temp-stk (lr-eval (t, lr-funcall (l, new-l), c − 1)))

= (1 + length (p-temp-stk (lr-funcall (l, new-l))))) ∧ (length (p-temp-stk (new-l))

= (length (p-temp-stk (l)) + arity (car (lr-expr (l))))) ∧ good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ lr-proper-formalsp (cdr (p-prog-segment (l)))

∧ (p-psw (lr-funcall (l, new-l)) = 'run)) → (length (p-temp-stk (lr-funcall (l, new-l))) = length (p-temp-stk (l)))

Theorem: length-p-temp-stk-lr-eval (proper-p-statep (lr->p (l)) ∧ good-posp (flag, offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ lr-proper-formalsp (cdr (p-prog-segment (l))) ∧ (p-psw (lr-eval (flag, l, c)) = 'run)) → (length (p-temp-stk (lr-eval (flag, l, c)))

= if flag = 'list then length (lr-expr-list (l)) + length (p-temp-stk (l)) else 1 + length (p-temp-stk (l)) endif)

Theorem: length-p-temp-stk-lr-eval-flag-list (proper-p-statep (lr->p (s->lr1 (s, l, table))) ∧ good-posp ('list, pos, s-body (s-prog (s))) ∧ s-good-statep (s, c) ∧ lr-programs-properp (s->lr1 (s, l, table), table) ∧ (p-psw (lr-eval ('list, lr-set-pos (s->lr1 (s, l, table), pos), c))

    = 'run))

→ (length (p-temp-stk (lr-eval ('list, lr-set-pos (s->lr1 (s, l, table), pos), c)))

= (length (s-expr-list (s-set-pos (s, pos))) + length (p-temp-stk (l))))

Theorem: reverse-reverse-alt reverse (reverse (l)) = plist (l)

Theorem: pairlist-plist-1 pairlist (x, plist (y)) = pairlist (x, y)

Theorem: s-good-statep-length-cdr-s-expr-funcall (s-good-statep (s, c) ∧ good-posp1 (s-pos (s), s-body (s-prog (s))) ∧ listp (s-expr (s)) ∧ (car (s-expr (s)) ≠ 'quote) ∧ (car (s-expr (s)) ≠ 'if) ∧ (litatom (car (s-expr (s))) ∨ subrp (car (s-expr (s))))) → (length (cdr (s-expr (s))) = arity (car (s-expr (s))))

Theorem: lr-s-similar-temps-make-temps-pair-temps lr-s-similar-temps (make-temps-entries (temp-list),

pair-temps-with-initial-values (lr-make-temp-var-dcls (lr-make-temp-name-alist-1 (initial, num-list, temp-list, formals))),

data-seg)

Theorem: lr-s-similar-temps-lr-funcall lr-s-similar-temps (make-temps-entries (s-temp-list (assoc (name, progs))),

pair-temps-with-initial-values (temp-var-dcls (assoc (name,

lr-compile-programs (progs,

table)))),

data-seg)

Theorem: lr-eval-preserves-lr-s-similar-const-table (proper-p-statep (lr->p (l)) ∧ good-posp (flag, offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table1 ) ∧ (p-psw (lr-eval (flag, l, c)) = 'run) ∧ lr-proper-heapp (p-data-segment (l)) ∧ lr-s-similar-const-table (table2 , p-data-segment (l))) → lr-s-similar-const-table (table2 , p-data-segment (lr-eval (flag, l, c)))

Theorem: lr-s-similar-statesp-lr-funcall let pos be dv (s-pos (s), 1) in (listp (s-expr (s)) ∧ (¬ subrp (car (s-expr (s)))) ∧ (car (s-expr (s)) ≠ 'quote) ∧ (car (s-expr (s)) ≠ 'if) ∧ litatom (car (s-expr (s))) ∧ good-posp1 (s-pos (s), s-body (s-prog (s))) ∧ proper-p-statep (lr->p (s->lr1 (s, l, table))) ∧ lr-programs-properp (s->lr1 (s, l, table), table) ∧ s-good-statep (s, c) ∧ (p-psw (lr-funcall (s->lr1 (s, l, table), lr-eval)) = 'run) ∧ (p-psw (lr-eval) = 'run) ∧ lr-check-result ('list,

values,

p-temp-stk (lr-eval), p-data-segment (lr-eval), p-temp-stk (l))

∧ lr-proper-heapp (p-data-segment (l)) ∧ (s-err-flag (s-eval ('list, s-set-pos (s, pos), c)) = 'run) ∧ (formals = s-formals (assoc (user-fname (car (s-expr (s))),

s-progs (s))))

∧ (lr-eval = lr-eval ('list, lr-set-pos (s->lr1 (s, l, table), pos), c))

∧ (values = s-ans (s-eval ('list, s-set-pos (s, pos), c))) ∧ lr-s-similar-statesp (s-params (s),

s-temps (s),

s->lr1 (s, l, table), table))

→ lr-s-similar-statesp (pairlist (formals, values),

make-temps-entries (s-temp-list (assoc (user-fname (car (s-expr (s))),

s-progs (s)))),

lr-funcall (s->lr1 (s, l, table), lr-eval),

table) endlet

Theorem: lr-params-lr-set-expr-lr-pop-cstk ((area-name (p-pc (l)) = area-name (p-pc (new-l))) ∧ (p-prog-segment (l) = p-prog-segment (new-l))) → (lr-params (frame,

lr-set-expr (lr-pop-cstk (lr-eval (t, lr-funcall (l, new-l), c)), l, pos))

= lr-params (frame, l))

Theorem: lr-temps-lr-set-expr-lr-pop-cstk ((area-name (p-pc (l)) = area-name (p-pc (new-l))) ∧ (p-prog-segment (l) = p-prog-segment (new-l))) → (lr-temps (frame,

lr-set-expr (lr-pop-cstk (lr-eval (t, lr-funcall (l, new-l), c)), l, pos))

= lr-temps (frame, l))

Theorem: lr-eval-preserves-lr-s-similar-params (proper-p-statep (lr->p (l)) ∧ good-posp (flag, offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ (p-psw (lr-eval (flag, l, c)) = 'run) ∧ lr-proper-heapp (p-data-segment (l)) ∧ lr-s-similar-params (s-params, lr-params, p-data-segment (l))) → lr-s-similar-params (s-params,

lr-params,

p-data-segment (lr-eval (flag, l, c)))

Theorem: lr-eval-preserves-lr-s-similar-temps (proper-p-statep (lr->p (l)) ∧ good-posp (flag, offset (p-pc (l)), program-body (p-current-program (l)))

∧ lr-programs-properp (l, table) ∧ (p-psw (lr-eval (flag, l, c)) = 'run) ∧ lr-proper-heapp (p-data-segment (l)) ∧ lr-s-similar-temps (s-temps, lr-temps, p-data-segment (l))) → lr-s-similar-temps (s-temps, lr-temps, p-data-segment (lr-eval (flag, l, c)))

Theorem: lr-s-similar-statesp-lr-set-expr-lr-pop-cstk let funcall be lr-funcall (s->lr1 (s, l, table),

lr-eval ('list, lr-set-pos (s->lr1 (s, l, table), pos), c)),

lr-eval be lr-eval ('list, lr-set-pos (s->lr1 (s, l, table), pos), c) in (lr-s-similar-statesp (s-params (s), s-temps (s-eval), lr-eval, table) ∧ listp (s-expr (s)) ∧ (¬ subrp (car (s-expr (s)))) ∧ (car (s-expr (s)) ≠ 'quote) ∧ (car (s-expr (s)) ≠ 'if) ∧ litatom (car (s-expr (s))) ∧ proper-p-statep (lr->p (s->lr1 (s, l, table))) ∧ good-posp1 (s-pos (s), s-body (s-prog (s))) ∧ lr-programs-properp (s->lr1 (s, l, table), table) ∧ lr-proper-heapp (p-data-segment (lr-eval)) ∧ (pos = dv (s-pos (s), 1)) ∧ (p-psw (lr-eval (t, funcall, c − 1)) = 'run) ∧ (p-psw (lr-eval) = 'run)) → lr-s-similar-statesp (s-params (s),

s-temps (s-eval),

lr-set-expr (lr-pop-cstk (lr-eval (t, funcall, c − 1)),

s->lr1 (s, l, table), s-pos (s)),

table) endlet

Theorem: popn-restn (length (list) ≮ n) → (popn (n, list) = restn (n, list))

Theorem: lr-check-result-lr-funcall let new-l be lr-eval ('list,

lr-set-pos (s->lr1 (s, l, table), dv (s-pos (s), 1)), c),

pos be dv (s-pos (s), 1),

s-eval be s-eval ('list, s-set-pos (s, dv (s-pos (s), 1)), c) in (listp (s-expr (s)) ∧ (car (s-expr (s)) ≠ 'if) ∧ (car (s-expr (s)) ≠ 'quote) ∧ (¬ subrp (car (s-expr (s)))) ∧ litatom (car (s-expr (s))) ∧ lr-check-result ('list,

s-ans (s-eval),

p-temp-stk (new-l), p-data-segment (new-l), p-temp-stk (l))

∧ proper-p-statep (lr->p (s->lr1 (s, l, table))) ∧ good-posp1 (s-pos (s), s-body (s-prog (s))) ∧ lr-programs-properp (s->lr1 (s, l, table), table) ∧ s-good-statep (s, c) ∧ (p-psw (new-l) = 'run) ∧ (p-psw (lr-funcall (s->lr1 (s, l, table), new-l)) = 'run) ∧ (s-err-flag (s-eval) = 'run) ∧ lr-check-result (t,

s-ans (s-eval (t,

s-fun-call-state (s-eval,

car (s-expr (s))),

c − 1)),

p-temp-stk (lr-eval (t,

lr-funcall (s->lr1 (s, l, table),

new-l),

c − 1)),

p-data-segment (lr-eval (t,

lr-funcall (s->lr1 (s, l, table),

new-l),

c − 1)), p-temp-stk (lr-funcall (s->lr1 (s, l, table), new-l))))

→ lr-check-result (t,

s-ans (s-eval (t,

s-fun-call-state (s-eval,

car (s-expr (s))),

c − 1)),

p-temp-stk (lr-eval (t,

lr-funcall (s->lr1 (s, l, table), new-l),

c − 1)), p-data-segment (lr-eval (t,

lr-funcall (s->lr1 (s, l, table),

new-l),

c − 1)),

p-temp-stk (l)) endlet

Event: Disable popn-restn.

Theorem: lr-eval-s->lr1-flag-list-opener-1 (good-posp ('list, s-pos (s), s-body (s-prog (s))) ∧ listp (s-expr-list (s)) ∧ listp (s-pos (s)) ∧ (s-err-flag (s) = 'run)) → (lr-eval ('list, s->lr1 (s, l, table), c)

= lr-eval ('list,

lr-set-expr (lr-eval (t, s->lr1 (s, l, table), c), s->lr1 (s, l, table), nx (s-pos (s))),

c))

Theorem: lr-eval-s->lr1-flag-list-opener-2 (good-posp ('list, s-pos (s), s-body (s-prog (s))) ∧ (¬ listp (s-expr-list (s))) ∧ listp (s-pos (s)) ∧ (s-err-flag (s) = 'run)) → (lr-eval ('list, s->lr1 (s, l, table), c) = s->lr1 (s, l, table))

Theorem: lr-check-result-lr-proper-heapp lr-check-result (flag, value, temp-stk, data-seg, orig-temp-stk) → lr-proper-heapp (data-seg)

Theorem: lr-programs-properp-lr-set-error lr-programs-properp (lr-set-error (l, error), table) = lr-programs-properp (l, table)

Theorem: p-psw-lr-pop-tstk-lr-eval-flag-t (proper-p-statep (lr->p (l)) ∧ good-posp1 (pos, program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ (p-psw (lr-if-ok (lr-eval (t, lr-set-pos (l, pos), c))) = 'run)) → (p-psw (lr-pop-tstk (lr-if-ok (lr-eval (t, lr-set-pos (l, pos), c))))

     = 'run)

Theorem: lr-eval-leaves-listp-p-temp-stk-lr-set-pos (proper-p-statep (lr->p (l)) ∧ good-posp1 (pos, program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ (p-psw (lr-eval (t, lr-set-pos (l, pos), c)) = 'run)) → listp (p-temp-stk (lr-eval (t, lr-set-pos (l, pos), c)))

Theorem: p-psw-run-lr-if-ok-p-psw-run (p-psw (lr-if-ok (l)) = 'run) → (p-psw (l) = 'run)

Theorem: lr-s-similar-statesp-lr-if-ok lr-s-similar-statesp (s-params, s-temps, lr-if-ok (l), table) = lr-s-similar-statesp (s-params, s-temps, l, table)

Theorem: lr-eval-s-eval-equivalence (proper-p-statep (lr->p (s->lr1 (s, l, table))) ∧ lr-proper-heapp (p-data-segment (l)) ∧ good-posp (flag, s-pos (s), s-body (s-prog (s))) ∧ lr-programs-properp (s->lr1 (s, l, table), table) ∧ lr-s-similar-statesp (s-params (s), s-temps (s), s->lr1 (s, l, table), table) ∧ s-good-statep (s, c) ∧ (p-psw (lr-eval (flag, s->lr1 (s, l, table), c)) = 'run)) → (lr-s-similar-statesp (s-params (s),

s-temps (s-eval (flag, s, c)),

lr-eval (flag, s->lr1 (s, l, table), c), table) ∧ lr-check-result (if flag = 'list then 'list else t endif, s-ans (s-eval (flag, s, c)), p-temp-stk (lr-eval (flag, s->lr1 (s, l, table), c)), p-data-segment (lr-eval (flag,

s->lr1 (s, l, table), c)),

p-temp-stk (l))

∧ (s-err-flag (s-eval (flag, s, c)) = 'run))

Event: Disable p-psw-run-lr-if-ok-p-psw-run.

; ------------------------------------------------------------
; was lr-eval5.events
; ------------------------------------------------------------

;; The following define functions for each SUBR that tell how many

;; resources are used.  In the computations of the maximum control
;; stack size we break out the parts needed for formals and
;; temporaries and building a new control-stack frame.  For example in
;; CONS we have (plus 2 0 1 ...), the 2 is for building a new frame,
;; the 0 is for the formals (CONS leaves its args on the temp stack)
;; and 1 for temporaries.

Definition: s-apply-car-r (s) = list (1, 2 + 1 + 0 + 0, 0, 0)

Definition: s-apply-cdr-r (s) = list (1, 2 + 1 + 0 + 0, 0, 0)

;; CONS takes two implicit args

Definition: s-apply-cons-r (s) = list (2, 2 + 0 + 1 + 0, 0, 1)

Definition: s-apply-false-r (s) = list (1, 2 + 0 + 0 + 0, 0, 0)

;; FALSEP takes one implicit arg on stack.

Definition: s-apply-falsep-r (s) = list (1, 2 + 0 + 0 + 0, 0, 0)

;; LISTP takes an implicit arg

Definition: s-apply-listp-r (s) = list (1, 2 + 0 + 0 + 0, 0, 0)

;; NLISTP takes an implicit arg

Definition: s-apply-nlistp-r (s) = list (1, 2 + 0 + 0 + 0, 0, 0)

Definition: s-apply-true-r (s) = list (1, 2 + 0 + 0 + 0, 0, 0)

Definition: s-apply-truep-r (s) = list (1, 2 + 0 + 0 + 0, 0, 0)

Definition: s-apply-subr-r (subr, s) = case on subr:

case = car

then s-apply-car-r (s) case = cdr then s-apply-cdr-r (s) case = cons then s-apply-cons-r (s) case = false then s-apply-false-r (s) case = falsep then s-apply-falsep-r (s) case = listp then s-apply-listp-r (s) case = nlistp then s-apply-nlistp-r (s) case = true then s-apply-true-r (s) case = truep then s-apply-truep-r (s) otherwise list (0, 0, 0, 0) endcase

Definition: max-r (list1 , list2 ) = list (max (car (list1 ), car (list2 )),

max (cadr (list1 ), cadr (list2 )), max (caddr (list1 ), caddr (list2 )), cadddr (list1 ) + cadddr (list2 ))

Event: Disable max-r.

Definition: s-add-temp-r (list, n) = list (n + car (list), cadr (list), caddr (list), cadddr (list))

;; S-EVAL-R is somewhat similar to S-EVAL.  It returns a list of four
;; numbers representing.  the maximum temp stack size, maximum ctrl stack
;; size, maximum word size and number of free heap nodes respectively needed
;; to execute the compilation of the S-STATE s in Piton without getting an
;; error.

Definition: s-eval-r (flag, s, c) = if s-err-flag (s) ≠ 'run then list (0, 0, 0, 0)

elseif flag = 'list

then if s-pos (s) ≃ nil then list (0, 0, 0, 0) elseif listp (s-expr-list (s)) then max-r (s-eval-r (t, s, c), s-add-temp-r (s-eval-r ('list,

s-set-expr (s-eval (t, s, c), s, nx (s-pos (s))),

c), 1))

else list (0, 0, 0, 0) endif elseif c ≃ 0 then list (0, 0, 0, 0) elseif litatom (s-expr (s)) then list (1, 0, 0, 0) elseif s-expr (s) ≃ nil then list (0, 0, 0, 0) elseif car (s-expr (s)) = 'if then let test be s-eval (t, s-set-pos (s, dv (s-pos (s), 1)), c)

in

if s-err-flag (test) = 'run

then if s-ans (test)

then max-r (s-add-temp-r (s-eval-r (t,

s-set-pos (s,

dv (s-pos (s), 1)),

c), 1),

s-eval-r (t,

s-set-expr (test, s, dv (s-pos (s), 2)),

c))

else max-r (s-add-temp-r (s-eval-r (t,

s-set-pos (s,

dv (s-pos (s), 1)),

c), 1),

s-eval-r (t,

s-set-expr (test, s, dv (s-pos (s), 3)),

c)) endif else s-eval-r (t, s-set-pos (s, dv (s-pos (s), 1)), c) endif endlet

elseif car (s-expr (s)) = s-temp-eval then s-eval-r (t, s-set-pos (s, dv (s-pos (s), 1)), c) elseif car (s-expr (s)) = s-temp-test then if s-temp-setp (cadr (s-expr (s)), s-temps (s)) then list (2, 0, 0, 0)

else max-r (list (2, 0, 0, 0), s-eval-r (t, s-set-pos (s, dv (s-pos (s), 1)), c)) endif elseif car (s-expr (s)) = s-temp-fetch then list (1, 0, 0, 0) elseif car (s-expr (s)) = 'quote then list (1, 0, 0, 0) elseif s-err-flag (s-eval ('list, s-set-pos (s, dv (s-pos (s), 1)), c))

     ≠ 'run

then s-eval-r ('list, s-set-pos (s, dv (s-pos (s), 1)), c) elseif subrp (car (s-expr (s))) then max-r (s-eval-r ('list, s-set-pos (s, dv (s-pos (s), 1)), c),

s-add-temp-r (s-apply-subr-r (car (s-expr (s)),

s-eval ('list,

s-set-pos (s,

dv (s-pos (s), 1)),

c)),

arity (car (s-expr (s)))))

elseif litatom (car (s-expr (s))) then let arg-s be s-eval ('list, s-set-pos (s, dv (s-pos (s), 1)), c)

in

let fstate be s-fun-call-state (arg-s, car (s-expr (s))) in let arg-r be s-eval-r (t, fstate, c − 1) in max-r (s-eval-r ('list,

s-set-pos (s, dv (s-pos (s), 1)), c), list (car (arg-r),

               2

+ length (s-params (fstate)) + length (s-temps (fstate)) + cadr (arg-r), caddr (arg-r), cadddr (arg-r))) endlet endlet endlet

else list (0, 0, 0, 0) endif

Definition: s-eval-temp-r (flag, s, c) = car (s-eval-r (flag, s, c))

Definition: s-eval-ctrl-r (flag, s, c) = cadr (s-eval-r (flag, s, c))

Definition: s-eval-ws-r (flag, s, c) = caddr (s-eval-r (flag, s, c))

Definition: s-eval-heap-r (flag, s, c) = cadddr (s-eval-r (flag, s, c))

Definition: s-max-subr-reqs = max (log (2, lr-cons-tag), max (log (2, lr-true-tag),

max (log (2, lr-cdr-offset), log (2, lr-car-offset))))

Event: Disable s-max-subr-reqs.

Theorem: numberp-car-cadr-caddr-cadddr-s-apply-subr-r (car (s-apply-subr-r (subr, s)) ∈ N) ∧ (cadr (s-apply-subr-r (subr, s)) ∈ N) ∧ (caddr (s-apply-subr-r (subr, s)) ∈ N) ∧ (cadddr (s-apply-subr-r (subr, s)) ∈ N)

Event: Disable s-apply-subr-r.

Theorem: numberp-max-r (car (max-r (list1 , list2 )) ∈ N) ∧ (cadr (max-r (list1 , list2 )) ∈ N) ∧ (caddr (max-r (list1 , list2 )) ∈ N) ∧ (cadddr (max-r (list1 , list2 )) ∈ N)

Theorem: numberp-s-eval-temp-ctrl-ws-heap-r (s-eval-temp-r (flag, s, c) ∈ N) ∧ (s-eval-ctrl-r (flag, s, c) ∈ N) ∧ (s-eval-ws-r (flag, s, c) ∈ N) ∧ (s-eval-heap-r (flag, s, c) ∈ N)

Event: Disable s-eval-temp-r.

Event: Disable s-eval-ctrl-r.

Event: Disable s-eval-ws-r.

Event: Disable s-eval-heap-r.

Definition: lr-count-free-nodes (addr, node-list, data-seg) = if addr ∈ node-list

then 1 + lr-count-free-nodes (fetch (add-addr (addr, lr-ref-count-offset), data-seg), delete (addr, node-list), data-seg)

else 0 endif Definition: lr-check-resourcesp (flag, s, l, c) = ((p-max-temp-stk-size (l)

≮ (length (p-temp-stk (l)) + s-eval-temp-r (flag, s, c)))

∧ (p-max-ctrl-stk-size (l)

≮ (p-ctrl-stk-size (p-ctrl-stk (l))

+ s-eval-ctrl-r (flag, s, c))) ∧ (p-word-size (l) ≮ s-eval-ws-r (flag, s, c)) ∧ (lr-count-free-nodes (fetch (lr-fp-addr, p-data-segment (l)),

lr-free-list-nodes (lr-max-node (p-data-segment (l)), p-data-segment (l)),

p-data-segment (l))

≮ s-eval-heap-r (flag, s, c)))

Event: Disable lr-check-resourcesp.

Theorem: not-lessp-max-r-car (car (max-r (list1 , list2 )) ≮ car (list1 )) ∧ (car (max-r (list1 , list2 )) ≮ car (list2 ))

Theorem: not-lessp-max-r-cadr (cadr (max-r (list1 , list2 )) ≮ cadr (list1 )) ∧ (cadr (max-r (list1 , list2 )) ≮ cadr (list2 ))

Theorem: not-lessp-max-r-caddr (caddr (max-r (list1 , list2 )) ≮ caddr (list1 )) ∧ (caddr (max-r (list1 , list2 )) ≮ caddr (list2 ))

Theorem: not-lessp-max-r-cadddr (cadddr (max-r (list1 , list2 )) ≮ cadddr (list1 )) ∧ (cadddr (max-r (list1 , list2 )) ≮ cadddr (list2 ))

Theorem: lr-check-resourcesp-listp-s-expr-list ((s-err-flag (s) = 'run) ∧ listp (s-pos (s)) ∧ listp (s-expr-list (s)) ∧ good-posp ('list, s-pos (s), s-body (s-prog (s))) ∧ lr-check-resourcesp ('list, s, l, c)) → lr-check-resourcesp (t, s, l, c)

Theorem: lr-eval-preserves-lr-proper-heapp (proper-p-statep (lr->p (s->lr1 (s, l, table))) ∧ lr-proper-heapp (p-data-segment (l)) ∧ good-posp (flag, s-pos (s), s-body (s-prog (s))) ∧ lr-programs-properp (s->lr1 (s, l, table), table)

∧ lr-s-similar-statesp (s-params (s), s-temps (s), s->lr1 (s, l, table), table) ∧ s-good-statep (s, c) ∧ (p-psw (lr-eval (flag, s->lr1 (s, l, table), c)) = 'run)) → lr-proper-heapp (p-data-segment (lr-eval (flag, s->lr1 (s, l, table), c)))

Theorem: lr-eval-preserves-lr-s-similar-statesp (proper-p-statep (lr->p (s->lr1 (s, l, table))) ∧ lr-proper-heapp (p-data-segment (l)) ∧ good-posp (flag, s-pos (s), s-body (s-prog (s))) ∧ lr-programs-properp (s->lr1 (s, l, table), table) ∧ lr-s-similar-statesp (s-params (s), s-temps (s), s->lr1 (s, l, table), table) ∧ s-good-statep (s, c) ∧ (p-psw (lr-eval (flag, s->lr1 (s, l, table), c)) = 'run)) → lr-s-similar-statesp (s-params (s),

s-temps (s-eval (flag, s, c)),

lr-eval (flag, s->lr1 (s, l, table), c), table)

Theorem: s-eval-flag-run-flag-t-subsetp-s-collect-all-temps (s-good-statep (s, c) ∧ good-posp1 (s-pos (s), s-body (s-prog (s))) ∧ s-all-temps-setp (flag, s-expr (s), temp-alist-to-set (s-temps (s))) ∧ s-all-progs-temps-setp (s-progs (s)) ∧ (s-err-flag (s-eval (flag, s, c)) = 'run) ∧ s-check-temps-setp (s-temps (s)) ∧ (flag ≠ 'list)) → subsetp (s-collect-all-temps (flag, s-expr (s)),

temp-alist-to-set (s-temps (s-eval (flag, s, c))))

Theorem: s-eval-flag-run-flag-t-s-check-temps-setp (s-good-statep (s, c) ∧ good-posp1 (s-pos (s), s-body (s-prog (s))) ∧ s-all-temps-setp (flag, s-expr (s), temp-alist-to-set (s-temps (s))) ∧ s-all-progs-temps-setp (s-progs (s)) ∧ (s-err-flag (s-eval (flag, s, c)) = 'run) ∧ s-check-temps-setp (s-temps (s)) ∧ (flag ≠ 'list)) → s-check-temps-setp (s-temps (s-eval (flag, s, c)))

Theorem: lr-eval-preserves-length-bindings-car-p-ctrl-stk (proper-p-statep (lr->p (l)) ∧ good-posp (flag, offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ (p-psw (lr-eval (flag, l, c)) = 'run)) → (length (bindings (car (p-ctrl-stk (lr-eval (flag, l, c)))))

= length (bindings (car (p-ctrl-stk (l)))))

Theorem: lr-eval-s->lr1-preserves-p-ctrl-stk-size (proper-p-statep (lr->p (l)) ∧ good-posp (flag, offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ (p-psw (lr-eval (flag, l, c)) = 'run)) → (p-ctrl-stk-size (p-ctrl-stk (lr-eval (flag, l, c)))

= p-ctrl-stk-size (p-ctrl-stk (l)))

Theorem: length-p-temp-stk-lr-eval-flag-not-list (proper-p-statep (lr->p (s->lr1 (s, l, table))) ∧ good-posp (flag, s-pos (s), s-body (s-prog (s))) ∧ s-good-statep (s, c) ∧ lr-programs-properp (s->lr1 (s, l, table), table) ∧ (p-psw (lr-eval (flag, s->lr1 (s, l, table), c)) = 'run) ∧ (flag ≠ 'list)) → (length (p-temp-stk (lr-eval (flag, s->lr1 (s, l, table), c)))

= (1 + length (p-temp-stk (l))))

Theorem: lr-eval-preserves-lr-proper-heapp-lr-set-pos (proper-p-statep (lr->p (s->lr1 (s, l, table))) ∧ lr-proper-heapp (p-data-segment (l)) ∧ good-posp (flag, pos, s-body (s-prog (s))) ∧ lr-programs-properp (s->lr1 (s, l, table), table) ∧ lr-s-similar-statesp (s-params (s), s-temps (s), s->lr1 (s, l, table), table) ∧ s-good-statep (s, c) ∧ (p-psw (lr-eval (flag, lr-set-pos (s->lr1 (s, l, table), pos), c)) = 'run)) → lr-proper-heapp (p-data-segment (lr-eval (flag,

lr-set-pos (s->lr1 (s, l, table), pos),

c)))

Theorem: lr-eval-preserves-lr-s-similar-statesp-lr-set-pos (proper-p-statep (lr->p (s->lr1 (s, l, table))) ∧ lr-proper-heapp (p-data-segment (l)) ∧ good-posp (flag, pos, s-body (s-prog (s))) ∧ lr-programs-properp (s->lr1 (s, l, table), table) ∧ lr-s-similar-statesp (s-params (s), s-temps (s), s->lr1 (s, l, table), table) ∧ s-good-statep (s, c) ∧ (p-psw (lr-eval (flag, lr-set-pos (s->lr1 (s, l, table), pos), c)) = 'run)) → lr-s-similar-statesp (s-params (s),

s-temps (s-eval (flag, s-set-pos (s, pos), c)),

lr-eval (flag, lr-set-pos (s->lr1 (s, l, table), pos), c), table)

Theorem: lr-eval-s-eval-flag-t-s-ans-f-lr-set-pos (proper-p-statep (lr->p (s->lr1 (s, l, table))) ∧ lr-proper-heapp (p-data-segment (l)) ∧ good-posp1 (pos, s-body (s-prog (s))) ∧ lr-programs-properp (s->lr1 (s, l, table), table) ∧ lr-s-similar-statesp (s-params (s), s-temps (s), s->lr1 (s, l, table), table) ∧ s-good-statep (s, c) ∧ (p-psw (lr-eval (t, lr-set-pos (s->lr1 (s, l, table), pos), c)) = 'run) ∧ (¬ s-ans (s-eval (t, s-set-pos (s, pos), c)))) → (car (p-temp-stk (lr-eval (t, lr-set-pos (s->lr1 (s, l, table), pos), c)))

= lr-f-addr)

Theorem: lr-eval-s-eval-flag-t-s-ans-non-f-lr-set-pos (proper-p-statep (lr->p (s->lr1 (s, l, table))) ∧ lr-proper-heapp (p-data-segment (l)) ∧ good-posp1 (pos, s-body (s-prog (s))) ∧ lr-programs-properp (s->lr1 (s, l, table), table) ∧ lr-s-similar-statesp (s-params (s), s-temps (s), s->lr1 (s, l, table), table) ∧ s-good-statep (s, c) ∧ (p-psw (lr-eval (t, lr-set-pos (s->lr1 (s, l, table), pos), c)) = 'run) ∧ s-ans (s-eval (t, s-set-pos (s, pos), c))) → (car (p-temp-stk (lr-eval (t, lr-set-pos (s->lr1 (s, l, table), pos), c)))

≠ identity (lr-f-addr))

Theorem: subsetp-not-member-both ((addr ∉ set2 ) ∧ subsetp (set1 , set2 )) → (addr ∉ set1 )

Theorem: lr-count-free-nodes-deposit-free-ptr (adpp ('(free-ptr . 0), data-seg) ∧ lr-node-listp (node-list, data-seg)) → (lr-count-free-nodes (addr,

node-list,

deposit (anything, identity (lr-fp-addr), data-seg))

= lr-count-free-nodes (addr, node-list, data-seg))

Theorem: lr-count-free-nodes-deposit-non-ref-count (lr-nodep (addr2 , data-seg) ∧ (offset ≠ lr-ref-count-offset) ∧ (offset ∈ N) ∧ (offset < lr-node-size) ∧ lr-node-listp (node-list, data-seg)) → (lr-count-free-nodes (addr1 ,

node-list,

deposit (anything, add-addr (addr2 , offset), data-seg))

= lr-count-free-nodes (addr1 , node-list, data-seg))

Theorem: lr-count-free-nodes-deposit-lr-nodep (lr-nodep (addr2 , data-seg) ∧ lr-node-listp (node-list, data-seg)) → (lr-count-free-nodes (addr1 , node-list, deposit (anything, addr2 , data-seg))

= lr-count-free-nodes (addr1 , node-list, data-seg))

Theorem: lr-count-free-nodes-delete-deposit ((addr1 ∉ node-list) ∧ lr-nodep (addr1 , data-seg) ∧ lr-node-listp (node-list, data-seg) ∧ (type (ref-count) = 'nat) ∧ (untag (ref-count) ∈ N)) → (lr-count-free-nodes (addr2 ,

node-list,

deposit (ref-count,

add-addr (addr1 ,

identity (lr-ref-count-offset)),

data-seg))

= lr-count-free-nodes (addr2 , node-list, data-seg))

Theorem: lr-count-free-nodes-max-addr-lr-free-list-nodes lr-count-free-nodes (max-addr,

lr-free-list-nodes (max-addr, data-seg1 ), data-seg2 )

= 0

Theorem: lr-count-lr-free-list-nodes-p-run-cons let dds be deposit-a-list (list (identity (tag ('nat, 5)),

ref-count, any1 , any2 ),

fetch (identity (lr-fp-addr), data-seg), data-seg)

in (lr-proper-heapp (data-seg) ∧ (max-addr = lr-max-node (data-seg)) ∧ (type (ref-count) = 'nat) ∧ (untag (ref-count) ∈ N) ∧ (fetch (identity (lr-fp-addr), data-seg) ≠ max-addr)) → ((1 + lr-count-free-nodes (fetch (add-addr (fetch (identity (lr-fp-addr),

data-seg), identity (lr-ref-count-offset)),

data-seg), lr-free-list-nodes (max-addr, dds), dds)) = lr-count-free-nodes (fetch (identity (lr-fp-addr),

data-seg), lr-free-list-nodes (max-addr,

data-seg),

data-seg)) endlet

Theorem: not-p-max-node-fetch-fp-addr-not-errorp-p-run-cons ((p-psw (p (p-set-pc (lr->p (new-l), pc), p-cons-clock (p-set-pc (lr->p (new-l), pc))))

 = 'run)

∧ proper-p-statep (lr->p (new-l)) ∧ proper-p-statep (p-set-pc (lr->p (new-l), pc)) ∧ (max-node = lr-max-node (p-data-segment (new-l))) ∧ (p-psw (new-l) = 'run) ∧ lr-programs-properp (new-l, table) ∧ lr-proper-heapp (p-data-segment (new-l)) ∧ (unlabel (get (offset (pc),

program-body (assoc (area-name (pc),

p-prog-segment (lr->p (new-l))))))

    = '(call cons)))

→ (fetch (identity (lr-fp-addr), p-data-segment (new-l)) ≠ max-node)

Theorem: get-comp-body-lr-compile-programs (good-posp1 (s-pos (s), s-body (s-prog (s))) ∧ lr-programs-properp (s->lr1 (s, l, table), table) ∧ (car (s-expr (s)) ≠ 'if) ∧ (car (s-expr (s)) ≠ s-temp-eval) ∧ (car (s-expr (s)) ≠ s-temp-test) ∧ (car (s-expr (s)) ≠ s-temp-fetch) ∧ (car (s-expr (s)) ≠ 'quote) ∧ listp (s-expr (s))) → (get (offset (lr-return-pc (s->lr1 (s, l, table))),

program-body (assoc (s-pname (s),

comp-programs (lr-compile-programs (s-progs (s),

table)))))

= list ('dl, lr-make-label (offset (lr-return-pc (s->lr1 (s, l, table)))), nil, if definedp (car (s-expr (s)), p-runtime-support-programs) then list ('call, car (s-expr (s))) else list ('call, user-fname (car (s-expr (s)))) endif))

Theorem: lr-count-lr-free-list-nodes-p-run-subr let p be p-set-pc (lr->p (lr-eval ('list,

lr-set-pos (s->lr1 (s, l, table), pos), c)), lr-return-pc (s->lr1 (s, l, table))),

new-l be lr-eval ('list, lr-set-pos (s->lr1 (s, l, table), pos), c) in (listp (s-expr (s)) ∧ (car (s-expr (s)) ≠ 'if) ∧ subrp (car (s-expr (s))) ∧ proper-p-statep (lr->p (s->lr1 (s, l, table))) ∧ good-posp1 (s-pos (s), s-body (s-prog (s))) ∧ lr-programs-properp (s->lr1 (s, l, table), table) ∧ s-good-statep (s, c) ∧ (p-psw (p-run-subr (car (s-expr (s)), p)) = 'run) ∧ (p-psw (new-l) = 'run) ∧ (pos = dv (s-pos (s), 1)) ∧ lr-proper-heapp (p-data-segment (l)) ∧ lr-s-similar-statesp (s-params (s),

s-temps (s),

s->lr1 (s, l, table), table))

→ (lr-count-free-nodes (fetch (identity (lr-fp-addr),

p-data-segment (new-l)), lr-free-list-nodes (lr-max-node (p-data-segment (l)),

p-data-segment (new-l)),

p-data-segment (new-l))

= (lr-count-free-nodes (fetch (identity (lr-fp-addr),

p-data-segment (p-run-subr (car (s-expr (s)),

p))),

lr-free-list-nodes (lr-max-node (p-data-segment (l)),

p-data-segment (p-run-subr (car (s-expr (s)),

p))),

p-data-segment (p-run-subr (car (s-expr (s)),

p)))

+ cadddr (s-apply-subr-r (car (s-expr (s)),

s-eval ('list, s-set-pos (s, pos), c))))) endlet

Theorem: lr-count-lr-free-list-nodes-lr-apply-subr let new-l be lr-eval ('list, lr-set-pos (s->lr1 (s, l, table), pos), c) in (listp (s-expr (s)) ∧ (car (s-expr (s)) ≠ 'if) ∧ subrp (car (s-expr (s))) ∧ proper-p-statep (lr->p (s->lr1 (s, l, table))) ∧ good-posp1 (s-pos (s), s-body (s-prog (s))) ∧ lr-programs-properp (s->lr1 (s, l, table), table) ∧ (p-psw (new-l) = 'run)

∧ (p-psw (lr-apply-subr (s->lr1 (s, l, table), new-l)) = 'run) ∧ s-good-statep (s, c) ∧ lr-proper-heapp (p-data-segment (l)) ∧ lr-s-similar-statesp (s-params (s),

s-temps (s),

s->lr1 (s, l, table), table)

∧ (pos = dv (s-pos (s), 1)) ∧ (max-addr = lr-max-node (p-data-segment (l))) ∧ (s-eval-size = s-eval-heap-r ('list, s-set-pos (s, pos), c)) ∧ ((lr-count-free-nodes (fetch (lr-fp-addr, p-data-segment (new-l)),

lr-free-list-nodes (max-addr,

p-data-segment (new-l)),

p-data-segment (new-l))

+ s-eval-size)

= lr-count-free-nodes (fetch (lr-fp-addr,

p-data-segment (l)), lr-free-list-nodes (max-addr,

p-data-segment (l)),

p-data-segment (l))))

→ ((s-eval-size

+ cadddr (s-apply-subr-r (car (s-expr (s)),

s-eval ('list, s-set-pos (s, pos), c)))

+ lr-count-free-nodes (fetch (identity (lr-fp-addr),

p-data-segment (lr-apply-subr (s->lr1 (s, l, table),

new-l))),

lr-free-list-nodes (max-addr,

p-data-segment (lr-apply-subr (s->lr1 (s, l, table),

new-l))),

p-data-segment (lr-apply-subr (s->lr1 (s, l, table),

new-l))))

= lr-count-free-nodes (fetch (identity (lr-fp-addr),

p-data-segment (l)), lr-free-list-nodes (max-addr,

p-data-segment (l)),

p-data-segment (l))) endlet Theorem: lr-eval-s-eval-equivalence-lr-check-result-flag-list let lr-eval be lr-eval ('list,

lr-set-pos (s->lr1 (s, l, table), dv (s-pos (s), 1)), c)

in (proper-p-statep (lr->p (s->lr1 (s, l, table))) ∧ lr-proper-heapp (p-data-segment (l)) ∧ good-posp1 (s-pos (s), s-body (s-prog (s))) ∧ lr-programs-properp (s->lr1 (s, l, table), table) ∧ lr-s-similar-statesp (s-params (s),

s-temps (s),

s->lr1 (s, l, table), table)

∧ s-good-statep (s, c) ∧ (p-psw (lr-eval) = 'run) ∧ listp (s-expr (s)) ∧ (car (s-expr (s)) ≠ 'if) ∧ (car (s-expr (s)) ≠ s-temp-eval) ∧ (car (s-expr (s)) ≠ s-temp-test) ∧ (car (s-expr (s)) ≠ s-temp-fetch) ∧ (car (s-expr (s)) ≠ 'quote)) → lr-check-result ('list,

s-ans (s-eval ('list, s-set-pos (s, dv (s-pos (s), 1)), c)),

p-temp-stk (lr-eval), p-data-segment (lr-eval), p-temp-stk (l)) endlet

Theorem: cadddr-max-r cadddr (max-r (list1 , list2 )) = (cadddr (list1 ) + cadddr (list2 ))

Theorem: lr-eval-s-eval-heap-r-lr-count-lr-free-list-nodes (proper-p-statep (lr->p (s->lr1 (s, l, table))) ∧ lr-proper-heapp (p-data-segment (l)) ∧ good-posp (flag, s-pos (s), s-body (s-prog (s))) ∧ lr-programs-properp (s->lr1 (s, l, table), table) ∧ lr-s-similar-statesp (s-params (s), s-temps (s), s->lr1 (s, l, table), table) ∧ s-good-statep (s, c) ∧ (p-psw (lr-eval (flag, s->lr1 (s, l, table), c)) = 'run) ∧ (s-err-flag (s-eval (flag, s, c)) = 'run)) → ((lr-count-free-nodes (fetch (lr-fp-addr,

p-data-segment (lr-eval (flag, s->lr1 (s, l, table),

c))),

lr-free-list-nodes (lr-max-node (p-data-segment (l)),

p-data-segment (lr-eval (flag,

s->lr1 (s, l, table),

c))),

p-data-segment (lr-eval (flag, s->lr1 (s, l, table), c)))

+ s-eval-heap-r (flag, s, c))

= lr-count-free-nodes (fetch (lr-fp-addr, p-data-segment (l)),

lr-free-list-nodes (lr-max-node (p-data-segment (l)), p-data-segment (l)),

p-data-segment (l)))

Theorem: lr-check-resourcesp-list-set-expr-nx (listp (s-pos (s)) ∧ listp (s-expr-list (s)) ∧ good-posp ('list, s-pos (s), s-body (s-prog (s))) ∧ proper-p-statep (lr->p (s->lr1 (s, l, table))) ∧ lr-proper-heapp (p-data-segment (l)) ∧ lr-programs-properp (s->lr1 (s, l, table), table) ∧ lr-s-similar-statesp (s-params (s), s-temps (s), s->lr1 (s, l, table), table) ∧ s-good-statep (s, c) ∧ (p-psw (lr-eval (t, s->lr1 (s, l, table), c)) = 'run) ∧ (s-err-flag (s-eval (t, s, c)) = 'run) ∧ lr-check-resourcesp ('list, s, l, c)) → lr-check-resourcesp ('list,

s-set-expr (s-eval (t, s, c), s, nx (s-pos (s))), lr-eval (t, s->lr1 (s, l, table), c), c)

Theorem: lr-check-resourcesp-lr-push-tstk-flag-run (lr-check-resourcesp (flag, s, l, c) ∧ (flag ≠ 'list) ∧ litatom (s-expr (s)) ∧ (c ≄ 0) ∧ (s-err-flag (s) = 'run)) → (p-psw (lr-push-tstk (s->lr1 (s, l, table),

cdr (assoc (s-expr (s), bindings (car (p-ctrl-stk (l)))))))

    = 'run)

Theorem: lr-check-resourcesp-s-set-pos-if-cadr (lr-check-resourcesp (flag, s, l, c) ∧ s-good-statep (s, c) ∧ (flag ≠ 'list)

∧ (c ≄ 0) ∧ listp (s-expr (s)) ∧ (car (s-expr (s)) = 'if)) → lr-check-resourcesp (t, s-set-pos (s, dv (s-pos (s), 1)), l, c)

Theorem: s-eval-subsetp-s-collect-temp-alist-s-set-pos-if (listp (s-expr (s)) ∧ (car (s-expr (s)) = 'if) ∧ s-good-statep (s, c) ∧ good-posp1 (dv (s-pos (s), 1), s-body (s-prog (s))) ∧ s-check-temps-setp (s-temps (s)) ∧ s-all-temps-setp (t, cadr (s-expr (s)), temp-alist-to-set (s-temps (s))) ∧ s-all-progs-temps-setp (s-progs (s)) ∧ (s-err-flag (s-eval (t, s-set-pos (s, dv (s-pos (s), 1)), c)) = 'run)) → subsetp (s-collect-all-temps (t, cadr (s-expr (s))),

temp-alist-to-set (s-temps (s-eval (t, s-set-pos (s, dv (s-pos (s), 1)), c))))

Theorem: length-p-temp-stk-lr-pop-tstk-lr-eval-flag-t (proper-p-statep (lr->p (s->lr1 (s, l, table))) ∧ good-posp1 (pos, s-body (s-prog (s))) ∧ lr-programs-properp (s->lr1 (s, l, table), table) ∧ s-good-statep (s, c) ∧ (p-psw (lr-if-ok (lr-eval (t, lr-set-pos (s->lr1 (s, l, table), pos), c)))

    = 'run))

→ (length (p-temp-stk (lr-pop-tstk (lr-if-ok (lr-eval (t,

lr-set-pos (s->lr1 (s, l, table),

pos),

c)))))

= length (p-temp-stk (l)))

Theorem: lr-eval-s->lr1-preserves-p-ctrl-stk-size-lr-set-pos (proper-p-statep (lr->p (l)) ∧ good-posp (flag, pos, program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ (p-psw (lr-eval (flag, lr-set-pos (l, pos), c)) = 'run)) → (p-ctrl-stk-size (p-ctrl-stk (lr-eval (flag, lr-set-pos (l, pos), c)))

= p-ctrl-stk-size (p-ctrl-stk (l)))

Theorem: lr-check-resourcesp-lr-pop-tstk-lr-eval-1 let lr-eval be lr-if-ok (lr-eval (t, lr-set-pos (s->lr1 (s, l, table), pos), c)) in ((c ≄ 0) ∧ listp (s-expr (s)) ∧ (car (s-expr (s)) = 'if) ∧ proper-p-statep (lr->p (s->lr1 (s, l, table))) ∧ good-posp1 (s-pos (s), s-body (s-prog (s))) ∧ lr-proper-heapp (p-data-segment (l)) ∧ lr-programs-properp (s->lr1 (s, l, table), table) ∧ lr-s-similar-statesp (s-params (s),

s-temps (s),

s->lr1 (s, l, table), table)

∧ s-good-statep (s, c) ∧ (p-psw (lr-eval) = 'run) ∧ (pos = dv (s-pos (s), 1)) ∧ (s-err-flag (s-eval (t, s-set-pos (s, pos), c)) = 'run) ∧ s-ans (s-eval (t, s-set-pos (s, dv (s-pos (s), 1)), c)) ∧ lr-check-resourcesp (flag, s, l, c) ∧ (flag ≠ 'list)) → lr-check-resourcesp (t,

s-set-expr (s-eval (t, s-set-pos (s, pos), c), s, dv (s-pos (s), 2)),

lr-pop-tstk (lr-eval),

c) endlet

Theorem: lr-check-resourcesp-lr-pop-tstk-lr-eval-2 let lr-eval be lr-if-ok (lr-eval (t, lr-set-pos (s->lr1 (s, l, table), pos), c)) in ((c ≄ 0) ∧ listp (s-expr (s)) ∧ (car (s-expr (s)) = 'if) ∧ proper-p-statep (lr->p (s->lr1 (s, l, table))) ∧ good-posp1 (s-pos (s), s-body (s-prog (s))) ∧ lr-proper-heapp (p-data-segment (l)) ∧ lr-programs-properp (s->lr1 (s, l, table), table) ∧ lr-s-similar-statesp (s-params (s),

s-temps (s),

s->lr1 (s, l, table), table)

∧ s-good-statep (s, c) ∧ (p-psw (lr-eval) = 'run) ∧ (pos = dv (s-pos (s), 1)) ∧ (s-err-flag (s-eval (t, s-set-pos (s, pos), c)) = 'run) ∧ (¬ s-ans (s-eval (t, s-set-pos (s, dv (s-pos (s), 1)), c)))

∧ lr-check-resourcesp (flag, s, l, c) ∧ (flag ≠ 'list)) → lr-check-resourcesp (t,

s-set-expr (s-eval (t, s-set-pos (s, pos), c), s, dv (s-pos (s), 3)),

lr-pop-tstk (lr-eval),

c) endlet

Theorem: lr-check-resourcesp-s-temp-eval ((c ≄ 0) ∧ listp (s-expr (s)) ∧ (car (s-expr (s)) = s-temp-eval) ∧ good-posp1 (s-pos (s), s-body (s-prog (s))) ∧ (pos = dv (s-pos (s), 1)) ∧ lr-check-resourcesp (flag, s, l, c) ∧ (flag ≠ 'list)) → lr-check-resourcesp (t, s-set-pos (s, pos), l, c)

Theorem: lr-check-resourcesp-s-temp-test ((c ≄ 0) ∧ listp (s-expr (s)) ∧ (car (s-expr (s)) = s-temp-test) ∧ (¬ s-temp-setp (cadr (s-expr (s)), s-temps (s))) ∧ good-posp1 (s-pos (s), s-body (s-prog (s))) ∧ (pos = dv (s-pos (s), 1)) ∧ lr-check-resourcesp (flag, s, l, c) ∧ (flag ≠ 'list)) → lr-check-resourcesp (t, s-set-pos (s, pos), l, c)

Theorem: lr-do-temp-fetch-lr-check-resourcesp-temp-test (lr-check-resourcesp (flag, s, l, c) ∧ proper-p-statep (lr->p (s->lr1 (s, l, table))) ∧ lr-proper-heapp (p-data-segment (l)) ∧ good-posp1 (s-pos (s), s-body (s-prog (s))) ∧ lr-programs-properp (s->lr1 (s, l, table), table) ∧ listp (s-expr (s)) ∧ ((car (s-expr (s)) = s-temp-test)

∨ (car (s-expr (s)) = s-temp-fetch)) ∧ s-good-statep (s, c) ∧ lr-s-similar-statesp (s-params (s), s-temps (s), s->lr1 (s, l, table), table) ∧ (c ≄ 0) ∧ s-temp-setp (cadr (s-expr (s)), s-temps (s)) ∧ (flag ≠ 'list)) → (p-psw (lr-do-temp-fetch (s->lr1 (s, l, table))) = 'run)

Theorem: lr-push-tstk-lr-check-resourcesp-quote (lr-check-resourcesp (flag, s, l, c) ∧ good-posp1 (s-pos (s), s-body (s-prog (s))) ∧ listp (s-expr (s)) ∧ (car (s-expr (s)) = 'quote) ∧ s-good-statep (s, c) ∧ (c ≄ 0) ∧ (flag ≠ 'list)) → (p-psw (lr-push-tstk (s->lr1 (s, l, table),

cadr (lr-expr (s->lr1 (s, l, table)))))

    = 'run)

Theorem: lr-check-resourcesp-funcall ((c ≄ 0) ∧ listp (s-expr (s)) ∧ (car (s-expr (s)) ≠ 'if) ∧ (car (s-expr (s)) ≠ s-temp-eval) ∧ (car (s-expr (s)) ≠ s-temp-test) ∧ (car (s-expr (s)) ≠ s-temp-fetch) ∧ (car (s-expr (s)) ≠ 'quote) ∧ (s-err-flag (s-eval ('list, s-set-pos (s, dv (s-pos (s), 1)), c)) = 'run) ∧ proper-p-statep (lr->p (s->lr1 (s, l, table))) ∧ lr-proper-heapp (p-data-segment (l)) ∧ good-posp1 (s-pos (s), s-body (s-prog (s))) ∧ lr-programs-properp (s->lr1 (s, l, table), table) ∧ s-good-statep (s, c) ∧ lr-check-resourcesp (flag, s, l, c) ∧ (flag ≠ 'list)) → lr-check-resourcesp ('list, s-set-pos (s, dv (s-pos (s), 1)), l, c)

Theorem: numberp-s-eval-temp-ctrl-ws-heap-r-opened (car (s-eval-r (flag, s, c)) ∈ N) ∧ (cadr (s-eval-r (flag, s, c)) ∈ N) ∧ (caddr (s-eval-r (flag, s, c)) ∈ N) ∧ (cadddr (s-eval-r (flag, s, c)) ∈ N)

Theorem: lessp-1-not-zerop-exp ((m ≄ 0) ∧ (1 < n)) → (1 < exp (n, m))

Theorem: lessp-1-not-zerop-log ((1 < c) ∧ (n ∈ N)) → ((log (c, n) < 1) = (n < 1))

Definition: induct-hint-18 (c, n, m) = if c < 2 then t elseif n ≃ 0 then t elseif m ≃ 0 then t else induct-hint-18 (c, n ÷ c, m − 1) endif

Theorem: times-quotient-lessp-fact-1 ((c ≄ 0) ∧ (n ∈ N) ∧ (m ∈ N)) → ((n < (c ∗ m)) = ((n ÷ c) < m))

Theorem: exp-log-lessp-fact-1 ((1 < c) ∧ (n ∈ N) ∧ (m ∈ N)) → ((n < exp (c, m)) = (log (c, n) < (1 + m)))

Event: Disable times-quotient-lessp-fact-1.

Theorem: adpp-untag-add-addr-offset-car (lr-good-pointerp (addr, data-seg) ∧ lr-proper-p-areasp (data-seg) ∧ (untag (fetch (addr, data-seg)) = lr-cons-tag) ∧ lr-proper-heapp (data-seg)) → adpp (untag (add-addr (addr, identity (lr-car-offset))), data-seg)

Theorem: adpp-untag-add-addr-offset-cdr (lr-good-pointerp (addr, data-seg) ∧ lr-proper-p-areasp (data-seg) ∧ (untag (fetch (addr, data-seg)) = lr-cons-tag) ∧ lr-proper-heapp (data-seg)) → adpp (untag (add-addr (addr, identity (lr-cdr-offset))), data-seg)

Theorem: exp-log-2-lessp-add1-fact-1 ((1 + n) < exp (2, m)) = (log (2, 1 + n) < (1 + m))

;; The P-TEST-BOOL-AND-JUMP cause a lot of case splits after being opened
;; and the result rewritten with P-OBJECTP-TYPE, so we prove two simple
;; lemmas and disable it, this should hopefully speed up the proof.

Theorem: p-test-bool-and-jump-okp-t-cons-bool-t p-test-bool-and-jump-okp (list (ins-name, 't, label),

p-state (pc, ctrl-stk, cons ('(bool t), temp-stk), prog-seg, data-seg, max-ctrl, max-temp, word-size, psw))

= t Theorem: p-test-bool-and-jump-okp-f-cons-bool-t p-test-bool-and-jump-okp (list (ins-name, 'f, label),

p-state (pc, ctrl-stk, cons ('(bool t), temp-stk), prog-seg, data-seg, max-ctrl, max-temp, word-size, psw))

= t

Theorem: p-test-bool-and-jump-okp-t-cons-bool-f p-test-bool-and-jump-okp (list (ins-name, 't, label),

p-state (pc, ctrl-stk, cons ('(bool f), temp-stk), prog-seg, data-seg, max-ctrl, max-temp, word-size, psw))

= t

Theorem: p-test-bool-and-jump-okp-f-cons-bool-f p-test-bool-and-jump-okp (list (ins-name, 'f, label),

p-state (pc, ctrl-stk, cons ('(bool f), temp-stk), prog-seg, data-seg, max-ctrl, max-temp, word-size, psw))

= t

Event: Disable p-test-bool-and-jump-okp.

Theorem: p-psw-run-run-car-lr-check-resourcesp (lr-check-result ('list,

s-ans (new-s), p-temp-stk (new-l), p-data-segment (new-l), orig-temp-stk)

∧ proper-p-statep (lr->p (new-l)) ∧ (p-psw (new-l) = 'run) ∧ lr-programs-properp (new-l, table) ∧ (unlabel (get (offset (pc),

program-body (assoc (area-name (pc),

p-prog-segment (lr->p (new-l))))))

    = '(call car))

∧ (p-max-temp-stk-size (new-l)

≮ (length (p-temp-stk (new-l))

+ car (s-apply-subr-r ('car, new-s))))

∧ (p-max-ctrl-stk-size (new-l)

≮ (p-ctrl-stk-size (p-ctrl-stk (new-l))

+ cadr (s-apply-subr-r ('car, new-s))))

∧ (p-word-size (new-l)

≮ max (s-max-subr-reqs, caddr (s-apply-subr-r ('car, new-s)))) ∧ (lr-count-free-nodes (fetch (lr-fp-addr, p-data-segment (new-l)),

lr-free-list-nodes (lr-max-node (p-data-segment (new-l)), p-data-segment (new-l)),

p-data-segment (new-l))

≮ cadddr (s-apply-subr-r ('car, new-s))) ∧ (length (p-temp-stk (new-l)) ≮ arity ('car)) ∧ (length (s-ans (new-s)) = arity ('car))) → (p-psw (p (p-set-pc (lr->p (new-l), pc),

p-car-clock (p-set-pc (lr->p (new-l), pc))))

    = 'run)

Theorem: p-psw-run-run-cdr-lr-check-resourcesp (lr-check-result ('list,

s-ans (new-s),

p-temp-stk (new-l), p-data-segment (new-l), orig-temp-stk)

∧ proper-p-statep (lr->p (new-l)) ∧ (p-psw (new-l) = 'run) ∧ lr-programs-properp (new-l, table) ∧ (unlabel (get (offset (pc),

program-body (assoc (area-name (pc),

p-prog-segment (lr->p (new-l))))))

    = '(call cdr))

∧ (p-max-temp-stk-size (new-l)

≮ (length (p-temp-stk (new-l))

+ car (s-apply-subr-r ('cdr, new-s))))

∧ (p-max-ctrl-stk-size (new-l)

≮ (p-ctrl-stk-size (p-ctrl-stk (new-l))

+ cadr (s-apply-subr-r ('cdr, new-s))))

∧ (p-word-size (new-l)

≮ max (s-max-subr-reqs, caddr (s-apply-subr-r ('cdr, new-s)))) ∧ (lr-count-free-nodes (fetch (lr-fp-addr, p-data-segment (new-l)),

lr-free-list-nodes (lr-max-node (p-data-segment (new-l)), p-data-segment (new-l)),

p-data-segment (new-l))

≮ cadddr (s-apply-subr-r ('cdr, new-s))) ∧ (length (p-temp-stk (new-l)) ≮ arity ('cdr)) ∧ (length (s-ans (new-s)) = arity ('cdr))) → (p-psw (p (p-set-pc (lr->p (new-l), pc),

p-cdr-clock (p-set-pc (lr->p (new-l), pc))))

    = 'run)

Theorem: lessp-plus-remainder-0-fact (((offset1 mod max) = 0) ∧ ((offset2 mod max) = 0) ∧ (n < max) ∧ (offset1 ∈ N) ∧ (offset2 ∈ N)) → (((n + offset1 ) < offset2 ) = (offset1 < offset2 ))

Theorem: lr-boundary-nodep-lessp-plus-fact (lr-boundary-nodep (addr1 ) ∧ lr-boundary-nodep (addr2 ) ∧ (n < lr-node-size) ∧ (offset (addr1 ) ∈ N) ∧ (offset (addr2 ) ∈ N)) → (((n + offset (addr1 )) < offset (addr2 ))

= (offset (addr1 ) < offset (addr2 )))

Theorem: adpp-untag-add-addr-lr-nodep-not-max-addr (adpp (untag (addr), data-seg) ∧ lr-boundary-nodep (addr) ∧ (area-name (addr) = 'heap) ∧ definedp (lr-heap-name, data-seg) ∧ lr-boundary-nodep (lr-max-node (data-seg)) ∧ (offset (addr) < offset (lr-max-node (data-seg))) ∧ (n < lr-node-size)) → adpp (untag (add-addr (addr, n)), data-seg)

Theorem: adpp-untag-add-addr-offset-on-free-listp (lr-proper-p-areasp (data-seg) ∧ (lr-count-free-nodes (fetch (lr-fp-addr, data-seg),

lr-free-list-nodes (lr-max-node (data-seg), data-seg),

data-seg)

≮ 1) ∧ lr-proper-heapp (data-seg) ∧ (n < lr-node-size)) → adpp (untag (add-addr (fetch (identity (lr-fp-addr), data-seg), n)), data-seg)

Theorem: p-psw-run-run-cons-lr-check-resourcesp (lr-check-result ('list,

s-ans (new-s),

p-temp-stk (new-l), p-data-segment (new-l), orig-temp-stk)

∧ proper-p-statep (lr->p (new-l)) ∧ (p-psw (new-l) = 'run) ∧ lr-programs-properp (new-l, table) ∧ (unlabel (get (offset (pc),

program-body (assoc (area-name (pc),

p-prog-segment (lr->p (new-l))))))

    = '(call cons))

∧ (p-max-temp-stk-size (new-l)

≮ (length (p-temp-stk (new-l))

+ car (s-apply-subr-r ('cons, new-s))))

∧ (p-max-ctrl-stk-size (new-l)

≮ (p-ctrl-stk-size (p-ctrl-stk (new-l))

+ cadr (s-apply-subr-r ('cons, new-s))))

∧ (p-word-size (new-l)

≮ max (s-max-subr-reqs, caddr (s-apply-subr-r ('cons, new-s)))) ∧ (lr-count-free-nodes (fetch (lr-fp-addr, p-data-segment (new-l)),

lr-free-list-nodes (lr-max-node (p-data-segment (new-l)), p-data-segment (new-l)),

p-data-segment (new-l))

≮ cadddr (s-apply-subr-r ('cons, new-s))) ∧ (length (p-temp-stk (new-l)) ≮ arity ('cons)) ∧ (length (s-ans (new-s)) = arity ('cons))) → (p-psw (p (p-set-pc (lr->p (new-l), pc),

p-cons-clock (p-set-pc (lr->p (new-l), pc))))

    = 'run)

Theorem: p-psw-run-run-false-lr-check-resourcesp (lr-check-result ('list, s-ans (new-s), p-temp-stk (new-l), p-data-segment (new-l), orig-temp-stk)

∧ proper-p-statep (lr->p (new-l)) ∧ (p-psw (new-l) = 'run) ∧ lr-programs-properp (new-l, table) ∧ (unlabel (get (offset (pc),

program-body (assoc (area-name (pc),

p-prog-segment (lr->p (new-l))))))

    = '(call false))

∧ (p-max-temp-stk-size (new-l)

≮ (length (p-temp-stk (new-l))

+ car (s-apply-subr-r ('false, new-s))))

∧ (p-max-ctrl-stk-size (new-l)

≮ (p-ctrl-stk-size (p-ctrl-stk (new-l))

+ cadr (s-apply-subr-r ('false, new-s))))

∧ (p-word-size (new-l)

≮ max (s-max-subr-reqs, caddr (s-apply-subr-r ('false, new-s)))) ∧ (lr-count-free-nodes (fetch (lr-fp-addr, p-data-segment (new-l)),

lr-free-list-nodes (lr-max-node (p-data-segment (new-l)), p-data-segment (new-l)),

p-data-segment (new-l))

≮ cadddr (s-apply-subr-r ('false, new-s))) ∧ (length (p-temp-stk (new-l)) ≮ arity ('false)) ∧ (length (s-ans (new-s)) = arity ('false))) → (p-psw (p (p-set-pc (lr->p (new-l), pc),

p-false-clock (p-set-pc (lr->p (new-l), pc))))

    = 'run)

Theorem: p-psw-run-run-falsep-lr-check-resourcesp (lr-check-result ('list,

s-ans (new-s),

p-temp-stk (new-l), p-data-segment (new-l), orig-temp-stk)

∧ proper-p-statep (lr->p (new-l)) ∧ (p-psw (new-l) = 'run) ∧ lr-programs-properp (new-l, table) ∧ (unlabel (get (offset (pc),

program-body (assoc (area-name (pc),

p-prog-segment (lr->p (new-l))))))

    = '(call falsep))

∧ (p-max-temp-stk-size (new-l)

≮ (length (p-temp-stk (new-l))

+ car (s-apply-subr-r ('falsep, new-s))))

∧ (p-max-ctrl-stk-size (new-l)

≮ (p-ctrl-stk-size (p-ctrl-stk (new-l))

+ cadr (s-apply-subr-r ('falsep, new-s))))

∧ (p-word-size (new-l)

≮ max (s-max-subr-reqs, caddr (s-apply-subr-r ('falsep, new-s)))) ∧ (lr-count-free-nodes (fetch (lr-fp-addr, p-data-segment (new-l)),

lr-free-list-nodes (lr-max-node (p-data-segment (new-l)), p-data-segment (new-l)),

p-data-segment (new-l))

≮ cadddr (s-apply-subr-r ('falsep, new-s))) ∧ (length (p-temp-stk (new-l)) ≮ arity ('falsep)) ∧ (length (s-ans (new-s)) = arity ('falsep))) → (p-psw (p (p-set-pc (lr->p (new-l), pc),

p-falsep-clock (p-set-pc (lr->p (new-l), pc))))

    = 'run)

Theorem: p-psw-run-run-listp-lr-check-resourcesp (lr-check-result ('list,

s-ans (new-s),

p-temp-stk (new-l), p-data-segment (new-l), orig-temp-stk)

∧ proper-p-statep (lr->p (new-l)) ∧ (p-psw (new-l) = 'run) ∧ lr-programs-properp (new-l, table) ∧ (unlabel (get (offset (pc),

program-body (assoc (area-name (pc),

p-prog-segment (lr->p (new-l))))))

    = '(call listp))

∧ (p-max-temp-stk-size (new-l)

≮ (length (p-temp-stk (new-l))

+ car (s-apply-subr-r ('listp, new-s))))

∧ (p-max-ctrl-stk-size (new-l)

≮ (p-ctrl-stk-size (p-ctrl-stk (new-l))

+ cadr (s-apply-subr-r ('listp, new-s))))

∧ (p-word-size (new-l)

≮ max (s-max-subr-reqs, caddr (s-apply-subr-r ('listp, new-s)))) ∧ (lr-count-free-nodes (fetch (lr-fp-addr, p-data-segment (new-l)),

lr-free-list-nodes (lr-max-node (p-data-segment (new-l)), p-data-segment (new-l)),

p-data-segment (new-l))

≮ cadddr (s-apply-subr-r ('listp, new-s)))

∧ (length (p-temp-stk (new-l)) ≮ arity ('listp)) ∧ (length (s-ans (new-s)) = arity ('listp))) → (p-psw (p (p-set-pc (lr->p (new-l), pc),

p-listp-clock (p-set-pc (lr->p (new-l), pc))))

    = 'run)

Theorem: p-psw-run-run-nlistp-lr-check-resourcesp (lr-check-result ('list,

s-ans (new-s),

p-temp-stk (new-l), p-data-segment (new-l), orig-temp-stk)

∧ proper-p-statep (lr->p (new-l)) ∧ (p-psw (new-l) = 'run) ∧ lr-programs-properp (new-l, table) ∧ (unlabel (get (offset (pc),

program-body (assoc (area-name (pc),

p-prog-segment (lr->p (new-l))))))

    = '(call nlistp))

∧ (p-max-temp-stk-size (new-l)

≮ (length (p-temp-stk (new-l))

+ car (s-apply-subr-r ('nlistp, new-s))))

∧ (p-max-ctrl-stk-size (new-l)

≮ (p-ctrl-stk-size (p-ctrl-stk (new-l))

+ cadr (s-apply-subr-r ('nlistp, new-s))))

∧ (p-word-size (new-l)

≮ max (s-max-subr-reqs, caddr (s-apply-subr-r ('nlistp, new-s)))) ∧ (lr-count-free-nodes (fetch (lr-fp-addr, p-data-segment (new-l)),

lr-free-list-nodes (lr-max-node (p-data-segment (new-l)), p-data-segment (new-l)),

p-data-segment (new-l))

≮ cadddr (s-apply-subr-r ('nlistp, new-s))) ∧ (length (p-temp-stk (new-l)) ≮ arity ('nlistp)) ∧ (length (s-ans (new-s)) = arity ('nlistp))) → (p-psw (p (p-set-pc (lr->p (new-l), pc),

p-nlistp-clock (p-set-pc (lr->p (new-l), pc))))

    = 'run)

Theorem: p-psw-run-run-true-lr-check-resourcesp (lr-check-result ('list,

s-ans (new-s),

p-temp-stk (new-l), p-data-segment (new-l), orig-temp-stk)

∧ proper-p-statep (lr->p (new-l)) ∧ (p-psw (new-l) = 'run) ∧ lr-programs-properp (new-l, table) ∧ (unlabel (get (offset (pc),

program-body (assoc (area-name (pc),

p-prog-segment (lr->p (new-l))))))

    = '(call true))

∧ (p-max-temp-stk-size (new-l)

≮ (length (p-temp-stk (new-l))

+ car (s-apply-subr-r ('true, new-s))))

∧ (p-max-ctrl-stk-size (new-l)

≮ (p-ctrl-stk-size (p-ctrl-stk (new-l))

+ cadr (s-apply-subr-r ('true, new-s))))

∧ (p-word-size (new-l)

≮ max (s-max-subr-reqs, caddr (s-apply-subr-r ('true, new-s)))) ∧ (lr-count-free-nodes (fetch (lr-fp-addr, p-data-segment (new-l)),

lr-free-list-nodes (lr-max-node (p-data-segment (new-l)), p-data-segment (new-l)),

p-data-segment (new-l))

≮ cadddr (s-apply-subr-r ('true, new-s))) ∧ (length (p-temp-stk (new-l)) ≮ arity ('true)) ∧ (length (s-ans (new-s)) = arity ('true))) → (p-psw (p (p-set-pc (lr->p (new-l), pc),

p-true-clock (p-set-pc (lr->p (new-l), pc))))

    = 'run)

Theorem: p-psw-run-run-truep-lr-check-resourcesp (lr-check-result ('list,

s-ans (new-s),

p-temp-stk (new-l), p-data-segment (new-l), orig-temp-stk)

∧ proper-p-statep (lr->p (new-l)) ∧ (p-psw (new-l) = 'run) ∧ lr-programs-properp (new-l, table) ∧ (unlabel (get (offset (pc),

program-body (assoc (area-name (pc),

p-prog-segment (lr->p (new-l))))))

    = '(call truep))

∧ (p-max-temp-stk-size (new-l)

≮ (length (p-temp-stk (new-l))

+ car (s-apply-subr-r ('truep, new-s))))

∧ (p-max-ctrl-stk-size (new-l)

≮ (p-ctrl-stk-size (p-ctrl-stk (new-l))

+ cadr (s-apply-subr-r ('truep, new-s))))

∧ (p-word-size (new-l)

≮ max (s-max-subr-reqs, caddr (s-apply-subr-r ('truep, new-s)))) ∧ (lr-count-free-nodes (fetch (lr-fp-addr, p-data-segment (new-l)),

lr-free-list-nodes (lr-max-node (p-data-segment (new-l)), p-data-segment (new-l)),

p-data-segment (new-l))

≮ cadddr (s-apply-subr-r ('truep, new-s))) ∧ (length (p-temp-stk (new-l)) ≮ arity ('truep)) ∧ (length (s-ans (new-s)) = arity ('truep))) → (p-psw (p (p-set-pc (lr->p (new-l), pc),

p-truep-clock (p-set-pc (lr->p (new-l), pc))))

    = 'run)

Theorem: length-last listp (l) → (length (last (l)) = 1)

Theorem: equal-plus-lessp-fact ((x + z) = y) → ((y < (n + x)) = (z < n))

Theorem: not-lessp-lr-count-free-nodes-lr-eval-list-lr-set-pos let new-l be lr-eval ('list, lr-set-pos (s->lr1 (s, l, table), pos), c) in (proper-p-statep (lr->p (s->lr1 (s, l, table))) ∧ lr-proper-heapp (p-data-segment (l)) ∧ good-posp1 (s-pos (s), s-body (s-prog (s))) ∧ lr-programs-properp (s->lr1 (s, l, table), table) ∧ lr-s-similar-statesp (s-params (s),

s-temps (s),

s->lr1 (s, l, table), table)

∧ s-good-statep (s, c) ∧ (p-psw (new-l) = 'run) ∧ (s-err-flag (s-eval ('list, s-set-pos (s, pos), c)) = 'run) ∧ listp (s-expr (s)) ∧ (car (s-expr (s)) ≠ 'if) ∧ (car (s-expr (s)) ≠ s-temp-eval) ∧ (car (s-expr (s)) ≠ s-temp-test) ∧ (car (s-expr (s)) ≠ s-temp-fetch) ∧ (car (s-expr (s)) ≠ 'quote) ∧ (pos = dv (s-pos (s), 1)) ∧ (max-addr = lr-max-node (p-data-segment (l)))) → ((lr-count-free-nodes (fetch (identity (lr-fp-addr),

p-data-segment (new-l)), lr-free-list-nodes (max-addr,

p-data-segment (new-l)),

p-data-segment (new-l))

< n)

= (lr-count-free-nodes (fetch (identity (lr-fp-addr),

p-data-segment (l)), lr-free-list-nodes (max-addr,

p-data-segment (l)),

p-data-segment (l))

< (s-eval-heap-r ('list, s-set-pos (s, dv (s-pos (s), 1)), c)

+ n))) endlet

Event: Disable equal-plus-lessp-fact.

Theorem: lr-programs-properp-definedp-subrp-runtime-support ((¬ definedp (car (lr-expr (l)), p-runtime-support-programs)) ∧ (car (lr-expr (l)) ≠ 'if) ∧ subrp (car (lr-expr (l))) ∧ good-posp1 (offset (p-pc (l)), program-body (p-current-program (l)))) → (¬ lr-programs-properp (l, table))

Theorem: p-psw-run-p-run-subr-lr-check-resourcesp let new-l be lr-eval ('list, lr-set-pos (s->lr1 (s, l, table), pos), c),

new-s be s-eval ('list, s-set-pos (s, pos), c),

pc be lr-return-pc (s->lr1 (s, l, table)),

r be s-apply-subr-r (car (s-expr (s)), s-eval ('list, s-set-pos (s, pos), c)) in (proper-p-statep (lr->p (s->lr1 (s, l, table))) ∧ (c ≄ 0) ∧ listp (s-expr (s)) ∧ (car (s-expr (s)) ≠ 'if) ∧ (car (s-expr (s)) ≠ 'quote) ∧ (s-err-flag (new-s) = 'run) ∧ subrp (car (s-expr (s))) ∧ (p-psw (new-l) = 'run) ∧ lr-proper-heapp (p-data-segment (l)) ∧ good-posp1 (s-pos (s), s-body (s-prog (s))) ∧ lr-programs-properp (s->lr1 (s, l, table), table) ∧ lr-s-similar-statesp (s-params (s),

s-temps (s),

s->lr1 (s, l, table), table)

∧ s-good-statep (s, c)

∧ (p-max-temp-stk-size (l)

≮ (length (p-temp-stk (l))

+ arity (car (s-expr (s)))

+ car (r)))

∧ (p-max-ctrl-stk-size (l)

≮ (p-ctrl-stk-size (p-ctrl-stk (l)) + cadr (r))) ∧ (p-word-size (l) ≮ max (s-max-subr-reqs, caddr (r))) ∧ (lr-count-free-nodes (fetch (lr-fp-addr, p-data-segment (l)),

lr-free-list-nodes (lr-max-node (p-data-segment (l)), p-data-segment (l)),

p-data-segment (l))

≮ (cadddr (r)

+ s-eval-heap-r ('list, s-set-pos (s, pos), c)))

∧ (pos = dv (s-pos (s), 1))) → (p-psw (p-run-subr (car (s-expr (s)), p-set-pc (lr->p (new-l), pc)))

= 'run) endlet

Event: Disable lr-programs-properp-definedp-subrp-runtime-support.

Theorem: not-lessp-help-fact ((x ≮ y) ∧ (x ≮ z)) → ((x < max (y, z)) = f)

Theorem: p-psw-run-lr-apply-subr-lr-check-resourcesp ((c ≄ 0) ∧ listp (s-expr (s)) ∧ (car (s-expr (s)) ≠ 'if) ∧ (car (s-expr (s)) ≠ 'quote) ∧ (s-err-flag (s-eval ('list, s-set-pos (s, dv (s-pos (s), 1)), c)) = 'run) ∧ subrp (car (s-expr (s))) ∧ (p-psw (lr-eval ('list,

lr-set-pos (s->lr1 (s, l, table), dv (s-pos (s), 1)), c))

    = 'run)

∧ proper-p-statep (lr->p (s->lr1 (s, l, table))) ∧ lr-proper-heapp (p-data-segment (l)) ∧ good-posp1 (s-pos (s), s-body (s-prog (s))) ∧ lr-programs-properp (s->lr1 (s, l, table), table) ∧ lr-s-similar-statesp (s-params (s), s-temps (s), s->lr1 (s, l, table), table) ∧ s-good-statep (s, c) ∧ lr-check-resourcesp (flag, s, l, c) ∧ (p-word-size (l) ≮ s-max-subr-reqs) ∧ (flag ≠ 'list)) → (p-psw (lr-apply-subr (s->lr1 (s, l, table),

lr-eval ('list, lr-set-pos (s->lr1 (s, l, table),

dv (s-pos (s), 1)),

c)))

    = 'run)

Theorem: strip-logic-fnames-lr-compile-programs strip-logic-fnames (lr-compile-programs (programs, const-table)) = strip-logic-fnames (programs)

Theorem: strip-logic-fnames-cdr-lr-compile-programs strip-logic-fnames (cdr (lr-compile-programs (programs, const-table))) = strip-logic-fnames (cdr (programs))

Theorem: lr-programs-properp-s->lr1-definedp-cdr-s-progs (lr-programs-properp (s->lr1 (s, l, table), table) ∧ listp (s-expr (s)) ∧ (car (s-expr (s)) ≠ 'if) ∧ (car (s-expr (s)) ≠ 'quote) ∧ (¬ subrp (car (s-expr (s)))) ∧ litatom (car (s-expr (s))) ∧ good-posp1 (s-pos (s), s-body (s-prog (s))) ∧ s-programs-okp (cdr (s-progs (s)))) → definedp (user-fname (car (s-expr (s))), cdr (s-progs (s)))

Theorem: s-programs-okp-formals-not-f (s-programs-okp (progs) ∧ (prog ∈ progs)) → (s-formals (prog) ≠ f)

Theorem: not-lessp-plus-arity-length-formals (listp (s-expr (s)) ∧ (car (s-expr (s)) ≠ 'if) ∧ (car (s-expr (s)) ≠ 'quote) ∧ (¬ subrp (car (s-expr (s)))) ∧ litatom (car (s-expr (s))) ∧ good-posp1 (s-pos (s), s-body (s-prog (s))) ∧ s-good-statep (s, c)) → (((arity (car (s-expr (s))) + x) < length (formals (car (s-expr (s)))))

= f)

Theorem: length-lr-make-temp-var-dcls length (lr-make-temp-var-dcls (temp-alist)) = length (temp-alist)

Theorem: length-lr-make-temp-name-alist-1 length (lr-make-temp-name-alist-1 (initial, num-list, temp-list, formals)) = length (temp-list)

Theorem: length-lr-make-temp-name-alist length (lr-make-temp-name-alist (temp-list, formals)) = length (temp-list)

Theorem: p-ctrl-stk-size-0 (p-ctrl-stk-size (ctrl-stk) = 0) = (¬ listp (ctrl-stk))

Theorem: length-make-temps-entries length (make-temps-entries (list)) = length (list)

Theorem: s-eval-ctrl-r-funcall-opener let arg-s be s-eval ('list, s-set-pos (s, dv (s-pos (s), 1)), c) in ((c ≄ 0) ∧ s-good-statep (s, c) ∧ listp (s-expr (s)) ∧ (car (s-expr (s)) ≠ 'if) ∧ (car (s-expr (s)) ≠ 'quote) ∧ (¬ subrp (car (s-expr (s)))) ∧ litatom (car (s-expr (s))) ∧ (flag ≠ 'list) ∧ good-posp1 (s-pos (s), s-body (s-prog (s))) ∧ (s-err-flag (arg-s) = 'run)) → (s-eval-ctrl-r (flag, s, c)

= max (s-eval-ctrl-r ('list, s-set-pos (s, dv (s-pos (s), 1)), c),

1 + (1 + (length (formals (car (s-expr (s))))

+ length (s-temp-list (assoc (user-fname (car (s-expr (s))),

s-progs (s))))

+ s-eval-ctrl-r (t,

s-fun-call-state (arg-s,

car (s-expr (s))),

c − 1))))) endlet

Theorem: s-good-statep-formals-assoc-cdr-s-progs (s-good-statep (s, c) ∧ listp (s-expr (s)) ∧ (car (s-expr (s)) ≠ 'if) ∧ (car (s-expr (s)) ≠ 'quote) ∧ (¬ subrp (car (s-expr (s)))) ∧ good-posp1 (s-pos (s), s-body (s-prog (s))) ∧ litatom (car (s-expr (s))) ∧ (progs = cdr (s-progs (s)))) → (s-formals (assoc (user-fname (car (s-expr (s))), progs))

= formals (car (s-expr (s))))

Theorem: not-lessp-p-ctrl-stk-size-make-p-call-frame let s-prog be assoc (user-fname (car (s-expr (s))), cdr (s-progs (s))),

lr-eval be lr-eval ('list, lr-set-pos (s->lr1 (s, l, table), dv (s-pos (s), 1)), c)

in (listp (s-expr (s)) ∧ (car (s-expr (s)) ≠ 'if) ∧ (car (s-expr (s)) ≠ 'quote) ∧ (¬ subrp (car (s-expr (s)))) ∧ litatom (car (s-expr (s))) ∧ good-posp1 (s-pos (s), s-body (s-prog (s))) ∧ s-good-statep (s, c) ∧ (c ≄ 0) ∧ proper-p-statep (lr->p (s->lr1 (s, l, table))) ∧ lr-programs-properp (s->lr1 (s, l, table), table) ∧ (length (temp-list) = length (s-temp-list (s-prog))) ∧ (p-psw (lr-eval) = 'run) ∧ (s-err-flag (s-eval ('list, s-set-pos (s, dv (s-pos (s), 1)), c))

    = 'run)

∧ (p-max-ctrl-stk-size (l)

≮ (p-ctrl-stk-size (p-ctrl-stk (l))

+ s-eval-ctrl-r (flag, s, c)))

∧ (flag ≠ 'list)) → (p-max-ctrl-stk-size (l)

≮ p-ctrl-stk-size (cons (make-p-call-frame (formals (car (s-expr (s))), temp-stk, temp-list, pc),

p-ctrl-stk (lr-eval)))) endlet

Theorem: definedp-0 definedp (x, 0) = f

Theorem: not-definedp-user-fname-p-runtime-support-programs ¬ definedp (user-fname (name), p-runtime-support-programs)

Theorem: comp-programs-assoc-cons-opener (user-fname (name) ≠ prog1-name) → (assoc (user-fname (name),

comp-programs (cons (cons (prog1-name, prog1 ), progs))) = assoc (user-fname (name), comp-programs-1 (progs)))

Theorem: lr-check-resourcesp-lr-funcall-p-psw-run ((c ≄ 0)

∧ listp (s-expr (s)) ∧ (car (s-expr (s)) ≠ 'if) ∧ (car (s-expr (s)) ≠ 'quote) ∧ (¬ subrp (car (s-expr (s)))) ∧ litatom (car (s-expr (s))) ∧ good-posp1 (s-pos (s), s-body (s-prog (s))) ∧ lr-programs-properp (s->lr1 (s, l, table), table) ∧ (p-psw (lr-eval ('list, lr-set-pos (s->lr1 (s, l, table), pos), c))

    = 'run)

∧ (s-err-flag (s-eval ('list, s-set-pos (s, pos), c)) = 'run) ∧ (pos = dv (s-pos (s), 1)) ∧ proper-p-statep (lr->p (s->lr1 (s, l, table))) ∧ s-good-statep (s, c) ∧ lr-proper-heapp (p-data-segment (l)) ∧ lr-check-resourcesp (flag, s, l, c) ∧ (flag ≠ 'list)) → (p-psw (lr-funcall (s->lr1 (s, l, table),

lr-eval ('list, lr-set-pos (s->lr1 (s, l, table), pos), c)))

    = 'run)

Theorem: lessp-max-arg2 max (x, y) ≮ y

Theorem: not-lessp-plus-arity-length-formals-alt (listp (s-expr (s)) ∧ (car (s-expr (s)) ≠ 'if) ∧ (car (s-expr (s)) ≠ 'quote) ∧ (¬ subrp (car (s-expr (s)))) ∧ litatom (car (s-expr (s))) ∧ good-posp1 (s-pos (s), s-body (s-prog (s))) ∧ s-good-statep (s, c)) → (((x + arity (car (s-expr (s)))) < length (formals (car (s-expr (s)))))

= f)

Theorem: listp-lr-compile-programs listp (lr-compile-programs (progs, table)) = listp (progs)

Theorem: caar-lr-compile-programs listp (progs) → (caar (lr-compile-programs (progs, table)) = caar (progs))

Theorem: length-p-temp-stk-lr-eval-lr-funcall let lr-eval be lr-eval ('list, lr-set-pos (s->lr1 (s, l, table), pos), c) in (listp (s-expr (s)) ∧ (¬ subrp (car (s-expr (s))))

∧ (car (s-expr (s)) ≠ 'quote) ∧ (car (s-expr (s)) ≠ 'if) ∧ litatom (car (s-expr (s))) ∧ proper-p-statep (lr->p (s->lr1 (s, l, table))) ∧ good-posp1 (s-pos (s), s-body (s-prog (s))) ∧ s-good-statep (s, c) ∧ lr-programs-properp (s->lr1 (s, l, table), table) ∧ (p-psw (lr-eval) = 'run) ∧ (p-psw (lr-funcall (s->lr1 (s, l, table), lr-eval)) = 'run) ∧ (s-err-flag (s-eval ('list, s-set-pos (s, pos), c)) = 'run) ∧ (pos = dv (s-pos (s), 1))) → (length (p-temp-stk (lr-funcall (s->lr1 (s, l, table), lr-eval)))

= length (p-temp-stk (l))) endlet

Theorem: p-ctrl-stk-size-p-ctrl-stk-lr-funcall (p-psw (lr-funcall (l, new-l)) = 'run) → (p-ctrl-stk-size (p-ctrl-stk (lr-funcall (l, new-l)))

= (2

+ length (formal-vars (assoc (user-fname (car (lr-expr (l))),

p-prog-segment (l))))

+ length (temp-var-dcls (assoc (user-fname (car (lr-expr (l))),

p-prog-segment (l))))

+ p-ctrl-stk-size (p-ctrl-stk (new-l))))

Theorem: lr-programs-properp-s->lr1-definedp-s-progs (lr-programs-properp (s->lr1 (s, l, table), table) ∧ listp (s-expr (s)) ∧ (car (s-expr (s)) ≠ 'if) ∧ (car (s-expr (s)) ≠ 'quote) ∧ (¬ subrp (car (s-expr (s)))) ∧ litatom (car (s-expr (s))) ∧ good-posp1 (s-pos (s), s-body (s-prog (s))) ∧ s-programs-okp (cdr (s-progs (s)))) → definedp (user-fname (car (s-expr (s))), s-progs (s))

Theorem: s-eval-ctrl-heap-temp-ws-s-fun-call-state-opener let s-eval be s-eval ('list, s-set-pos (s, dv (s-pos (s), 1)), c) in ((c ≄ 0) ∧ listp (s-expr (s)) ∧ (car (s-expr (s)) ≠ 'if) ∧ (car (s-expr (s)) ≠ 'quote) ∧ (¬ subrp (car (s-expr (s)))) ∧ litatom (car (s-expr (s))) ∧ s-good-statep (s, c)

∧ (s-err-flag (s-eval) = 'run) ∧ (flag ≠ 'list)) → ((s-eval-ctrl-r (flag, s, c)

= max (s-eval-ctrl-r ('list, s-set-pos (s, dv (s-pos (s), 1)), c),

             2

+ length (s-formals (assoc (user-fname (car (s-expr (s))),

s-progs (s))))

+ length (s-temp-list (assoc (user-fname (car (s-expr (s))),

s-progs (s))))

+ s-eval-ctrl-r (t,

s-fun-call-state (s-eval,

car (s-expr (s))),

c − 1)))

∧ (s-eval-heap-r (flag, s, c)

= (s-eval-heap-r ('list, s-set-pos (s, dv (s-pos (s), 1)), c)

+ s-eval-heap-r (t,

s-fun-call-state (s-eval,

car (s-expr (s))),

c − 1)))

∧ (s-eval-temp-r (flag, s, c)

= max (s-eval-temp-r ('list, s-set-pos (s, dv (s-pos (s), 1)), c),

s-eval-temp-r (t,

s-fun-call-state (s-eval,

car (s-expr (s))),

c − 1)))

∧ (s-eval-ws-r (flag, s, c)

= max (s-eval-ws-r ('list, s-set-pos (s, dv (s-pos (s), 1)), c),

s-eval-ws-r (t,

s-fun-call-state (s-eval,

car (s-expr (s))),

c − 1)))) endlet

Theorem: lr-check-resourcesp-lr-funcall-s-fun-call-state ((c ≄ 0) ∧ listp (s-expr (s)) ∧ (car (s-expr (s)) ≠ 'if)

∧ (car (s-expr (s)) ≠ s-temp-eval) ∧ (car (s-expr (s)) ≠ s-temp-test) ∧ (car (s-expr (s)) ≠ s-temp-fetch) ∧ (car (s-expr (s)) ≠ 'quote) ∧ (¬ subrp (car (s-expr (s)))) ∧ good-posp1 (s-pos (s), s-body (s-prog (s))) ∧ litatom (car (s-expr (s))) ∧ lr-programs-properp (s->lr1 (s, l, table), table) ∧ (p-psw (lr-eval ('list, lr-set-pos (s->lr1 (s, l, table), pos), c))

    = 'run)

∧ (s-err-flag (s-eval ('list, s-set-pos (s, pos), c)) = 'run) ∧ (pos = dv (s-pos (s), 1)) ∧ proper-p-statep (lr->p (s->lr1 (s, l, table))) ∧ s-good-statep (s, c) ∧ lr-proper-heapp (p-data-segment (l)) ∧ lr-check-resourcesp (flag, s, l, c) ∧ (flag ≠ 'list) ∧ lr-s-similar-statesp (s-params (s), s-temps (s), s->lr1 (s, l, table), table)) → lr-check-resourcesp (t,

s-fun-call-state (s-eval ('list, s-set-pos (s, pos), c), car (s-expr (s))),

lr-funcall (s->lr1 (s, l, table),

lr-eval ('list,

lr-set-pos (s->lr1 (s, l, table), pos),

c)),

c − 1)

Event: Disable s-eval-ctrl-heap-temp-ws-s-fun-call-state-opener.

Theorem: s-eval-flag-run-car-s-apply-subr-r-not-zero (listp (s-expr (s)) ∧ (car (s-expr (s)) ≠ 'if) ∧ (car (s-expr (s)) ≠ 'quote) ∧ (s-err-flag (s-eval ('list, s-set-pos (s, dv (s-pos (s), 1)), c)) = 'run) ∧ subrp (car (s-expr (s))) ∧ (p-psw (lr-apply-subr (s->lr1 (s, l, table), new-l)) = 'run) ∧ good-posp1 (s-pos (s), s-body (s-prog (s))) ∧ s-good-statep (s, c)) → (car (s-apply-subr-r (car (s-expr (s)),

s-eval ('list, s-set-pos (s, dv (s-pos (s), 1)), c)))

≮ 1)

Theorem: length-p-temp-stk-lr-eval-lr-set-pos-flag-t (proper-p-statep (lr->p (s->lr1 (s, l, table))) ∧ good-posp1 (pos, s-body (s-prog (s))) ∧ lr-programs-properp (s->lr1 (s, l, table), table) ∧ s-good-statep (s, c) ∧ (p-psw (lr-eval (t, lr-set-pos (s->lr1 (s, l, table), pos), c)) = 'run)) → (length (p-temp-stk (lr-eval (t, lr-set-pos (s->lr1 (s, l, table), pos), c)))

= (1 + length (p-temp-stk (l))))

Theorem: s-eval-flag-run-s-eval-temp-r-not-zero ((p-psw (lr-eval (flag, s->lr1 (s, l, table), c)) = 'run) ∧ (s-err-flag (s-eval (flag, s, c)) = 'run) ∧ good-posp (flag, s-pos (s), s-body (s-prog (s))) ∧ s-good-statep (s, c) ∧ (flag ≠ 'list)) → (s-eval-temp-r (flag, s, c) ≮ 1)

Theorem: p-psw-run-p-psw-lr-if-ok-not-run-check-resourcesp ((flag ≠ 'list) ∧ (c ≄ 0) ∧ listp (s-expr (s)) ∧ (car (s-expr (s)) = 'if) ∧ s-good-statep (s, c) ∧ lr-programs-properp (s->lr1 (s, l, table), table) ∧ proper-p-statep (lr->p (s->lr1 (s, l, table))) ∧ (s-err-flag (s-eval (t, s-set-pos (s, dv (s-pos (s), 1)), c)) = 'run) ∧ (p-psw (lr-if-ok (lr-eval (t,

lr-set-pos (s->lr1 (s, l, table), dv (s-pos (s), 1)), c)))

    ≠ 'run)

∧ (p-psw (lr-eval (t, lr-set-pos (s->lr1 (s, l, table), dv (s-pos (s), 1)), c))

    = 'run)

∧ good-posp1 (s-pos (s), s-body (s-prog (s)))) → (¬ lr-check-resourcesp (flag, s, l, c))

Theorem: not-lr-check-resourcesp-temp-test-bad-max-temp-stk-size ((flag ≠ 'list) ∧ (c ≠ 0) ∧ (c ∈ N) ∧ listp (s-expr (s)) ∧ (car (s-expr (s)) = s-temp-test) ∧ (p-max-temp-stk-size (l) < (2 + length (p-temp-stk (l)))) ∧ s-good-statep (s, c)) → (¬ lr-check-resourcesp (flag, s, l, c))

Theorem: lr-eval-s-eval-flag-run (proper-p-statep (lr->p (s->lr1 (s, l, table))) ∧ lr-proper-heapp (p-data-segment (l)) ∧ good-posp (flag, s-pos (s), s-body (s-prog (s))) ∧ lr-programs-properp (s->lr1 (s, l, table), table) ∧ lr-s-similar-statesp (s-params (s), s-temps (s), s->lr1 (s, l, table), table) ∧ s-good-statep (s, c) ∧ s-all-temps-setp (flag,

if flag = 'list then s-expr-list (s) else s-expr (s) endif, temp-alist-to-set (s-temps (s)))

∧ s-all-progs-temps-setp (s-progs (s)) ∧ s-check-temps-setp (s-temps (s)) ∧ (s-err-flag (s-eval (flag, s, c)) = 'run) ∧ lr-check-resourcesp (flag, s, l, c) ∧ (p-word-size (l) ≮ s-max-subr-reqs)) → (p-psw (lr-eval (flag, s->lr1 (s, l, table), c)) = 'run)

Theorem: plistp-lr-compile-body-1 plistp (prog) → plistp (lr-compile-body (flag, prog, temp-alist, table))

Definition: l-restrict-subrps (flag, expr) = if flag = 'list

then if listp (expr)

then l-restrict-subrps (t, car (expr))

∧ l-restrict-subrps ('list, cdr (expr)) else t endif

elseif listp (expr)

then if car (expr) = 'quote then t elseif car (expr) = 'if then l-restrict-subrps ('list, cdr (expr)) elseif subrp (car (expr)) then definedp (car (expr), p-runtime-support-programs)

∧ l-restrict-subrps ('list, cdr (expr)) elseif body (car (expr)) then l-restrict-subrps ('list, cdr (expr)) else t endif

else t endif

Definition: l-restrict-subrps-progs (pnames) = if listp (pnames)

then l-restrict-subrps (t, body (car (pnames)))

∧ l-restrict-subrps-progs (cdr (pnames)) else t endif Definition: s-restrict-subrps (flag, expr) = if flag = 'list

then if listp (expr)

then s-restrict-subrps (t, car (expr))

∧ s-restrict-subrps ('list, cdr (expr)) else t endif

elseif listp (expr)

then if car (expr) = 'quote then t

elseif (car (expr) = s-temp-fetch)

∨ (car (expr) = s-temp-eval) ∨ (car (expr) = s-temp-test)

then s-restrict-subrps (t, cadr (expr))

elseif car (expr) = 'if

then s-restrict-subrps ('list, cdr (expr))

elseif subrp (car (expr))

then definedp (car (expr), p-runtime-support-programs)

∧ s-restrict-subrps ('list, cdr (expr)) elseif body (car (expr)) then s-restrict-subrps ('list, cdr (expr)) else t endif

else t endif

Definition: s-restrict-subrps-progs (progs) = if listp (progs)

then s-restrict-subrps (t, s-body (car (progs))) ∧ s-restrict-subrps-progs (cdr (progs))

else t endif

Theorem: s-proper-exprp-plist-temp-list s-proper-exprp (flag, expr, program-names, formals, plist (temp-list)) = s-proper-exprp (flag, expr, program-names, formals, temp-list)

Theorem: not-listp-s-progs-not-s-good-statep (¬ listp (s-progs (s))) → (¬ s-good-statep (s, c))

Theorem: length-lr-init-heap-contents length (lr-init-heap-contents (addr, size)) = (1 + (size ∗ lr-node-size))

Theorem: fetch-cons fetch (list (x, cons (name1 , n)), cons (cons (name2 , contents), rest-data-seg)) = if name1 = name2 then get (n, contents)

else fetch (list (x, cons (name1 , n)), rest-data-seg) endif

Theorem: lr-s-similar-const-table-cons lr-s-similar-const-table (cons (cons (object, addr), table), data-seg) = (lr-valp (object, addr, data-seg)

∧ lr-s-similar-const-table (table, data-seg))

Theorem: lr-s-similar-const-table-nil lr-s-similar-const-table (nil, data-seg)

Theorem: lr-init-heap-contents-add1-opener lr-init-heap-contents (addr, 1 + size) = append (lr-new-node (tag ('nat, lr-init-tag),

add-addr (addr, lr-node-size), tag ('nat, 0), tag ('nat, 0)),

lr-init-heap-contents (add-addr (addr, lr-node-size), size))

Theorem: deposit-cons deposit (object,

list (x, cons (name1 , n)),

cons (cons (name2 , contents), rest-data-seg)) = if name1 = name2

then cons (cons (name1 , put (object, n, contents)), rest-data-seg) else cons (cons (name2 , contents),

deposit (object, list (x, cons (name1 , n)), rest-data-seg)) endif

Theorem: adpp-cons-pack-opener (n ∈ N) → (adpp (cons (pack (xxx), n), cons (cons (pack (yyy), contents), rest))

= if xxx = yyy then n < length (contents) else adpp (cons (pack (xxx), n), rest) endif)

Theorem: fetch-deposit-a-list ((offset (addr1 ) ∈ N) ∧ (offset (addr2 ) ∈ N) ∧ listp (list)) → (fetch (addr1 , deposit-a-list (list, addr2 , data-seg))

= if definedp (area-name (addr2 ), data-seg)

then if area-name (addr1 ) = area-name (addr2 ) then if (offset (addr1 ) ≮ offset (addr2 )) ∧ (offset (addr1 )

< (offset (addr2 ) + length (list))) then get (offset (addr1 ) − offset (addr2 ), list) else fetch (addr1 , data-seg) endif

else fetch (addr1 , data-seg) endif else fetch (addr1 , data-seg) endif)

Theorem: lr-valp-0-lr-0-addr-opener lr-valp (0, identity (lr-0-addr), data-seg)

= (adpp (identity (untag (lr-0-addr)), data-seg)

∧ (type (fetch (identity (add-addr (lr-0-addr, lr-ref-count-offset)),

data-seg))

        = 'nat)

∧ (untag (fetch (identity (lr-0-addr), data-seg)) = lr-add1-tag)

∧ (untag (fetch (identity (add-addr (lr-0-addr, lr-unbox-nat-offset)),

data-seg))

= 0))

Event: Disable lr-valp-0-lr-0-addr-opener.

Theorem: lr-valp-t-lr-t-addr-opener lr-valp (t, identity (lr-t-addr), data-seg) = (adpp (identity (untag (lr-t-addr)), data-seg)

∧ (type (fetch (identity (add-addr (lr-t-addr, lr-ref-count-offset)),

data-seg))

        = 'nat)

∧ (untag (fetch (identity (lr-t-addr), data-seg)) = lr-true-tag))

Event: Disable lr-valp-t-lr-t-addr-opener.

Theorem: lr-valp-f-lr-f-addr-opener lr-valp (f, identity (lr-f-addr), data-seg) = (adpp (identity (untag (lr-f-addr)), data-seg)

∧ (type (fetch (identity (add-addr (lr-f-addr, lr-ref-count-offset)),

data-seg))

        = 'nat)

∧ (untag (fetch (identity (lr-f-addr), data-seg)) = lr-false-tag))

Event: Disable lr-valp-f-lr-f-addr-opener.

Theorem: definedp-table-definedp-cdr-lr-compile-quote definedp (x, table) → definedp (x, cdr (lr-compile-quote (flag, object, data-seg, table)))

Theorem: definedp-car-lr-compile-quote definedp (x, car (lr-compile-quote (flag, object, data-seg, table))) = definedp (x, data-seg)

Theorem: lr-proper-p-areasp-car-lr-compile-quote lr-proper-p-areasp (data-seg) → lr-proper-p-areasp (car (lr-compile-quote (flag, object, data-seg, table)))

Theorem: length-deposit-a-list listp (list) → (length (cdr (assoc (name, deposit-a-list (list, addr, data-seg))))

= if definedp (area-name (addr), data-seg) then if area-name (addr) = name

then if length (cdr (assoc (name, data-seg))) < (offset (addr) + length (list)) then offset (addr) + length (list) else length (cdr (assoc (name, data-seg))) endif

else length (cdr (assoc (name, data-seg))) endif else length (cdr (assoc (name, data-seg))) endif)

Theorem: adpp-lr-compile-quote adpp (addr, data-seg) → adpp (addr, car (lr-compile-quote (flag, object, data-seg, table)))

Theorem: adpp-untag-definedp-area-name-free-ptr adpp (untag (lr-fp-addr), data-seg) → definedp (identity (area-name (lr-fp-addr)), data-seg)

Theorem: lr-max-node-deposit-a-list (adpp (untag (addr), data-seg) ∧ listp (list) ∧ ((offset (addr) + length (list))

< length (cdr (assoc (area-name (addr), data-seg))))) → (lr-max-node (deposit-a-list (list, addr, data-seg))

= lr-max-node (data-seg))

Definition: all-p-objects-lookup (list, table, p) = if listp (list)

then p-objectp (cdr (assoc (car (list), table)), p)

∧ all-p-objects-lookup (cdr (list), table, p) else t endif

Theorem: proper-p-alistp-all-litatoms-all-p-objectps-lookup (all-litatoms (strip-cars (params)) ∧ all-p-objects-lookup (strip-cdrs (params), table, p)) → proper-p-alistp (pair-formals-with-addresses (params, table), p)

Theorem: definedp-table-definedp-cdr-lr-data-seg-table-body definedp (object, table) → definedp (object, cdr (lr-data-seg-table-body (flag, expr, data-seg, table)))

Theorem: definedp-table-definedp-cdr-lr-data-seg-table-list definedp (object, table) → definedp (object, cdr (lr-data-seg-table-list (progs, data-seg, table)))

Theorem: definedp-table-definedp-cdr-lr-init-data-seg-table definedp (object, table) → definedp (object, cdr (lr-init-data-seg-table (params, data-seg, table)))

Theorem: definedp-table-definedp-car-lr-data-seg-table-body definedp (name, data-seg) → definedp (name, car (lr-data-seg-table-body (flag, expr, data-seg, table)))

Theorem: definedp-table-definedp-car-lr-data-seg-table-list definedp (name, data-seg) → definedp (name, car (lr-data-seg-table-list (progs, data-seg, table)))

Theorem: equal-lengths-same-signature-car-lr-compile-quote same-signature (data-seg, car (lr-compile-quote (flag, object, data-seg, table))) → (length (cdr (assoc (name,

car (lr-compile-quote (flag, object, data-seg, table)))))

= length (cdr (assoc (name, data-seg))))

Theorem: adpp-same-signature-car-lr-compile-quote same-signature (data-seg, car (lr-compile-quote (flag, object, data-seg, table))) → (adpp (adp, car (lr-compile-quote (flag, object, data-seg, table)))

= adpp (adp, data-seg))

Theorem: same-signature-car-lr-compile-quote-helper let pair be lr-compile-quote ('list,

list (car (object), cdr (object)), data-seg, table)

in (lr-proper-free-listp (car (pair)) ∧ same-signature (data-seg, car (pair)) ∧ lr-proper-p-areasp (data-seg) ∧ definedp (lr-heap-name, data-seg) ∧ lr-boundary-nodep (lr-max-node (data-seg)) ∧ ((length (cdr (assoc (lr-heap-name, data-seg))) − 1)

≮ (offset (fetch (lr-fp-addr, car (pair))) + length (list)))) → same-signature (data-seg,

deposit-a-list (list,

fetch (identity (lr-fp-addr),

car (pair)), car (pair))) endlet

Theorem: same-signature-car-lr-compile-quote-generalized (lr-proper-free-listp (data-seg) ∧ lr-proper-p-areasp (data-seg)

∧ definedp (lr-heap-name, data-seg) ∧ lr-boundary-nodep (lr-max-node (data-seg))) → (same-signature (data-seg,

car (lr-compile-quote (flag, object, data-seg, table)))

∧ lr-proper-free-listp (car (lr-compile-quote (flag, object, data-seg, table))))

Event: Disable equal-lengths-same-signature-car-lr-compile-quote.

Event: Disable adpp-same-signature-car-lr-compile-quote.

Theorem: lr-proper-free-listp-car-lr-compile-quote (lr-proper-free-listp (data-seg) ∧ lr-proper-p-areasp (data-seg) ∧ definedp (lr-heap-name, data-seg) ∧ lr-boundary-nodep (lr-max-node (data-seg))) → lr-proper-free-listp (car (lr-compile-quote (flag, object, data-seg, table)))

Theorem: p-objectp-car-lr-compile-quote (p-objectp (object1 ,

p-state (pc, ctrl-stk, temp-stk, prog-seg, data-seg, max-ctrl, max-temp, word-size, psw))

∧ lr-proper-free-listp (data-seg) ∧ lr-proper-p-areasp (data-seg) ∧ definedp (lr-heap-name, data-seg) ∧ lr-boundary-nodep (lr-max-node (data-seg))) → p-objectp (object1 ,

p-state (pc, ctrl-stk, temp-stk, prog-seg, car (lr-compile-quote (flag, object2 , data-seg, table)), max-ctrl, max-temp, word-size, psw))

Theorem: lr-proper-p-areasp-car-lr-data-seg-table-body lr-proper-p-areasp (data-seg) → lr-proper-p-areasp (car (lr-data-seg-table-body (flag,

expr, data-seg, table)))

Theorem: same-signature-car-lr-compile-quote (lr-proper-free-listp (data-seg) ∧ lr-proper-p-areasp (data-seg) ∧ definedp (lr-heap-name, data-seg) ∧ lr-boundary-nodep (lr-max-node (data-seg))) → same-signature (data-seg,

car (lr-compile-quote (flag, object, data-seg, table)))

Theorem: same-signature-car-lr-data-seg-table-body (lr-proper-free-listp (data-seg) ∧ lr-proper-p-areasp (data-seg) ∧ definedp (lr-heap-name, data-seg) ∧ lr-boundary-nodep (lr-max-node (data-seg))) → (same-signature (data-seg,

car (lr-data-seg-table-body (flag, expr, data-seg, table)))

∧ lr-proper-free-listp (car (lr-data-seg-table-body (flag, expr, data-seg, table))))

Event: Disable same-signature-car-lr-compile-quote.

Theorem: lr-max-node-car-lr-data-seg-table-body (lr-proper-free-listp (data-seg) ∧ lr-proper-p-areasp (data-seg) ∧ definedp (lr-heap-name, data-seg) ∧ lr-boundary-nodep (lr-max-node (data-seg))) → (lr-max-node (car (lr-data-seg-table-body (flag, body, data-seg, table)))

= lr-max-node (data-seg))

Theorem: same-signature-car-lr-data-seg-table-list-helper let dst-body be lr-data-seg-table-body (t, s-body (prog), data-seg, table) in (same-signature (car (dst-body), car (lr-data-seg-table-list (progs,

car (dst-body), cdr (dst-body))))

∧ lr-proper-free-listp (data-seg) ∧ lr-proper-p-areasp (data-seg) ∧ definedp (lr-heap-name, data-seg) ∧ lr-boundary-nodep (lr-max-node (data-seg))) → same-signature (data-seg,

car (lr-data-seg-table-list (progs, car (dst-body), cdr (dst-body)))) endlet

Theorem: same-signature-car-lr-data-seg-table-list (lr-proper-free-listp (data-seg) ∧ lr-proper-p-areasp (data-seg) ∧ definedp (lr-heap-name, data-seg) ∧ lr-boundary-nodep (lr-max-node (data-seg))) → same-signature (data-seg,

car (lr-data-seg-table-list (progs, data-seg, table)))

Event: Disable same-signature-car-lr-data-seg-table-list-helper.

Theorem: length-car-lr-compile-quote (lr-proper-free-listp (data-seg) ∧ lr-proper-p-areasp (data-seg) ∧ definedp (lr-heap-name, data-seg) ∧ lr-boundary-nodep (lr-max-node (data-seg))) → (length (cdr (assoc (name,

car (lr-compile-quote (flag, object, data-seg, table)))))

= length (cdr (assoc (name, data-seg))))

Theorem: lr-max-node-car-lr-compile-quote (lr-proper-free-listp (data-seg) ∧ lr-proper-p-areasp (data-seg) ∧ definedp (lr-heap-name, data-seg) ∧ lr-boundary-nodep (lr-max-node (data-seg))) → (lr-max-node (car (lr-compile-quote (flag, object, data-seg, table)))

= lr-max-node (data-seg))

Theorem: lr-proper-free-listp-car-lr-init-data-seg-table (lr-proper-free-listp (data-seg) ∧ lr-proper-p-areasp (data-seg) ∧ definedp (lr-heap-name, data-seg) ∧ lr-boundary-nodep (lr-max-node (data-seg))) → lr-proper-free-listp (car (lr-init-data-seg-table (params, data-seg, table)))

Theorem: adpp-untag-lr-fp-addr-lr-init-data-seg adpp (identity (untag (lr-fp-addr)), lr-init-data-seg (heap-size))

Theorem: lr-max-node-lr-init-data-seg (heap-size ≮ 2) → (lr-max-node (lr-init-data-seg (heap-size))

= tag ('addr,

cons (identity (lr-heap-name), identity (lr-node-size) ∗ heap-size)))

Theorem: fetch-lr-fp-addr-lr-init-data-seg fetch (identity (lr-fp-addr), lr-init-data-seg (heap-size)) = identity (add-addr (lr-f-addr, lr-node-size))

Theorem: lr-boundary-nodep-not-lessp-fact-helper ((x < (y ∗ z)) ∧ ((x mod y) = 0) ∧ (x ∈ N)) → ((x < (y ∗ (z − 1))) = (x ≠ (y ∗ (z − 1))))

Theorem: lessp-times-difference-fact ((z ≄ 0) ∧ (x ≄ 0) ∧ ((x mod y) = 0)) → (((x − y) < (y ∗ (z − 1))) = (x < (y ∗ z)))

Theorem: lessp-times-difference-node-on-boundaryp-fact ((heap-size ≄ 0) ∧ (offset (addr) ≄ 0) ∧ lr-boundary-nodep (addr)) → ((((((offset (addr) − 1) − 1) − 1) − 1)

< (identity (lr-node-size) ∗ (heap-size − 1)))

= (offset (addr) < (identity (lr-node-size) ∗ heap-size)))

Theorem: lr-boundary-nodep-lessp-lr-node-size-0 lr-boundary-nodep (addr) → ((((offset (addr) − 1) = 1) = f)

∧ ((((offset (addr) − 1) − 1) = 1) = f))

Theorem: lr-boundary-nodep-lessp-lr-node-size-1 ((offset (addr) ∈ N) ∧ lr-boundary-nodep (addr) ∧ (n < lr-node-size)) → ((n < offset (addr)) = (offset (addr) ≠ 0))

Theorem: lr-boundary-nodep-lessp-lr-node-size-2 lr-boundary-nodep (addr) → ((offset (addr) = 1) = f)

Definition: induct-hint-17 (addr1 , size, addr2 ) = if size ≃ 0 then t

elseif offset (addr2 ) ≃ 0 then t

else induct-hint-17 (add-addr (addr1 , lr-node-size), size − 1, sub-addr (addr2 , lr-node-size)) endif Theorem: get-cdr-lr-init-heap-contents ((offset (addr2 ) < (lr-node-size ∗ heap-size)) ∧ lr-boundary-nodep (addr2 ) ∧ (offset (addr2 ) ∈ N) ∧ (offset (addr1 ) ∈ N)) → (get (offset (addr2 ), cdr (lr-init-heap-contents (addr1 , heap-size)))

= add-addr (add-addr (addr1 , offset (addr2 )), lr-node-size))

Event: Disable lr-boundary-nodep-lessp-lr-node-size-0.

Event: Disable lr-boundary-nodep-lessp-lr-node-size-1.

Event: Disable lr-boundary-nodep-lessp-lr-node-size-2.

Theorem: length-cdr-assoc-lr-heap-name-lr-init-data-seg (heap-size ≮ 2) → (length (cdr (assoc (identity (lr-heap-name), lr-init-data-seg (heap-size))))

= (1 + (heap-size ∗ identity (lr-node-size))))

Theorem: fetch-add-addr-ref-count-offset-lr-init-data-seg-help-1 ((offset (addr) = 0) ∧ (type (addr) = 'addr) ∧ (area-name (addr) = 'heap)) → (add-addr (addr, 4) = '(addr (heap . 4)))

Theorem: equal-add-addr-fact (type (addr1 ) = type (addr2 )) → ((add-addr (addr1 , n1 ) = add-addr (addr2 , n2 ))

= ((area-name (addr1 ) = area-name (addr2 ))

∧ ((offset (addr1 ) + n1 ) = (offset (addr2 ) + n2 ))))

Definition: lr-all-nodes (min-offset, max-addr) = if offset (max-addr) ≃ 0 then nil

elseif min-offset ≮ offset (max-addr) then nil else cons (sub-addr (max-addr, lr-node-size), lr-all-nodes (min-offset,

sub-addr (max-addr, lr-node-size))) endif

Definition: induct-hint-19 (addr, max-addr) = if offset (addr) < offset (max-addr)

then induct-hint-19 (add-addr (addr, lr-node-size), max-addr)

else t endif Theorem: lessp-times-plus-fact (n ≄ 0) → (((n ∗ v) < (n + (n ∗ w))) = (v < (1 + w)))

Theorem: lessp-sub1-lessp-fact ((x ∈ N) ∧ (y ∈ N) ∧ (x ≠ 0) ∧ (x ≠ y)) → (((x − 1) < y) = (x < y))

Theorem: remainder-difference-not-equal-lessp-fact (((x mod n) = 0) ∧ ((y mod n) = 0) ∧ (x ≠ (y − n)) ∧ (y ≮ n) ∧ (x ∈ N) ∧ (y ∈ N)) → ((x < (y − n)) = (x < y))

Event: Disable lessp-sub1-lessp-fact.

Theorem: lr-boundaryp-nodep-difference-node-size lr-boundary-offsetp (offset) → lr-boundary-offsetp (offset − lr-node-size)

Theorem: lr-boundary-offsetp-difference-not-equal-lessp-fact-1 (lr-boundary-offsetp (x) ∧ lr-boundary-offsetp (y) ∧ (x ≠ (y − lr-node-size)) ∧ (y ≮ lr-node-size) ∧ (x ∈ N) ∧ (y ∈ N)) → ((x < (y − lr-node-size)) = (x < y))

Theorem: member-lr-all-nodes-helper ((offset (max-addr) ≄ 0) ∧ (offset (addr) ∈ N) ∧ (cddr (addr) = nil) ∧ listp (addr) ∧ listp (untag (addr)) ∧ lr-boundary-nodep (addr) ∧ lr-boundary-nodep (max-addr) ∧ (area-name (addr) = area-name (max-addr)) ∧ (type (addr) = type (max-addr)) ∧ (addr ≠ sub-addr (max-addr, lr-node-size))) → ((offset (addr) < ((((offset (max-addr) − 1) − 1) − 1) − 1))

= (offset (addr) < offset (max-addr)))

Theorem: member-lr-all-nodes ((type (addr) = 'addr) ∧ (cddr (addr) = nil) ∧ listp (addr) ∧ lr-boundary-nodep (addr) ∧ (area-name (addr) = lr-heap-name) ∧ listp (untag (addr)) ∧ (offset (addr) ∈ N) ∧ (type (max-addr) = 'addr) ∧ (cddr (max-addr) = nil) ∧ listp (max-addr) ∧ lr-boundary-nodep (max-addr) ∧ (area-name (max-addr) = lr-heap-name) ∧ listp (untag (max-addr)) ∧ lr-boundary-offsetp (min-offset) ∧ (offset (addr) ≮ min-offset)) → ((addr ∈ lr-all-nodes (min-offset, max-addr))

= (offset (addr) < offset (max-addr)))

Event: Disable member-lr-all-nodes-helper.

Theorem: lr-all-nodes-nil (lr-all-nodes (min-offset, max-addr) = nil) = ((offset (max-addr) ≃ 0) ∨ (min-offset ≮ offset (max-addr)))

Theorem: delete-append delete (e, append (x, y)) = if e ∈ x then append (delete (e, x), y)

else append (x, delete (e, y)) endif

Theorem: lessp-difference-node-size-sub-addr-2 ((offset < offset (addr)) ∧ lr-boundary-nodep (addr) ∧ (offset (addr) ∈ N) ∧ lr-boundary-offsetp (offset)) → (((offset (addr) − identity (lr-node-size)) < offset) = f)

Theorem: not-member-lr-all-nodes-too-small-addr (lr-boundary-nodep (addr) ∧ lr-boundary-nodep (max-addr) ∧ lr-boundary-offsetp (min-offset) ∧ (offset (addr) < min-offset) ∧ (min-offset ∈ N)) → (addr ∉ lr-all-nodes (min-offset, max-addr))

Theorem: plist-delete plist (delete (e, x)) = delete (e, plist (x))

Theorem: lr-check-free-nodes-plist-node-list lr-check-free-nodes (addr, plist (node-list), data-seg, max-addr) = lr-check-free-nodes (addr, node-list, data-seg, max-addr)

Theorem: lr-all-nodes-offset-same-max lr-all-nodes (offset (addr), addr) = nil

Theorem: lr-all-nodes-offset-max-addr-opener-helper ((offset (addr) ≄ 0) ∧ lr-boundary-nodep (addr) ∧ (offset ∈ N) ∧ lr-boundary-offsetp (offset) ∧ (offset < offset (addr))) → ((offset < ((((offset (addr) − 1) − 1) − 1) − 1))

= (offset ≠ ((((offset (addr) − 1) − 1) − 1) − 1)))

Theorem: lr-all-nodes-lessp-max-addr-opener ((type (max-addr) = 'addr) ∧ listp (max-addr) ∧ (cddr (max-addr) = nil) ∧ listp (untag (max-addr)) ∧ (offset (max-addr) ∈ N) ∧ lr-boundary-nodep (max-addr) ∧ (area-name (max-addr) = lr-heap-name) ∧ (min-offset < offset (max-addr)) ∧ (min-offset ∈ N) ∧ lr-boundary-offsetp (min-offset)) → (lr-all-nodes (min-offset, max-addr)

= append (lr-all-nodes (min-offset + identity (lr-node-size), max-addr),

list (tag ('addr, cons (identity (lr-heap-name), min-offset)))))

Theorem: fetch-init-init-data-seg-generalized ((offset (addr) ∈ N) ∧ (type (addr) = 'addr) ∧ (cddr (addr) = nil) ∧ listp (addr) ∧ listp (untag (addr)) ∧ lr-boundary-nodep (addr) ∧ (area-name (addr) = lr-heap-name) ∧ (offset (addr) < (identity (lr-node-size) ∗ heap-size))

∧ (cdr (assoc (lr-heap-name, data-seg))

= lr-init-heap-contents (identity (tag ('addr,

cons (lr-heap-name, 0))),

heap-size)))

→ (fetch (add-addr (addr, identity (lr-ref-count-offset)), data-seg) = add-addr (addr, 4))

Theorem: lessp-difference-node-size-sub-addr-3 ((offset (addr) < (lr-node-size ∗ heap-size)) ∧ lr-boundary-nodep (addr) ∧ (offset (addr) ∈ N)) → (((((((identity (lr-node-size) ∗ heap-size) − 1) − 1) − 1) − 1)

< offset (addr))

= f)

Theorem: lr-boundary-nodep-tag-cons-times-lr-node-size lr-boundary-nodep (tag (x, cons (name, identity (lr-node-size) ∗ heap-size)))

Theorem: tag-type-name-offset-equal-same ((type (addr) = x) ∧ (cddr (addr) = nil) ∧ listp (untag (addr)) ∧ (offset (addr) ∈ N) ∧ (area-name (addr) = name)) → (tag (x, cons (name, offset (addr))) = addr)

Theorem: lr-check-free-nodes-lr-free-list-nodes-init-data-seg let init-data-seg be list (cons (area-name (lr-fp-addr), any1 ),

cons (area-name (lr-answer-addr), any2 ), cons (lr-heap-name,

lr-init-heap-contents (tag ('addr,

cons (lr-heap-name,

0)),

heap-size)))

in ((offset (max-addr) ≮ offset (addr)) ∧ (type (addr) = 'addr) ∧ (cddr (addr) = nil) ∧ listp (addr) ∧ listp (untag (addr)) ∧ (offset (addr) ∈ N) ∧ lr-boundary-nodep (addr) ∧ (area-name (addr) = lr-heap-name) ∧ (max-addr = lr-max-node (init-data-seg))) → lr-check-free-nodes (addr, lr-all-nodes (offset (addr), max-addr), list (cons (identity (area-name (lr-fp-addr)),

any1 ), cons (identity (area-name (lr-answer-addr)),

any2 ), cons (identity (lr-heap-name),

lr-init-heap-contents (identity (tag ('addr,

cons (lr-heap-name,

0))),

heap-size))),

max-addr) endlet

Event: Disable fetch-init-init-data-seg-generalized.

Theorem: lr-free-list-nodes-deposit-a-list-lr-nodep ((type (addr) = 'addr) ∧ (cddr (addr) = nil) ∧ listp (addr) ∧ adpp (untag (addr), data-seg) ∧ lr-boundary-nodep (addr) ∧ (area-name (addr) = lr-heap-name) ∧ (type (max-addr) = 'addr) ∧ (cddr (max-addr) = nil) ∧ listp (max-addr) ∧ adpp (untag (max-addr), data-seg) ∧ lr-boundary-nodep (max-addr) ∧ (area-name (max-addr) = lr-heap-name)) → (lr-free-list-nodes (max-addr,

deposit-a-list (list (a, b, c, d), addr, data-seg))

= lr-free-list-nodes (max-addr,

deposit (b,

add-addr (addr,

identity (lr-ref-count-offset)),

data-seg)))

Theorem: lr-check-free-nodes-deposit-a-list-lr-nodep ((type (addr) = 'addr) ∧ (cddr (addr) = nil) ∧ listp (addr) ∧ adpp (untag (addr), data-seg) ∧ lr-boundary-nodep (addr) ∧ (area-name (addr) = lr-heap-name) ∧ (type (max-addr) = 'addr) ∧ (cddr (max-addr) = nil)

∧ listp (max-addr) ∧ adpp (untag (max-addr), data-seg) ∧ lr-boundary-nodep (max-addr) ∧ (area-name (max-addr) = lr-heap-name) ∧ lr-node-listp (node-list, data-seg)) → (lr-check-free-nodes (addr1 ,

node-list,

deposit-a-list (list (a, b, c, d), addr, data-seg), max-addr)

= lr-check-free-nodes (addr1 , node-list, deposit (b,

add-addr (addr,

identity (lr-ref-count-offset)),

data-seg), max-addr))

Theorem: lr-all-nodes-not-lessp-min-offset-max-addr (min-offset ≮ offset (max-addr)) → (lr-all-nodes (min-offset, max-addr) = nil)

Theorem: fetch-init-init-data-seg-sub-addr (((identity (lr-node-size) ∗ heap-size) ≮ offset (addr)) ∧ (offset (addr) ∈ N) ∧ (cddr (addr) = nil) ∧ listp (addr) ∧ listp (untag (addr)) ∧ (type (addr) = 'addr) ∧ lr-boundary-nodep (addr) ∧ (area-name (addr) = lr-heap-name) ∧ ((offset (addr) − identity (lr-node-size))

< (lr-node-size ∗ heap-size)) ∧ (offset (addr) ≠ 0) ∧ (cdr (assoc (lr-heap-name, data-seg))

= lr-init-heap-contents (tag ('addr, cons (lr-heap-name, 0)), heap-size)))

→ (fetch (add-addr (sub-addr (addr, identity (lr-node-size)),

identity (lr-ref-count-offset)),

data-seg) = addr)

Theorem: lr-free-list-nodes-lr-init-heap-contents-generalized (lr-boundary-nodep (max-addr) ∧ (area-name (max-addr) = lr-heap-name) ∧ (type (max-addr) = 'addr)

∧ (cddr (max-addr) = nil) ∧ listp (max-addr) ∧ listp (untag (max-addr)) ∧ ((lr-node-size ∗ heap-size) ≮ offset (max-addr)) ∧ (cdr (assoc (lr-heap-name, data-seg))

= lr-init-heap-contents (identity (tag ('addr,

cons (lr-heap-name, 0))),

heap-size)))

→ (lr-free-list-nodes (max-addr, data-seg) = lr-all-nodes (0, max-addr))

Theorem: lr-free-list-nodes-lr-init-heap-contents (lr-boundary-nodep (max-addr) ∧ (area-name (max-addr) = lr-heap-name) ∧ (type (max-addr) = 'addr) ∧ (cddr (max-addr) = nil) ∧ listp (max-addr) ∧ listp (untag (max-addr)) ∧ ((lr-node-size ∗ heap-size) ≮ offset (max-addr))) → (lr-free-list-nodes (max-addr,

list (cons (identity (area-name (lr-fp-addr)), any1 ), cons (identity (area-name (lr-answer-addr)),

any2 ), cons (identity (lr-heap-name),

lr-init-heap-contents (identity (tag ('addr,

cons (lr-heap-name,

0))),

heap-size))))

= lr-all-nodes (0, max-addr))

Theorem: lr-node-listp-lr-all-nodes (lr-boundary-nodep (addr) ∧ (area-name (addr) = lr-heap-name) ∧ adpp (untag (addr), data-seg) ∧ (type (addr) = 'addr)) → lr-node-listp (lr-all-nodes (min-offset, addr), data-seg)

Theorem: plistp-lr-all-nodes plistp (lr-all-nodes (min-offset, max-addr))

Theorem: lr-free-list-nodes-lr-init-data-seg (heap-size ≮ 2) → (lr-free-list-nodes (tag ('addr,

cons (identity (lr-heap-name),

identity (lr-node-size) ∗ heap-size)),

lr-init-data-seg (heap-size))

= lr-all-nodes (identity (offset (add-addr (lr-f-addr, lr-node-size))),

                   tag ('addr,

cons (identity (lr-heap-name), identity (lr-node-size) ∗ heap-size))))

Theorem: lr-proper-free-listp-lr-init-data-seg-helper (heap-size ≮ 2) → lr-check-free-nodes (identity (add-addr (lr-f-addr, lr-node-size)),

lr-all-nodes (identity (offset (add-addr (lr-f-addr,

lr-node-size))),

                               tag ('addr,

cons (identity (lr-heap-name), identity (lr-node-size)

∗ heap-size))),

lr-init-data-seg (heap-size),

                     tag ('addr,

cons (identity (lr-heap-name), identity (lr-node-size) ∗ heap-size)))

Theorem: lr-proper-free-listp-lr-init-data-seg (heap-size ≮ 2) → lr-proper-free-listp (lr-init-data-seg (heap-size))

Theorem: definedp-lr-heap-name-lr-init-data-seg definedp (identity (lr-heap-name), lr-init-data-seg (heap-size))

Theorem: lr-proper-p-areasp-lr-heap-name-lr-init-data-seg lr-proper-p-areasp (lr-init-data-seg (heap-size))

Theorem: lr-proper-p-areasp-car-lr-init-data-seg-table lr-proper-p-areasp (data-seg) → lr-proper-p-areasp (car (lr-init-data-seg-table (params, data-seg, table)))

Theorem: lr-proper-p-areasp-car-lr-data-seg-table-list lr-proper-p-areasp (data-seg) → lr-proper-p-areasp (car (lr-data-seg-table-list (progs, data-seg, table)))

Theorem: definedp-table-definedp-car-lr-init-data-seg-table definedp (name, car (lr-init-data-seg-table (params, data-seg, table))) = definedp (name, data-seg)

Theorem: all-p-objects-lookup-cons-table (all-p-objects-lookup (list, table, p) ∧ p-objectp (y, p)) → all-p-objects-lookup (list, cons (cons (x, y), table), p)

Theorem: p-objectp-opener-alt-lr-proper-free-listp (lr-proper-free-listp (p-data-segment (p)) ∧ adpp (untag (lr-max-node (data-seg)), data-seg) ∧ lr-boundary-nodep (lr-max-node (data-seg)) ∧ (data-seg = p-data-segment (p))) → p-objectp (fetch (identity (lr-fp-addr), data-seg), p)

Theorem: p-objectp-lookup-deposit-a-list p-objectp (object,

p-state (pc, ctrl-stk, temp-stk, prog-seg, data-seg, max-ctrl-stk-size, max-temp-stk-size, word-size, psw))

→ p-objectp (object,

p-state (pc, ctrl-stk, temp-stk, prog-seg, deposit-a-list (stuff , addr, data-seg), max-ctrl-stk-size, max-temp-stk-size, word-size, psw))

Theorem: all-p-objects-lookup-deposit-a-list all-p-objects-lookup (list,

table,

p-state (pc, ctrl-stk, temp-stk, prog-seg, data-seg, max-ctrl-stk-size, max-temp-stk-size, word-size, psw))

→ all-p-objects-lookup (list, table, p-state (pc, ctrl-stk, temp-stk, prog-seg, deposit-a-list (stuff , addr, data-seg), max-ctrl-stk-size, max-temp-stk-size, word-size, psw))

Theorem: p-objectp-lookup-deposit p-objectp (object,

p-state (pc, ctrl-stk, temp-stk, prog-seg, data-seg, max-ctrl-stk-size, max-temp-stk-size, word-size, psw))

→ p-objectp (object,

p-state (pc, ctrl-stk, temp-stk, prog-seg, deposit (anything, addr, data-seg), max-ctrl-stk-size, max-temp-stk-size, word-size, psw))

Theorem: all-p-objects-lookup-deposit all-p-objects-lookup (list,

table, p-state (pc,

ctrl-stk, temp-stk, prog-seg, data-seg, max-ctrl-stk-size, max-temp-stk-size, word-size, psw))

→ all-p-objects-lookup (list, table, p-state (pc,

ctrl-stk, temp-stk, prog-seg, deposit (anything, addr, data-seg), max-ctrl-stk-size, max-temp-stk-size, word-size, psw))

Theorem: definedp-name-p-objectp-tag-0-lr-proper-p-areasp lr-proper-p-areasp (data-seg) → (p-objectp (list ('addr, cons (name, 0)),

p-state (pc, ctrl-stk, temp-stk, prog-seg, data-seg, max-ctrl-stk-size, max-temp-stk-size, word-size, psw))

= definedp (name, data-seg))

Theorem: all-p-objects-lookup-lr-compile-quote (all-p-objects-lookup (list,

table, p-state (pc,

ctrl-stk, temp-stk, prog-seg, data-seg, max-ctrl-stk-size, max-temp-stk-size, word-size, psw))

∧ lr-proper-free-listp (data-seg) ∧ lr-proper-p-areasp (data-seg) ∧ definedp (lr-heap-name, data-seg) ∧ lr-boundary-nodep (lr-max-node (data-seg))) → all-p-objects-lookup (list,

cdr (lr-compile-quote (flag, object, data-seg, table)), p-state (pc, ctrl-stk, temp-stk, prog-seg, car (lr-compile-quote (flag,

object, data-seg, table)),

max-ctrl-stk-size, max-temp-stk-size, word-size, psw))

Theorem: all-p-objects-lookup-lr-data-seg-table-body (all-p-objects-lookup (list,

table, p-state (pc,

ctrl-stk, temp-stk, prog-seg, data-seg, max-ctrl-stk-size, max-temp-stk-size, word-size, psw))

∧ lr-proper-free-listp (data-seg) ∧ lr-proper-p-areasp (data-seg) ∧ definedp (lr-heap-name, data-seg) ∧ lr-boundary-nodep (lr-max-node (data-seg))) → all-p-objects-lookup (list,

cdr (lr-data-seg-table-body (flag, body, data-seg, table)),

p-state (pc, ctrl-stk, temp-stk, prog-seg, car (lr-data-seg-table-body (flag,

body, data-seg, table)),

max-ctrl-stk-size, max-temp-stk-size, word-size,

psw))

Theorem: all-p-objects-lookup-lr-data-seg-table-list (all-p-objects-lookup (list,

table, p-state (pc,

ctrl-stk, temp-stk, prog-seg, data-seg, max-ctrl-stk-size, max-temp-stk-size, word-size, psw))

∧ lr-proper-free-listp (data-seg) ∧ lr-proper-p-areasp (data-seg) ∧ definedp (lr-heap-name, data-seg) ∧ lr-boundary-nodep (lr-max-node (data-seg))) → all-p-objects-lookup (list,

cdr (lr-data-seg-table-list (progs, data-seg, table)), p-state (pc,

ctrl-stk, temp-stk, prog-seg, car (lr-data-seg-table-list (progs,

data-seg, table)),

max-ctrl-stk-size, max-temp-stk-size, word-size, psw))

Theorem: p-objectp-lookup-lr-init-data-seg-table (p-objectp (object,

p-state (pc, ctrl-stk, temp-stk, prog-seg, data-seg, max-ctrl-stk-size, max-temp-stk-size, word-size, psw))

∧ lr-proper-free-listp (data-seg)

∧ lr-proper-p-areasp (data-seg) ∧ definedp (lr-heap-name, data-seg) ∧ lr-boundary-nodep (lr-max-node (data-seg))) → p-objectp (object,

p-state (pc, ctrl-stk, temp-stk, prog-seg, car (lr-init-data-seg-table (params, data-seg, table)), max-ctrl-stk-size, max-temp-stk-size, word-size, psw))

Theorem: assoc-definedp-table-lr-compile-quote definedp (object1 , table) → (assoc (object1 , cdr (lr-compile-quote (flag, object2 , data-seg, table)))

= assoc (object1 , table))

Theorem: assoc-definedp-table-lr-init-data-seg-table definedp (object, table) → (assoc (object, cdr (lr-init-data-seg-table (params, data-seg, table)))

= assoc (object, table))

Theorem: definedp-table-lr-compile-quote-self (flag ≠ 'list) → definedp (object, cdr (lr-compile-quote (flag, object, data-seg, table)))

Theorem: lr-s-similar-const-table-lr-good-pointerp-opener (lr-s-similar-const-table (table, data-seg) ∧ definedp (object, table)) → ((type (cdr (assoc (object, table))) = 'addr)

∧ (cddr (cdr (assoc (object, table))) = nil)

∧ listp (cdr (assoc (object, table)))

∧ adpp (untag (cdr (assoc (object, table))), data-seg) ∧ lr-boundary-nodep (cdr (assoc (object, table))) ∧ (area-name (cdr (assoc (object, table))) = identity (lr-heap-name))

∧ (type (fetch (add-addr (cdr (assoc (object, table)),

identity (lr-ref-count-offset)),

data-seg))

         = 'nat))

Theorem: lr-s-similar-const-table-deposit-lr-fp-addr (adpp (untag (lr-fp-addr), data-seg) ∧ lr-s-similar-const-table (table, data-seg))

→ lr-s-similar-const-table (table,

deposit (anything, identity (lr-fp-addr), data-seg))

Theorem: adpp-fetch-lr-fp-addr-car-lr-compile-quote (lr-proper-free-listp (data-seg) ∧ lr-proper-p-areasp (data-seg) ∧ definedp (lr-heap-name, data-seg) ∧ lr-boundary-nodep (lr-max-node (data-seg))) → adpp (untag (fetch (identity (lr-fp-addr),

car (lr-compile-quote (flag, object, data-seg, table)))),

data-seg)

Definition: lr-good-pointerp-tablep (table, data-seg) = if listp (table)

then lr-good-pointerp (cdar (table), data-seg)

∧ lr-good-pointerp-tablep (cdr (table), data-seg) else t endif

Theorem: lr-good-pointerp-tablep-definedp-table (lr-good-pointerp-tablep (table, data-seg) ∧ definedp (object, table)) → lr-good-pointerp (cdr (assoc (object, table)), data-seg)

Theorem: lr-proper-free-listp-opener-2-area-name-alt (lr-proper-free-listp (data-seg) ∧ adpp (untag (lr-max-node (data-seg)), data-seg) ∧ lr-boundary-nodep (lr-max-node (data-seg))) → (car (untag (fetch (identity (lr-fp-addr), data-seg))) = lr-heap-name)

Theorem: lr-good-pointerp-tablep-deposit-free-ptr lr-good-pointerp-tablep (table,

deposit (anything, identity (lr-fp-addr), data-seg))

= lr-good-pointerp-tablep (table, data-seg)

Theorem: add1-lr-boundary-nodep (lr-boundary-nodep (addr1 ) ∧ lr-boundary-nodep (addr2 )) → ((offset (addr1 ) = (1 + offset (addr2 ))) = f)

Theorem: lr-boundary-offsetp-plus lr-boundary-offsetp (n) → (lr-boundary-offsetp (m + n) = lr-boundary-offsetp (m))

Theorem: add1-add1-lr-boundary-nodep (lr-boundary-nodep (addr1 ) ∧ lr-boundary-nodep (addr2 )) → ((offset (addr1 ) = (1 + (1 + offset (addr2 )))) = f)

Theorem: lr-good-pointerp-tablep-deposit-a-list (lr-good-pointerp-tablep (table, data-seg) ∧ (offset (addr) ∈ N) ∧ lr-boundary-nodep (addr) ∧ (type (ref-count) = 'nat) ∧ (untag (ref-count) ∈ N) ∧ (area-name (addr) = lr-heap-name) ∧ (type (tag) = 'nat)) → lr-good-pointerp-tablep (table,

deposit-a-list (list (tag, ref-count, x, y), addr, data-seg))

Theorem: lr-good-pointerp-table-cons ((type (addr) = 'addr) ∧ (cddr (addr) = nil) ∧ listp (addr) ∧ adpp (untag (addr), data-seg) ∧ lr-boundary-nodep (addr) ∧ (area-name (addr) = lr-heap-name)) → (lr-good-pointerp-tablep (cons (cons (object, addr), table), data-seg)

= ((type (fetch (add-addr (addr, identity (lr-ref-count-offset)),

data-seg))

         = 'nat)

∧ lr-good-pointerp-tablep (table, data-seg)))

Theorem: lr-proper-free-listp-length-sub1-not-lessp (lr-proper-free-listp (data-seg) ∧ lr-proper-p-areasp (data-seg) ∧ definedp (lr-heap-name, data-seg) ∧ lr-boundary-nodep (lr-max-node (data-seg))) → ((length (cdr (assoc (identity (lr-heap-name), data-seg))) − 1)

≮ offset (fetch (identity (lr-fp-addr), car (lr-compile-quote (flag, object, data-seg, table)))))

Theorem: lr-minimum-heapp-lr-compile-quote (lr-proper-free-listp (data-seg) ∧ lr-proper-p-areasp (data-seg) ∧ definedp (lr-heap-name, data-seg) ∧ lr-boundary-nodep (lr-max-node (data-seg))) → (lr-minimum-heapp (car (lr-compile-quote (flag, object, data-seg, table)))

= lr-minimum-heapp (data-seg))

Definition: s-heap-reqs (flag, object, data-seg, table)

= if flag = 'list

then if listp (object)

then let pair be lr-compile-quote (t, car (object), data-seg, table)

in

s-heap-reqs (t, car (object), data-seg, table) + s-heap-reqs ('list,

cdr (object), car (pair), cdr (pair)) endlet

else 0 endif elseif definedp (object, table) then 0 elseif listp (object) then 1 + s-heap-reqs ('list,

list (car (object), cdr (object)), data-seg, table)

elseif object ∈ N then 1 elseif truep (object) then 1 else 0 endif

Event: Disable s-heap-reqs.

Definition: s-heap-reqs-body (flag, expr, data-seg, table) = if flag = 'list

then if listp (expr)

then let dst1 be lr-data-seg-table-body (t, car (expr), data-seg, table)

in

s-heap-reqs-body (t, car (expr), data-seg, table) + s-heap-reqs-body ('list,

cdr (expr), car (dst1 ), cdr (dst1 )) endlet

else 0 endif elseif listp (expr) then if (car (expr) = s-temp-fetch)

∨ (car (expr) = s-temp-eval) ∨ (car (expr) = s-temp-test) then s-heap-reqs-body (t, cadr (expr), data-seg, table) elseif car (expr) = 'quote then s-heap-reqs (t, cadr (expr), data-seg, table) else s-heap-reqs-body ('list, cdr (expr), data-seg, table) endif

else 0 endif

Definition: s-heap-reqs-list (progs, data-seg, table) = if listp (progs)

then s-heap-reqs-body (t, s-body (car (progs)), data-seg, table)

+ s-heap-reqs-list (cdr (progs),

car (lr-data-seg-table-body (t, s-body (car (progs)), data-seg, table)),

cdr (lr-data-seg-table-body (t, s-body (car (progs)), data-seg, table)))

else 0 endif

Definition: s-init-heap-reqs (params, data-seg, table) = if listp (params)

then s-heap-reqs (t, cdar (params), data-seg, table) + s-init-heap-reqs (cdr (params),

car (lr-compile-quote (t, cdar (params), data-seg, table)),

cdr (lr-compile-quote (t, cdar (params), data-seg, table)))

else 0 endif

Definition: s-total-heap-reqs (progs, params, heap-size) = let init-ds-table1 be lr-compile-quote ('list,

list (t, 0),

lr-init-data-seg (heap-size), list (cons (f, lr-f-addr)))

in

let init-ds-table2 be lr-init-data-seg-table (params, car (init-ds-table1 ),

cdr (init-ds-table1 ))

in

2

+ s-heap-reqs ('list, list (t, 0), lr-init-data-seg (heap-size), list (cons (f, lr-f-addr)))

+ s-init-heap-reqs (params, car (init-ds-table1 ), cdr (init-ds-table1 ))

+ s-heap-reqs-list (progs, car (init-ds-table2 ), cdr (init-ds-table2 )) endlet endlet

Definition: s-ws-reqs (flag, object, data-seg, table) = if flag = 'list

then if listp (object)

then let pair be lr-compile-quote (t, car (object), data-seg, table)

in

max (s-ws-reqs (t, car (object), data-seg, table),

s-ws-reqs ('list, cdr (object), car (pair), cdr (pair))) endlet

else 0 endif elseif definedp (object, table) then 0 elseif listp (object) then max (log (2, lr-cons-tag),

s-ws-reqs ('list, list (car (object), cdr (object)), data-seg, table))

elseif object ∈ N then max (log (2, lr-add1-tag), log (2, object)) elseif truep (object) then log (2, lr-true-tag) elseif falsep (object) then log (2, lr-false-tag) else 0 endif

Event: Disable s-ws-reqs.

Definition: s-ws-reqs-body (flag, expr, data-seg, table) = if flag = 'list

then if listp (expr)

then let dst1 be lr-data-seg-table-body (t, car (expr), data-seg, table)

in

max (s-ws-reqs-body (t, car (expr), data-seg, table),

s-ws-reqs-body ('list, cdr (expr), car (dst1 ), cdr (dst1 ))) endlet

else 0 endif elseif listp (expr) then if (car (expr) = s-temp-fetch)

∨ (car (expr) = s-temp-eval) ∨ (car (expr) = s-temp-test)

then s-ws-reqs-body (t, cadr (expr), data-seg, table)

elseif car (expr) = 'quote

then s-ws-reqs (t, cadr (expr), data-seg, table)

else s-ws-reqs-body ('list, cdr (expr), data-seg, table) endif else 0 endif

Definition: s-ws-reqs-list (progs, data-seg, table) = if listp (progs)

then max (s-ws-reqs-body (t, s-body (car (progs)), data-seg, table),

s-ws-reqs-list (cdr (progs),

car (lr-data-seg-table-body (t, s-body (car (progs)), data-seg, table)),

cdr (lr-data-seg-table-body (t, s-body (car (progs)), data-seg, table))))

else 0 endif

Definition: s-init-ws-reqs (params, data-seg, table) = if listp (params)

then max (s-ws-reqs (t, cdar (params), data-seg, table), s-init-ws-reqs (cdr (params), car (lr-compile-quote (t,

cdar (params), data-seg, table)),

cdr (lr-compile-quote (t, cdar (params), data-seg, table))))

else 0 endif

Definition: s-total-ws-reqs (progs, params, heap-size) = let init-ds-table1 be lr-compile-quote ('list,

list (t, 0),

lr-init-data-seg (heap-size), list (cons (f, lr-f-addr)))

in let init-ds-table2 be lr-init-data-seg-table (params,

car (init-ds-table1 ), cdr (init-ds-table1 ))

in max (s-ws-reqs ('list,

list (f, t, 0),

lr-init-data-seg (heap-size), nil), max (s-init-ws-reqs (params,

car (init-ds-table1 ), cdr (init-ds-table1 )),

max (s-ws-reqs-list (progs, car (init-ds-table2 ), cdr (init-ds-table2 )),

s-max-subr-reqs))) endlet endlet

Definition: s-restricted-objectp (flag, object) = if flag = 'list

then if listp (object)

then s-restricted-objectp (t, car (object))

∧ s-restricted-objectp ('list, cdr (object)) else t endif

elseif object = t then t elseif object = f then t elseif listp (object) then s-restricted-objectp ('list, list (car (object), cdr (object))) elseif object ∈ N then t else f endif

Definition: s-data-seg-body-restrictedp (flag, expr) = if flag = 'list

then if listp (expr)

then s-data-seg-body-restrictedp (t, car (expr))

∧ s-data-seg-body-restrictedp ('list, cdr (expr)) else t endif

elseif listp (expr)

then if (car (expr) = s-temp-fetch)

∨ (car (expr) = s-temp-eval) ∨ (car (expr) = s-temp-test)

then s-data-seg-body-restrictedp (t, cadr (expr))

elseif car (expr) = 'quote

then s-restricted-objectp (t, cadr (expr))

else s-data-seg-body-restrictedp ('list, cdr (expr)) endif else t endif

Definition: s-data-seg-list-restrictedp (progs) = if listp (progs)

then s-data-seg-body-restrictedp (t, s-body (car (progs))) ∧ s-data-seg-list-restrictedp (cdr (progs))

else t endif

Definition: s-init-data-seg-restrictedp (params) = if listp (params)

then s-restricted-objectp (t, cdar (params))

∧ s-init-data-seg-restrictedp (cdr (params)) else t endif

Definition: s-restrictedp (progs, params) = (s-init-data-seg-restrictedp (params)

∧ s-data-seg-list-restrictedp (progs))

Theorem: lr-minimum-heapp-not-equal-length-1 lr-minimum-heapp (data-seg) → (length (cdr (assoc (identity (lr-heap-name), data-seg))) ≠ 1)

Theorem: lr-count-free-nodes-at-most length (node-list) ≮ lr-count-free-nodes (addr, node-list, data-seg)

Theorem: lr-proper-free-listp-lr-count-free-nodes-max-addr (lr-proper-free-listp (data-seg) ∧ definedp (lr-heap-name, data-seg) ∧ lr-boundary-nodep (lr-max-node (data-seg)) ∧ lr-proper-p-areasp (data-seg) ∧ (length (cdr (assoc (lr-heap-name, data-seg)))

= (1 + offset (fetch (lr-fp-addr, data-seg)))) ∧ (max-addr = lr-max-node (data-seg))) → (lr-count-free-nodes (fetch (identity (lr-fp-addr), data-seg),

lr-free-list-nodes (max-addr, data-seg), data-seg)

= 0)

Event: Disable lr-count-free-nodes-at-most.

Theorem: lr-count-free-nodes-deposit-a-list-lr-nodep ((type (addr1 ) = 'addr) ∧ (cddr (addr1 ) = nil) ∧ listp (addr1 ) ∧ adpp (untag (addr1 ), data-seg) ∧ lr-boundary-nodep (addr1 ) ∧ (area-name (addr1 ) = lr-heap-name) ∧ (type (ref-count) = 'nat) ∧ (untag (ref-count) ∈ N) ∧ lr-boundary-nodep (lr-max-node (data-seg)) ∧ adpp (untag (lr-max-node (data-seg)), data-seg) ∧ lr-node-listp (node-list, data-seg) ∧ (addr1 ∉ node-list)) → (lr-count-free-nodes (addr2 ,

node-list,

deposit-a-list (list (x, ref-count, y, z), addr1 , data-seg))

= lr-count-free-nodes (addr2 , delete (addr1 , node-list), data-seg))

Theorem: lr-proper-free-listp-member-free-addr-lr-free-list-nodes (adpp (untag (lr-max-node (data-seg)), data-seg) ∧ lr-boundary-nodep (lr-max-node (data-seg)) ∧ (max-addr = lr-max-node (data-seg)) ∧ (offset (fetch (lr-fp-addr, data-seg))

< (length (cdr (assoc (lr-heap-name, data-seg))) − 1)) ∧ lr-proper-free-listp (data-seg)) → (fetch (identity (lr-fp-addr), data-seg)

∈ lr-free-list-nodes (max-addr, data-seg))

Theorem: lr-count-free-nodes-lr-compile-quote-s-heap-reqs-help1 (adpp (untag (lr-max-node (data-seg)), data-seg) ∧ lr-boundary-nodep (lr-max-node (data-seg)) ∧ (offset (fetch (lr-fp-addr, data-seg))

< (length (cdr (assoc (lr-heap-name, data-seg))) − 1)) ∧ lr-proper-free-listp (data-seg) ∧ lr-proper-p-areasp (data-seg) ∧ (max-addr = lr-max-node (data-seg))) → (lr-count-free-nodes (fetch (identity (lr-fp-addr), data-seg),

lr-free-list-nodes (max-addr, data-seg), data-seg)

= (1 + lr-count-free-nodes (fetch (add-addr (fetch (identity (lr-fp-addr),

data-seg), identity (lr-ref-count-offset)),

data-seg), delete (fetch (identity (lr-fp-addr), data-seg),

lr-free-list-nodes (max-addr,

data-seg)),

data-seg)))

Theorem: lr-proper-free-listp-lr-count-free-nodes-max-addr-alt (lr-proper-free-listp (data-seg) ∧ definedp (lr-heap-name, data-seg) ∧ lr-boundary-nodep (lr-max-node (data-seg)) ∧ lr-proper-p-areasp (data-seg) ∧ (offset (fetch (lr-fp-addr, data-seg))

≮ (length (cdr (assoc (lr-heap-name, data-seg))) − 1)) ∧ (max-addr = lr-max-node (data-seg))) → (lr-count-free-nodes (fetch (identity (lr-fp-addr), data-seg),

lr-free-list-nodes (max-addr, data-seg), data-seg)

= 0)

Theorem: s-heap-reqs-object-t ((flag ≠ 'list) ∧ (¬ definedp (t, table))) → (s-heap-reqs (flag, t, data-seg, table) = 1)

Theorem: lessp-lr-boundary-offsetp-nodep-plus-node-size-fact-1 (lr-boundary-offsetp (offset) ∧ lr-boundary-nodep (addr)) → ((offset < (identity (lr-node-size) + offset (addr)))

= (offset (addr) ≮ offset))

Theorem: lr-count-free-nodes-lr-compile-quote-s-heap-reqs (lr-proper-free-listp (data-seg)

∧ lr-proper-p-areasp (data-seg) ∧ definedp (lr-heap-name, data-seg) ∧ lr-minimum-heapp (data-seg) ∧ lr-boundary-nodep (lr-max-node (data-seg)) ∧ (lr-count-free-nodes (fetch (lr-fp-addr, data-seg),

lr-free-list-nodes (lr-max-node (data-seg), data-seg),

data-seg) ≮ s-heap-reqs (flag, object, data-seg, table)))

→ ((lr-count-free-nodes (fetch (lr-fp-addr,

car (lr-compile-quote (flag, object, data-seg, table))),

lr-free-list-nodes (lr-max-node (data-seg),

car (lr-compile-quote (flag, object, data-seg, table))),

car (lr-compile-quote (flag, object, data-seg, table)))

+ s-heap-reqs (flag, object, data-seg, table))

= lr-count-free-nodes (fetch (lr-fp-addr, data-seg),

lr-free-list-nodes (lr-max-node (data-seg), data-seg),

data-seg))

Theorem: lr-compile-quote-lr-good-pointerp-tablep-help-1 let ccar be lr-compile-quote (t, object, data-seg, table) in (lr-proper-free-listp (data-seg) ∧ lr-proper-p-areasp (data-seg) ∧ definedp (lr-heap-name, data-seg) ∧ lr-boundary-nodep (lr-max-node (data-seg)) ∧ lr-minimum-heapp (data-seg) ∧ (lr-count-free-nodes (fetch (identity (lr-fp-addr), data-seg),

lr-free-list-nodes (lr-max-node (data-seg), data-seg),

data-seg) ≮ (s-heap-reqs (t, object, data-seg, table) + x)))

→ (lr-count-free-nodes (fetch (identity (lr-fp-addr), car (ccar)),

lr-free-list-nodes (lr-max-node (data-seg), car (ccar)),

car (ccar))

≮ x) endlet Theorem: s-heap-reqs-flag-list-nil-opener s-heap-reqs ('list, nil, data-seg, table) = 0

Theorem: lr-compile-quote-flag-list-nil-opener lr-compile-quote ('list, nil, data-seg, table) = cons (data-seg, table)

Theorem: s-heap-reqs-flag-list-cons-opener s-heap-reqs ('list, cons (x, y), data-seg, table) = (s-heap-reqs (t, x, data-seg, table)

+ s-heap-reqs ('list, y, car (lr-compile-quote (t, x, data-seg, table)), cdr (lr-compile-quote (t, x, data-seg, table))))

Theorem: lr-compile-quote-flag-list-cons-opener lr-compile-quote ('list, cons (x, y), data-seg, table) = lr-compile-quote ('list,

y,

car (lr-compile-quote (t, x, data-seg, table)), cdr (lr-compile-quote (t, x, data-seg, table)))

Theorem: lr-compile-quote-lr-good-pointerp-tablep-help-2 (lr-proper-free-listp (data-seg) ∧ lr-proper-p-areasp (data-seg) ∧ definedp (lr-heap-name, data-seg) ∧ lr-boundary-nodep (lr-max-node (data-seg)) ∧ lr-minimum-heapp (data-seg) ∧ (lr-count-free-nodes (fetch (lr-fp-addr, data-seg),

lr-free-list-nodes (lr-max-node (data-seg), data-seg),

data-seg)

≠ 0) ∧ (lr-count-free-nodes (fetch (add-addr (fetch (lr-fp-addr, data-seg),

lr-ref-count-offset),

data-seg), delete (fetch (lr-fp-addr, data-seg),

lr-free-list-nodes (lr-max-node (data-seg), data-seg)),

data-seg)

≮ s-heap-reqs ('list, list (car (object), cdr (object)), data-seg, table))

∧ listp (object)) → ((length (cdr (assoc (identity (lr-heap-name), data-seg))) − 1)

≮ (offset (fetch (identity (lr-fp-addr),

car (lr-compile-quote ('list,

list (car (object), cdr (object)),

data-seg, table))))

+ identity (lr-node-size)))

Event: Disable s-heap-reqs-flag-list-cons-opener.

Event: Disable lr-compile-quote-flag-list-cons-opener.

Theorem: lr-compile-quote-lr-good-pointerp-tablep-help-3 (lr-proper-free-listp (data-seg) ∧ lr-proper-p-areasp (data-seg) ∧ definedp (lr-heap-name, data-seg) ∧ lr-boundary-nodep (lr-max-node (data-seg)) ∧ lr-minimum-heapp (data-seg) ∧ (lr-count-free-nodes (fetch (lr-fp-addr, data-seg),

lr-free-list-nodes (lr-max-node (data-seg), data-seg),

data-seg)

≮ 1)) → ((length (cdr (assoc (identity (lr-heap-name), data-seg))) − 1)

≮ (offset (fetch (identity (lr-fp-addr), data-seg)) + identity (lr-node-size)))

Theorem: lr-compile-quote-lr-good-pointerp-tablep (lr-proper-free-listp (data-seg) ∧ lr-proper-p-areasp (data-seg) ∧ definedp (lr-heap-name, data-seg) ∧ lr-boundary-nodep (lr-max-node (data-seg)) ∧ lr-minimum-heapp (data-seg) ∧ lr-good-pointerp-tablep (table, data-seg) ∧ s-restricted-objectp (flag, object) ∧ (lr-count-free-nodes (fetch (lr-fp-addr, data-seg),

lr-free-list-nodes (lr-max-node (data-seg), data-seg),

data-seg) ≮ s-heap-reqs (flag, object, data-seg, table))

∧ definedp (f, table)) → lr-good-pointerp-tablep (cdr (lr-compile-quote (flag,

object, data-seg, table)),

car (lr-compile-quote (flag, object, data-seg, table)))

Theorem: lr-nodep-car-lr-compile-quote lr-nodep (addr, data-seg) → lr-nodep (addr, car (lr-compile-quote (flag, object, data-seg, table)))

Theorem: lr-proper-free-listp-opener-2-lr-nodep (lr-proper-free-listp (data-seg) ∧ adpp (untag (lr-max-node (data-seg)), data-seg) ∧ lr-boundary-nodep (lr-max-node (data-seg)) ∧ (addr = fetch (identity (lr-fp-addr), data-seg))) → lr-nodep (addr, data-seg)

Theorem: lr-nodep-deposit-a-list lr-nodep (addr1 , data-seg) → lr-nodep (addr1 , deposit-a-list (list, addr2 , data-seg))

Definition: induct-hint-16 (object, list, data-seg, table) = if list ≃ nil then t

elseif object = car (list) then t else induct-hint-16 (object,

cdr (list),

car (lr-compile-quote (t, car (list), data-seg, table)),

cdr (lr-compile-quote (t, car (list), data-seg, table))) endif

Theorem: definedp-object-cdr-lr-compile-quote-list (object ∈ list) → definedp (object, cdr (lr-compile-quote ('list, list, data-seg, table)))

Theorem: lr-good-pointerp-cdr-assoc-car-lr-compile-quote-list (lr-proper-free-listp (data-seg) ∧ lr-proper-p-areasp (data-seg) ∧ definedp (lr-heap-name, data-seg)

∧ lr-boundary-nodep (lr-max-node (data-seg)) ∧ lr-minimum-heapp (data-seg) ∧ lr-good-pointerp-tablep (table, data-seg) ∧ s-restricted-objectp ('list, object-list) ∧ (lr-count-free-nodes (fetch (lr-fp-addr, data-seg),

lr-free-list-nodes (lr-max-node (data-seg), data-seg),

data-seg)

≠ 0) ∧ ((lr-count-free-nodes (fetch (lr-fp-addr, data-seg),

lr-free-list-nodes (lr-max-node (data-seg), data-seg),

data-seg) − 1) ≮ s-heap-reqs ('list, object-list, data-seg, table))

∧ definedp (f, table) ∧ (object ∈ object-list)) → lr-good-pointerp (cdr (assoc (object,

cdr (lr-compile-quote ('list, object-list, data-seg, table)))),

car (lr-compile-quote ('list, object-list, data-seg, table)))

Theorem: lr-good-pointerp-deposit-non-ref-not-good-pointerp (lr-boundary-nodep (addr) ∧ adpp (untag (addr), data-seg) ∧ (area-name (addr) = 'heap) ∧ (type (addr) = 'addr) ∧ (cddr (addr) = nil) ∧ listp (addr) ∧ (n < lr-node-size) ∧ (n ≠ lr-ref-count-offset) ∧ definedp (lr-heap-name, data-seg) ∧ lr-good-pointerp (good-pointer, data-seg) ∧ (type (fetch (add-addr (addr, lr-ref-count-offset), data-seg)) ≠ 'nat)) → lr-good-pointerp (good-pointer, deposit (x, add-addr (addr, n), data-seg))

Theorem: lr-good-pointerp-deposit-ref-count-not-good-pointerp (lr-boundary-nodep (addr) ∧ adpp (untag (addr), data-seg) ∧ (area-name (addr) = 'heap)

∧ (type (addr) = 'addr) ∧ (cddr (addr) = nil) ∧ listp (addr) ∧ (type (x) = 'nat) ∧ definedp (lr-heap-name, data-seg) ∧ lr-good-pointerp (good-pointer, data-seg) ∧ (type (fetch (add-addr (addr, lr-ref-count-offset), data-seg)) ≠ 'nat)) → lr-good-pointerp (good-pointer,

deposit (x, add-addr (addr, identity (lr-ref-count-offset)), data-seg))

Theorem: lr-good-pointerp-deposit-non-add-addr-not-good-pointerp (lr-boundary-nodep (addr) ∧ adpp (untag (addr), data-seg) ∧ (area-name (addr) = 'heap) ∧ (type (addr) = 'addr) ∧ (cddr (addr) = nil) ∧ listp (addr) ∧ definedp (lr-heap-name, data-seg) ∧ lr-good-pointerp (good-pointer, data-seg) ∧ (type (fetch (add-addr (addr, lr-ref-count-offset), data-seg)) ≠ 'nat)) → lr-good-pointerp (good-pointer, deposit (x, addr, data-seg))

Theorem: lr-check-numberp-addrp-deposit-a-list-cons-same-addr ((type (addr) = 'addr) ∧ (cddr (addr) = nil) ∧ listp (addr) ∧ adpp (untag (addr), data-seg) ∧ lr-boundary-nodep (addr) ∧ (area-name (addr) = 'heap) ∧ (offset (addr) ≮ (lr-node-size + offset (lr-f-addr))) ∧ (type (fetch (add-addr (addr, lr-ref-count-offset), data-seg))

    = 'addr)

∧ lr-good-pointerp (good-pointer, data-seg) ∧ definedp ('heap, data-seg) ∧ lr-proper-p-areasp (data-seg) ∧ (type (ref-count) = 'nat) ∧ (untag (ref-count) ∈ N) ∧ (type (tagged-number) = 'nat) ∧ (untag (tagged-number) ∈ N)) → lr-check-numberp-addrp (addr,

deposit-a-list (list (identity (tag ('nat, lr-add1-tag)), ref-count, tagged-number, good-pointer),

addr, data-seg))

Theorem: lr-proper-heapp-nodep-deposit-a-list-numberp (lr-nodep (max-addr, data-seg) ∧ lr-nodep (addr, data-seg) ∧ lr-proper-heapp-nodep (max-addr, data-seg) ∧ (type (fetch (add-addr (addr, lr-ref-count-offset), data-seg)) ≠ 'nat) ∧ lr-good-pointerp (good-pointer, data-seg) ∧ adpp (untag (lr-max-node (data-seg)), data-seg) ∧ lr-proper-p-areasp (data-seg) ∧ (type (ref-count) = 'nat) ∧ (untag (ref-count) ∈ N) ∧ (type (tagged-number) = 'nat) ∧ (untag (tagged-number) ∈ N)) → lr-proper-heapp-nodep (max-addr,

deposit-a-list (list (identity (tag ('nat,

lr-add1-tag)),

ref-count,

tagged-number, good-pointer),

addr, data-seg))

Theorem: lr-proper-heapp2-deposit-a-list-numberp (lr-nodep (max-addr, data-seg) ∧ lr-nodep (addr, data-seg) ∧ lr-proper-heapp2 (max-addr, data-seg) ∧ (type (fetch (add-addr (addr, lr-ref-count-offset), data-seg)) ≠ 'nat) ∧ lr-good-pointerp (good-pointer, data-seg) ∧ adpp (untag (lr-max-node (data-seg)), data-seg) ∧ lr-proper-p-areasp (data-seg) ∧ (type (tag) = 'nat) ∧ (untag (tag) ∈ N) ∧ (type (tagged-number) = 'nat) ∧ (untag (tagged-number) ∈ N)) → lr-proper-heapp2 (max-addr,

deposit-a-list (list (identity (tag ('nat, lr-add1-tag)), tag, tagged-number, good-pointer), addr, data-seg))

Theorem: lr-good-pointerp-lr-undef-addr (lr-minimum-heapp (data-seg) ∧ lr-proper-p-areasp (data-seg) ∧ lr-proper-heapp2 (lr-max-node (data-seg), data-seg) ∧ lr-nodep (lr-max-node (data-seg), data-seg)) → lr-good-pointerp (identity (lr-undef-addr), data-seg)

Theorem: lr-proper-heapp-nodep-deposit-a-list-truep (lr-nodep (max-addr, data-seg) ∧ lr-nodep (addr, data-seg) ∧ lr-proper-heapp-nodep (max-addr, data-seg) ∧ (type (fetch (add-addr (addr, lr-ref-count-offset), data-seg)) ≠ 'nat) ∧ lr-good-pointerp (good-pointer1 , data-seg) ∧ lr-good-pointerp (good-pointer2 , data-seg) ∧ adpp (untag (lr-max-node (data-seg)), data-seg) ∧ lr-proper-p-areasp (data-seg) ∧ (type (ref-count) = 'nat) ∧ (untag (ref-count) ∈ N)) → lr-proper-heapp-nodep (max-addr,

deposit-a-list (list (identity (tag ('nat,

lr-true-tag)),

ref-count, good-pointer1 , good-pointer2 ),

addr, data-seg))

Theorem: lr-proper-heapp2-deposit-a-list-truep (lr-nodep (max-addr, data-seg) ∧ lr-nodep (addr, data-seg) ∧ lr-proper-heapp2 (max-addr, data-seg) ∧ (type (fetch (add-addr (addr, lr-ref-count-offset), data-seg)) ≠ 'nat) ∧ lr-good-pointerp (good-pointer1 , data-seg) ∧ lr-good-pointerp (good-pointer2 , data-seg) ∧ adpp (untag (lr-max-node (data-seg)), data-seg) ∧ lr-proper-p-areasp (data-seg) ∧ (type (tag) = 'nat) ∧ (untag (tag) ∈ N)) → lr-proper-heapp2 (max-addr,

deposit-a-list (list (identity (tag ('nat, lr-true-tag)), tag, good-pointer1 ,

good-pointer2 ), addr, data-seg))

Theorem: lr-compile-quote-preserves-lr-proper-heapp2 (lr-proper-free-listp (data-seg) ∧ lr-proper-p-areasp (data-seg) ∧ lr-nodep (lr-max-node (data-seg), data-seg) ∧ definedp (lr-heap-name, data-seg) ∧ lr-boundary-nodep (lr-max-node (data-seg)) ∧ lr-good-pointerp-tablep (table, data-seg) ∧ s-restricted-objectp (flag, object) ∧ lr-minimum-heapp (data-seg) ∧ lr-proper-heapp2 (lr-max-node (data-seg), data-seg) ∧ definedp (f, table) ∧ (lr-count-free-nodes (fetch (lr-fp-addr, data-seg),

lr-free-list-nodes (lr-max-node (data-seg), data-seg),

data-seg) ≮ s-heap-reqs (flag, object, data-seg, table)))

→ lr-proper-heapp2 (lr-max-node (data-seg), car (lr-compile-quote (flag, object, data-seg, table)))

Theorem: plistp-pair-formals-with-addresses plistp (pair-formals-with-addresses (formals, table))

Theorem: strip-cars-pair-formals-with-addresses strip-cars (pair-formals-with-addresses (formals, table)) = strip-cars (formals)

Theorem: strip-cars-lr-make-initial-temps strip-cars (lr-make-initial-temps (temp-vars)) = plist (temp-vars)

Theorem: lr-s-similar-const-table-implies-lr-good-pointerp-tablep lr-s-similar-const-table (table, data-seg) → lr-good-pointerp-tablep (table, data-seg)

Theorem: lr-s-similar-const-table-deposit-cons (lr-proper-heapp (data-seg) ∧ lr-s-similar-const-table (table, data-seg) ∧ lr-proper-p-areasp (data-seg)) → lr-s-similar-const-table (table,

deposit-a-list (list (x0 , x1 , x2 , x3 ),

fetch (identity (lr-fp-addr),

data-seg), data-seg))

Theorem: lr-valp-deposit-a-list-cons-cons (listp (object) ∧ lr-proper-p-areasp (data-seg) ∧ lr-proper-heapp (data-seg) ∧ lr-s-similar-const-table (table, data-seg) ∧ (type (ref-count) = 'nat) ∧ (untag (ref-count) ∈ N) ∧ definedp (car (object), table) ∧ definedp (cdr (object), table) ∧ definedp (lr-heap-name, data-seg) ∧ (addr = fetch (identity (lr-fp-addr), data-seg))) → lr-valp (object,

addr,

deposit-a-list (list (identity (tag ('nat, lr-cons-tag)), ref-count, cdr (assoc (car (object), table)), cdr (assoc (cdr (object), table))),

addr, data-seg))

Theorem: lr-valp-deposit-a-list-cons-numberp ((object ∈ N) ∧ lr-proper-p-areasp (data-seg) ∧ lr-proper-heapp (data-seg) ∧ (type (ref-count) = 'nat) ∧ (untag (ref-count) ∈ N) ∧ definedp (lr-heap-name, data-seg) ∧ (addr = fetch (identity (lr-fp-addr), data-seg))) → lr-valp (object,

addr,

deposit-a-list (list (identity (tag ('nat, lr-add1-tag)), ref-count, tag ('nat, object), identity (lr-undef-addr)),

addr, data-seg))

Theorem: lr-compile-quote-preserves-lr-valp (lr-proper-p-areasp (data-seg) ∧ lr-good-pointerp-tablep (table, data-seg) ∧ s-restricted-objectp (flag, object) ∧ lr-minimum-heapp (data-seg) ∧ lr-nodep (lr-max-node (data-seg), data-seg) ∧ lr-proper-free-listp (data-seg)

∧ lr-proper-heapp2 (lr-max-node (data-seg), data-seg) ∧ definedp (f, table) ∧ (lr-count-free-nodes (fetch (lr-fp-addr, data-seg),

lr-free-list-nodes (lr-max-node (data-seg), data-seg),

data-seg) ≮ s-heap-reqs (flag, object, data-seg, table))

∧ lr-valp (value, addr, data-seg)) → lr-valp (value, addr, car (lr-compile-quote (flag, object, data-seg, table)))

Theorem: lr-compile-quote-preserves-lr-proper-heapp (lr-proper-p-areasp (data-seg) ∧ lr-good-pointerp-tablep (table, data-seg) ∧ lr-proper-heapp (data-seg) ∧ s-restricted-objectp (flag, object) ∧ definedp (f, table) ∧ (lr-count-free-nodes (fetch (lr-fp-addr, data-seg),

lr-free-list-nodes (lr-max-node (data-seg), data-seg),

data-seg) ≮ s-heap-reqs (flag, object, data-seg, table)))

→ lr-proper-heapp (car (lr-compile-quote (flag, object, data-seg, table)))

Theorem: lr-valp-deposit-a-list-cons-truep (lr-proper-p-areasp (data-seg) ∧ lr-proper-heapp (data-seg) ∧ (type (ref-count) = 'nat) ∧ (untag (ref-count) ∈ N) ∧ definedp (lr-heap-name, data-seg) ∧ (addr = fetch (identity (lr-fp-addr), data-seg))) → lr-valp (t,

addr,

deposit-a-list (list (identity (tag ('nat, lr-true-tag)), ref-count, identity (lr-undef-addr), identity (lr-undef-addr)),

addr, data-seg))

Theorem: lr-s-similar-const-table-lr-compile-quote (lr-proper-p-areasp (data-seg) ∧ lr-proper-heapp (data-seg) ∧ lr-s-similar-const-table (table, data-seg) ∧ s-restricted-objectp (flag, object) ∧ definedp (f, table)

∧ (lr-count-free-nodes (fetch (lr-fp-addr, data-seg),

lr-free-list-nodes (lr-max-node (data-seg), data-seg),

data-seg) ≮ s-heap-reqs (flag, object, data-seg, table)))

→ lr-s-similar-const-table (cdr (lr-compile-quote (flag, object, data-seg, table)),

car (lr-compile-quote (flag, object, data-seg, table)))

Theorem: p-objectp-cdr-assoc-car-lr-compile-quote (lr-proper-p-areasp (data-seg) ∧ lr-proper-heapp (data-seg) ∧ lr-s-similar-const-table (table, data-seg) ∧ s-restricted-objectp (flag, object) ∧ (word-size ≮ s-ws-reqs (flag, object, data-seg, table)) ∧ definedp (f, table) ∧ (lr-count-free-nodes (fetch (lr-fp-addr, data-seg),

lr-free-list-nodes (lr-max-node (data-seg), data-seg),

data-seg) ≮ s-heap-reqs (flag, object, data-seg, table))

∧ (flag ≠ 'list)) → p-objectp (cdr (assoc (object,

cdr (lr-compile-quote (flag, object, data-seg, table)))),

p-state (pc, ctrl-stk, temp-stk, prog-seg, car (lr-compile-quote (flag, object, data-seg, table)), max-ctrl-stk-size, max-temp-stk-size, word-size, psw))

Theorem: lr-count-free-nodes-s-init-heap-reqs let ccar be lr-compile-quote (t, object, data-seg, table) in (lr-proper-p-areasp (data-seg) ∧ lr-proper-heapp (data-seg)

∧ lr-s-similar-const-table (table, data-seg) ∧ (lr-count-free-nodes (fetch (lr-fp-addr, data-seg),

lr-free-list-nodes (lr-max-node (data-seg), data-seg),

data-seg)

≮ (s-heap-reqs (t, object, data-seg, table)

+ s-init-heap-reqs (params, car (ccar), cdr (ccar)))))

→ (lr-count-free-nodes (fetch (identity (lr-fp-addr), car (ccar)),

lr-free-list-nodes (lr-max-node (data-seg), car (ccar)),

car (ccar))

≮ s-init-heap-reqs (params, car (ccar), cdr (ccar))) endlet

Theorem: all-p-objects-lookup-strip-cdrs-lr-init-data-seg-table (lr-proper-p-areasp (data-seg) ∧ lr-proper-heapp (data-seg) ∧ lr-s-similar-const-table (table, data-seg) ∧ definedp (f, table) ∧ definedp (t, table) ∧ s-init-data-seg-restrictedp (params) ∧ (word-size ≮ s-init-ws-reqs (params, data-seg, table)) ∧ (lr-count-free-nodes (fetch (lr-fp-addr, data-seg),

lr-free-list-nodes (lr-max-node (data-seg), data-seg),

data-seg) ≮ s-init-heap-reqs (params, data-seg, table)))

→ all-p-objects-lookup (strip-cdrs (params), cdr (lr-init-data-seg-table (params, data-seg, table)), p-state (pc,

ctrl-stk, temp-stk, prog-seg, car (lr-init-data-seg-table (params,

data-seg, table)),

max-ctrl-stk-size, max-temp-stk-size, word-size, psw))

Theorem: lr-minimum-heapp-lr-init-data-seg (heap-size ≮ 4) → lr-minimum-heapp (lr-init-data-seg (heap-size))

Theorem: adpp-cons-heap-name-node-size-lr-init-data-seg (heap-size ≮ 2)

→ adpp (cons (identity (lr-heap-name), identity (lr-node-size)

∗ heap-size),

lr-init-data-seg (heap-size))

Theorem: lr-check-f-addrp-lr-undef-addr-lr-init-data-seg ((offset (addr) = identity (offset (lr-undef-addr))) ∧ (type (addr) = 'addr) ∧ (cddr (addr) = nil) ∧ listp (addr) ∧ (area-name (addr) = lr-heap-name) ∧ adpp (untag (addr), data-seg)) → lr-check-undef-addrp (addr, data-seg)

Theorem: fetch-offset-lr-t-addr-ref-count-offset-compile-quote-t ((type (addr) = 'addr) ∧ (cddr (addr) = nil) ∧ listp (addr) ∧ (area-name (addr) = lr-heap-name) ∧ adpp (untag (addr), data-seg) ∧ lr-boundary-nodep (addr) ∧ (¬ definedp (t, table)) ∧ lr-proper-free-listp (data-seg) ∧ lr-boundary-nodep (lr-max-node (data-seg)) ∧ (offset (fetch (lr-fp-addr, data-seg)) < lr-minimum-heap-size) ∧ lr-proper-p-areasp (data-seg) ∧ ((length (cdr (assoc (lr-heap-name, data-seg))) − 1)

≮ (offset (addr) + lr-node-size))) → (fetch (add-addr (addr, identity (lr-ref-count-offset)),

car (lr-compile-quote (t, t, data-seg, table))) = if offset (addr) = offset (fetch (lr-fp-addr, data-seg))

then identity (tag ('nat, 1))

else fetch (add-addr (addr, identity (lr-ref-count-offset)), data-seg) endif)

Theorem: definedp-cdr-lr-compile-quote-t definedp (x, cdr (lr-compile-quote (t, t, data-seg, table))) = ((x = t) ∨ definedp (x, table))

Theorem: fetch-lr-fp-addr-compile-quote-t ((¬ definedp (t, table)) ∧ lr-proper-free-listp (data-seg) ∧ lr-boundary-nodep (lr-max-node (data-seg)) ∧ adpp (untag (lr-max-node (data-seg)), data-seg) ∧ ((length (value (lr-heap-name, data-seg)) − 1)

≮ (offset (fetch (lr-fp-addr, data-seg)) + lr-node-size))

∧ lr-proper-p-areasp (data-seg)) → (fetch (identity (lr-fp-addr), car (lr-compile-quote (t, t, data-seg, table)))

= fetch (add-addr (fetch (identity (lr-fp-addr), data-seg),

identity (lr-ref-count-offset)),

data-seg))

Theorem: numberp-lessp-4-not-3-not-2-not-1-must-be-0 ((c ∈ N) ∧ (c ≠ 3) ∧ (c ≠ 2) ∧ (c ≠ 1) ∧ (c < 4)) → (c = 0)

Event: Disable fetch-offset-lr-t-addr-ref-count-offset-compile-quote-t.

Theorem: lessp-minimum-heap-size-not-0-f-t-must-be-undef-alt-1-help (lr-boundary-offsetp (offset) ∧ (offset ∈ N) ∧ (offset ≠ offset (lr-undef-addr)) ∧ (offset ≠ offset (lr-f-addr)) ∧ (offset ≠ offset (lr-t-addr)) ∧ (offset ≠ offset (lr-0-addr))) → (offset ≮ lr-minimum-heap-size)

Theorem: lessp-minimum-heap-size-not-0-f-t-must-be-undef-alt-1 ((offset (addr) < lr-minimum-heap-size) ∧ (type (addr) = 'addr) ∧ (cddr (addr) = nil) ∧ listp (addr) ∧ (area-name (addr) = 'heap) ∧ adpp (untag (addr), lr-init-data-seg (heap-size)) ∧ lr-boundary-nodep (addr) ∧ (offset (addr) ≠ offset (lr-0-addr)) ∧ (offset (addr) ≠ offset (lr-t-addr)) ∧ (offset (addr) ≠ offset (lr-f-addr))) → (fetch (addr, lr-init-data-seg (heap-size))

= identity (tag ('nat, lr-undefined-tag)))

Theorem: lessp-lr-boundary-offsetp-3 (lr-boundary-offsetp (offset) ∧ (offset ∈ N)) → ((offset < 3) = (offset = 0))

Theorem: numberp-lessp-2-not-1-must-be-0 ((c ∈ N) ∧ (c ≠ 1) ∧ (c < 2)) → (c = 0)

Theorem: not-lessp-difference-lr-boundary-offsetp-fact ((offset ∈ N) ∧ (offset < (lr-node-size + offset (lr-f-addr)))) → (lr-boundary-offsetp (offset)

= ((offset = identity (offset (lr-f-addr))) ∨ (offset = identity (offset (lr-undef-addr)))))

Theorem: fetch-ref-count-lr-init-data-seg-free-list (((lr-node-size ∗ heap-size) ≮ (offset (addr) + lr-node-size)) ∧ (type (addr) = 'addr) ∧ (cddr (addr) = nil) ∧ listp (addr) ∧ (area-name (addr) = lr-heap-name) ∧ listp (untag (addr)) ∧ lr-boundary-nodep (addr) ∧ (heap-size ≮ 2)) → (fetch (add-addr (addr, identity (lr-ref-count-offset)),

lr-init-data-seg (heap-size)) = if offset (lr-f-addr) < offset (addr)

then add-addr (addr, identity (lr-node-size)) else identity (tag ('nat, 1)) endif)

Theorem: lessp-offset-lr-init-data-seg-adpp-untag-lessp-offset (adpp (untag (addr), lr-init-data-seg (heap-size)) ∧ lr-boundary-offsetp (offset) ∧ lr-boundary-offsetp (offset (addr)) ∧ (offset < offset (addr)) ∧ (area-name (addr) = lr-heap-name) ∧ (heap-size ≮ 2)) → ((offset < (identity (lr-node-size) ∗ heap-size)) = t)

Theorem: lr-count-free-nodes-lr-all-nodes (lr-boundary-nodep (addr) ∧ (area-name (addr) = lr-heap-name) ∧ listp (untag (addr)) ∧ (offset (addr) ∈ N) ∧ (type (addr) = 'addr) ∧ (cddr (addr) = nil) ∧ listp (addr) ∧ lr-boundary-nodep (max-addr) ∧ (area-name (max-addr) = lr-heap-name) ∧ adpp (untag (max-addr), lr-init-data-seg (heap-size)) ∧ (type (max-addr) = 'addr) ∧ (cddr (max-addr) = nil) ∧ listp (max-addr) ∧ (offset (lr-f-addr) < offset (addr)) ∧ (heap-size ≮ 2)) → (lr-count-free-nodes (addr,

lr-all-nodes (offset (addr), max-addr),

lr-init-data-seg (heap-size))

= length (lr-all-nodes (offset (addr), max-addr)))

Theorem: same-signature-car-lr-init-data-seg-table-help-1 let comp-obj be lr-compile-quote (t, object, data-seg, table) in (same-signature (car (comp-obj ),

car (lr-init-data-seg-table (params, car (comp-obj ), cdr (comp-obj ))))

∧ lr-proper-free-listp (data-seg) ∧ lr-proper-p-areasp (data-seg) ∧ definedp (lr-heap-name, data-seg) ∧ lr-boundary-nodep (lr-max-node (data-seg))) → same-signature (data-seg,

car (lr-init-data-seg-table (params, car (comp-obj ), cdr (comp-obj )))) endlet

Theorem: same-signature-car-lr-init-data-seg-table (lr-proper-free-listp (data-seg) ∧ lr-proper-p-areasp (data-seg) ∧ definedp (lr-heap-name, data-seg) ∧ lr-boundary-nodep (lr-max-node (data-seg))) → same-signature (data-seg,

car (lr-init-data-seg-table (params, data-seg, table)))

Theorem: lr-max-node-car-lr-init-data-seg-table (lr-proper-free-listp (data-seg) ∧ lr-proper-p-areasp (data-seg) ∧ definedp (lr-heap-name, data-seg) ∧ lr-boundary-nodep (lr-max-node (data-seg))) → (lr-max-node (car (lr-init-data-seg-table (params, data-seg, table)))

= lr-max-node (data-seg))

Theorem: s-heap-reqs-object-0 ((flag ≠ 'list) ∧ (¬ definedp (0, table))) → (s-heap-reqs (flag, 0, data-seg, table) = 1)

Theorem: lr-free-list-nodes-deposit-0 ((type (max-addr) = 'addr) ∧ (cddr (max-addr) = nil) ∧ listp (max-addr) ∧ adpp (untag (max-addr), data-seg) ∧ lr-boundary-nodep (max-addr)

∧ (area-name (max-addr) = lr-heap-name) ∧ (¬ definedp (0, table)) ∧ lr-proper-free-listp (data-seg) ∧ adpp (untag (lr-max-node (data-seg)), data-seg) ∧ lr-boundary-nodep (lr-max-node (data-seg)) ∧ lr-proper-p-areasp (data-seg) ∧ ((length (cdr (assoc (lr-heap-name, data-seg))) − 1)

≮ (offset (fetch (lr-fp-addr, data-seg)) + lr-node-size))) → (lr-free-list-nodes (max-addr,

car (lr-compile-quote (t, 0, data-seg, table)))

= lr-free-list-nodes (max-addr,

deposit (identity (tag ('nat, 1)),

add-addr (fetch (identity (lr-fp-addr), data-seg),

identity (lr-ref-count-offset)),

data-seg)))

Theorem: lr-free-list-nodes-deposit-t ((type (max-addr) = 'addr) ∧ (cddr (max-addr) = nil) ∧ listp (max-addr) ∧ adpp (untag (max-addr), data-seg) ∧ lr-boundary-nodep (max-addr) ∧ (area-name (max-addr) = lr-heap-name) ∧ (¬ definedp (t, table)) ∧ lr-proper-free-listp (data-seg) ∧ adpp (untag (lr-max-node (data-seg)), data-seg) ∧ lr-boundary-nodep (lr-max-node (data-seg)) ∧ lr-proper-p-areasp (data-seg) ∧ ((length (cdr (assoc (lr-heap-name, data-seg))) − 1)

≮ (offset (fetch (lr-fp-addr, data-seg)) + lr-node-size))) → (lr-free-list-nodes (max-addr,

car (lr-compile-quote (t, t, data-seg, table)))

= lr-free-list-nodes (max-addr,

deposit (identity (tag ('nat, 1)),

add-addr (fetch (identity (lr-fp-addr), data-seg),

identity (lr-ref-count-offset)),

data-seg)))

Theorem: fetch-lr-fp-addr-compile-quote-0 ((¬ definedp (0, table)) ∧ ((length (cdr (assoc (lr-heap-name, data-seg))) − 1)

≮ (offset (fetch (lr-fp-addr, data-seg)) + lr-node-size))

∧ definedp (area-name (lr-fp-addr), data-seg)) → (fetch (identity (lr-fp-addr),

car (lr-compile-quote (t, 0, data-seg, table))) = fetch (add-addr (fetch (identity (lr-fp-addr), data-seg),

identity (lr-ref-count-offset)),

data-seg))

Theorem: fetch-add-addr-ref-count-f-addr-lr-init-data-seg (heap-size ≮ 2) → (fetch (identity (add-addr (lr-f-addr, lr-ref-count-offset)),

lr-init-data-seg (heap-size)) = identity (tag ('nat, 1)))

Theorem: lr-good-pointerp-tablep-f-lr-f-addr-lr-init-data-seg (heap-size ≮ 4) → lr-good-pointerp-tablep (list (cons (f, identity (lr-f-addr))),

lr-init-data-seg (heap-size))

Theorem: lr-proper-heapp-nodep-lr-undef-addr-lr-init-data-seg (heap-size ≮ 2) → lr-proper-heapp-nodep (identity (lr-undef-addr),

lr-init-data-seg (heap-size))

Definition: induct-hint-2 (offset) = if offset < offset (add-addr (lr-f-addr, lr-node-size)) then t

else induct-hint-2 (offset − lr-node-size) endif

Theorem: lr-boundary-offsetp-difference-lr-node-size lr-boundary-offsetp (offset) → lr-boundary-offsetp (offset − identity (lr-node-size))

Theorem: fetch-lr-f-addr-lr-init-data-seg (heap-size ≮ 2) → (fetch (identity (lr-f-addr), lr-init-data-seg (heap-size))

= identity (tag ('nat, lr-false-tag)))

Theorem: lr-proper-heapp-nodep-lr-init-data-seg-helper ((offset ≮ offset (lr-f-addr)) ∧ (heap-size ≮ 2) ∧ (offset ∈ N) ∧ lr-boundary-nodep (tag ('addr, cons (lr-heap-name, offset))) ∧ ((lr-node-size ∗ heap-size) ≮ (offset + lr-node-size))) → lr-proper-heapp-nodep (tag ('addr, cons (identity (lr-heap-name), offset)),

lr-init-data-seg (heap-size))

Theorem: lr-proper-heapp2-lr-init-data-seg-helper ((heap-size ≮ 2) ∧ (offset < length (cdr (assoc (lr-heap-name,

lr-init-data-seg (heap-size)))))

∧ (offset ∈ N) ∧ lr-boundary-nodep (tag ('addr, cons (lr-heap-name, offset)))) → lr-proper-heapp2 (tag ('addr, cons (lr-heap-name, offset)),

lr-init-data-seg (heap-size))

Theorem: lr-proper-heapp2-lr-init-data-seg (heap-size ≮ 2) → lr-proper-heapp2 (tag ('addr,

cons (identity (lr-heap-name),

identity (lr-node-size) ∗ heap-size)),

lr-init-data-seg (heap-size))

Theorem: fetch-add-addr-ref-count-lr-t-addr-lr-init-data-seg (heap-size ≮ 4) → (fetch (identity (add-addr (lr-t-addr, lr-ref-count-offset)),

lr-init-data-seg (heap-size)) = identity (add-addr (lr-t-addr, lr-node-size)))

Theorem: fetch-t-addr-compile-quote-list-init-data-seg ((heap-size ≮ 4) ∧ (¬ definedp (t, table))) → (fetch (identity (lr-t-addr),

car (lr-compile-quote ('list, list (t, 0), lr-init-data-seg (heap-size), table)))

= identity (tag ('nat, lr-true-tag)))

Theorem: fetch-ref-count-t-addr-compile-quote-list-init-data-seg ((heap-size ≮ 4) ∧ (¬ definedp (t, table))) → (fetch (identity (add-addr (lr-t-addr, lr-ref-count-offset)),

car (lr-compile-quote ('list, list (t, 0), lr-init-data-seg (heap-size), table)))

= identity (tag ('nat, 1)))

Theorem: fetch-add-addr-ref-count-lr-0-addr-lr-init-data-seg (heap-size ≮ 4) → (fetch (identity (add-addr (lr-0-addr, lr-ref-count-offset)),

lr-init-data-seg (heap-size)) = identity (add-addr (lr-0-addr, lr-node-size)))

Theorem: fetch-0-addr-compile-quote-list-init-data-seg ((heap-size ≮ 4) ∧ (¬ definedp (t, table)) ∧ (¬ definedp (0, table))) → (fetch (identity (lr-0-addr),

car (lr-compile-quote ('list, list (t, 0), lr-init-data-seg (heap-size), table)))

= identity (tag ('nat, lr-add1-tag)))

Theorem: fetch-ref-count-0-addr-compile-quote-list-init-data-seg ((heap-size ≮ 4) ∧ (¬ definedp (t, table)) ∧ (¬ definedp (0, table))) → (fetch (identity (add-addr (lr-0-addr, lr-ref-count-offset)),

car (lr-compile-quote ('list, list (t, 0), lr-init-data-seg (heap-size), table)))

= identity (tag ('nat, 1)))

Theorem: fetch-unbox-nat-0-addr-compile-quote-list-init-data-seg ((heap-size ≮ 4) ∧ (¬ definedp (t, table)) ∧ (¬ definedp (0, table))) → (fetch (identity (add-addr (lr-0-addr, lr-unbox-nat-offset)),

car (lr-compile-quote ('list, list (t, 0), lr-init-data-seg (heap-size), table)))

= identity (tag ('nat, 0)))

Theorem: lr-proper-heapp-lr-compile-quote-ft-lr-init-data-seg (heap-size ≮ 4) → lr-proper-heapp (car (lr-compile-quote ('list,

list (t, 0),

lr-init-data-seg (heap-size),

list (cons (f, identity (lr-f-addr))))))

Theorem: cdr-compile-quote-list-t0-lr-init-data-seg-cons-table ((¬ definedp (0, table)) ∧ (¬ definedp (t, table)) ∧ (heap-size ≮ 4)) → (cdr (lr-compile-quote ('list,

list (t, 0),

lr-init-data-seg (heap-size), table))

= cons (cons (0, identity (lr-0-addr)), cons (cons (t, identity (lr-t-addr)), table)))

Theorem: fetch-f-addr-compile-quote-list-init-data-seg ((heap-size ≮ 4) ∧ (¬ definedp (t, table)) ∧ (¬ definedp (0, table)))

→ (fetch (identity (lr-f-addr),

car (lr-compile-quote ('list, list (t, 0), lr-init-data-seg (heap-size), table)))

= identity (tag ('nat, lr-false-tag)))

Theorem: fetch-ref-count-f-addr-compile-quote-list-init-data-seg ((heap-size ≮ 4) ∧ (¬ definedp (t, table)) ∧ (¬ definedp (0, table))) → (fetch (identity (add-addr (lr-f-addr, lr-ref-count-offset)),

car (lr-compile-quote ('list, list (t, 0), lr-init-data-seg (heap-size), table)))

= identity (tag ('nat, 1)))

Theorem: lr-s-similar-const-table-compile-quote-t0-init-data-seg (heap-size ≮ 4) → lr-s-similar-const-table (cdr (lr-compile-quote ('list,

list (t, 0),

lr-init-data-seg (heap-size), list (cons (f,

identity (lr-f-addr))))),

car (lr-compile-quote ('list, list (t, 0), lr-init-data-seg (heap-size), list (cons (f,

identity (lr-f-addr))))))

Event: Disable cdr-compile-quote-list-t0-lr-init-data-seg-cons-table.

Theorem: fetch-fp-addr-compile-quote-list-t0-lr-init-data-seg-cons-table ((¬ definedp (0, table)) ∧ (¬ definedp (t, table)) ∧ (heap-size ≮ 4)) → (fetch (identity (lr-fp-addr),

car (lr-compile-quote ('list, list (t, 0), lr-init-data-seg (heap-size), table)))

= identity (add-addr (lr-0-addr, lr-node-size)))

Theorem: lr-free-list-nodes-lr-compile-quote-t0 ((¬ definedp (t, table)) ∧ (¬ definedp (0, table)) ∧ (heap-size ≮ 4)) → (lr-free-list-nodes (tag ('addr,

cons (identity (lr-heap-name),

identity (lr-node-size) ∗ heap-size)),

car (lr-compile-quote ('list, list (t, 0), lr-init-data-seg (heap-size), table)))

= lr-all-nodes (identity (lr-node-size + offset (lr-0-addr)),

                   tag ('addr,

cons (identity (lr-heap-name), identity (lr-node-size) ∗ heap-size))))

Theorem: listp-lr-all-nodes listp (lr-all-nodes (min-offset, max-addr)) = ((offset (max-addr) ≄ 0) ∧ (min-offset < offset (max-addr)))

Theorem: length-lr-all-nodes (lr-boundary-offsetp (offset) ∧ (offset ∈ N) ∧ lr-boundary-nodep (addr)) → (length (lr-all-nodes (offset, addr))

= ((offset (addr) − offset) ÷ identity (lr-node-size)))

Theorem: lr-count-free-nodes-append-lr-all-nodes-fact (((lr-node-size ∗ heap-size) ≮ lr-minimum-heap-size) ∧ (¬ definedp (t, table)) ∧ (¬ definedp (0, table))) → (lr-count-free-nodes (identity (add-addr (lr-0-addr, lr-node-size)),

lr-all-nodes (identity (lr-minimum-heap-size),

                                tag ('addr,

cons (identity (lr-heap-name), identity (lr-node-size)

∗ heap-size))),

car (lr-compile-quote ('list, list (t, 0), lr-init-data-seg (heap-size), table)))

= (heap-size − lr-node-size))

Theorem: proper-p-alistp-pair-formal-with-addresses (all-litatoms (strip-cars (params)) ∧ s-init-data-seg-restrictedp (params) ∧ (heap-size ≮ s-total-heap-reqs (s-progs (s), params, heap-size)) ∧ (word-size ≮ s-total-ws-reqs (s-progs (s), params, heap-size))) → proper-p-alistp (pair-formals-with-addresses (params,

cdr (lr-data-seg-table (s-progs (s), params, heap-size))),

lr->p (s->lr1 (s, p-state (pc,

ctrl-stk, temp-stk, prog-seg, car (lr-data-seg-table (s-progs (s),

params, heap-size)),

max-ctrl-stk-size, max-temp-stk-size, word-size, psw),

cdr (lr-data-seg-table (s-progs (s), params, heap-size)))))

Theorem: proper-p-alistp-lr-make-initial-temps (lr-proper-heapp (data-seg) ∧ all-litatoms (temp-vars) ∧ lr-proper-p-areasp (data-seg)) → proper-p-alistp (lr-make-initial-temps (temp-vars),

lr->p (s->lr1 (s,

p-state (pc, ctrl-stk, temp-stk, prog-seg, data-seg, max-ctrl, max-temp, word-size, psw),

table)))

Theorem: lr-minimum-heapp-lr-data-seg-table-body (lr-proper-free-listp (data-seg) ∧ lr-proper-p-areasp (data-seg) ∧ definedp (lr-heap-name, data-seg) ∧ lr-boundary-nodep (lr-max-node (data-seg))) → (lr-minimum-heapp (car (lr-data-seg-table-body (flag, body, data-seg, table)))

= lr-minimum-heapp (data-seg))

Theorem: lr-count-free-nodes-lr-compile-quote-s-heap-reqs-flag-t (lr-proper-free-listp (data-seg) ∧ lr-proper-p-areasp (data-seg) ∧ definedp (lr-heap-name, data-seg) ∧ lr-minimum-heapp (data-seg)

∧ lr-boundary-nodep (lr-max-node (data-seg)) ∧ (lr-count-free-nodes (fetch (lr-fp-addr, data-seg),

lr-free-list-nodes (lr-max-node (data-seg), data-seg),

data-seg) ≮ s-heap-reqs (t, object, data-seg, table)))

→ ((s-heap-reqs (t, object, data-seg, table)

+ lr-count-free-nodes (fetch (identity (lr-fp-addr),

car (lr-compile-quote (t, object, data-seg, table))),

lr-free-list-nodes (lr-max-node (data-seg),

car (lr-compile-quote (t, object, data-seg, table))),

car (lr-compile-quote (t, object, data-seg, table))))

= lr-count-free-nodes (fetch (identity (lr-fp-addr), data-seg),

lr-free-list-nodes (lr-max-node (data-seg), data-seg),

data-seg))

Theorem: lr-count-free-nodes-lr-data-seg-table-body-s-heap-reqs (lr-proper-free-listp (data-seg) ∧ lr-proper-p-areasp (data-seg) ∧ definedp (lr-heap-name, data-seg) ∧ lr-minimum-heapp (data-seg) ∧ lr-boundary-nodep (lr-max-node (data-seg)) ∧ (lr-count-free-nodes (fetch (lr-fp-addr, data-seg),

lr-free-list-nodes (lr-max-node (data-seg), data-seg),

data-seg) ≮ s-heap-reqs-body (flag, body, data-seg, table)))

→ ((lr-count-free-nodes (fetch (lr-fp-addr,

car (lr-data-seg-table-body (flag, body, data-seg, table))),

lr-free-list-nodes (lr-max-node (data-seg), car (lr-data-seg-table-body (flag, body, data-seg, table))),

car (lr-data-seg-table-body (flag, body, data-seg, table)))

+ s-heap-reqs-body (flag, body, data-seg, table)) = lr-count-free-nodes (fetch (lr-fp-addr, data-seg),

lr-free-list-nodes (lr-max-node (data-seg), data-seg),

data-seg))

Theorem: lr-data-seg-table-body-lr-good-pointerp-tablep-help1 let data-seg-tab be lr-data-seg-table-body (t, car (body), data-seg, table) in (listp (body) ∧ lr-proper-free-listp (data-seg) ∧ lr-proper-p-areasp (data-seg) ∧ definedp (lr-heap-name, data-seg) ∧ lr-minimum-heapp (data-seg) ∧ lr-boundary-nodep (lr-max-node (data-seg)) ∧ (lr-count-free-nodes (fetch (lr-fp-addr, data-seg),

lr-free-list-nodes (lr-max-node (data-seg), data-seg),

data-seg) ≮ (s-heap-reqs-body (t, car (body), data-seg, table)

+ s-heap-reqs-body ('list, cdr (body), car (data-seg-tab), cdr (data-seg-tab)))))

→ (lr-count-free-nodes (fetch (identity (lr-fp-addr),

car (data-seg-tab)), lr-free-list-nodes (lr-max-node (data-seg),

car (data-seg-tab)),

car (data-seg-tab))

≮ s-heap-reqs-body ('list, cdr (body), car (data-seg-tab), cdr (data-seg-tab))) endlet

Theorem: lr-data-seg-table-body-lr-good-pointerp-tablep (lr-proper-free-listp (data-seg) ∧ lr-proper-p-areasp (data-seg)

∧ definedp (lr-heap-name, data-seg) ∧ lr-boundary-nodep (lr-max-node (data-seg)) ∧ lr-minimum-heapp (data-seg) ∧ lr-good-pointerp-tablep (table, data-seg) ∧ s-data-seg-body-restrictedp (flag, body) ∧ definedp (f, table) ∧ (lr-count-free-nodes (fetch (lr-fp-addr, data-seg),

lr-free-list-nodes (lr-max-node (data-seg), data-seg),

data-seg) ≮ s-heap-reqs-body (flag, body, data-seg, table)))

→ lr-good-pointerp-tablep (cdr (lr-data-seg-table-body (flag, body, data-seg, table)),

car (lr-data-seg-table-body (flag, body, data-seg, table)))

Theorem: lr-data-seg-table-list-lr-good-pointerp-tablep-helper-1 let dst-body be lr-data-seg-table-body (t,

s-body (car (progs)), data-seg, table)

in (listp (progs) ∧ lr-proper-free-listp (data-seg) ∧ lr-proper-p-areasp (data-seg) ∧ definedp (lr-heap-name, data-seg) ∧ lr-boundary-nodep (lr-max-node (data-seg)) ∧ lr-minimum-heapp (data-seg) ∧ (lr-count-free-nodes (fetch (lr-fp-addr, data-seg),

lr-free-list-nodes (lr-max-node (data-seg), data-seg),

data-seg)

≮ (s-heap-reqs-body (t, s-body (car (progs)), data-seg, table)

+ s-heap-reqs-list (cdr (progs), car (dst-body), cdr (dst-body)))))

→ (lr-count-free-nodes (fetch (identity (lr-fp-addr), car (dst-body)),

lr-free-list-nodes (lr-max-node (data-seg),

car (dst-body)),

car (dst-body))

≮ s-heap-reqs-list (cdr (progs), car (dst-body), cdr (dst-body))) endlet

Theorem: lr-init-data-seg-table-lr-good-pointerp-tablep (lr-proper-free-listp (data-seg) ∧ lr-proper-p-areasp (data-seg) ∧ definedp (lr-heap-name, data-seg) ∧ lr-boundary-nodep (lr-max-node (data-seg)) ∧ lr-minimum-heapp (data-seg) ∧ lr-good-pointerp-tablep (table, data-seg) ∧ s-init-data-seg-restrictedp (params) ∧ definedp (f, table) ∧ (lr-count-free-nodes (fetch (lr-fp-addr, data-seg),

lr-free-list-nodes (lr-max-node (data-seg), data-seg),

data-seg) ≮ s-init-heap-reqs (params, data-seg, table)))

→ lr-good-pointerp-tablep (cdr (lr-init-data-seg-table (params, data-seg, table)),

car (lr-init-data-seg-table (params, data-seg, table)))

Theorem: lr-proper-heapp-car-lr-data-seg-table-body (lr-proper-heapp (data-seg) ∧ lr-proper-p-areasp (data-seg) ∧ lr-good-pointerp-tablep (table, data-seg) ∧ s-data-seg-body-restrictedp (flag, body) ∧ definedp (f, table) ∧ (lr-count-free-nodes (fetch (lr-fp-addr, data-seg),

lr-free-list-nodes (lr-max-node (data-seg), data-seg),

data-seg) ≮ s-heap-reqs-body (flag, body, data-seg, table)))

→ lr-proper-heapp (car (lr-data-seg-table-body (flag, body, data-seg, table)))

Theorem: lr-proper-heapp-car-lr-data-seg-table-list (lr-proper-heapp (data-seg) ∧ lr-proper-p-areasp (data-seg) ∧ lr-good-pointerp-tablep (table, data-seg) ∧ s-data-seg-list-restrictedp (progs) ∧ definedp (f, table) ∧ (lr-count-free-nodes (fetch (lr-fp-addr, data-seg), lr-free-list-nodes (lr-max-node (data-seg), data-seg),

data-seg) ≮ s-heap-reqs-list (progs, data-seg, table)))

→ lr-proper-heapp (car (lr-data-seg-table-list (progs, data-seg, table)))

Theorem: lr-proper-heapp-car-lr-init-data-seg-table (lr-proper-heapp (data-seg) ∧ lr-proper-p-areasp (data-seg) ∧ lr-good-pointerp-tablep (table, data-seg) ∧ s-init-data-seg-restrictedp (params) ∧ definedp (f, table) ∧ (lr-count-free-nodes (fetch (lr-fp-addr, data-seg),

lr-free-list-nodes (lr-max-node (data-seg), data-seg),

data-seg) ≮ s-init-heap-reqs (params, data-seg, table)))

→ lr-proper-heapp (car (lr-init-data-seg-table (params, data-seg, table)))

Theorem: lr-count-free-nodes-lr-init-data-seg-table-s-init-heap-reqs (lr-proper-free-listp (data-seg) ∧ lr-proper-p-areasp (data-seg) ∧ definedp (lr-heap-name, data-seg) ∧ lr-minimum-heapp (data-seg) ∧ lr-boundary-nodep (lr-max-node (data-seg)) ∧ (lr-count-free-nodes (fetch (lr-fp-addr, data-seg),

lr-free-list-nodes (lr-max-node (data-seg), data-seg),

data-seg) ≮ s-init-heap-reqs (params, data-seg, table)))

→ ((lr-count-free-nodes (fetch (lr-fp-addr,

car (lr-init-data-seg-table (params, data-seg, table))),

lr-free-list-nodes (lr-max-node (data-seg),

car (lr-init-data-seg-table (params, data-seg, table))),

car (lr-init-data-seg-table (params, data-seg, table)))

+ s-init-heap-reqs (params, data-seg, table))

= lr-count-free-nodes (fetch (lr-fp-addr, data-seg), lr-free-list-nodes (lr-max-node (data-seg),

data-seg),

data-seg))

Theorem: lr-proper-heapp-car-lr-data-seg-table-helper-1 let data-seg-table be lr-compile-quote ('list,

list (t, 0),

lr-init-data-seg (heap-size),

list (cons (f, identity (lr-f-addr))))

in ((heap-size ≮ (2

             + 2

+ s-init-heap-reqs (params, car (data-seg-table), cdr (data-seg-table))

+ x))

∧ (max-addr = lr-max-node (car (data-seg-table)))) → (lr-count-free-nodes (fetch (identity (lr-fp-addr),

car (lr-init-data-seg-table (params, car (data-seg-table), cdr (data-seg-table)))),

lr-free-list-nodes (max-addr,

car (lr-init-data-seg-table (params, car (data-seg-table), cdr (data-seg-table)))),

car (lr-init-data-seg-table (params, car (data-seg-table), cdr (data-seg-table))))

≮ x) endlet

Theorem: lr-proper-heapp-car-lr-data-seg-table ((heap-size ≮ s-total-heap-reqs (progs, params, heap-size)) ∧ s-restrictedp (progs, params)) → lr-proper-heapp (car (lr-data-seg-table (progs, params, heap-size)))

Theorem: litatom-car-gensym litatom (car (gensym (initial, num-list, atom-list)))

Theorem: all-litatoms-strip-cdrs-lr-make-temp-name-alist-1 all-litatoms (strip-cdrs (lr-make-temp-name-alist-1 (initial,

num-list, temp-list, formals)))

Theorem: all-litatoms-strip-cdrs-lr-make-temp-name-alist all-litatoms (strip-cdrs (lr-make-temp-name-alist (temp-list, formals)))

Theorem: lr-proper-p-areasp-car-lr-data-seg-table lr-proper-p-areasp (car (lr-data-seg-table (progs, params, heap-size)))

Theorem: plist-strip-cdrs plist (strip-cdrs (x)) = strip-cdrs (x)

Theorem: lr-make-temp-name-alist-1-plist-arg-1 lr-make-temp-name-alist-1 (initial, num-list, plist (temp-list), formals) = lr-make-temp-name-alist-1 (initial, num-list, temp-list, formals)

Theorem: lr-make-temp-name-alist-plist-arg-1 lr-make-temp-name-alist (plist (temp-list), formals) = lr-make-temp-name-alist (temp-list, formals)

Theorem: length-lr-make-initial-temps length (lr-make-initial-temps (temp-vars)) = length (temp-vars)

Theorem: length-strip-cdrs length (strip-cdrs (alist)) = length (alist)

Theorem: length-pair-formals-with-addresses length (pair-formals-with-addresses (formals, alist)) = length (formals)

Theorem: s-good-statep-length-s-temp-list s-good-statep (s, c) → (length (s-temp-list (s-prog (s))) = length (s-temps (s)))

Theorem: plistp-comp-programs-1 plistp (comp-programs-1 (progs))

Theorem: proper-p-instructionp-ret proper-p-instructionp ('(ret), name, p)

Theorem: proper-p-instructionp-eq proper-p-instructionp ('(eq), name, p)

Theorem: proper-p-instructionp-fetch proper-p-instructionp ('(fetch), name, p)

Theorem: proper-p-instructionp-deposit proper-p-instructionp ('(deposit), name, p)

Theorem: proper-p-instructionp-add-addr proper-p-instructionp ('(add-addr), name, p)

Theorem: proper-p-instructionp-pop-global-free-ptr lr-proper-heapp (p-data-segment (l)) → proper-p-instructionp ('(pop-global free-ptr), name, lr->p (l))

Theorem: proper-p-instructionp-push-global-free-ptr lr-proper-heapp (p-data-segment (l)) → proper-p-instructionp ('(push-global free-ptr), name, lr->p (l))

Theorem: proper-p-instructionp-push-local-temp-car lr-programs-properp (l, table) → proper-p-instructionp ('(push-local x), 'car, lr->p (l))

Theorem: proper-p-instructionp-push-local-temp-cdr lr-programs-properp (l, table) → proper-p-instructionp ('(push-local x), 'cdr, lr->p (l))

Theorem: proper-p-instructionp-push-local-temp-cons lr-programs-properp (l, table) → proper-p-instructionp ('(push-local temp), 'cons, lr->p (l))

Theorem: proper-p-instructionp-set-local-temp-cons lr-programs-properp (l, table) → proper-p-instructionp ('(set-local temp), 'cons, lr->p (l))

Theorem: proper-labeled-p-instructionsp-append plistp (instrs1 ) → (proper-labeled-p-instructionsp (append (instrs1 , instrs2 ), name, p)

= (proper-labeled-p-instructionsp (instrs1 , name, p)

∧ proper-labeled-p-instructionsp (instrs2 , name, p)))

Theorem: lessp-number-cons-cur-expr-dv-1-listp listp (cur-expr (pos, body)) → (number-cons (cur-expr (dv (pos, 1), body))

< number-cons (cur-expr (pos, body)))

Theorem: lessp-number-cons-cur-expr-dv-2-listp listp (cur-expr (pos, body)) → (number-cons (cur-expr (dv (pos, 2), body))

< number-cons (cur-expr (pos, body)))

Theorem: lessp-number-cons-cur-expr-dv-3-listp listp (cur-expr (pos, body)) → (number-cons (cur-expr (dv (pos, 3), body))

< number-cons (cur-expr (pos, body)))

Theorem: lessp-number-cons-restn-cdr (listp (pos) ∧ (car (last (pos)) < length (cur-expr (butlast (pos), body))) ∧ listp (cur-expr (butlast (pos), body))) → (number-cons (restn (car (last (pos)), cdr (cur-expr (butlast (pos), body))))

< number-cons (restn (car (last (pos)), cur-expr (butlast (pos), body))))

Theorem: proper-p-instructionp-test-bool-and-jump-label proper-p-instructionp (list ('test-bool-and-jump, x, lab), name, p) = find-labelp (lab, program-body (assoc (name, p-prog-segment (p))))

Theorem: proper-p-instructionp-jump-label proper-p-instructionp (list ('jump, lab), name, p) = find-labelp (lab, program-body (assoc (name, p-prog-segment (p))))

Theorem: plist-lr-convert-num-to-ascii plistp (lr-convert-num-to-ascii (number, list)) = plistp (list)

Theorem: zerop-lr-convert-num-to-ascii (number ≃ 0) → (lr-convert-num-to-ascii (number, list) = cons (ascii-0, list))

Theorem: lr-convert-digit-to-ascii-equal (lr-convert-digit-to-ascii (m) = lr-convert-digit-to-ascii (n)) = (fix (m) = fix (n))

Theorem: zerop-lr-convert-digit-to-ascii (number ≃ 0) → (lr-convert-digit-to-ascii (number) = ascii-0)

Theorem: equal-ascii-0-lr-convert-digit-to-ascii (lr-convert-digit-to-ascii (number) = identity (ascii-0)) = (number ≃ 0)

Theorem: length-lr-convert-num-to-ascii length (lr-convert-num-to-ascii (number, list)) ≮ (1 + length (list))

Definition: induct-hint-22 (n, m, list) = if n < 10 then t

elseif m < 10 then t

else induct-hint-22 (n ÷ 10, m ÷ 10, cons (lr-convert-digit-to-ascii (n mod 10),

list)) endif

Theorem: lr-convert-num-to-ascii-equal-arg1 (lr-convert-num-to-ascii (x, list1 ) = lr-convert-num-to-ascii (x, list2 )) = (list1 = list2 )

Definition: induct-hint-23 (n, m, list1 , list2 ) = if n < 10 then t

elseif m < 10 then t

else induct-hint-23 (n ÷ 10, m ÷ 10, cons (lr-convert-digit-to-ascii (n mod 10),

list1 ), cons (lr-convert-digit-to-ascii (m mod 10),

list2 )) endif

Theorem: lr-convert-num-to-ascii-equal-arg2-lengths-helper-1 (length (list1 ) = length (list2 )) → (lr-convert-num-to-ascii (number, cons (x, list1 )) ≠ cons (y, list2 ))

Theorem: lr-convert-num-to-ascii-equal-arg2-lengths ((length (list1 ) = length (list2 )) ∧ (list1 ≠ list2 )) → (lr-convert-num-to-ascii (x, list1 )

≠ lr-convert-num-to-ascii (y, list2 ))

Theorem: lr-convert-num-to-ascii-equal-arg2-helper-1 (x ≠ y) → (lr-convert-num-to-ascii (w, cons (x, list))

≠ lr-convert-num-to-ascii (z, cons (y, list)))

Theorem: lr-convert-num-to-ascii-equal-arg2 (lr-convert-num-to-ascii (m, list) = lr-convert-num-to-ascii (n, list)) = (fix (m) = fix (n))

Theorem: lr-make-label-equal (lr-make-label (m) = lr-make-label (n)) = (fix (m) = fix (n))

Theorem: find-labelp-lr-make-label-label-instrs find-labelp (lr-make-label (m), label-instrs (instrs, n)) = ((m ≮ n) ∧ (m < (n + length (instrs))))

Theorem: find-labelp-lr-make-label-comp-body (n < length (comp-body (body))) → find-labelp (lr-make-label (n), comp-body (body))

Theorem: label-instrs-append (n ∈ N) → (label-instrs (append (instrs1 , instrs2 ), n)

= append (label-instrs (instrs1 , n), label-instrs (instrs2 , n + length (instrs1 ))))

Theorem: proper-p-temp-var-dclsp-all-litatoms-all-undef-addrs (all-litatoms (strip-cars (temp-var-dcls)) ∧ all-undef-addrs (strip-cadrs (temp-var-dcls)) ∧ lr-proper-heapp (p-data-segment (p)) ∧ lr-proper-p-areasp (p-data-segment (p))) → proper-p-temp-var-dclsp (temp-var-dcls, p)

Theorem: plistp-label-instrs plistp (label-instrs (instrs, n))

Definition: not-labelledp-instrs (instrs) = if listp (instrs)

then (¬ labelledp (car (instrs)))

∧ not-labelledp-instrs (cdr (instrs)) else t endif

Theorem: label-instrs-proper-labeled-p-instructionsp (proper-labeled-p-instructionsp (instrs, name, p) ∧ not-labelledp-instrs (instrs)) → proper-labeled-p-instructionsp (label-instrs (instrs, n), name, p)

Theorem: not-labelledp-instrs-append not-labelledp-instrs (append (instrs1 , instrs2 )) = (not-labelledp-instrs (instrs1 ) ∧ not-labelledp-instrs (instrs2 ))

Theorem: not-labelledp-instrs-comp-body-1 not-labelledp-instrs (comp-body-1 (flag, body, n))

Theorem: comp-body-1-list-not-listp (¬ listp (body)) → (comp-body-1 ('list, body, n) = nil)

Theorem: proper-labeled-p-instructionsp-nil proper-labeled-p-instructionsp (nil, name, p)

Theorem: proper-labeled-p-instructionsp-comp-body-1-helper-1 (proper-labeled-p-instructionsp (comp-body-1 (t, test-body, n1 ),

name, p-state (pc,

ctrl-stk, temp-stk, comp-programs (prog-seg), data-seg, max-ctrl, max-temp, word-size, psw))

∧ proper-labeled-p-instructionsp (comp-body-1 (t, then-body, n2 ), name, p-state (pc,

ctrl-stk, temp-stk, comp-programs (prog-seg), data-seg, max-ctrl, max-temp, word-size, psw))

∧ proper-labeled-p-instructionsp (else-instrs, name, p-state (pc,

ctrl-stk, temp-stk, comp-programs (prog-seg), data-seg, max-ctrl, max-temp, word-size, psw))

∧ lr-proper-heapp (data-seg) ∧ lr-proper-p-areasp (data-seg) ∧ definedp (name, prog-seg) ∧ (((n

+ lr-p-c-size (t, test-body) + lr-p-c-size (t, then-body) + length (else-instrs) + 4)− 1) < lr-p-c-size (t, program-body (assoc (name, prog-seg)))))

→ proper-labeled-p-instructionsp (comp-if (comp-body-1 (t, test-body, n1 ), comp-body-1 (t, then-body, n2 ), else-instrs, n),

name, p-state (pc,

ctrl-stk, temp-stk, comp-programs (prog-seg), data-seg, max-ctrl, max-temp, word-size, psw))

Theorem: proper-labeled-p-instructionsp-comp-body-1-helper-2 (listp (body) ∧ ((car (body) = s-temp-fetch) ∨ (car (body) = s-temp-test))

∧ lr-proper-exprp (t, body, program-names, formal-vars (assoc (name, prog-seg)), strip-cars (temp-var-dcls (assoc (name, prog-seg))), table)

∧ definedp (name, prog-seg)) → proper-labeled-p-instructionsp (list (list ('push-local, caddr (body))),

name, p-state (pc,

ctrl-stk, temp-stk, comp-programs (prog-seg), data-seg, max-ctrl, max-temp, word-size, psw))

Theorem: proper-labeled-p-instructionsp-comp-body-1-helper-3 (listp (body) ∧ ((car (body) = s-temp-eval) ∨ (car (body) = s-temp-test)) ∧ lr-proper-exprp (t,

body, program-names, formal-vars (assoc (name, prog-seg)), strip-cars (temp-var-dcls (assoc (name, prog-seg))), table)

∧ definedp (name, prog-seg)) → proper-labeled-p-instructionsp (list (list ('set-local, caddr (body))),

name, p-state (pc,

ctrl-stk, temp-stk, comp-programs (prog-seg), data-seg, max-ctrl, max-temp, word-size, psw))

Theorem: proper-labeled-p-instructionsp-comp-body-1-helper-4 (listp (body) ∧ (car (body) = s-temp-test)

∧ proper-labeled-p-instructionsp (comp-body-1 (t, cadr (body), n + 4), name, p-state (pc,

ctrl-stk, temp-stk, comp-programs (prog-seg), data-seg, max-ctrl, max-temp, word-size, psw))

∧ lr-proper-exprp (t, body, program-names, formal-vars (assoc (name, prog-seg)), strip-cars (temp-var-dcls (assoc (name, prog-seg))), table)

∧ lr-proper-heapp (data-seg) ∧ lr-proper-p-areasp (data-seg) ∧ (lr-p-c-size (t, program-body (assoc (name, prog-seg)))

≮ (n + lr-p-c-size (t, cadr (body)) + 7)) ∧ definedp (name, prog-seg)) → proper-labeled-p-instructionsp (comp-temp-test (body,

comp-body-1 (t, cadr (body), n + 4),

n),

name, p-state (pc,

ctrl-stk, temp-stk, comp-programs (prog-seg), data-seg, max-ctrl, max-temp, word-size, psw))

Definition: assoc-cdr (x, l) = if listp (l)

then if x = cdar (l) then car (l)

else assoc-cdr (x, cdr (l)) endif else f endif Theorem: lr-s-similar-const-table-lr-valp-member-strip-cdrs ((addr ∈ strip-cdrs (table)) ∧ lr-s-similar-const-table (table, data-seg)) → lr-valp (car (assoc-cdr (addr, table)), addr, data-seg)

Theorem: lr-s-similar-const-table-type-addr-member-strip-cdrs ((addr ∈ strip-cdrs (table)) ∧ lr-s-similar-const-table (table, data-seg)) → ((type (addr) = 'addr)

∧ (cddr (addr) = nil) ∧ listp (addr) ∧ adpp (untag (addr), data-seg) ∧ lr-boundary-nodep (addr) ∧ (area-name (addr) = identity (lr-heap-name)) ∧ (type (fetch (add-addr (addr, identity (lr-ref-count-offset)),

data-seg))

= 'nat))

Theorem: proper-labeled-p-instructionsp-comp-body-1-helper-5 (listp (body) ∧ (car (body) = 'quote) ∧ lr-proper-heapp (data-seg) ∧ lr-proper-p-areasp (data-seg) ∧ lr-proper-exprp (t,

body, strip-logic-fnames (cdr (prog-seg)), formal-vars (assoc (name, prog-seg)), strip-cars (temp-var-dcls (assoc (name, prog-seg))), table)

∧ lr-s-similar-const-table (table, data-seg) ∧ definedp (name, prog-seg)) → proper-labeled-p-instructionsp (list (list ('push-constant,

cadr (body))), name, p-state (pc,

ctrl-stk, temp-stk, comp-programs (prog-seg), data-seg, max-ctrl, max-temp, word-size, psw))

Event: Disable lr-s-similar-const-table-type-addr-member-strip-cdrs.

Theorem: lr-proper-exprp-flag-list-cdr-funcall (listp (body) ∧ (car (body) ≠ 'if) ∧ (car (body) ≠ s-temp-fetch) ∧ (car (body) ≠ s-temp-eval) ∧ (car (body) ≠ s-temp-test) ∧ (car (body) ≠ 'quote) ∧ lr-proper-exprp (t, body, program-names, formals, temps, table)) → lr-proper-exprp ('list, cdr (body), program-names, formals, temps, table)

Theorem: proper-labeled-p-instructionsp-comp-body-1-helper-6-1 (listp (body) ∧ (car (body) ≠ 'if) ∧ (car (body) ≠ s-temp-fetch) ∧ (car (body) ≠ s-temp-eval) ∧ (car (body) ≠ s-temp-test) ∧ (car (body) ≠ 'quote) ∧ lr-proper-exprp (t,

body,

strip-logic-fnames (cdr (prog-seg)), formals, temps, table)

∧ definedp (car (body), p-runtime-support-programs)) → proper-labeled-p-instructionsp (list (list ('call, car (body))),

name, p-state (pc,

ctrl-stk, temp-stk, comp-programs (prog-seg), data-seg, max-ctrl, max-temp, word-size, psw))

Theorem: proper-labeled-p-instructionsp-comp-body-1-helper-6-2 (listp (body) ∧ (car (body) ≠ 'if) ∧ (car (body) ≠ s-temp-fetch) ∧ (car (body) ≠ s-temp-eval) ∧ (car (body) ≠ s-temp-test) ∧ (car (body) ≠ 'quote) ∧ lr-proper-exprp (t,

body, strip-logic-fnames (cdr (prog-seg)), formals, temps, table)

∧ (¬ definedp (car (body), p-runtime-support-programs)) ∧ all-user-fnamesp (cdr (strip-cars (prog-seg))) ∧ definedp (name, prog-seg)) → proper-labeled-p-instructionsp (list (list ('call,

user-fname (car (body)))), name, p-state (pc,

ctrl-stk, temp-stk, comp-programs (prog-seg), data-seg, max-ctrl, max-temp, word-size, psw))

Theorem: proper-labeled-p-instructionsp-comp-body-1-helper-7 ((¬ listp (body)) ∧ lr-proper-exprp (t,

body, program-names, formal-vars (assoc (name, prog-seg)), temps, table)

∧ definedp (name, prog-seg)) → proper-labeled-p-instructionsp (list (list ('push-local, body)),

name, p-state (pc,

ctrl-stk, temp-stk, comp-programs (prog-seg), data-seg, max-ctrl, max-temp, word-size, psw))

Theorem: not-definedp-not-listp (¬ listp (alist)) → (¬ definedp (name, alist))

Theorem: proper-labeled-p-instructionsp-comp-body-1 (lr-proper-heapp (data-seg) ∧ lr-proper-p-areasp (data-seg) ∧ all-user-fnamesp (cdr (strip-cars (prog-seg))) ∧ lr-proper-exprp (if flag = 'list then 'list

else t endif,

body,

strip-logic-fnames (cdr (prog-seg)), formal-vars (assoc (name, prog-seg)), strip-cars (temp-var-dcls (assoc (name, prog-seg))), table)

∧ lr-s-similar-const-table (table, data-seg) ∧ ((n + lr-p-c-size (if flag = 'list then 'list

else t endif, body))

< (1 + lr-p-c-size (t, program-body (assoc (name, prog-seg))))) ∧ definedp (name, prog-seg)) → proper-labeled-p-instructionsp (comp-body-1 (flag, body, n),

name, p-state (pc,

ctrl-stk, temp-stk, comp-programs (prog-seg), data-seg, max-ctrl, max-temp, word-size, psw))

Theorem: all-undef-addrs-strip-cadrs-lr-make-temp-var-dcls all-undef-addrs (strip-cadrs (lr-make-temp-var-dcls (temp-alist)))

Theorem: proper-p-programp-p-car-code (lr-programs-properp (l, table) ∧ (p-word-size (l) ∈ N) ∧ (p-word-size (l) ≮ s-max-subr-reqs) ∧ lr-proper-heapp (p-data-segment (l)) ∧ lr-proper-p-areasp (p-data-segment (l))) → proper-p-programp (p-car-code, lr->p (l))

Theorem: proper-p-programp-p-cdr-code (lr-programs-properp (l, table) ∧ (p-word-size (l) ∈ N) ∧ (p-word-size (l) ≮ s-max-subr-reqs) ∧ lr-proper-heapp (p-data-segment (l)) ∧ lr-proper-p-areasp (p-data-segment (l)))

→ proper-p-programp (p-cdr-code, lr->p (l))

Theorem: proper-p-programp-p-cons-code (lr-programs-properp (l, table) ∧ (p-word-size (l) ∈ N) ∧ (p-word-size (l) ≮ s-max-subr-reqs) ∧ lr-proper-heapp (p-data-segment (l)) ∧ lr-proper-p-areasp (p-data-segment (l))) → proper-p-programp (p-cons-code, lr->p (l))

Theorem: proper-p-programp-p-false-code (lr-programs-properp (l, table) ∧ (p-word-size (l) ∈ N) ∧ (p-word-size (l) ≮ log (2, lr-false-tag)) ∧ lr-proper-heapp (p-data-segment (l)) ∧ lr-proper-p-areasp (p-data-segment (l))) → proper-p-programp (p-false-code, lr->p (l))

Theorem: proper-p-programp-p-falsep-code (lr-programs-properp (l, table) ∧ (p-word-size (l) ∈ N) ∧ (p-word-size (l) ≮ log (2, lr-false-tag)) ∧ lr-proper-heapp (p-data-segment (l)) ∧ lr-proper-p-areasp (p-data-segment (l))) → proper-p-programp (p-falsep-code, lr->p (l))

Theorem: proper-p-programp-p-listp-code (lr-programs-properp (l, table) ∧ (p-word-size (l) ∈ N) ∧ (p-word-size (l) ≮ s-max-subr-reqs) ∧ lr-proper-heapp (p-data-segment (l)) ∧ lr-proper-p-areasp (p-data-segment (l))) → proper-p-programp (p-listp-code, lr->p (l))

Theorem: proper-p-programp-p-nlistp-code (lr-programs-properp (l, table) ∧ (p-word-size (l) ∈ N) ∧ (p-word-size (l) ≮ s-max-subr-reqs) ∧ lr-proper-heapp (p-data-segment (l)) ∧ lr-proper-p-areasp (p-data-segment (l))) → proper-p-programp (p-nlistp-code, lr->p (l))

Theorem: proper-p-programp-p-true-code (lr-programs-properp (l, table) ∧ (p-word-size (l) ∈ N)

∧ (p-word-size (l) ≮ log (2, lr-true-tag)) ∧ lr-proper-heapp (p-data-segment (l)) ∧ lr-proper-p-areasp (p-data-segment (l))) → proper-p-programp (p-true-code, lr->p (l))

Theorem: proper-p-programp-p-truep-code (lr-programs-properp (l, table) ∧ (p-word-size (l) ∈ N) ∧ (p-word-size (l) ≮ log (2, lr-true-tag)) ∧ lr-proper-heapp (p-data-segment (l)) ∧ lr-proper-p-areasp (p-data-segment (l))) → proper-p-programp (p-truep-code, lr->p (l))

Theorem: lr-s-similar-const-table-lr-data-seg-table-body (lr-proper-p-areasp (data-seg) ∧ lr-proper-heapp (data-seg) ∧ lr-s-similar-const-table (table, data-seg) ∧ s-data-seg-body-restrictedp (flag, body) ∧ definedp (f, table) ∧ (lr-count-free-nodes (fetch (lr-fp-addr, data-seg),

lr-free-list-nodes (lr-max-node (data-seg), data-seg),

data-seg) ≮ s-heap-reqs-body (flag, body, data-seg, table)))

→ lr-s-similar-const-table (cdr (lr-data-seg-table-body (flag, body, data-seg, table)),

car (lr-data-seg-table-body (flag, body, data-seg, table)))

Theorem: lr-s-similar-const-table-lr-data-seg-table-list (lr-proper-p-areasp (data-seg) ∧ lr-proper-heapp (data-seg) ∧ lr-s-similar-const-table (table, data-seg) ∧ s-data-seg-list-restrictedp (progs) ∧ definedp (f, table) ∧ (lr-count-free-nodes (fetch (lr-fp-addr, data-seg),

lr-free-list-nodes (lr-max-node (data-seg), data-seg),

data-seg) ≮ s-heap-reqs-list (progs, data-seg, table)))

→ lr-s-similar-const-table (cdr (lr-data-seg-table-list (progs, data-seg, table)),

car (lr-data-seg-table-list (progs, data-seg, table)))

Theorem: lr-s-similar-const-table-lr-init-data-seg-table (lr-proper-p-areasp (data-seg) ∧ lr-proper-heapp (data-seg) ∧ lr-s-similar-const-table (table, data-seg) ∧ s-init-data-seg-restrictedp (params) ∧ definedp (f, table) ∧ (lr-count-free-nodes (fetch (lr-fp-addr, data-seg),

lr-free-list-nodes (lr-max-node (data-seg), data-seg),

data-seg) ≮ s-init-heap-reqs (params, data-seg, table)))

→ lr-s-similar-const-table (cdr (lr-init-data-seg-table (params, data-seg, table)),

car (lr-init-data-seg-table (params, data-seg, table)))

Theorem: lr-s-similar-const-table-cdr-car-lr-data-seg-table ((heap-size ≮ s-total-heap-reqs (progs, params, heap-size)) ∧ s-restrictedp (progs, params)) → lr-s-similar-const-table (cdr (lr-data-seg-table (progs, params, heap-size)),

car (lr-data-seg-table (progs, params, heap-size)))

Definition: induct-hint-3 (flag, pos, prog) = if flag = 'list

then if pos ≃ nil then t

elseif listp (restn (car (last (pos)),

cur-expr (butlast (pos), s-body (prog))))

then induct-hint-3 (t, pos, prog)

∧ induct-hint-3 ('list, nx (pos), prog) else t endif

elseif listp (cur-expr (pos, s-body (prog)))

then if car (cur-expr (pos, s-body (prog))) = 'if

then induct-hint-3 (t, dv (pos, 1), prog)

∧ induct-hint-3 (t, dv (pos, 2), prog) ∧ induct-hint-3 (t, dv (pos, 3), prog)

elseif car (cur-expr (pos, s-body (prog))) = s-temp-fetch then t elseif (car (cur-expr (pos, s-body (prog))) = s-temp-eval)

∨ (car (cur-expr (pos, s-body (prog))) = s-temp-test) then induct-hint-3 (t, dv (pos, 1), prog) elseif car (cur-expr (pos, s-body (prog))) = 'quote then t else induct-hint-3 ('list, dv (pos, 1), prog) endif

else t endif

Theorem: lr-proper-exprp-p-lr-compile-programs-helper-1 listp (pos) → (lr-compile-body (t,

get (car (last (pos)), cur-expr (butlast (pos), body)), temp-alist, table)

= lr-compile-body (t, cur-expr (pos, body), temp-alist, table))

Theorem: good-posp1-cons-lessp-4-if-s-proper-exprp ((car (cur-expr (pos, body)) = 'if) ∧ good-posp1 (pos, body) ∧ s-proper-exprp (t, body, program-names, formals, temp-list)) → (good-posp1 (dv (pos, 1), body)

∧ good-posp1 (dv (pos, 2), body) ∧ good-posp1 (dv (pos, 3), body))

Theorem: lr-proper-exprp-flag-list-cons lr-proper-exprp ('list, cons (car, cdr), program-names, formals, temps, table) = (lr-proper-exprp ('list, cdr, program-names, formals, temps, table)

∧ lr-proper-exprp (t, car, program-names, formals, temps, table))

Theorem: lr-proper-exprp-flag-list-nil lr-proper-exprp ('list, nil, program-names, formals, temps, table)

Theorem: length-3-cdr-cddr-not-nil ((length (x) = 3) ∧ plistp (x)) → ((cdddr (x) = nil) ∧ (cddr (x) ≠ nil) ∧ (cdr (x) ≠ nil))

Theorem: lr-proper-exprp-flag-not-list-cons-if-helper (flag ≠ 'list) → (lr-proper-exprp (flag,

list ('if, test, then, else), program-names, formals, temp-alist, table)

= (('if ∉ program-names) ∧ lr-proper-exprp (t, test, program-names, formals, temp-alist, table)

∧ lr-proper-exprp (t, then, program-names, formals, temp-alist, table)

∧ lr-proper-exprp (t, else, program-names, formals, temp-alist, table)))

Theorem: lr-proper-exprp-flag-not-list-cons-if ((flag ≠ 'list) ∧ listp (cur-expr (pos, body)) ∧ (car (cur-expr (pos, body)) = 'if) ∧ good-posp1 (pos, body) ∧ lr-proper-exprp (t,

lr-compile-body (t, cur-expr (dv (pos, 3), body), temp-alist, table),

program-names, formals, strip-cdrs (temp-alist), table)

∧ lr-proper-exprp (t,

lr-compile-body (t, cur-expr (dv (pos, 2), body), temp-alist, table),

program-names, formals, strip-cdrs (temp-alist), table)

∧ lr-proper-exprp (t,

lr-compile-body (t, cur-expr (dv (pos, 1), body), temp-alist, table),

program-names, formals, strip-cdrs (temp-alist), table)

∧ s-proper-exprp (t, body, program-names, formals, strip-cars (temp-alist))) → lr-proper-exprp (flag,

cons ('if,

lr-compile-body ('list, cdr (cur-expr (pos, body)), temp-alist, table)),

program-names, formals, strip-cdrs (temp-alist), table)

Theorem: lr-proper-exprp-flag-not-list-cons-temp-fetch ((flag ≠ 'list) ∧ good-posp1 (pos, body) ∧ listp (cur-expr (pos, body)) ∧ (car (cur-expr (pos, body)) = s-temp-fetch) ∧ s-proper-exprp (t, body, program-names, formals, strip-cars (temp-alist))) → lr-proper-exprp (flag,

list (identity (s-temp-fetch), x, cdr (assoc (cadr (cur-expr (pos, body)), temp-alist))),

program-names, formals, strip-cdrs (temp-alist), table)

Theorem: good-posp1-dv-1-temp-eval-test (good-posp1 (pos, body) ∧ ((car (cur-expr (pos, body)) = s-temp-eval)

∨ (car (cur-expr (pos, body)) = s-temp-test)) ∧ listp (cur-expr (pos, body))) → good-posp1 (dv (pos, 1), body)

Theorem: length-last-fact (length (x) = 1) → (last (x) = x)

Theorem: lr-proper-exprp-flag-not-list-cons-temp-eval ((flag ≠ 'list)

∧ listp (cur-expr (pos, body)) ∧ good-posp1 (pos, body) ∧ (car (cur-expr (pos, body)) = s-temp-eval) ∧ lr-proper-exprp (t,

lr-compile-body (t, cur-expr (dv (pos, 1), body), temp-alist, table),

program-names,

formals,

strip-cdrs (temp-alist), table)

∧ s-proper-exprp (t, body, program-names, formals, strip-cars (temp-alist))) → lr-proper-exprp (flag,

list (identity (s-temp-eval), lr-compile-body (t,

cadr (cur-expr (pos, body)), temp-alist, table),

cdr (assoc (cadr (cur-expr (pos, body)), temp-alist))), program-names, formals, strip-cdrs (temp-alist), table)

Theorem: lr-proper-exprp-flag-not-list-cons-temp-test ((flag ≠ 'list) ∧ listp (cur-expr (pos, body)) ∧ good-posp1 (pos, body) ∧ (car (cur-expr (pos, body)) = s-temp-test) ∧ lr-proper-exprp (t,

lr-compile-body (t, cur-expr (dv (pos, 1), body), temp-alist, table),

program-names,

formals,

strip-cdrs (temp-alist), table)

∧ s-proper-exprp (t, body, program-names, formals, strip-cars (temp-alist))) → lr-proper-exprp (flag,

list (identity (s-temp-test), lr-compile-body (t,

cadr (cur-expr (pos, body)), temp-alist, table),

cdr (assoc (cadr (cur-expr (pos, body)), temp-alist))), program-names, formals, strip-cdrs (temp-alist), table)

Definition: lr-data-seg-table-body-n (n, body, data-seg, table) = if n ≃ 0 then cons (data-seg, table)

else lr-data-seg-table-body-n (n − 1, cdr (body), car (lr-data-seg-table-body (t,

car (body), data-seg, table)),

cdr (lr-data-seg-table-body (t, car (body), data-seg, table))) endif

Definition: induct-hint-20 (pos, body, data-seg, table) = if pos ≃ nil then t

elseif body ≃ nil then f

elseif car (body) = s-temp-fetch then f

elseif (car (body) = s-temp-eval) ∨ (car (body) = s-temp-test) then induct-hint-20 (cdr (pos), cadr (body), data-seg, table) elseif car (body) = 'quote then f else induct-hint-20 (cdr (pos),

get (car (pos), body),

car (lr-data-seg-table-body-n (car (pos) − 1, cdr (body), data-seg, table)),

cdr (lr-data-seg-table-body-n (car (pos) − 1, cdr (body), data-seg, table))) endif

Theorem: lr-data-seg-body-list-n lr-data-seg-table-body ('list, body, data-seg, table) = lr-data-seg-table-body-n (length (body), body, data-seg, table)

Theorem: definedp-table-definedp-cdr-lr-data-seg-table-body-n definedp (object, table) → definedp (object, cdr (lr-data-seg-table-body-n (n, body, data-seg, table)))

Theorem: definedp-lr-data-seg-body-list-n-not-lessp (definedp (x, cdr (lr-data-seg-table-body-n (n, body, data-seg, table))) ∧ (m ≮ n)) → definedp (x, cdr (lr-data-seg-table-body-n (m, body, data-seg, table)))

Theorem: lr-data-seg-table-body-add1-opener (n < length (body)) → (lr-data-seg-table-body-n (1 + n, body, data-seg, table)

= lr-data-seg-table-body (t, get (n, body), car (lr-data-seg-table-body-n (n,

body, data-seg, table)),

cdr (lr-data-seg-table-body-n (n, body, data-seg, table))))

Theorem: lr-data-seg-table-body-flag-t-flag-t (definedp (object,

cdr (lr-data-seg-table-body (t, get (n, body), car (lr-data-seg-table-body-n (n,

body, data-seg, table)),

cdr (lr-data-seg-table-body-n (n, body, data-seg, table)))))

∧ (n ∈ N) ∧ (n < length (body))) → definedp (object,

cdr (lr-data-seg-table-body ('list, body, data-seg, table)))

Theorem: definedp-cadr-cur-expr-quote-lr-data-seg-table-body (listp (cur-expr (pos, body)) ∧ (car (cur-expr (pos, body)) = 'quote) ∧ good-posp1 (pos, body)) → definedp (cadr (cur-expr (pos, body)),

cdr (lr-data-seg-table-body (t, body, data-seg, table)))

Theorem: definedp-cadr-cur-expr-quote-lr-data-seg-table-list (listp (cur-expr (pos, s-body (prog))) ∧ (car (cur-expr (pos, s-body (prog))) = 'quote) ∧ (prog ∈ progs) ∧ good-posp1 (pos, s-body (prog))) → definedp (cadr (cur-expr (pos, s-body (prog))),

cdr (lr-data-seg-table-list (progs, data-seg, table)))

Theorem: definedp-cadr-cur-expr-quote-lr-data-seg-table (listp (cur-expr (pos, s-body (prog))) ∧ (car (cur-expr (pos, s-body (prog))) = 'quote) ∧ (prog ∈ progs) ∧ good-posp1 (pos, s-body (prog))) → definedp (cadr (cur-expr (pos, s-body (prog))),

cdr (lr-data-seg-table (progs, params, heap-size)))

Theorem: lr-proper-exprp-p-lr-compile-programs-helper-2 (listp (cur-expr (pos, s-body (prog))) ∧ (car (cur-expr (pos, s-body (prog))) = 'quote) ∧ (prog ∈ progs) ∧ good-posp1 (pos, s-body (prog)) ∧ (heap-size ≮ s-total-heap-reqs (progs, params, heap-size)) ∧ s-restrictedp (progs, params)) → (type (cdr (assoc (cadr (cur-expr (pos, s-body (prog))),

cdr (lr-data-seg-table (progs, params, heap-size)))))

    = 'addr)

Theorem: good-posp-dv-1-funcall-opened (listp (cur-expr (pos, s-body (prog))) ∧ (car (cur-expr (pos, s-body (prog))) ≠ 'if) ∧ (car (cur-expr (pos, s-body (prog))) ≠ s-temp-eval) ∧ (car (cur-expr (pos, s-body (prog))) ≠ s-temp-test) ∧ (car (cur-expr (pos, s-body (prog))) ≠ s-temp-fetch) ∧ (car (cur-expr (pos, s-body (prog))) ≠ 'quote) ∧ good-posp1 (pos, s-body (prog))) → good-posp ('list, dv (pos, 1), s-body (prog))

Theorem: s-restrict-subrps-list-lr-proper-get-t (s-restrict-subrps ('list, cdr (expr)) ∧ listp (expr) ∧ (n ≄ 0) ∧ (n < length (expr))) → s-restrict-subrps (t, get (n, expr))

Theorem: s-restrict-subrps-t-lr-proper-get-t ((car (body) ≠ s-temp-fetch) ∧ (car (body) ≠ s-temp-eval) ∧ (car (body) ≠ s-temp-test) ∧ (car (body) ≠ 'quote) ∧ listp (body) ∧ s-proper-exprp (t, body, program-names, formals, temp-list) ∧ (n ≄ 0) ∧ (n < length (body)) ∧ s-restrict-subrps (t, body)) → s-restrict-subrps (t, get (n, body))

Event: Disable s-restrict-subrps-list-lr-proper-get-t.

Theorem: s-restrict-subrps-s-restrict-subrps-cur-expr (s-restrict-subrps (t, body) ∧ s-proper-exprp (t, body, program-names, formals, temp-list) ∧ good-posp1 (pos, body)) → s-restrict-subrps (t, cur-expr (pos, body))

Theorem: lr-proper-exprp-flag-not-list-cons-funcall ((flag ≠ 'list) ∧ listp (cur-expr (pos, s-body (prog))) ∧ good-posp1 (pos, s-body (prog)) ∧ (car (cur-expr (pos, s-body (prog))) ≠ 'if) ∧ (car (cur-expr (pos, s-body (prog))) ≠ s-temp-fetch) ∧ (car (cur-expr (pos, s-body (prog))) ≠ s-temp-eval) ∧ (car (cur-expr (pos, s-body (prog))) ≠ s-temp-test) ∧ (car (cur-expr (pos, s-body (prog))) ≠ 'quote) ∧ lr-proper-exprp ('list,

lr-compile-body ('list, cdr (cur-expr (pos, s-body (prog))), temp-alist, table),

program-names,

formals, temps, table)

∧ s-restrict-subrps (t, s-body (prog)) ∧ s-proper-exprp (t, s-body (prog), program-names, formals, temp-list)) → lr-proper-exprp (flag,

cons (car (cur-expr (pos, s-body (prog))), lr-compile-body ('list,

cdr (cur-expr (pos, s-body (prog))), temp-alist,

table)),

program-names, formals, temps, table)

Theorem: lr-proper-exprp-flag-not-list-not-listp ((flag ≠ 'list) ∧ (¬ listp (cur-expr (pos, body))) ∧ good-posp1 (pos, body) ∧ s-proper-exprp (t, body, program-names, formals, temp-list)) → lr-proper-exprp (flag,

cur-expr (pos, body), program-names, formals, temps, table)

Theorem: lr-proper-exprp-p-lr-compile-programs (s-restrict-subrps (t, s-body (prog)) ∧ (prog ∈ progs) ∧ subsetp (progs, all-progs) ∧ s-proper-exprp (t,

s-body (prog), program-names, formals, strip-cars (temp-alist))

∧ good-posp (flag, pos, s-body (prog)) ∧ (heap-size ≮ s-total-heap-reqs (all-progs, params, heap-size)) ∧ s-restrictedp (all-progs, params)) → lr-proper-exprp (flag,

lr-compile-body (flag, if flag = 'list then restn (car (last (pos)),

cur-expr (butlast (pos),

s-body (prog)))

else cur-expr (pos, s-body (prog)) endif, temp-alist, cdr (lr-data-seg-table (all-progs,

params, heap-size))),

program-names, formals, strip-cdrs (temp-alist), cdr (lr-data-seg-table (all-progs, params, heap-size)))

Event: Disable lr-proper-exprp-p-lr-compile-programs-helper-1.

Theorem: all-litatoms-s-formals-member-s-programs-properp ((prog ∈ progs) ∧ s-programs-properp (progs, program-names)) → all-litatoms (s-formals (prog))

Theorem: s-restrict-subrps-s-body-member-s-restrict-subrps-progs (s-restrict-subrps-progs (progs) ∧ (prog ∈ progs)) → s-restrict-subrps (t, s-body (prog))

Theorem: lr-proper-exprp-p-lr-compile-programs-flag-t (s-restrict-subrps-progs (all-progs) ∧ (prog ∈ all-progs) ∧ s-programs-properp (all-progs, program-names) ∧ (heap-size ≮ s-total-heap-reqs (all-progs, params, heap-size)) ∧ s-restrictedp (all-progs, params) ∧ (temp-alist = lr-make-temp-name-alist (s-temp-list (prog),

s-formals (prog))))

→ lr-proper-exprp (t,

lr-compile-body (t, s-body (prog), temp-alist, cdr (lr-data-seg-table (all-progs,

params, heap-size))),

program-names, s-formals (prog), strip-cdrs (temp-alist), cdr (lr-data-seg-table (all-progs, params, heap-size)))

Theorem: lr-programs-properp-1-lr-compile-programs (s-programs-properp (all-progs, program-names) ∧ s-programs-okp (progs) ∧ s-restrict-subrps-progs (all-progs) ∧ subsetp (progs, all-progs) ∧ (heap-size ≮ s-total-heap-reqs (all-progs, params, heap-size)) ∧ s-restrictedp (all-progs, params)) → lr-programs-properp-1 (lr-compile-programs (progs,

cdr (lr-data-seg-table (all-progs, params, heap-size))),

program-names,

cdr (lr-data-seg-table (all-progs, params, heap-size)))

Event: Disable all-litatoms-s-formals-member-s-programs-properp.

Theorem: subsetp-cdr subsetp (cdr (x), x)

Theorem: lr-programs-properp-s->lr-opened (s-good-statep (s, c) ∧ s-restrict-subrps-progs (s-progs (s)) ∧ (heap-size ≮ s-total-heap-reqs (s-progs (s), s-params (s), heap-size)) ∧ s-restrictedp (s-progs (s), s-params (s)) ∧ litatom (name (car (s-progs (s))))) → lr-programs-properp (s->lr1 (s,

p-state (pc, ctrl-stk, temp-stk, anything, data-seg, max-ctrl, max-temp, word-size, nil),

cdr (lr-data-seg-table (s-progs (s), s-params (s), heap-size))),

cdr (lr-data-seg-table (s-progs (s), s-params (s), heap-size)))

Theorem: fall-off-proofp-append-cons-ret fall-off-proofp (append (instrs, list (list ('dl, label, comment, '(ret)))))

Theorem: proper-labeled-p-instructionsp-label-ret litatom (label) → proper-labeled-p-instructionsp (list (list ('dl, label, comment, '(ret))),

name, p)

Theorem: member-definedp-car (x ∈ y) → definedp (car (x), y)

Theorem: all-litatoms-s-formals-member-lr-programs-properp ((prog ∈ prog-seg) ∧ (¬ all-litatoms (formal-vars (prog)))) → (¬ lr-programs-properp-1 (prog-seg, program-names, table))

Theorem: properp-p-temp-var-dclps-member-lr-programs-properp ((prog ∈ progs) ∧ lr-proper-heapp (data-seg) ∧ lr-proper-p-areasp (data-seg) ∧ lr-programs-properp-1 (progs, strip-logic-fnames (cdr (prog-seg)), table)) → proper-p-temp-var-dclsp (temp-var-dcls (prog),

p-state (pc, ctrl-stk, temp-stk, comp-programs (prog-seg), data-seg, max-ctrl-stk-size, max-temp-stk-size, word-size, psw))

Theorem: member-f-definedp-0 (f ∈ alist) → definedp (0, alist)

Theorem: member-no-duplicatesp-assoc-equal ((x ∈ alist) ∧ no-duplicatesp (strip-cars (alist)) ∧ good-alistp (alist)) → (assoc (car (x), alist) = x)

Event: Disable member-f-definedp-0.

Theorem: lr-proper-exprp-program-body-not-listp (¬ listp (prog)) → (¬ lr-proper-exprp (t, program-body (prog), pnames, formals, temps, table))

Theorem: good-alistp-lr-programs-properp (¬ good-alistp (prog-seg)) → (¬ lr-programs-properp-1 (prog-seg, program-names, table))

Event: Disable lr-proper-exprp-program-body-not-listp.

Theorem: proper-p-prog-segmentp-comp-programs-1-helper (lr-proper-heapp (data-seg) ∧ lr-proper-p-areasp (data-seg) ∧ lr-programs-properp-1 (prog-seg,

strip-logic-fnames (cdr (prog-seg)), table)

∧ all-user-fnamesp (cdr (strip-cars (prog-seg))) ∧ lr-s-similar-const-table (table, data-seg) ∧ (prog ∈ prog-seg)

∧ no-duplicatesp (strip-cars (prog-seg))) → proper-labeled-p-instructionsp (comp-body-1 (t, program-body (prog), 0),

car (prog), p-state (pc,

ctrl-stk, temp-stk, comp-programs (prog-seg), data-seg, max-ctrl, max-temp, word-size, psw))

Theorem: proper-p-prog-segmentp-comp-programs-1 (lr-proper-heapp (data-seg) ∧ lr-proper-p-areasp (data-seg) ∧ lr-programs-properp-1 (prog-seg,

strip-logic-fnames (cdr (prog-seg)), table)

∧ all-user-fnamesp (cdr (strip-cars (prog-seg))) ∧ lr-s-similar-const-table (table, data-seg) ∧ no-duplicatesp (strip-cars (prog-seg)) ∧ subsetp (progs, prog-seg) ∧ all-litatoms (strip-cars (progs))) → proper-p-prog-segmentp (comp-programs-1 (progs),

p-state (pc, ctrl-stk, temp-stk, comp-programs (prog-seg), data-seg, max-ctrl-stk-size, max-temp-stk-size, word-size, psw))

Event: Disable all-litatoms-s-formals-member-lr-programs-properp.

Theorem: proper-p-instructionp-set-global adpp (cons (name, 0), p-data-segment (l)) → proper-p-instructionp (list ('set-global, name), x, lr->p (l))

Theorem: proper-p-programp-append-car-prog-segment (lr-programs-properp-1 (prog-seg, strip-logic-fnames (cdr (prog-seg)), table) ∧ definedp (area-name (p-pc (l)), p-prog-segment (l))

∧ lr-proper-heapp (p-data-segment (l)) ∧ lr-proper-p-areasp (p-data-segment (l)) ∧ lr-s-similar-const-table (table, p-data-segment (l)) ∧ adpp (untag (lr-answer-addr), p-data-segment (l)) ∧ (prog-seg = p-prog-segment (l)) ∧ all-litatoms (strip-cars (prog-seg)) ∧ all-user-fnamesp (strip-cars (cdr (p-prog-segment (l))))) → proper-p-programp (cons (name (car (prog-seg)),

cons (formal-vars (car (prog-seg)),

cons (temp-var-dcls (car (prog-seg)),

append (label-instrs (comp-body-1 (t, program-body (car (prog-seg)), 0),

0),

list (list ('dl, lr-make-label (n1 ), coment1 ,

                                                 list ('set-global,

identity (area-name (lr-answer-addr)))), list ('dl,

lr-make-label (n2 ), comment2 , '(ret))))))),

lr->p (l))

Theorem: all-litatoms-all-user-fnamesp-plistp (all-user-fnamesp (list) ∧ plistp (list)) → all-litatoms (list)

Theorem: plistp-strip-cars plistp (strip-cars (x))

Theorem: lr-programs-properp-all-user-fnamesp-strip-cars-cdr lr-programs-properp (l, table) → all-user-fnamesp (strip-cars (cdr (p-prog-segment (l))))

Theorem: lr-programs-properp-caar-main lr-programs-properp (l, table) → (caar (p-prog-segment (l)) = 'main)

Theorem: proper-p-prog-segmentp-p-runtime-support-programs (lr-programs-properp (l, table) ∧ (p-word-size (l) ∈ N) ∧ (p-word-size (l) ≮ s-max-subr-reqs) ∧ lr-proper-heapp (p-data-segment (l)) ∧ lr-proper-p-areasp (p-data-segment (l))) → proper-p-prog-segmentp (p-runtime-support-programs, lr->p (l))

Theorem: proper-p-prog-segmentp-comp-programs (lr-proper-heapp (p-data-segment (l)) ∧ lr-proper-p-areasp (p-data-segment (l)) ∧ (progs = p-prog-segment (l)) ∧ lr-programs-properp (l, table) ∧ lr-s-similar-const-table (table, p-data-segment (l)) ∧ no-duplicatesp (strip-cars (p-prog-segment (l))) ∧ (p-word-size (l) ∈ N) ∧ (p-word-size (l) ≮ s-max-subr-reqs) ∧ adpp (untag (lr-answer-addr), p-data-segment (l))) → proper-p-prog-segmentp (comp-programs (progs), lr->p (l))

Event: Disable lr-programs-properp-caar-main.

Theorem: no-duplicatesp-remove-duplicates no-duplicatesp (remove-duplicates (x))

Theorem: all-p-objectps-put (all-p-objectps (lst, p) ∧ p-objectp (value, p) ∧ (offset < length (lst))) → all-p-objectps (put (value, offset, lst), p)

Theorem: proper-p-data-segmentp-deposit-helper (proper-p-data-segmentp (data-seg, p) ∧ (offset (addr) < length (cdr (assoc (area-name (addr), data-seg)))) ∧ p-objectp (value, p)) → proper-p-data-segmentp (deposit (value, addr, data-seg), p)

Theorem: proper-p-data-segmentp-deposit (proper-p-data-segmentp (data-seg, p) ∧ adpp (untag (addr), data-seg) ∧ p-objectp (value, p)) → proper-p-data-segmentp (deposit (value, addr, data-seg), p)

Theorem: all-p-objectps-get (all-p-objectps (lst, p) ∧ (offset < length (lst)) ∧ all-p-objectps (lst, p)) → p-objectp (get (offset, lst), p)

Theorem: proper-p-data-segmentp-fetch (proper-p-data-segmentp (data-seg, p) ∧ (offset (addr) < length (cdr (assoc (area-name (addr), data-seg)))) ∧ definedp (area-name (addr), data-seg)) → p-objectp (fetch (addr, data-seg), p)

Theorem: lr-s-similar-const-table-p-objectp-definedp (lr-s-similar-const-table (table, data-seg) ∧ lr-proper-heapp (data-seg) ∧ lr-proper-p-areasp (data-seg) ∧ definedp (f, table) ∧ (lr-count-free-nodes (fetch (lr-fp-addr, data-seg),

lr-free-list-nodes (lr-max-node (data-seg), data-seg),

data-seg) ≮ s-heap-reqs (flag, object2 , data-seg, table))

∧ definedp (object1 , cdr (lr-compile-quote (flag, object2 , data-seg, table))) ∧ same-signature (p-data-segment (p), data-seg) ∧ s-restricted-objectp (flag, object2 )) → p-objectp (cdr (assoc (object1 ,

cdr (lr-compile-quote (flag, object2 , data-seg, table)))),

p)

Theorem: lessp-x-sub1-facts (x < ((y − 1) − 1)) → ((x < y) ∧ (x < (y − 1)))

Theorem: proper-p-data-segmentp-deposit-a-list-cons ((area-name (addr) = lr-heap-name) ∧ adpp (untag (addr), data-seg) ∧ ((offset (addr) + 3) < length (cdr (assoc (lr-heap-name, data-seg)))) ∧ p-objectp (a, p) ∧ p-objectp (b, p) ∧ p-objectp (c, p) ∧ p-objectp (d, p) ∧ proper-p-data-segmentp (data-seg, p)) → proper-p-data-segmentp (deposit-a-list (list (a, b, c, d), addr, data-seg), p)

Theorem: proper-p-data-segmentp-deposit-a-list-cons-cons let ds-tab be lr-compile-quote ('list, list (x, y), data-seg, table),

count-nodes be lr-count-free-nodes (fetch (lr-fp-addr, data-seg),

lr-free-list-nodes (lr-max-node (data-seg), data-seg),

data-seg)

in (lr-proper-p-areasp (data-seg) ∧ lr-proper-heapp (data-seg) ∧ lr-s-similar-const-table (table, data-seg) ∧ definedp (f, table) ∧ ((count-nodes − 1)

≮ s-heap-reqs ('list, list (x, y), data-seg, table)) ∧ (count-nodes ≠ 0)

∧ proper-p-data-segmentp (car (ds-tab), p) ∧ ((length (cdr (assoc (lr-heap-name, data-seg))) − 1)

≮ (offset (fetch (lr-fp-addr, car (ds-tab)))

+ lr-node-size))

∧ (p-word-size (p) ∈ N) ∧ (p-word-size (p) ≮ s-max-subr-reqs) ∧ same-signature (p-data-segment (p), data-seg) ∧ s-restricted-objectp ('list, list (x, y))) → proper-p-data-segmentp (deposit-a-list (list (identity (tag ('nat,

lr-cons-tag)),

identity (tag ('nat,

1)),

cdr (assoc (x,

cdr (ds-tab))),

cdr (assoc (y,

cdr (ds-tab)))),

fetch (identity (lr-fp-addr), car (ds-tab)),

car (ds-tab)),

p) endlet

Theorem: proper-p-data-segmentp-deposit-a-list-cons-numberp (lr-proper-p-areasp (data-seg) ∧ lr-proper-heapp (data-seg) ∧ (p-word-size (p) ≮ log (2, number)) ∧ (number ∈ N) ∧ proper-p-data-segmentp (data-seg, p) ∧ ((length (cdr (assoc (lr-heap-name, data-seg))) − 1)

≮ (offset (fetch (lr-fp-addr, data-seg)) + lr-node-size)) ∧ (p-word-size (p) ∈ N) ∧ (p-word-size (p) ≮ s-max-subr-reqs) ∧ same-signature (p-data-segment (p), data-seg)) → proper-p-data-segmentp (deposit-a-list (list (identity (tag ('nat,

lr-add1-tag)),

identity (tag ('nat, 1)), tag ('nat, number), identity (lr-undef-addr)),

fetch (identity (lr-fp-addr),

data-seg), data-seg),

p)

Theorem: proper-p-data-segmentp-deposit-a-list-cons-truep (lr-proper-p-areasp (data-seg)

∧ lr-proper-heapp (data-seg) ∧ proper-p-data-segmentp (data-seg, p) ∧ ((length (cdr (assoc (lr-heap-name, data-seg))) − 1)

≮ (offset (fetch (lr-fp-addr, data-seg)) + lr-node-size)) ∧ (p-word-size (p) ∈ N) ∧ (p-word-size (p) ≮ log (2, lr-true-tag)) ∧ same-signature (p-data-segment (p), data-seg)) → proper-p-data-segmentp (deposit-a-list (list (identity (tag ('nat,

lr-true-tag)),

identity (tag ('nat, 1)), identity (lr-undef-addr), identity (lr-undef-addr)),

fetch (identity (lr-fp-addr),

data-seg), data-seg),

p)

Event: Disable proper-p-data-segmentp-deposit-a-list-cons.

Theorem: s-ws-reqs-flag-not-list-t ((flag ≠ 'list) ∧ (¬ definedp (t, table))) → (s-ws-reqs (flag, t, data-seg, table) = identity (log (2, lr-true-tag)))

Theorem: lr-compile-quote-preserves-proper-p-data-segmentp (lr-s-similar-const-table (table, data-seg) ∧ s-restricted-objectp (flag, object) ∧ lr-proper-heapp (data-seg) ∧ lr-proper-p-areasp (data-seg) ∧ definedp (f, table) ∧ (p-word-size (p) ∈ N) ∧ (p-word-size (p) ≮ s-ws-reqs (flag, object, data-seg, table)) ∧ (lr-count-free-nodes (fetch (lr-fp-addr, data-seg),

lr-free-list-nodes (lr-max-node (data-seg), data-seg),

data-seg) ≮ s-heap-reqs (flag, object, data-seg, table))

∧ proper-p-data-segmentp (data-seg, p) ∧ same-signature (p-data-segment (p), data-seg)) → proper-p-data-segmentp (car (lr-compile-quote (flag,

object, data-seg, table)),

p)

Theorem: lr-data-seg-table-body-preserves-proper-p-data-segmentp (lr-s-similar-const-table (table, data-seg) ∧ s-data-seg-body-restrictedp (flag, body) ∧ lr-proper-heapp (data-seg) ∧ lr-proper-p-areasp (data-seg) ∧ proper-p-data-segmentp (data-seg, p) ∧ definedp (f, table) ∧ (p-word-size (p) ∈ N) ∧ (p-word-size (p) ≮ s-ws-reqs-body (flag, body, data-seg, table)) ∧ (lr-count-free-nodes (fetch (lr-fp-addr, data-seg),

lr-free-list-nodes (lr-max-node (data-seg), data-seg),

data-seg) ≮ s-heap-reqs-body (flag, body, data-seg, table))

∧ same-signature (p-data-segment (p), data-seg)) → proper-p-data-segmentp (car (lr-data-seg-table-body (flag,

body, data-seg, table)),

p)

Theorem: lr-data-seg-table-list-preserves-proper-p-data-segmentp (lr-s-similar-const-table (table, data-seg) ∧ s-data-seg-list-restrictedp (progs) ∧ lr-proper-heapp (data-seg) ∧ lr-proper-p-areasp (data-seg) ∧ proper-p-data-segmentp (data-seg, p) ∧ definedp (f, table) ∧ (p-word-size (p) ∈ N) ∧ (p-word-size (p) ≮ s-ws-reqs-list (progs, data-seg, table)) ∧ (lr-count-free-nodes (fetch (lr-fp-addr, data-seg),

lr-free-list-nodes (lr-max-node (data-seg), data-seg),

data-seg)

≮ s-heap-reqs-list (progs, data-seg, table)) ∧ same-signature (p-data-segment (p), data-seg)) → proper-p-data-segmentp (car (lr-data-seg-table-list (progs,

data-seg, table)),

p)

Theorem: lr-init-data-seg-table-preserves-proper-p-data-segmentp (lr-s-similar-const-table (table, data-seg) ∧ s-init-data-seg-restrictedp (params)

∧ lr-proper-heapp (data-seg) ∧ lr-proper-p-areasp (data-seg) ∧ proper-p-data-segmentp (data-seg, p) ∧ definedp (f, table) ∧ (p-word-size (p) ∈ N) ∧ (p-word-size (p) ≮ s-init-ws-reqs (params, data-seg, table)) ∧ (lr-count-free-nodes (fetch (lr-fp-addr, data-seg),

lr-free-list-nodes (lr-max-node (data-seg), data-seg),

data-seg) ≮ s-init-heap-reqs (params, data-seg, table))

∧ same-signature (p-data-segment (p), data-seg)) → proper-p-data-segmentp (car (lr-init-data-seg-table (params,

data-seg, table)),

p)

Theorem: all-p-objectps-lr-init-heap-contents-helper-helper (heap-size ≄ 0) → ((identity (lr-node-size)

+ x

+ (identity (lr-node-size) ∗ (heap-size − 1))) = (x + (identity (lr-node-size) ∗ heap-size)))

Theorem: all-p-objectps-lr-init-heap-contents-helper ((p-word-size (p) ∈ N) ∧ (p-word-size (p) ≮ s-max-subr-reqs) ∧ (heap-size ≮ 4) ∧ lr-proper-p-areasp (p-data-segment (p)) ∧ lr-minimum-heapp (p-data-segment (p)) ∧ (type (addr) = 'addr) ∧ (cddr (addr) = nil) ∧ listp (addr) ∧ (offset (addr) ∈ N) ∧ lr-boundary-nodep (addr) ∧ (area-name (addr) = lr-heap-name) ∧ definedp (lr-heap-name, p-data-segment (p)) ∧ (((lr-node-size ∗ heap-size) + offset (addr))

< length (cdr (assoc (lr-heap-name, p-data-segment (p)))))) → all-p-objectps (lr-init-heap-contents (addr, heap-size), p)

Event: Disable all-p-objectps-lr-init-heap-contents-helper-helper.

Theorem: all-p-objectps-lr-init-heap-contents ((p-word-size (p) ∈ N) ∧ (p-word-size (p) ≮ s-max-subr-reqs) ∧ (heap-size ≮ 4) ∧ lr-proper-p-areasp (p-data-segment (p)) ∧ same-signature (p-data-segment (p), lr-init-data-seg (heap-size))) → all-p-objectps (lr-init-heap-contents (identity (tag ('addr,

cons (lr-heap-name,

0))),

heap-size),

p)

Theorem: proper-p-data-segmentp-lr-init-data-seg-helper ((p-word-size (p) ∈ N) ∧ (p-word-size (p) ≮ s-max-subr-reqs) ∧ (heap-size ≮ 4) ∧ lr-proper-p-areasp (p-data-segment (p)) ∧ same-signature (p-data-segment (p), lr-init-data-seg (heap-size))) → proper-p-data-segmentp (deposit-a-list (list (tag ('nat, lr-false-tag),

tag ('nat, 1), lr-undef-addr, lr-undef-addr),

lr-f-addr,

deposit-a-list (list (tag ('nat,

lr-undefined-tag), tag ('nat, 1),

lr-undef-addr, lr-undef-addr),

lr-undef-addr,

list (list (area-name (lr-fp-addr), add-addr (lr-f-addr,

lr-node-size)),

list (area-name (lr-answer-addr),

tag ('nat, 0)), cons (lr-heap-name,

lr-init-heap-contents (tag ('addr,

cons (lr-heap-name,

0)),

heap-size))))),

p)

Theorem: proper-p-data-segmentp-lr-init-data-seg ((p-word-size (p) ∈ N)

∧ (p-word-size (p) ≮ s-max-subr-reqs) ∧ (heap-size ≮ 4) ∧ lr-proper-p-areasp (p-data-segment (p)) ∧ same-signature (p-data-segment (p), lr-init-data-seg (heap-size))) → proper-p-data-segmentp (lr-init-data-seg (heap-size), p)

Theorem: proper-p-data-segmentp-lr-init-data-seg-compile-t0 ((p-word-size (p) ∈ N) ∧ (p-word-size (p) ≮ s-max-subr-reqs) ∧ (heap-size ≮ 4) ∧ lr-proper-p-areasp (p-data-segment (p)) ∧ same-signature (p-data-segment (p), lr-init-data-seg (heap-size))) → proper-p-data-segmentp (car (lr-compile-quote ('list,

list (t, 0),

lr-init-data-seg (heap-size), list (cons (f, addr)))),

p)

Theorem: same-signature-car-lr-data-seg-table-list-reducer (lr-proper-free-listp (data-seg2 ) ∧ lr-proper-p-areasp (data-seg2 ) ∧ definedp (lr-heap-name, data-seg2 ) ∧ lr-boundary-nodep (lr-max-node (data-seg2 ))) → (same-signature (data-seg1 ,

car (lr-data-seg-table-list (progs, data-seg2 , table)))

↔ same-signature (data-seg1 , data-seg2 ))

Theorem: same-signature-car-lr-init-data-seg-table-reducer (lr-proper-free-listp (data-seg2 ) ∧ lr-proper-p-areasp (data-seg2 ) ∧ definedp (lr-heap-name, data-seg2 ) ∧ lr-boundary-nodep (lr-max-node (data-seg2 ))) → (same-signature (data-seg1 ,

car (lr-init-data-seg-table (params, data-seg2 , table)))

↔ same-signature (data-seg1 , data-seg2 ))

Theorem: same-signature-car-lr-compile-quote-reducer (lr-proper-free-listp (data-seg2 ) ∧ lr-proper-p-areasp (data-seg2 ) ∧ definedp (lr-heap-name, data-seg2 ) ∧ lr-boundary-nodep (lr-max-node (data-seg2 ))) → (same-signature (data-seg1 ,

car (lr-compile-quote (flag, object, data-seg2 , table)))

↔ same-signature (data-seg1 , data-seg2 ))

Theorem: proper-p-data-segmentp-lr-data-seg-table ((p-word-size (p) ∈ N) ∧ (p-word-size (p) ≮ s-max-subr-reqs) ∧ lr-proper-p-areasp (p-data-segment (p)) ∧ s-restrictedp (progs, params) ∧ (heap-size ≮ s-total-heap-reqs (progs, params, heap-size)) ∧ (p-word-size (p) ≮ s-total-ws-reqs (progs, params, heap-size)) ∧ same-signature (p-data-segment (p),

car (lr-data-seg-table (progs, params, heap-size))))

→ proper-p-data-segmentp (car (lr-data-seg-table (progs, params, heap-size)), p)

Theorem: adpp-untag-answer-addr-car-lr-data-seg-table adpp (identity (untag (lr-answer-addr)),

car (lr-data-seg-table (progs, params, heap-size)))

Theorem: program-body-assoc-cdr-lr-compile-programs (name ≠ caar (progs)) → (program-body (assoc (name, cdr (lr-compile-programs (progs, table))))

= lr-compile-body (t, s-body (assoc (name, cdr (progs))), lr-make-temp-name-alist (s-temp-list (assoc (name,

cdr (progs))),

s-formals (assoc (name,

cdr (progs)))),

table))

Theorem: s-total-ws-reqs-not-lessp-s-max-subr-reqs (word-size ≮ s-total-ws-reqs (progs, params, heap-size)) → (word-size ≮ s-max-subr-reqs)

Theorem: proper-p-statep-lr->p-s->lr (s-good-statep (s, c) ∧ all-litatoms (strip-cars (s-params (s))) ∧ (max-ctrl ≮ (2 + length (s-params (s)) + length (s-temps (s)))) ∧ (word-size ∈ N) ∧ (max-temp < exp (2, word-size)) ∧ (max-ctrl < exp (2, word-size)) ∧ (max-temp ∈ N) ∧ (max-ctrl ∈ N) ∧ (heap-size ≮ s-total-heap-reqs (s-progs (s), s-params (s), heap-size)) ∧ s-restrict-subrps-progs (s-progs (s)) ∧ litatom (name (car (s-progs (s)))) ∧ no-duplicatesp (strip-cars (s-progs (s))) ∧ (strip-cars (s-params (s)) = s-formals (s-prog (s)))

∧ s-restrictedp (s-progs (s), s-params (s)) ∧ (word-size ≮ s-total-ws-reqs (s-progs (s), s-params (s), heap-size))) → proper-p-statep (lr->p (s->lr (s, heap-size, max-ctrl, max-temp, word-size)))

Theorem: lr-programs-properp-s->lr (s-good-statep (s, c) ∧ s-restrict-subrps-progs (s-progs (s)) ∧ s-restrictedp (s-progs (s), s-params (s)) ∧ (heap-size ≮ s-total-heap-reqs (s-progs (s), s-params (s), heap-size)) ∧ litatom (name (car (s-progs (s))))) → lr-programs-properp (s->lr (s, heap-size, max-ctrl, max-temp, word-size),

cdr (lr-data-seg-table (s-progs (s), s-params (s), heap-size)))

Definition: lr-total-heap-reqs (expr, alist, program-names, heap-size, c) = (s-total-heap-reqs (s-progs (logic->s (expr, alist, program-names)),

alist, heap-size)

+ s-eval-heap-r (t, logic->s (expr, alist, program-names), c))

Definition: lr-max-ctrl-reqs (expr, alist, program-names, c) = (2

+ length (s-params (logic->s (expr, alist, program-names))) + length (s-temps (logic->s (expr, alist, program-names))) + s-eval-ctrl-r (t, logic->s (expr, alist, program-names), c))

Definition: lr-max-temp-reqs (expr, alist, program-names, c) = s-eval-temp-r (t, logic->s (expr, alist, program-names), c)

Definition: lr-max-word-size-reqs (expr, alist, program-names, heap-size, c) = max (s-total-ws-reqs (s-progs (logic->s (expr, alist, program-names)),

s-params (logic->s (expr, alist, program-names)), heap-size),

s-eval-ws-r (t, logic->s (expr, alist, program-names), c))

Theorem: lr-eval-s-eval-equivalence-s->lr let s-lr be s->lr (s, heap-size, max-ctrl, max-temp, word-size) in (proper-p-statep (lr->p (s-lr)) ∧ lr-programs-properp (s-lr, cdr (lr-data-seg-table (s-progs (s),

s-params (s), heap-size)))

∧ lr-s-similar-statesp (s-params (s), s-temps (s), s-lr, cdr (lr-data-seg-table (s-progs (s),

s-params (s), heap-size)))

∧ s-restrictedp (s-progs (s), s-params (s)) ∧ (heap-size ≮ s-total-heap-reqs (s-progs (s),

s-params (s), heap-size))

∧ s-good-statep (s, c) ∧ (p-psw (lr-eval (t, s-lr, c)) = 'run) ∧ (s-pname (s) = name (car (s-progs (s)))) ∧ (s-pos (s) = nil)) → lr-valp (s-ans (s-eval (t, s, c)),

car (p-temp-stk (lr-eval (t, s-lr, c))),

p-data-segment (lr-eval (t, s-lr, c))) endlet

Theorem: same-signature-car-lr-data-seg-table (heap-size ≮ s-total-heap-reqs (progs, params, heap-size)) → same-signature (lr-init-data-seg (heap-size),

car (lr-data-seg-table (progs, params, heap-size)))

Theorem: lr-max-node-car-lr-data-seg-table (heap-size ≮ s-total-heap-reqs (progs, params, heap-size)) → (lr-max-node (car (lr-data-seg-table (progs, params, heap-size)))

= tag ('addr,

cons (identity (lr-heap-name), identity (lr-node-size) ∗ heap-size)))

Theorem: lr-count-free-nodes-lr-data-seg-table-list-s-heap-reqs-help (lr-proper-free-listp (data-seg) ∧ lr-proper-p-areasp (data-seg) ∧ definedp (lr-heap-name, data-seg) ∧ lr-minimum-heapp (data-seg) ∧ lr-boundary-nodep (lr-max-node (data-seg)) ∧ (lr-count-free-nodes (fetch (lr-fp-addr, data-seg),

lr-free-list-nodes (lr-max-node (data-seg), data-seg),

data-seg) ≮ s-heap-reqs-body (t, body, data-seg, table)))

→ ((s-heap-reqs-body (t, body, data-seg, table)

+ lr-count-free-nodes (fetch (identity (lr-fp-addr),

car (lr-data-seg-table-body (t, body, data-seg, table))),

lr-free-list-nodes (lr-max-node (data-seg),

car (lr-data-seg-table-body (t, body, data-seg, table))),

car (lr-data-seg-table-body (t, body, data-seg, table))))

= lr-count-free-nodes (fetch (identity (lr-fp-addr), data-seg),

lr-free-list-nodes (lr-max-node (data-seg), data-seg),

data-seg))

Theorem: lr-count-free-nodes-lr-data-seg-table-list-s-heap-reqs (lr-proper-free-listp (data-seg) ∧ lr-proper-p-areasp (data-seg) ∧ definedp (lr-heap-name, data-seg) ∧ lr-minimum-heapp (data-seg) ∧ lr-boundary-nodep (lr-max-node (data-seg)) ∧ (lr-count-free-nodes (fetch (lr-fp-addr, data-seg),

lr-free-list-nodes (lr-max-node (data-seg), data-seg),

data-seg) ≮ s-heap-reqs-list (progs, data-seg, table)))

→ ((lr-count-free-nodes (fetch (lr-fp-addr,

car (lr-data-seg-table-list (progs, data-seg, table))),

lr-free-list-nodes (lr-max-node (data-seg),

car (lr-data-seg-table-list (progs, data-seg, table))),

car (lr-data-seg-table-list (progs, data-seg, table)))

+ s-heap-reqs-list (progs, data-seg, table))

= lr-count-free-nodes (fetch (lr-fp-addr, data-seg),

lr-free-list-nodes (lr-max-node (data-seg), data-seg),

data-seg))

Theorem: lr-max-node-car-lr-data-seg-table-list (lr-proper-free-listp (data-seg) ∧ lr-proper-p-areasp (data-seg) ∧ definedp (lr-heap-name, data-seg) ∧ lr-boundary-nodep (lr-max-node (data-seg))) → (lr-max-node (car (lr-data-seg-table-list (progs, data-seg, table)))

= lr-max-node (data-seg))

Theorem: lr-count-free-nodes-lr-data-seg-table-list-s-heap-reqs-1 (lr-proper-heapp (data-seg) ∧ lr-proper-p-areasp (data-seg) ∧ (lr-count-free-nodes (fetch (lr-fp-addr, data-seg),

lr-free-list-nodes (lr-max-node (data-seg), data-seg),

data-seg)

≮ s-heap-reqs-list (progs, data-seg, table)) ∧ (max-addr = lr-max-node (car (lr-data-seg-table-list (progs,

data-seg, table)))))

→ (lr-count-free-nodes (fetch (identity (lr-fp-addr),

car (lr-data-seg-table-list (progs, data-seg, table))),

lr-free-list-nodes (max-addr,

car (lr-data-seg-table-list (progs, data-seg, table))),

car (lr-data-seg-table-list (progs, data-seg, table)))

= (lr-count-free-nodes (fetch (lr-fp-addr, data-seg),

lr-free-list-nodes (lr-max-node (data-seg), data-seg),

data-seg) − s-heap-reqs-list (progs, data-seg, table)))

Theorem: lr-count-free-nodes-lr-init-data-seg-table-s-heap-reqs-1 (lr-proper-heapp (data-seg) ∧ lr-proper-p-areasp (data-seg) ∧ (lr-count-free-nodes (fetch (lr-fp-addr, data-seg),

lr-free-list-nodes (lr-max-node (data-seg), data-seg),

data-seg) ≮ s-init-heap-reqs (params, data-seg, table))

∧ (max-addr = lr-max-node (car (lr-init-data-seg-table (params, data-seg,

table)))))

→ (lr-count-free-nodes (fetch (identity (lr-fp-addr),

car (lr-init-data-seg-table (params, data-seg, table))),

lr-free-list-nodes (max-addr,

car (lr-init-data-seg-table (params, data-seg, table))),

car (lr-init-data-seg-table (params, data-seg, table)))

= (lr-count-free-nodes (fetch (lr-fp-addr, data-seg),

lr-free-list-nodes (lr-max-node (data-seg), data-seg),

data-seg) − s-init-heap-reqs (params, data-seg, table)))

Theorem: not-lessp-lr-count-free-nodes-lr-data-seg-table-heap-r ((heap-size ≮ (s-total-heap-reqs (progs, params, heap-size) + x)) ∧ s-restrictedp (progs, params)) → (lr-count-free-nodes (fetch (identity (lr-fp-addr),

car (lr-data-seg-table (progs, params, heap-size))),

lr-free-list-nodes (lr-max-node (car (lr-data-seg-table (progs, params, heap-size))),

car (lr-data-seg-table (progs, params, heap-size))),

car (lr-data-seg-table (progs, params, heap-size)))

≮ x)

Theorem: lr-eval-s-eval-flag-run-s->lr let s-lr be s->lr (s, heap-size, max-ctrl, max-temp, word-size) in (proper-p-statep (lr->p (s-lr)) ∧ lr-programs-properp (s-lr,

cdr (lr-data-seg-table (s-progs (s), s-params (s), heap-size)))

∧ lr-s-similar-statesp (s-params (s), s-temps (s), s-lr, cdr (lr-data-seg-table (s-progs (s), s-params (s), heap-size)))

∧ s-restrictedp (s-progs (s), s-params (s)) ∧ s-good-statep (s, c) ∧ s-all-temps-setp (t,

s-body (car (s-progs (s))), temp-alist-to-set (s-temps (s)))

∧ s-all-progs-temps-setp (s-progs (s)) ∧ s-check-temps-setp (s-temps (s)) ∧ (s-err-flag (s-eval (t, s, c)) = 'run) ∧ (heap-size ≮ (s-total-heap-reqs (s-progs (s),

s-params (s), heap-size)

+ s-eval-heap-r (t, s, c)))

∧ (max-ctrl ≮ (p-ctrl-stk-size (p-ctrl-stk (s-lr))

+ s-eval-ctrl-r (t, s, c)))

∧ (max-temp ≮ s-eval-temp-r (t, s, c)) ∧ (word-size ≮ s-eval-ws-r (t, s, c)) ∧ (word-size ≮ s-max-subr-reqs) ∧ (s-pname (s) = name (car (s-progs (s)))) ∧ (s-pos (s) = nil)) → (p-psw (lr-eval (t, s-lr, c)) = 'run) endlet

Theorem: all-undef-addr-strip-cdrs-lr-make-initial-temps all-undef-addrs (strip-cdrs (lr-make-initial-temps (x)))

Theorem: lr-s-similar-temps-make-temps-entries-initial-temps (all-undef-addrs (strip-cdrs (lr-temps)) ∧ (length (s-temps) = length (lr-temps))) → lr-s-similar-temps (make-temps-entries (s-temps), lr-temps, data-seg)

Definition: object-addrs (object-list, table) = if listp (object-list)

then cons (cdr (assoc (car (object-list), table)),

object-addrs (cdr (object-list), table))

else nil endif

Theorem: lr-valp-lr-compile-quote (lr-proper-p-areasp (data-seg) ∧ lr-s-similar-const-table (table, data-seg) ∧ s-restricted-objectp (flag, object) ∧ lr-proper-heapp (data-seg) ∧ definedp (f, table) ∧ (lr-count-free-nodes (fetch (lr-fp-addr, data-seg), lr-free-list-nodes (lr-max-node (data-seg), data-seg),

data-seg) ≮ s-heap-reqs (flag, object, data-seg, table)))

→ if flag = 'list

then lr-check-result1 (object,

object-addrs (object,

cdr (lr-compile-quote (flag, object, data-seg, table))),

car (lr-compile-quote (flag, object, data-seg, table)))

else lr-valp (object,

cdr (assoc (object,

cdr (lr-compile-quote (flag, object, data-seg, table)))),

car (lr-compile-quote (flag, object, data-seg, table))) endif

Theorem: lr-init-data-seg-table-preserves-lr-valp (lr-proper-p-areasp (data-seg) ∧ lr-good-pointerp-tablep (table, data-seg) ∧ s-init-data-seg-restrictedp (params) ∧ lr-proper-heapp (data-seg) ∧ definedp (f, table) ∧ (lr-count-free-nodes (fetch (lr-fp-addr, data-seg),

lr-free-list-nodes (lr-max-node (data-seg), data-seg),

data-seg) ≮ s-init-heap-reqs (params, data-seg, table))

∧ lr-valp (value, addr, data-seg)) → lr-valp (value, addr, car (lr-init-data-seg-table (params, data-seg, table)))

Theorem: lr-valp-lr-compile-quote-flag-t (lr-proper-p-areasp (data-seg) ∧ lr-s-similar-const-table (table, data-seg) ∧ s-restricted-objectp (t, object) ∧ lr-proper-heapp (data-seg) ∧ definedp (f, table) ∧ (lr-count-free-nodes (fetch (lr-fp-addr, data-seg),

lr-free-list-nodes (lr-max-node (data-seg), data-seg),

data-seg)

≮ s-heap-reqs (t, object, data-seg, table))) → lr-valp (object,

cdr (assoc (object,

cdr (lr-compile-quote (t, object, data-seg, table)))),

car (lr-compile-quote (t, object, data-seg, table)))

Theorem: lr-s-similar-params-pair-formals-lr-init-data-seg (lr-proper-p-areasp (data-seg) ∧ lr-s-similar-const-table (table, data-seg) ∧ s-init-data-seg-restrictedp (params) ∧ lr-proper-heapp (data-seg) ∧ definedp (f, table) ∧ (lr-count-free-nodes (fetch (lr-fp-addr, data-seg),

lr-free-list-nodes (lr-max-node (data-seg), data-seg),

data-seg) ≮ s-init-heap-reqs (params, data-seg, table)))

→ lr-s-similar-params (params,

pair-formals-with-addresses (params,

cdr (lr-init-data-seg-table (params, data-seg, table))),

car (lr-init-data-seg-table (params, data-seg, table)))

Theorem: lr-data-seg-table-body-preserves-lr-valp (lr-proper-p-areasp (data-seg) ∧ lr-good-pointerp-tablep (table, data-seg) ∧ s-data-seg-body-restrictedp (flag, body) ∧ lr-proper-heapp (data-seg) ∧ definedp (f, table) ∧ (lr-count-free-nodes (fetch (lr-fp-addr, data-seg),

lr-free-list-nodes (lr-max-node (data-seg), data-seg),

data-seg) ≮ s-heap-reqs-body (flag, body, data-seg, table))

∧ lr-valp (value, addr, data-seg)) → lr-valp (value,

addr,

car (lr-data-seg-table-body (flag, body, data-seg, table)))

Theorem: lr-data-seg-table-list-preserves-lr-valp (lr-proper-p-areasp (data-seg) ∧ lr-good-pointerp-tablep (table, data-seg) ∧ s-data-seg-list-restrictedp (progs) ∧ lr-proper-heapp (data-seg)

∧ definedp (f, table) ∧ (lr-count-free-nodes (fetch (lr-fp-addr, data-seg),

lr-free-list-nodes (lr-max-node (data-seg), data-seg),

data-seg)

≮ s-heap-reqs-list (progs, data-seg, table)) ∧ lr-valp (value, addr, data-seg)) → lr-valp (value, addr, car (lr-data-seg-table-list (progs, data-seg, table)))

Theorem: lr-data-seg-table-list-preserves-lr-s-similar-params (lr-proper-p-areasp (data-seg) ∧ lr-good-pointerp-tablep (table, data-seg) ∧ s-data-seg-list-restrictedp (progs) ∧ lr-proper-heapp (data-seg) ∧ definedp (f, table) ∧ (lr-count-free-nodes (fetch (lr-fp-addr, data-seg),

lr-free-list-nodes (lr-max-node (data-seg), data-seg),

data-seg)

≮ s-heap-reqs-list (progs, data-seg, table)) ∧ lr-s-similar-params (s-params, lr-params, data-seg)) → lr-s-similar-params (s-params,

lr-params,

car (lr-data-seg-table-list (progs, data-seg, table)))

Definition: all-definedp (list, alist) = if listp (list)

then definedp (car (list), alist) ∧ all-definedp (cdr (list), alist)

else t endif

Theorem: assoc-definedp-table-lr-data-seg-table-body definedp (object, table) → (assoc (object, cdr (lr-data-seg-table-body (flag, expr, data-seg, table)))

= assoc (object, table))

Theorem: assoc-definedp-table-lr-data-seg-table-list definedp (object, table) → (assoc (object, cdr (lr-data-seg-table-list (progs, data-seg, table)))

= assoc (object, table))

Theorem: pair-formals-with-addresses-lr-data-seg-table-list all-definedp (strip-cdrs (params), table) → (pair-formals-with-addresses (params,

cdr (lr-data-seg-table-list (progs, data-seg, table)))

= pair-formals-with-addresses (params, table))

Theorem: all-definedp-strip-cdrs-lr-init-data-seg-table (lr-s-similar-const-table (table, data-seg) ∧ lr-proper-p-areasp (data-seg) ∧ lr-proper-heapp (data-seg) ∧ definedp (f, table) ∧ s-init-data-seg-restrictedp (params) ∧ (lr-count-free-nodes (fetch (lr-fp-addr, data-seg),

lr-free-list-nodes (lr-max-node (data-seg), data-seg),

data-seg) ≮ s-init-heap-reqs (params, data-seg, table)))

→ all-definedp (strip-cdrs (params), cdr (lr-init-data-seg-table (params, data-seg, table)))

Theorem: lr-s-similar-params-pair-formals-with-addresses ((heap-size ≮ s-total-heap-reqs (progs, params, heap-size)) ∧ s-restrictedp (progs, params)) → lr-s-similar-params (params,

pair-formals-with-addresses (params,

cdr (lr-data-seg-table (progs, params, heap-size))),

car (lr-data-seg-table (progs, params, heap-size)))

Theorem: lr-s-similar-statesp-s->lr-lr-data-seg-table ((heap-size ≮ s-total-heap-reqs (s-progs (s), s-params (s), heap-size)) ∧ s-restrictedp (s-progs (s), s-params (s)) ∧ (strip-cars (s-params (s)) = s-formals (car (s-progs (s)))) ∧ (s-pname (s) = name (car (s-progs (s)))) ∧ (s-temps (s) = make-temps-entries (s-temp-list (car (s-progs (s)))))) → lr-s-similar-statesp (s-params (s),

s-temps (s),

s->lr (s, heap-size, max-ctrl, max-temp, word-size), cdr (lr-data-seg-table (s-progs (s),

s-params (s), heap-size)))

Theorem: p-ctrl-stk-size-p-ctrl-stk-s->lr p-ctrl-stk-size (p-ctrl-stk (s->lr (s, heap-size, max-ctrl, max-temp, word-size))) = (2 + length (s-params (s)) + length (s-temps (s)))

Theorem: s->lr-ok let s-lr be s->lr (s, heap-size, max-ctrl, max-temp, word-size) in (s-good-statep (s, c) ∧ s-all-temps-setp (t,

s-body (car (s-progs (s))), temp-alist-to-set (s-temps (s)))

∧ s-all-progs-temps-setp (s-progs (s)) ∧ (s-temps (s)

= make-temps-entries (s-temp-list (car (s-progs (s))))) ∧ s-check-temps-setp (s-temps (s)) ∧ s-restrictedp (s-progs (s), s-params (s)) ∧ (heap-size ≮ (s-total-heap-reqs (s-progs (s),

s-params (s), heap-size)

+ s-eval-heap-r (t, s, c)))

∧ s-restrict-subrps-progs (s-progs (s)) ∧ (max-ctrl ≮ (2

+ length (s-params (s)) + length (s-temps (s)) + s-eval-ctrl-r (t, s, c)))

∧ (max-ctrl ∈ N) ∧ (max-ctrl < exp (2, word-size)) ∧ (max-temp ∈ N) ∧ (max-temp ≮ s-eval-temp-r (t, s, c)) ∧ (max-temp < exp (2, word-size)) ∧ (word-size ≮ max (s-total-ws-reqs (s-progs (s),

s-params (s), heap-size),

s-eval-ws-r (t, s, c)))

∧ (word-size ∈ N) ∧ litatom (name (car (s-progs (s)))) ∧ (s-pname (s) = name (car (s-progs (s)))) ∧ (s-pos (s) = nil) ∧ all-litatoms (strip-cars (s-params (s))) ∧ no-duplicatesp (strip-cars (s-progs (s))) ∧ (strip-cars (s-params (s)) = s-formals (car (s-progs (s)))) ∧ (s-err-flag (s-eval (t, s, c)) = 'run)) → lr-valp (s-ans (s-eval (t, s, c)),

car (p-temp-stk (lr-eval (t, s-lr, c))),

p-data-segment (lr-eval (t, s-lr, c))) endlet

Theorem: s-good-state-logic->s (l-proper-programsp (prog-names)

∧ l-proper-exprp (t, expr, prog-names, strip-cars (alist)) ∧ all-litatoms (strip-cars (alist))) → s-good-statep (logic->s (expr, alist, prog-names), c)

Theorem: s-body-car-s-progs-logic->s s-body (car (s-progs (logic->s (expr, alist, pnames)))) = expr

Theorem: l-proper-programsp-s-progs-logic->s (l-proper-programsp (pnames) ∧ l-proper-exprp (t, expr, pnames, formals)) → s-all-progs-temps-setp (s-progs (logic->s (expr, alist, pnames)))

Theorem: s-temps-logic->s s-temps (logic->s (expr, alist, pnames)) = nil

Theorem: s-temp-list-car-s-progs-logic->s s-temp-list (car (s-progs (logic->s (expr, alist, pnames)))) = nil

Theorem: s-params-logic->s s-params (logic->s (expr, alist, pnames)) = alist

Definition: l-data-seg-body-restrictedp (flag, expr) = if flag = 'list

then if listp (expr)

then l-data-seg-body-restrictedp (t, car (expr))

∧ l-data-seg-body-restrictedp ('list, cdr (expr)) else t endif

elseif listp (expr)

then if car (expr) = 'quote then s-restricted-objectp (t, cadr (expr)) else l-data-seg-body-restrictedp ('list, cdr (expr)) endif

else t endif

Definition: l-data-seg-list-restrictedp (fun-names) = if listp (fun-names)

then l-data-seg-body-restrictedp (t, body (car (fun-names))) ∧ l-data-seg-list-restrictedp (cdr (fun-names))

else t endif

Definition: l-restrictedp (fun-names, alist) = (s-init-data-seg-restrictedp (alist)

∧ l-data-seg-list-restrictedp (fun-names))

Theorem: l-data-seg-body-restrictedp-s-data-seg-body-restrictedp l-data-seg-body-restrictedp (flag, body) → s-data-seg-body-restrictedp (flag, body)

Theorem: l-data-seg-body-restrictedp-delete-all l-data-seg-list-restrictedp (pnames) → l-data-seg-list-restrictedp (delete-all (name, pnames))

Theorem: l-data-seg-list-restrictedp-s-data-seg-list-restrictedp (l-data-seg-list-restrictedp (pnames) ∧ l-data-seg-body-restrictedp (t, expr)) → s-data-seg-list-restrictedp (s-progs (logic->s (expr, alist, pnames)))

Theorem: l-restrict-subrps-s-restrict-subrps (l-restrict-subrps (flag, expr) ∧ l-proper-exprp (flag, expr, program-names, formals)) → s-restrict-subrps (flag, expr)

Theorem: l-restrict-subrps-progs-delete-all l-restrict-subrps-progs (pnames) → l-restrict-subrps-progs (delete-all (name, pnames))

Theorem: l-restrict-subrps-progs-s-restrict-subrps-progs (l-restrict-subrps-progs (pnames) ∧ l-proper-programsp-1 (pnames, program-names)) → s-restrict-subrps-progs (s-construct-programs (remove-duplicates (pnames)))

Theorem: l-restrict-subrps-progs-s-restrict-subrps-progs-logic->s (l-restrict-subrps-progs (pnames) ∧ l-restrict-subrps (t, expr) ∧ l-proper-exprp (t, expr, program-names, formals) ∧ l-proper-programsp (pnames)) → s-restrict-subrps-progs (s-progs (logic->s (expr, alist, pnames)))

Theorem: name-car-s-progs-logic->s name (car (s-progs (logic->s (expr, alist, pnames)))) = 'main

Theorem: s-pname-logic->s s-pname (logic->s (expr, alist, pnames)) = 'main

Theorem: s-pos-logic->s s-pos (logic->s (expr, alist, pnames)) = nil

Theorem: definedp-user-fname-s-construct-programs (litatom (name) ∧ all-litatoms-not-plist (pnames)) → (definedp (user-fname (name), s-construct-programs (pnames))

= (name ∈ pnames))

Theorem: no-duplicatesp-strip-cars-s-construct-programs all-litatoms-not-plist (pnames) → (no-duplicatesp (strip-cars (s-construct-programs (pnames)))

= no-duplicatesp (pnames))

Theorem: all-user-fnamesp-strip-cars-s-construct-programs all-litatoms-not-plist (pnames) → all-user-fnamesp (strip-cars (s-construct-programs (pnames)))

Theorem: no-duplicatesp-strip-cars-s-progs-logic->s all-litatoms-not-plist (pnames) → no-duplicatesp (strip-cars (s-progs (logic->s (expr, alist, pnames))))

Theorem: s-formals-car-s-progs-logic->s s-formals (car (s-progs (logic->s (expr, alist, pnames)))) = strip-cars (alist)

Theorem: s-expr-logic->s s-expr (logic->s (expr, alist, pnames)) = expr

Theorem: all-litatoms-not-plist-lr-proper-programsp l-proper-programsp (prog-names) → all-litatoms-not-plist (prog-names)

Theorem: logic->lr-ok-really (l-proper-exprp (t, expr, pnames, strip-cars (alist)) ∧ l-proper-programsp (pnames) ∧ all-litatoms (strip-cars (alist)) ∧ l-data-seg-body-restrictedp (t, expr) ∧ l-restrictedp (pnames, alist) ∧ v&c$ (t, expr, alist) ∧ (cdr (v&c$ (t, expr, alist)) < c) ∧ l-restrict-subrps (t, expr) ∧ l-restrict-subrps-progs (pnames) ∧ (heap-size ≮ lr-total-heap-reqs (expr, alist, pnames, heap-size, c)) ∧ (max-ctrl ≮ lr-max-ctrl-reqs (expr, alist, pnames, c)) ∧ (max-ctrl < exp (2, word-size)) ∧ (max-ctrl ∈ N) ∧ (max-temp ≮ lr-max-temp-reqs (expr, alist, pnames, c)) ∧ (max-temp < exp (2, word-size)) ∧ (max-temp ∈ N) ∧ (word-size ≮ lr-max-word-size-reqs (expr, alist, pnames, heap-size, c)) ∧ (word-size ∈ N)) → lr-valp (car (v&c$ (t, expr, alist)),

car (p-temp-stk (lr-eval (t,

s->lr (logic->s (expr, alist, pnames), heap-size, max-ctrl, max-temp, word-size),

c))),

p-data-segment (lr-eval (t,

s->lr (logic->s (expr, alist, pnames), heap-size, max-ctrl, max-temp, word-size),

c)))

; ------------------------------------------------------------
; was p1.events
; ------------------------------------------------------------

Definition: logic->p (expr, alist, pnames, heap-size, max-ctrl, max-temp, word-size) = lr->p (s->lr (logic->s (expr, alist, pnames),

heap-size, max-ctrl, max-temp, word-size))

Definition: p-run-subr-clock (l, new-l) = case on car (lr-expr (l)):

case = car then p-car-clock (p-set-pc (lr->p (new-l), lr-return-pc (l))) case = cdr then p-cdr-clock (p-set-pc (lr->p (new-l), lr-return-pc (l))) case = cons then p-cons-clock (p-set-pc (lr->p (new-l), lr-return-pc (l))) case = false then p-false-clock (p-set-pc (lr->p (new-l), lr-return-pc (l))) case = falsep then p-falsep-clock (p-set-pc (lr->p (new-l), lr-return-pc (l))) case = listp then p-listp-clock (p-set-pc (lr->p (new-l), lr-return-pc (l))) case = nlistp then p-nlistp-clock (p-set-pc (lr->p (new-l), lr-return-pc (l))) case = true then p-true-clock (p-set-pc (lr->p (new-l), lr-return-pc (l))) case = truep then p-truep-clock (p-set-pc (lr->p (new-l), lr-return-pc (l))) otherwise 0 endcase

Event: Disable p-run-subr-clock.

Definition: p-clock1 (flag, l, c) = if p-psw (l) ≠ 'run then 0

elseif flag = 'list then if offset (p-pc (l)) ≃ nil then 0

elseif listp (lr-expr-list (l)) then p-clock1 (t, l, c)

+ p-clock1 ('list,

lr-set-expr (lr-eval (t, l, c), l, nx (offset (p-pc (l)))),

c)

else 0 endif elseif c ≃ 0 then 0 elseif litatom (lr-expr (l)) then 1 elseif lr-expr (l) ≃ nil then 0 elseif car (lr-expr (l)) = 'if then let test be lr-if-ok (lr-eval (t,

lr-set-pos (l,

dv (offset (p-pc (l)), 1)),

c))

in

if p-psw (test) = 'run

then if top (p-temp-stk (test)) ≠ lr-f-addr

then p-clock1 (t, lr-set-pos (l, dv (offset (p-pc (l)), 1)), c)

               + 3

+ p-clock1 (t,

lr-set-expr (lr-pop-tstk (test), l, dv (offset (p-pc (l)),

2)),

c)

               + 1

else p-clock1 (t,

lr-set-pos (l,

dv (offset (p-pc (l)), 1)),

c)

+ p-clock1 (t,

lr-set-expr (lr-pop-tstk (test), l, dv (offset (p-pc (l)),

3)),

c) endif

else p-clock1 (t, lr-set-pos (l, dv (offset (p-pc (l)), 1)),

c) endif endlet

elseif car (lr-expr (l)) = s-temp-eval then p-clock1 (t, lr-set-pos (l, dv (offset (p-pc (l)), 1)), c) + 1 elseif car (lr-expr (l)) = s-temp-test then if lr-eval-temp-setp (l) then 5

else 4

+ p-clock1 (t, lr-set-pos (l, dv (offset (p-pc (l)), 1)), c)

+ 2 endif

elseif car (lr-expr (l)) = s-temp-fetch then 1 elseif car (lr-expr (l)) = 'quote then 1 elseif p-psw (lr-eval ('list, lr-set-pos (l, dv (offset (p-pc (l)), 1)), c))

     ≠ 'run

then p-clock1 ('list, lr-set-pos (l, dv (offset (p-pc (l)), 1)), c) elseif subrp (car (lr-expr (l))) then p-clock1 ('list, lr-set-pos (l, dv (offset (p-pc (l)), 1)), c)

+ p-run-subr-clock (l,

lr-eval ('list,

lr-set-pos (l,

dv (offset (p-pc (l)), 1)),

c))

elseif litatom (car (lr-expr (l))) then let fs be lr-funcall (l,

lr-eval ('list,

lr-set-pos (l,

dv (offset (p-pc (l)), 1)),

c))

in

p-clock1 ('list, lr-set-pos (l, dv (offset (p-pc (l)), 1)), c)

     + 1

+ p-clock1 (t, fs, c − 1)

+ 1 endlet else 0 endif Definition: lr-good-pointerps (list, data-seg) = if listp (list)

then lr-good-pointerp (car (list), data-seg)

∧ lr-good-pointerps (cdr (list), data-seg) else t endif

Definition: lr-proper-ctrl-stkp (ctrl-stk, data-seg) = if ctrl-stk ≃ nil then ctrl-stk = nil

else lr-good-pointerps (strip-cdrs (bindings (top (ctrl-stk))), data-seg)

∧ lr-proper-ctrl-stkp (pop (ctrl-stk), data-seg) endif

Definition: lr-p-proper-statep (temp-stk, ctrl-stk, data-seg, table) = (lr-proper-ctrl-stkp (ctrl-stk, data-seg)

∧ lr-good-pointerps (temp-stk, data-seg)

∧ lr-proper-heapp (data-seg)

∧ lr-good-pointerp-tablep (table, data-seg))

Event: Disable lr-p-proper-statep.

Theorem: definedp-cdr-assoc-lr-good-pointerps ((addr ∈ list) ∧ lr-good-pointerps (list, data-seg)) → lr-good-pointerp (addr, data-seg)

Theorem: lr-p-proper-statep-lr-push-tstk-cdr-assoc-lr-expr (litatom (lr-expr (l)) ∧ proper-p-statep (lr->p (l)) ∧ good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ lr-p-proper-statep (p-temp-stk (l),

p-ctrl-stk (l),

p-data-segment (l), table)

∧ (p-psw (lr-push-tstk (l,

cdr (assoc (lr-expr (l),

bindings (car (p-ctrl-stk (l)))))))

      = 'run))

→ lr-p-proper-statep (p-temp-stk (lr-push-tstk (l,

cdr (assoc (lr-expr (l),

bindings (car (p-ctrl-stk (l))))))),

p-ctrl-stk (l), p-data-segment (l), table)

Theorem: lr-p-proper-statep-cdr-temp-stk lr-p-proper-statep (temp-stk, ctrl-stk, data-seg, table) → lr-p-proper-statep (cdr (temp-stk), ctrl-stk, data-seg, table)

Theorem: lr-good-pointerps-put-assoc (lr-good-pointerp (addr, data-seg) ∧ lr-good-pointerps (strip-cdrs (bindings), data-seg)) → lr-good-pointerps (strip-cdrs (put-assoc (addr, expr, bindings)), data-seg)

Theorem: lr-p-proper-statep-cons-p-frame-put-assoc (lr-p-proper-statep (temp-stk, ctrl-stk, data-seg, table) ∧ listp (temp-stk) ∧ listp (ctrl-stk) ∧ (cdr-ctrl-stk = cdr (ctrl-stk))) → lr-p-proper-statep (temp-stk,

cons (p-frame (put-assoc (car (temp-stk), expr, bindings (car (ctrl-stk))),

ret-pc), cdr-ctrl-stk),

data-seg, table)

Theorem: lr-eval-leaves-listp-p-ctrl-stk-lr->p-lr-set-pos (proper-p-statep (lr->p (l)) ∧ good-posp (flag, pos, program-body (p-current-program (l))) ∧ good-posp (flag, offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ (p-psw (lr-eval (flag, lr-set-pos (l, pos), c)) = 'run)) → listp (p-ctrl-stk (lr-eval (flag, lr-set-pos (l, pos), c)))

Theorem: lr-p-proper-statep-cdr-assoc-caddr-lr-expr-bindings (proper-p-statep (lr->p (l)) ∧ lr-p-proper-statep (temp-stk, p-ctrl-stk (l), data-seg, table) ∧ good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ listp (lr-expr (l)) ∧ ((car (lr-expr (l)) = s-temp-test)

∨ (car (lr-expr (l)) = s-temp-fetch))) → lr-p-proper-statep (cons (cdr (assoc (caddr (lr-expr (l)),

bindings (car (p-ctrl-stk (l))))),

temp-stk), p-ctrl-stk (l), data-seg, table)

Theorem: member-strip-cdrs-lr-good-pointerp-tablep ((object ∈ strip-cdrs (table)) ∧ lr-good-pointerp-tablep (table, data-seg)) → lr-good-pointerp (object, data-seg)

Theorem: lr-p-proper-statep-p-temps-stk-lr-push-tstk-quote (listp (lr-expr (l)) ∧ (car (lr-expr (l)) = 'quote) ∧ good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ (p-psw (lr-push-tstk (l, cadr (lr-expr (l)))) = 'run) ∧ lr-p-proper-statep (p-temp-stk (l), ctrl-stk, data-seg, table)) → lr-p-proper-statep (p-temp-stk (lr-push-tstk (l, cadr (lr-expr (l)))),

ctrl-stk, data-seg, table)

Theorem: p-run-subr-preserves-lr-good-pointerp-tablep (listp (lr-expr (l)) ∧ (car (lr-expr (l)) ≠ 'if) ∧ (car (lr-expr (l)) ≠ 'quote) ∧ (p-psw (new-l) = 'run) ∧ subrp (car (lr-expr (l))) ∧ lr-good-pointerp-tablep (table2 , p-data-segment (new-l)) ∧ proper-p-statep (lr->p (l)) ∧ good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table1 ) ∧ lr-programs-properp (new-l, table1 ) ∧ (p-psw (p-run-subr (car (lr-expr (l)),

p-set-pc (lr->p (new-l), lr-return-pc (l))))

    = 'run)

∧ lr-proper-heapp (p-data-segment (new-l)) ∧ proper-p-statep (lr->p (new-l)) ∧ (p-prog-segment (new-l) = p-prog-segment (l))) → lr-good-pointerp-tablep (table2 ,

p-data-segment (p-run-subr (car (lr-expr (l)),

p-set-pc (lr->p (new-l), lr-return-pc (l)))))

Theorem: lr-good-pointerps-deposit-free-ptr lr-good-pointerps (list, deposit (anything, identity (lr-fp-addr), data-seg)) = lr-good-pointerps (list, data-seg)

Theorem: lr-proper-ctrl-stkp-deposit-free-ptr lr-proper-ctrl-stkp (ctrl-stk, deposit (anything, identity (lr-fp-addr), data-seg)) = lr-proper-ctrl-stkp (ctrl-stk, data-seg)

Theorem: lr-good-pointerp-deposit-a-list-node (lr-good-pointerp (addr1 , data-seg) ∧ (type (addr2 ) = 'addr) ∧ (cddr (addr2 ) = nil) ∧ listp (addr2 ) ∧ adpp (untag (addr2 ), data-seg) ∧ lr-boundary-nodep (addr2 ) ∧ (area-name (addr2 ) = 'heap) ∧ (type (ref-count) = 'nat)) → lr-good-pointerp (addr1 ,

deposit-a-list (list (x, ref-count, y, z), addr2 , data-seg))

Theorem: lr-good-pointerps-deposit-a-list-node (lr-good-pointerps (list, data-seg) ∧ (type (addr) = 'addr) ∧ (cddr (addr) = nil) ∧ listp (addr) ∧ adpp (untag (addr), data-seg) ∧ lr-boundary-nodep (addr) ∧ (area-name (addr) = 'heap) ∧ (type (ref-count) = 'nat)) → lr-good-pointerps (list,

deposit-a-list (list (x, ref-count, y, z), addr, data-seg))

Theorem: lr-proper-ctrl-stkp-deposit-a-list-node (lr-proper-ctrl-stkp (list, data-seg) ∧ (type (addr) = 'addr) ∧ (cddr (addr) = nil) ∧ listp (addr) ∧ adpp (untag (addr), data-seg) ∧ lr-boundary-nodep (addr) ∧ (area-name (addr) = 'heap) ∧ (type (ref-count) = 'nat)) → lr-proper-ctrl-stkp (list,

deposit-a-list (list (x, ref-count, y, z), addr, data-seg))

Theorem: p-run-subr-preserves-lr-proper-ctrl-stkp (good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table)

∧ listp (lr-expr (l)) ∧ subrp (car (lr-expr (l))) ∧ (car (lr-expr (l)) ≠ 'if) ∧ (car (lr-expr (l)) ≠ 'quote) ∧ proper-p-statep (lr->p (l)) ∧ lr-proper-heapp (p-data-segment (lr-eval ('list, lr-set-pos (l, pos), c))) ∧ lr-proper-ctrl-stkp (p-ctrl-stk (lr-eval ('list, lr-set-pos (l, pos), c)),

p-data-segment (lr-eval ('list, lr-set-pos (l, pos), c)))

∧ (p-psw (lr-eval ('list, lr-set-pos (l, pos), c)) = 'run) ∧ (p-psw (p-run-subr (car (lr-expr (l)),

p-set-pc (lr->p (lr-eval ('list, lr-set-pos (l, pos), c)),

lr-return-pc (l))))

    = 'run)

∧ (pos = dv (offset (p-pc (l)), 1))) → lr-proper-ctrl-stkp (p-ctrl-stk (lr-eval ('list, lr-set-pos (l, pos), c)),

p-data-segment (p-run-subr (car (lr-expr (l)),

p-set-pc (lr->p (lr-eval ('list,

lr-set-pos (l,

pos),

c)),

lr-return-pc (l)))))

Theorem: lr-good-pointerps-cons-lr-f-addr-lr-proper-heapp (lr-good-pointerps (list, data-seg) ∧ lr-proper-heapp (data-seg) ∧ lr-proper-p-areasp (data-seg)) → lr-good-pointerps (cons (identity (lr-f-addr), list), data-seg)

Theorem: lr-good-pointerps-cons-lr-t-addr-lr-proper-heapp (lr-good-pointerps (list, data-seg) ∧ lr-proper-heapp (data-seg) ∧ lr-proper-p-areasp (data-seg)) → lr-good-pointerps (cons (identity (lr-t-addr), list), data-seg)

Theorem: lr-good-pointerps-cons-lr-0-addr-lr-proper-heapp (lr-good-pointerps (list, data-seg) ∧ lr-proper-heapp (data-seg) ∧ lr-proper-p-areasp (data-seg)) → lr-good-pointerps (cons (identity (lr-0-addr), list), data-seg)

Theorem: lr-good-pointerps-cdr lr-good-pointerps (list, data-seg) → lr-good-pointerps (cdr (list), data-seg)

Theorem: lr-good-pointerps-cons-fetch-car-temp-stk-cdr-car (lr-good-pointerps (temp-stk, data-seg) ∧ lr-proper-heapp (data-seg) ∧ lr-proper-p-areasp (data-seg) ∧ (length (temp-stk) ≮ 1) ∧ (fetch (car (temp-stk), data-seg) = tag ('nat, lr-cons-tag))) → lr-good-pointerps (cons (fetch (add-addr (car (temp-stk),

identity (lr-car-offset)),

data-seg), cdr (temp-stk)),

data-seg)

Theorem: lr-good-pointerps-cons-fetch-car-temp-stk-cdr-cdr (lr-good-pointerps (temp-stk, data-seg) ∧ lr-proper-heapp (data-seg) ∧ lr-proper-p-areasp (data-seg) ∧ (length (temp-stk) ≮ 1) ∧ (fetch (car (temp-stk), data-seg) = tag ('nat, lr-cons-tag))) → lr-good-pointerps (cons (fetch (add-addr (car (temp-stk),

identity (lr-cdr-offset)),

data-seg), cdr (temp-stk)),

data-seg)

Theorem: lr-good-pointerps-cons-fetch-fp-addr-deposit-a-list-cons (lr-proper-heapp (data-seg) ∧ lr-good-pointerps (temp-stk, data-seg) ∧ (fp-addr = fetch (identity (lr-fp-addr), data-seg)) ∧ (type (ref-count) = 'nat)) → lr-good-pointerps (cons (fetch (identity (lr-fp-addr), data-seg), temp-stk),

deposit-a-list (list (x, ref-count, y, z), fp-addr, data-seg))

Theorem: p-run-subr-preserves-lr-good-pointerps let lr-eval be lr-eval ('list, lr-set-pos (l, pos), c) in (good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ listp (lr-expr (l)) ∧ subrp (car (lr-expr (l))) ∧ (car (lr-expr (l)) ≠ 'if) ∧ (car (lr-expr (l)) ≠ 'quote) ∧ proper-p-statep (lr->p (l)) ∧ lr-proper-heapp (p-data-segment (lr-eval))

∧ lr-good-pointerps (p-temp-stk (lr-eval), p-data-segment (lr-eval)) ∧ (p-psw (lr-eval) = 'run) ∧ (p-psw (p-run-subr (car (lr-expr (l)),

p-set-pc (lr->p (lr-eval), lr-return-pc (l))))

    = 'run)

∧ (length (p-temp-stk (lr-eval)) ≮ arity (car (lr-expr (l)))) ∧ (pos = dv (offset (p-pc (l)), 1))) → lr-good-pointerps (p-temp-stk (p-run-subr (car (lr-expr (l)),

p-set-pc (lr->p (lr-eval),

lr-return-pc (l)))),

p-data-segment (p-run-subr (car (lr-expr (l)),

p-set-pc (lr->p (lr-eval), lr-return-pc (l))))) endlet

Theorem: p-run-subr-preserves-lr-proper-heapp2-alt (good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ lr-programs-properp (new-l, table) ∧ listp (lr-expr (l)) ∧ proper-p-statep (lr->p (new-l)) ∧ lr-proper-free-listp (p-data-segment (new-l)) ∧ adpp (untag (lr-max-node (p-data-segment (new-l))), p-data-segment (new-l)) ∧ lr-boundary-nodep (lr-max-node (p-data-segment (new-l))) ∧ (p-psw (new-l) = 'run) ∧ (p-psw (p-run-subr (car (lr-expr (l)),

p-set-pc (lr->p (new-l), lr-return-pc (l))))

    = 'run)

∧ lr-good-pointerps (p-temp-stk (new-l), p-data-segment (new-l)) ∧ (length (p-temp-stk (new-l)) ≮ arity (car (lr-expr (l)))) ∧ lr-proper-heapp2 (addr, p-data-segment (new-l)) ∧ lr-nodep (addr, p-data-segment (new-l)) ∧ (p-prog-segment (l) = p-prog-segment (new-l))) → lr-proper-heapp2 (addr,

p-data-segment (p-run-subr (car (lr-expr (l)),

p-set-pc (lr->p (new-l), lr-return-pc (l)))))

Theorem: p-run-subr-preserves-lr-proper-heapp (good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ lr-programs-properp (new-l, table) ∧ listp (lr-expr (l)) ∧ (car (lr-expr (l)) ≠ 'if) ∧ subrp (car (lr-expr (l)))

∧ proper-p-statep (lr->p (new-l)) ∧ (p-psw (new-l) = 'run) ∧ (p-psw (p-run-subr (car (lr-expr (l)),

p-set-pc (lr->p (new-l), lr-return-pc (l))))

    = 'run)

∧ (p-prog-segment (l) = p-prog-segment (new-l)) ∧ (area-name (p-pc (l)) = area-name (p-pc (new-l))) ∧ lr-proper-heapp (p-data-segment (new-l)) ∧ lr-good-pointerps (p-temp-stk (new-l), p-data-segment (new-l)) ∧ (length (p-temp-stk (new-l)) ≮ arity (car (lr-expr (l))))) → lr-proper-heapp (p-data-segment (p-run-subr (car (lr-expr (l)),

p-set-pc (lr->p (new-l), lr-return-pc (l)))))

Theorem: lr-apply-subr-preserves-lr-p-proper-statep let lr-eval be lr-eval ('list, lr-set-pos (l, pos), c) in (listp (lr-expr (l)) ∧ (car (lr-expr (l)) ≠ 'if) ∧ (car (lr-expr (l)) ≠ 'quote) ∧ (car (lr-expr (l)) ≠ s-temp-eval) ∧ (car (lr-expr (l)) ≠ s-temp-test) ∧ (car (lr-expr (l)) ≠ s-temp-fetch) ∧ (p-psw (lr-eval ('list, lr-set-pos (l, pos), c)) = 'run) ∧ subrp (car (lr-expr (l))) ∧ lr-p-proper-statep (p-temp-stk (lr-eval),

p-ctrl-stk (lr-eval),

p-data-segment (lr-eval), table)

∧ proper-p-statep (lr->p (l)) ∧ good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ (p-psw (lr-apply-subr (l, lr-eval)) = 'run) ∧ lr-proper-formalsp (cdr (p-prog-segment (l))) ∧ (pos = dv (offset (p-pc (l)), 1))) → lr-p-proper-statep (p-temp-stk (lr-apply-subr (l, lr-eval)),

p-ctrl-stk (lr-eval),

p-data-segment (lr-apply-subr (l, lr-eval)), table) endlet

Theorem: strip-cdrs-append strip-cdrs (append (x, y)) = append (strip-cdrs (x), strip-cdrs (y))

Theorem: strip-cdrs-pairlist (length (x) ≮ length (y))

→ (strip-cdrs (pairlist (x, y)) = first-n (length (x), y))

Theorem: lr-good-pointerps-append lr-good-pointerps (append (x, y), data-seg) = (lr-good-pointerps (x, data-seg) ∧ lr-good-pointerps (y, data-seg))

Theorem: lr-good-pointerps-reverse lr-good-pointerps (reverse (x), data-seg) = lr-good-pointerps (x, data-seg)

Theorem: lr-good-pointerps-first-n (lr-good-pointerps (list, data-seg) ∧ (length (list) ≮ n)) → lr-good-pointerps (first-n (n, list), data-seg)

Definition: all-numberps (list) = if listp (list) then (car (list) ∈ N) ∧ all-numberps (cdr (list))

else t endif

Theorem: all-numberps-strip-cadrs-numberp-cdr-assoc all-numberps (strip-cadrs (list)) → (cadr (assoc (x, list)) ∈ N)

Theorem: all-numberps-strip-cadrs-subr-arity-alist all-numberps (strip-cadrs (subr-arity-alist))

Theorem: numberp-arity arity (x) ∈ N

Theorem: strip-cdrs-pair-temps-with-initial-values strip-cdrs (pair-temps-with-initial-values (temp-var-dcls)) = strip-cadrs (temp-var-dcls)

Theorem: lr-good-pointerps-all-undef-addrs (lr-proper-heapp (data-seg) ∧ lr-proper-p-areasp (data-seg) ∧ all-undef-addrs (list)) → lr-good-pointerps (list, data-seg)

Theorem: all-undef-addrs-strip-cadrs-temp-vars-programs-properp-1 (lr-programs-properp-1 (programs, program-names, table) ∧ definedp (name, programs)) → all-undef-addrs (strip-cadrs (temp-var-dcls (assoc (name, programs))))

Theorem: all-undef-addrs-strip-cadrs-temp-vars-programs-properp (lr-programs-properp (l, table) ∧ definedp (name, cdr (p-prog-segment (l)))) → all-undef-addrs (strip-cadrs (temp-var-dcls (assoc (name,

cdr (p-prog-segment (l))))))

Theorem: lr-good-pointerps-popn (lr-good-pointerps (list, data-seg) ∧ (length (list) ≮ n)) → lr-good-pointerps (popn (n, list), data-seg)

Theorem: lr-p-proper-statep-lr-funcall ((p-psw (lr-eval (t, lr-funcall (l, new-l), c − 1)) = 'run) ∧ listp (lr-expr (l)) ∧ (car (lr-expr (l)) ≠ 'if) ∧ (car (lr-expr (l)) ≠ 'quote) ∧ litatom (car (lr-expr (l))) ∧ (¬ subrp (car (lr-expr (l)))) ∧ proper-p-statep (lr->p (new-l)) ∧ good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-p-proper-statep (p-temp-stk (l),

p-ctrl-stk (l),

p-data-segment (l),

table)

∧ lr-p-proper-statep (p-temp-stk (new-l), p-ctrl-stk (new-l), p-data-segment (new-l), table)

∧ (length (p-temp-stk (new-l)) ≮ arity (car (lr-expr (l)))) ∧ lr-proper-formalsp (cdr (p-prog-segment (l))) ∧ lr-programs-properp (l, table)) → lr-p-proper-statep (p-temp-stk (lr-funcall (l, new-l)),

p-ctrl-stk (lr-funcall (l, new-l)), p-data-segment (new-l), table)

Theorem: length-p-temp-stk-lr-eval-flag-list-alt (proper-p-statep (lr->p (l)) ∧ listp (lr-expr (l)) ∧ (car (lr-expr (l)) ≠ 'if) ∧ (car (lr-expr (l)) ≠ 'quote) ∧ (¬ subrp (car (lr-expr (l)))) ∧ litatom (car (lr-expr (l))) ∧ good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ lr-proper-formalsp (cdr (p-prog-segment (l))) ∧ (p-psw (lr-eval ('list, lr-set-pos (l, dv (offset (p-pc (l)), 1)), c))

    = 'run))

→ (length (p-temp-stk (lr-eval ('list, lr-set-pos (l, dv (offset (p-pc (l)), 1)), c))) = (arity (car (lr-expr (l))) + length (p-temp-stk (l))))

Theorem: lr-p-proper-statep-cdr-lr-ctrl-stk (listp (lr-expr (l)) ∧ (car (lr-expr (l)) ≠ 'if) ∧ (¬ subrp (car (lr-expr (l)))) ∧ (car (lr-expr (l)) ≠ 'quote) ∧ litatom (car (lr-expr (l))) ∧ lr-p-proper-statep (temp-stk,

p-ctrl-stk (lr-eval (t,

lr-funcall (l,

lr-eval ('list,

lr-set-pos (l,

pos),

c)),

c − 1)),

data-segment,

table)

∧ good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ proper-p-statep (lr->p (l)) ∧ (p-psw (lr-eval (t,

lr-funcall (l, lr-eval ('list, lr-set-pos (l, pos), c)), c − 1))

    = 'run)

∧ (p-psw (lr-eval ('list, lr-set-pos (l, pos), c)) = 'run) ∧ (pos = dv (offset (p-pc (l)), 1))) → lr-p-proper-statep (temp-stk,

cdr (p-ctrl-stk (lr-eval (t,

lr-funcall (l,

lr-eval ('list,

lr-set-pos (l,

pos),

c)),

c − 1))),

data-segment,

table)

Theorem: lr-eval-preserves-lr-p-proper-statep (proper-p-statep (lr->p (l)) ∧ good-posp (flag, offset (p-pc (l)), program-body (p-current-program (l))) ∧ (p-psw (lr-eval (flag, l, c)) = 'run) ∧ lr-p-proper-statep (p-temp-stk (l),

p-ctrl-stk (l),

p-data-segment (l), table)

∧ lr-programs-properp (l, table) ∧ lr-proper-formalsp (cdr (p-prog-segment (l)))) → lr-p-proper-statep (p-temp-stk (lr-eval (flag, l, c)),

p-ctrl-stk (lr-eval (flag, l, c)),

p-data-segment (lr-eval (flag, l, c)), table)

Theorem: p-plus p (p, c1 + c2 ) = p (p (p, c1 ), c2 )

Theorem: p-set-pc-lr->p-lr-set-expr (p-prog-segment (l1 ) = p-prog-segment (l2 )) → (lr->p (lr-set-expr (l1 , l2 , pos))

= p-set-pc (lr->p (l1 ), lr-p-pc (lr-set-expr (l1 , l2 , pos))))

Event: Disable p-set-pc-lr->p-lr-set-expr.

Theorem: member-assoc-area-name-cdr-lr-programs-properp ((assoc (area-name (p-pc (l)), cdr (p-prog-segment (l))) ∉ p-prog-segment (l)) ∧ (area-name (p-pc (l)) ≠ caar (p-prog-segment (l)))) → (¬ lr-programs-properp (l, table))

Event: Disable member-assoc-area-name-cdr-lr-programs-properp.

Theorem: not-listp-prog-segment-not-lr-programs-properp (¬ listp (p-prog-segment (l))) → (¬ lr-programs-properp (l, table))

Event: Disable not-listp-prog-segment-not-lr-programs-properp.

Theorem: unlabel-get-lr-p-pc-program-body-assoc-comp-programs (good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table)) → (get (lr-p-pc-1 (program-body (p-current-program (l)), offset (p-pc (l))),

program-body (assoc (area-name (p-pc (l)),

comp-programs (p-prog-segment (l)))))

= list ('dl, lr-make-label (offset (lr-p-pc (l))), nil, car (comp-body-1 (t, lr-expr (l), offset (lr-p-pc (l))))))

Theorem: car-comp-body-1-litatom litatom (body) → (car (comp-body-1 (t, body, n)) = list ('push-local, body))

Theorem: lr-p-pc-1-append-helper-1 (listp (body) ∧ (car (body) = 'if) ∧ (n ≄ 0)) → (lr-p-pc-1 (body, cons (n, pos))

= if n = 1 then lr-p-pc-1 (cadr (body), pos)

elseif n = 2 then 3

+ lr-p-c-size (t, cadr (body)) + lr-p-pc-1 (caddr (body), pos)

else lr-p-c-size (t, cadr (body)) + lr-p-c-size (t, caddr (body)) + lr-p-pc-1 (cadddr (body), pos) + 4 endif)

Theorem: lr-p-pc-1-append-helper-2 (listp (body) ∧ (car (body) = s-temp-eval)) → (lr-p-pc-1 (body, cons (1, pos)) = lr-p-pc-1 (cadr (body), pos))

Theorem: lr-p-pc-1-append-helper-3 (listp (body) ∧ (car (body) = s-temp-test)) → (lr-p-pc-1 (body, cons (1, pos)) = (lr-p-pc-1 (cadr (body), pos) + 4))

Theorem: lr-p-pc-1-append-helper-4 (listp (body) ∧ (car (body) ≠ s-temp-fetch) ∧ (car (body) ≠ s-temp-eval) ∧ (car (body) ≠ s-temp-test) ∧ (car (body) ≠ 'quote) ∧ (car (body) ≠ 'if) ∧ (n ≄ 0)) → (lr-p-pc-1 (body, cons (n, pos))

= (lr-p-c-size-list (n − 1, body) + lr-p-pc-1 (get (n, body), pos)))

Theorem: lr-p-pc-1-append (good-posp1 (pos1 , body) ∧ lr-proper-exprp (t, body, pnames, formals, temps, table)) → (lr-p-pc-1 (body, append (pos1 , pos2 ))

= (lr-p-pc-1 (body, pos1 ) + lr-p-pc-1 (cur-expr (pos1 , body), pos2 )))

Theorem: append-butlast-list-car-last listp (x) → (append (butlast (x), list (car (last (x)))) = plist (x))

Theorem: listp-plist-car listp (x) → (car (plist (x)) = car (x))

Theorem: lr-p-pc-1-plist lr-p-pc-1 (body, plist (pos)) = lr-p-pc-1 (body, pos)

Theorem: lr-p-pc-1-listp-offset (listp (pos) ∧ good-posp1 (butlast (pos), body) ∧ lr-proper-exprp (t, body, pnames, formals, temps, table)) → (lr-p-pc-1 (body, pos)

= (lr-p-pc-1 (body, butlast (pos))

+ lr-p-pc-1 (cur-expr (butlast (pos), body), list (car (last (pos))))))

Theorem: lr-p-pc-1-nil lr-p-pc-1 (body, nil) = 0

Theorem: lr-p-pc-1-nx-helper (listp (expr) ∧ (car (expr) ≠ s-temp-fetch) ∧ (car (expr) ≠ s-temp-eval) ∧ (car (expr) ≠ s-temp-test) ∧ (car (expr) ≠ 'quote) ∧ (n ≄ 0) ∧ (n < length (expr))) → (lr-p-pc-1 (expr, list (n))

= if car (expr) = 'if then case on n: case = 1 then 0 case = 2 then 3 + lr-p-c-size (t, cadr (expr)) otherwise lr-p-c-size (t, cadr (expr))

+ lr-p-c-size (t, caddr (expr)) + 4 endcase

else lr-p-c-size-list (n − 1, expr) endif)

Theorem: lr-p-pc-1-nx (lr-programs-properp (l, table) ∧ good-posp ('list, offset (p-pc (l)), program-body (p-current-program (l))) ∧ listp (offset (p-pc (l))) ∧ listp (lr-expr-list (l)) ∧ (car (cur-expr (butlast (offset (p-pc (l))),

program-body (p-current-program (l))))

    ≠ 'if))

→ (lr-p-pc-1 (program-body (p-current-program (l)), nx (offset (p-pc (l))))

= (lr-p-pc-1 (program-body (p-current-program (l)), offset (p-pc (l))) + lr-p-c-size (t, lr-expr (l))))

Event: Disable lr-p-pc-1-listp-offset.

Theorem: lr-p-pc-1-dv-1-car-lr-expr-if ((car (lr-expr (l)) = 'if) ∧ good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ (body = program-body (p-current-program (l)))) → (lr-p-pc-1 (body, dv (offset (p-pc (l)), 1))

= lr-p-pc-1 (body, offset (p-pc (l))))

Theorem: lr-p-pc-1-dv-2-car-lr-expr-if (listp (lr-expr (l)) ∧ (car (lr-expr (l)) = 'if) ∧ good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table)) → (lr-p-pc-1 (program-body (p-current-program (l)), dv (offset (p-pc (l)), 2))

= (3 + lr-p-c-size (t, cadr (lr-expr (l))) + lr-p-pc-1 (program-body (p-current-program (l)),

offset (p-pc (l)))))

Theorem: lr-p-pc-1-dv-3-car-lr-expr-if (listp (lr-expr (l)) ∧ (car (lr-expr (l)) = 'if) ∧ good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table)) → (lr-p-pc-1 (program-body (p-current-program (l)), dv (offset (p-pc (l)), 3))

= (lr-p-c-size (t, cadr (lr-expr (l)))

         + 3

+ lr-p-c-size (t, caddr (lr-expr (l)))

         + 1

+ lr-p-pc-1 (program-body (p-current-program (l)), offset (p-pc (l)))))

Theorem: lr-p-c-size-not-1-car-if (listp (expr) ∧ (car (expr) = 'if)) → (lr-p-c-size (t, expr) ≠ 1)

Theorem: lr-p-c-size-ge-plus-2-size-cadr-car-if (listp (expr) ∧ (car (expr) = 'if)) → ((1 + (1 + lr-p-c-size (t, cadr (expr)))) < lr-p-c-size (t, expr))

Theorem: get-comp-if-helper-helper ((n ≮ (x + y + 3)) ∧ (n ≠ (x + y + 3))) → (get (n − (x + 3 + y), cons (w, l3 ))

= get (n − (x + y + 4), l3 ))

Theorem: get-comp-if-helper get (n, append (l1 , append (list (x, y, z), append (l2 , cons (w, l3 ))))) = if n < length (l1 ) then get (n, l1 )

elseif n < (length (l1 ) + 3) then get (n − length (l1 ), list (x, y, z)) elseif n < (length (l1 ) + length (l2 ) + 3) then get (n − (length (l1 ) + 3), l2 ) elseif n = (length (l1 ) + length (l2 ) + 3) then w else get (n − (length (l1 ) + length (l2 ) + 4), l3 ) endif

Theorem: get-comp-if get (n, comp-if (test-instrs, then-instrs, else-instrs, m)) = if n < length (test-instrs) then get (n, test-instrs)

elseif n < (length (test-instrs) + 3) then get (n − length (test-instrs),

list (identity (list ('push-constant, lr-f-addr)),

            '(eq),
            list ('test-bool-and-jump,
                't,

lr-make-label (m

                            + 4

+ length (test-instrs) + length (then-instrs)))))

elseif n < (length (test-instrs) + length (then-instrs) + 3) then get (n − (length (test-instrs) + 3), then-instrs) elseif n = (length (test-instrs) + length (then-instrs) + 3) then list ('jump,

lr-make-label (m

                     + 4

+ length (test-instrs) + length (then-instrs) + length (else-instrs)))

else get (n − (length (test-instrs)

+ length (then-instrs) + 4), else-instrs) endif

Definition: p-final-pc (flag, l, n) = if flag = 'list

then add-addr (lr-p-pc (l), n + lr-p-c-size ('list, lr-expr-list (l))) else add-addr (lr-p-pc (l), n + lr-p-c-size (flag, lr-expr (l))) endif

Event: Disable p-final-pc.

Theorem: proper-p-statep-p-set-pc (proper-p-statep (p) ∧ (area-name (p-pc (p)) = area-name (pc))) → (proper-p-statep (p-set-pc (p, pc)) = p-objectp-type ('pc, pc, p))

Theorem: proper-p-statep-p-set-pc-equal-p-set-pc (good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ (p (lr->p (l), p-clock1 (t, l, c))

= p-set-pc (lr->p (lr-eval (t, l, c)), tag ('pc,

cons (area-name (p-pc (l)),

lr-p-pc-1 (program-body (p-current-program (l)),

offset (p-pc (l))) + lr-p-c-size (t, lr-expr (l))))))

∧ proper-p-statep (lr->p (lr-eval (t, l, c)))) → proper-p-statep (p (lr->p (l), p-clock1 (t, l, c)))

Theorem: lr-eval-p-pc-equivalence-helper-1 p (lr->p (l1 ), p-clock1 (flag1 , l2 , c1 ) + p-clock1 (flag2 , l3 , c2 )) = p (p (lr->p (l1 ), p-clock1 (flag1 , l2 , c1 )), p-clock1 (flag2 , l3 , c2 ))

Theorem: lr-eval-p-pc-equivalence-helper-1-5 (listp (offset (p-pc (l))) ∧ listp (lr-expr-list (l))) → (p-final-pc ('list,

lr-set-expr (lr-eval (t, l, c), l, nx (offset (p-pc (l)))),

              0)

= tag ('pc,

cons (area-name (p-pc (l)),

lr-p-pc-1 (program-body (p-current-program (l)),

nx (offset (p-pc (l))))

+ lr-p-c-size-list (length (lr-expr-list (l)) − 1, lr-expr-list (l)))))

Theorem: lr-eval-p-pc-equivalence-helper-2 ((p-psw (l) = 'run) ∧ listp (offset (p-pc (l))) ∧ (¬ listp (lr-expr-list (l)))) → (p-set-pc (lr->p (l),

tag ('pc,

cons (area-name (p-pc (l)),

lr-p-pc-1 (program-body (p-current-program (l)),

offset (p-pc (l))))))

= p (lr->p (l), 0))

Theorem: lr-eval-p-pc-equivalence-helper-3 ((p-psw (l) = 'run)

∧ (flag ≠ 'list) ∧ litatom (lr-expr (l)) ∧ good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ (length (p-temp-stk (l)) < p-max-temp-stk-size (l))) → (p-set-pc (lr->p (lr-set-tstk (l,

cons (cdr (assoc (lr-expr (l),

bindings (car (p-ctrl-stk (l))))),

p-temp-stk (l)))),

p-final-pc (flag, l, 0))

= p (lr->p (l), 1))

Theorem: lr->p-lr-set-pos-dv-1-car-lr-expr-if ((car (lr-expr (l)) = 'if) ∧ listp (lr-expr (l)) ∧ good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table)) → (lr->p (lr-set-pos (l, dv (offset (p-pc (l)), 1))) = lr->p (l))

Theorem: lr-p-proper-statep-listp-p-temp-stk-type-car-addr (lr-p-proper-statep (temp-stk, ctrl-stk, data-seg, table) ∧ listp (temp-stk)) → (type (car (temp-stk)) = 'addr)

Theorem: proper-p-statep-lessp-length-p-temp-stk-max-temp-stk-size proper-p-statep (lr->p (l)) → (p-max-temp-stk-size (l) ≮ length (p-temp-stk (l)))

Theorem: length-p-temp-stk-lr-eval-lr-set-pos (proper-p-statep (lr->p (l)) ∧ good-posp1 (pos, program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ lr-proper-formalsp (cdr (p-prog-segment (l))) ∧ (p-psw (lr-eval (t, lr-set-pos (l, pos), c)) = 'run)) → (length (p-temp-stk (lr-eval (t, lr-set-pos (l, pos), c)))

= (1 + length (p-temp-stk (l))))

Theorem: not-lessp-length-proper-p-statep-lr-eval-lr-set-pos (good-posp1 (pos, program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ proper-p-statep (lr->p (l)) ∧ (length (p-temp-stk (l)) ≮ (p-max-temp-stk-size (l) − 1)) ∧ lr-proper-formalsp (cdr (p-prog-segment (l)))) → (p-psw (lr-if-ok (lr-eval (t, lr-set-pos (l, pos), c))) ≠ 'run)

Theorem: lr-pop-tstk-lr-if-ok (p-psw (lr-if-ok (l)) = 'run) → (lr-pop-tstk (lr-if-ok (l)) = lr-pop-tstk (l))

Theorem: add-addr-p-final-pc (add-addr (p-final-pc (flag, l, n), 1 + m) = add-addr (p-final-pc (flag, l, 1 + n), m)) ∧ (add-addr (p-final-pc (flag, l, n), 0) = p-final-pc (flag, l, n))

Theorem: lessp-3-lr-p-c-size-car-if (listp (expr) ∧ (car (expr) = 'if)) → (3 < lr-p-c-size (t, expr))

Theorem: comp-body-1-car-expr-if ((car (expr) = 'if) ∧ listp (expr)) → (comp-body-1 (t, expr, n)

= comp-if (comp-body-1 (t, cadr (expr), n), comp-body-1 (t,

caddr (expr),

n + 3 + lr-p-c-size (t, cadr (expr))),

comp-body-1 (t, cadddr (expr), n

                            + 4

+ lr-p-c-size (t, cadr (expr)) + lr-p-c-size (t, caddr (expr))),

n))

Theorem: get-lr-p-c-size-lessp-restn-lr-p-pc-1-comp-body-1 (good-posp1 (pos, program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ listp (lr-expr (l)) ∧ (car (lr-expr (l)) = 'if) ∧ (m < 3) ∧ (name = area-name (p-pc (l))) ∧ (pos = offset (p-pc (l)))) → (unlabel (get (offset (p-final-pc (t, lr-set-pos (l, dv (pos, 1)), m)),

program-body (assoc (name, comp-programs (p-prog-segment (l))))))

= get (m,

list (list ('push-constant, lr-f-addr),

                '(eq),
                list ('test-bool-and-jump,
                   't,

lr-make-label (lr-p-pc-1 (program-body (p-current-program (l)),

pos)

                               + 4

+ lr-p-c-size (t,

cadr (lr-expr (l)))

+ lr-p-c-size (t, caddr (lr-expr (l))))))))

Theorem: area-name-p-final-pc area-name (p-final-pc (flag, l, n)) = area-name (p-pc (l))

Theorem: lr-eval-p-pc-equivalence-helper-4-helper-1 let test be lr-eval (t, lr-set-pos (l, dv (offset (p-pc (l)), 1)), c) in ((p-psw (l) = 'run) ∧ (c ≄ 0) ∧ listp (lr-expr (l)) ∧ (car (lr-expr (l)) = 'if) ∧ (p-psw (lr-if-ok (test)) = 'run) ∧ (car (p-temp-stk (test)) ≠ lr-f-addr) ∧ proper-p-statep (lr->p (l)) ∧ good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ lr-p-proper-statep (p-temp-stk (l),

p-ctrl-stk (l),

p-data-segment (l), table)

∧ lr-proper-formalsp (cdr (p-prog-segment (l))) ∧ (p-psw (lr-eval (t,

lr-set-expr (lr-pop-tstk (test), l, dv (offset (p-pc (l)), 2)),

c))

    = 'run))

→ (p (p-set-pc (lr->p (test),

p-final-pc (t, lr-set-pos (l, dv (offset (p-pc (l)), 1)), 0)),

      3)

= p-set-pc (lr->p (lr-pop-tstk (test)), tag ('pc,

cons (area-name (p-pc (l)),

                        3

+ lr-p-c-size (t,

cadr (lr-expr (l))) + lr-p-pc-1 (program-body (p-current-program (l)), offset (p-pc (l))))))) endlet

Theorem: lessp-plus-lr-p-c-size-cadr-caddr-3-car-if (listp (expr) ∧ (car (expr) = 'if)) → ((lr-p-c-size (t, cadr (expr)) + lr-p-c-size (t, caddr (expr)))

< (((lr-p-c-size (t, expr) − 1) − 1) − 1))

Theorem: get-plus-lr-p-c-size-cadr-caddr-4-comp-body-cur-expr ((size1 = length (test)) ∧ (size2 = length (then))) → (get (3 + size1 + size2 , comp-if (test, then, else, n))

= list ('jump,

lr-make-label (4 + n + length (test) + length (then) + length (else))))

Theorem: cur-expr-add1-opener cur-expr (cons (1 + n, pos), body) = cur-expr (pos, get (n, cdr (body)))

Theorem: lr-p-pc-1-car-expr-if-2 (listp (expr) ∧ (car (expr) = 'if)) → (lr-p-pc-1 (expr, '(2)) = (3 + lr-p-c-size (t, cadr (expr))))

Theorem: get-plus-lr-p-pc-1-lr-pc-size-cadr-assoc-comp-body-if-4 (good-posp1 (offset (p-pc (l1 )), program-body (p-current-program (l1 ))) ∧ lr-programs-properp (l1 , table) ∧ listp (lr-expr (l1 )) ∧ (car (lr-expr (l1 )) = 'if) ∧ (pos = dv (offset (p-pc (l1 )), 2)) ∧ (area-name (p-pc (l2 )) = area-name (p-pc (l1 ))) ∧ (p-prog-segment (l2 ) = p-prog-segment (l1 ))) → (get (offset (p-final-pc (t, lr-set-expr (l2 , l1 , pos), 0)),

program-body (assoc (area-name (p-pc (l1 )),

comp-programs (p-prog-segment (l1 )))))

= list ('dl,

lr-make-label (offset (p-final-pc (t, lr-set-expr (l2 , l1 , pos), 0))),

nil,

list ('jump,

lr-make-label (4

+ lr-p-pc-1 (program-body (p-current-program (l1 )),

offset (p-pc (l1 )))

+ lr-p-c-size (t,

cadr (lr-expr (l1 )))

+ lr-p-c-size (t,

caddr (lr-expr (l1 )))

+ lr-p-c-size (t, cadddr (lr-expr (l1 )))))))

Theorem: find-label-lr-make-label-label-instrs ((m ≮ n) ∧ (m ∈ N) ∧ (m < (n + length (instrs)))) → (find-label (lr-make-label (m), label-instrs (instrs, n)) = (m − n))

Theorem: find-label-past-else-lr-expr-car-if (listp (lr-expr (l)) ∧ (car (lr-expr (l)) = 'if) ∧ (expr = lr-expr (l)) ∧ (body = program-body (p-current-program (l))) ∧ (pos = offset (p-pc (l))) ∧ lr-programs-properp (l, table) ∧ good-posp1 (pos, body)) → (find-label (lr-make-label (1 + (1 + (1 + (1 + (lr-p-c-size (t,

cadr (expr))

+ lr-p-c-size (t,

caddr (expr))

+ lr-p-c-size (t,

cadddr (expr))

+ lr-p-pc-1 (body,

pos)))))),

program-body (assoc (area-name (p-pc (l)),

comp-programs (p-prog-segment (l)))))

= (1 + (1 + (1 + (1 + (lr-p-c-size (t, cadr (expr)) + lr-p-c-size (t, caddr (expr)) + lr-p-c-size (t, cadddr (expr)) + lr-p-pc-1 (body, pos)))))))

Theorem: lr-eval-p-pc-equivalence-helper-4-helper-2 let test be lr-eval (t, lr-set-pos (l, dv (offset (p-pc (l)), 1)), c) in let then be lr-set-expr (lr-pop-tstk (test), l, dv (offset (p-pc (l)), 2)) in ((p-psw (l) = 'run) ∧ (flag ≠ 'list) ∧ (c ≠ 0) ∧ (c ∈ N) ∧ listp (lr-expr (l)) ∧ (car (lr-expr (l)) = 'if) ∧ (p-psw (lr-if-ok (test)) = 'run) ∧ (car (p-temp-stk (test)) ≠ lr-f-addr) ∧ proper-p-statep (lr->p (l)) ∧ good-posp1 (offset (p-pc (l)),

program-body (p-current-program (l)))

∧ lr-programs-properp (l, table) ∧ lr-p-proper-statep (p-temp-stk (l), p-ctrl-stk (l), p-data-segment (l), table)

∧ lr-proper-formalsp (cdr (p-prog-segment (l))) ∧ (p-psw (lr-eval (t, then, c)) = 'run)) → (p (p-set-pc (lr->p (lr-eval (t, then, c)),

p-final-pc (t, then, 0)),

      1)

= p-set-pc (lr->p (lr-eval (t, then, c)), p-final-pc (flag, l, 0))) endlet endlet

Theorem: lr-eval-p-pc-equivalence-helper-4 let test be lr-eval (t, lr-set-pos (l, pos), c),

cadr-size be lr-p-c-size (t, cadr (lr-expr (l))),

lr-p-pc-1 be lr-p-pc-1 (program-body (p-current-program (l)),

offset (p-pc (l))),

then be lr-set-expr (lr-pop-tstk (lr-eval (t, lr-set-pos (l, pos), c)), l, dv (offset (p-pc (l)), 2))

in ((p-psw (l) = 'run) ∧ (flag ≠ 'list) ∧ (c ≠ 0) ∧ (c ∈ N) ∧ listp (lr-expr (l)) ∧ (car (lr-expr (l)) = 'if) ∧ (p-psw (lr-if-ok (test)) = 'run) ∧ (car (p-temp-stk (test)) ≠ lr-f-addr) ∧ (p (lr->p (l), p-clock1 (t, lr-set-pos (l, pos), c))

= p-set-pc (lr->p (lr-eval (t, lr-set-pos (l, pos), c)),

p-final-pc (t, lr-set-pos (l, pos), 0)))

∧ (p (p-set-pc (lr->p (lr-pop-tstk (test)),

tag ('pc,

cons (area-name (p-pc (l)),

3 + cadr-size + lr-p-pc-1 ))),

p-clock1 (t, then, c)) = p-set-pc (lr->p (lr-eval (t, then, c)),

p-final-pc (t, then, 0)))

∧ proper-p-statep (lr->p (l)) ∧ good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ lr-p-proper-statep (p-temp-stk (l),

p-ctrl-stk (l),

p-data-segment (l),

table)

∧ lr-proper-formalsp (cdr (p-prog-segment (l))) ∧ (p-psw (lr-eval (t, then, c)) = 'run) ∧ (pos = dv (offset (p-pc (l)), 1))) → (p (lr->p (l),

p-clock1 (t, lr-set-pos (l, pos), c)

      + 3

+ p-clock1 (t, then, c)

+ 1) = p-set-pc (lr->p (lr-eval (t, then, c)),

p-final-pc (flag, l, 0))) endlet

Theorem: lessp-plus-lr-p-pc-1-lr-p-c-size-3-1-lr-expr-car-if ((car (lr-expr (l)) = 'if) ∧ listp (lr-expr (l)) ∧ good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table)) → ((lr-p-c-size (t, cadr (lr-expr (l)))

     + 3

+ lr-p-c-size (t, caddr (lr-expr (l)))

     + 1

+ lr-p-pc-1 (program-body (p-current-program (l)), offset (p-pc (l)))) < length (program-body (assoc (area-name (p-pc (l)),

comp-programs (p-prog-segment (l))))))

Theorem: find-label-else-start-lr-expr-car-if (listp (lr-expr (l)) ∧ (car (lr-expr (l)) = 'if) ∧ (expr = lr-expr (l)) ∧ (body = program-body (p-current-program (l))) ∧ (pos = offset (p-pc (l))) ∧ lr-programs-properp (l, table) ∧ good-posp1 (pos, body)) → (find-label (lr-make-label (1 + (1 + (1 + (1 + (lr-p-c-size (t,

cadr (expr))

+ lr-p-c-size (t,

caddr (expr))

+ lr-p-pc-1 (body,

pos)))))),

program-body (assoc (area-name (p-pc (l)),

comp-programs (p-prog-segment (l)))))

= (1 + (1 + (1 + (1 + (lr-p-c-size (t, cadr (expr)) + lr-p-c-size (t, caddr (expr)) + lr-p-pc-1 (body, pos)))))))

Theorem: lr-eval-p-pc-equivalence-helper-5-helper-1 let test be lr-eval (t, lr-set-pos (l, dv (offset (p-pc (l)), 1)), c) in ((p-psw (l) = 'run) ∧ (c ≄ 0) ∧ listp (lr-expr (l)) ∧ (car (lr-expr (l)) = 'if) ∧ (p-psw (lr-if-ok (test)) = 'run) ∧ (car (p-temp-stk (test)) = lr-f-addr) ∧ proper-p-statep (lr->p (l)) ∧ good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ lr-p-proper-statep (p-temp-stk (l),

p-ctrl-stk (l),

p-data-segment (l), table)

∧ lr-proper-formalsp (cdr (p-prog-segment (l)))) → (p (p-set-pc (lr->p (test),

p-final-pc (t, lr-set-pos (l, dv (offset (p-pc (l)), 1)), 0)),

      3)

= p-set-pc (lr->p (lr-pop-tstk (test)), tag ('pc,

cons (area-name (p-pc (l)), lr-p-c-size (t, cadr (lr-expr (l)))

                        + 3

+ lr-p-c-size (t,

caddr (lr-expr (l)))

                        + 1

+ lr-p-pc-1 (program-body (p-current-program (l)), offset (p-pc (l))))))) endlet

Theorem: lr-eval-p-pc-equivalence-helper-5-helper-2 let test be lr-eval (t, lr-set-pos (l, dv (offset (p-pc (l)), 1)), c) in let else be lr-set-expr (lr-pop-tstk (test), l, dv (offset (p-pc (l)), 3)) in ((flag ≠ 'list) ∧ listp (lr-expr (l)) ∧ (car (lr-expr (l)) = 'if) ∧ good-posp1 (offset (p-pc (l)),

program-body (p-current-program (l)))

∧ lr-programs-properp (l, table))

→ (p-final-pc (flag, l, 0) = p-final-pc (t, else, 0)) endlet endlet

Theorem: lr-eval-p-pc-equivalence-helper-5 let test be lr-eval (t, lr-set-pos (l, pos), c),

cadr-size be lr-p-c-size (t, cadr (lr-expr (l))),

caddr-size be lr-p-c-size (t, caddr (lr-expr (l))),

lr-p-pc-1 be lr-p-pc-1 (program-body (p-current-program (l)),

offset (p-pc (l))),

else be lr-set-expr (lr-pop-tstk (lr-eval (t, lr-set-pos (l, pos), c)), l, dv (offset (p-pc (l)), 3))

in ((p-psw (l) = 'run) ∧ (flag ≠ 'list) ∧ (c ≠ 0) ∧ (c ∈ N) ∧ listp (lr-expr (l)) ∧ (car (lr-expr (l)) = 'if) ∧ (p-psw (lr-if-ok (test)) = 'run) ∧ (car (p-temp-stk (test)) = lr-f-addr) ∧ (p (p-set-pc (lr->p (lr-pop-tstk (test)),

tag ('pc,

cons (area-name (p-pc (l)), cadr-size

                      + 3

+ caddr-size

                      + 1

+ lr-p-pc-1 ))),

p-clock1 (t, else, c)) = p-set-pc (lr->p (lr-eval (t, else, c)),

p-final-pc (t, else, 0)))

∧ (p (lr->p (l), p-clock1 (t, lr-set-pos (l, pos), c))

= p-set-pc (lr->p (test),

p-final-pc (t, lr-set-pos (l, pos), 0)))

∧ proper-p-statep (lr->p (l)) ∧ good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ lr-p-proper-statep (p-temp-stk (l),

p-ctrl-stk (l),

p-data-segment (l), table)

∧ lr-proper-formalsp (cdr (p-prog-segment (l))) ∧ (p-psw (lr-eval (t, else, c)) = 'run) ∧ (pos = dv (offset (p-pc (l)), 1)))

→ (p (lr->p (l), p-clock1 (t, lr-set-pos (l, pos), c)

      + 3

+ p-clock1 (t, else, c)) = p-set-pc (lr->p (lr-eval (t, else, c)),

p-final-pc (flag, l, 0))) endlet

Theorem: lr-p-pc-1-dv-1-car-lr-expr-temp-eval ((car (lr-expr (l)) = s-temp-eval) ∧ listp (lr-expr (l)) ∧ good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ (body = program-body (p-current-program (l)))) → (lr-p-pc-1 (body, dv (offset (p-pc (l)), 1))

= lr-p-pc-1 (body, offset (p-pc (l))))

Theorem: comp-body-1-car-expr-temp-eval (listp (expr) ∧ (car (expr) = s-temp-eval)) → (comp-body-1 (t, expr, n)

= append (comp-body-1 (t, cadr (expr), n), list (list ('set-local, caddr (expr)))))

Theorem: lr-eval-p-pc-equivalence-helper-5-get-lr-p-c-size (listp (lr-expr (l)) ∧ (car (lr-expr (l)) = s-temp-eval) ∧ good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ (body = program-body (p-current-program (l))) ∧ (progs = p-prog-segment (l))) → (unlabel (get (lr-p-pc-1 (body, offset (p-pc (l)))

+ lr-p-c-size (t, cadr (lr-expr (l))),

program-body (assoc (area-name (p-pc (l)),

comp-programs (progs)))))

= list ('set-local, caddr (lr-expr (l))))

Theorem: lr->p-lr-set-pos-dv-1-car-lr-expr-temp-eval (listp (lr-expr (l)) ∧ (car (lr-expr (l)) = s-temp-eval) ∧ good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table)) → (lr->p (lr-set-pos (l, dv (offset (p-pc (l)), 1))) = lr->p (l))

Theorem: lr-eval-p-pc-equivalence-helper-6-helper let lr-eval be lr-eval (t, lr-set-pos (l, dv (offset (p-pc (l)), 1)), c) in ((p-psw (l) = 'run) ∧ (flag ≠ 'list) ∧ (c ≠ 0) ∧ (c ∈ N) ∧ listp (lr-expr (l)) ∧ (car (lr-expr (l)) = s-temp-eval) ∧ proper-p-statep (lr->p (l)) ∧ good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ (p-psw (lr-eval) = 'run)) → (p (p-set-pc (lr->p (lr-eval),

p-final-pc (t, lr-set-pos (l, dv (offset (p-pc (l)), 1)), 0)),

      1)

= p-set-pc (lr->p (lr-set-temp (lr-eval, car (p-temp-stk (lr-eval)), caddr (lr-expr (l)))),

p-final-pc (flag, l, 0))) endlet

Theorem: lr-eval-p-pc-equivalence-helper-6 ((p-psw (l) = 'run) ∧ (flag ≠ 'list) ∧ (c ≠ 0) ∧ (c ∈ N) ∧ listp (lr-expr (l)) ∧ (car (lr-expr (l)) = s-temp-eval) ∧ (p (lr->p (l), p-clock1 (t, lr-set-pos (l, pos), c))

= p-set-pc (lr->p (lr-eval (t, lr-set-pos (l, pos), c)),

p-final-pc (t, lr-set-pos (l, pos), 0)))

∧ proper-p-statep (lr->p (l)) ∧ good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ (p-psw (lr-eval (t, lr-set-pos (l, pos), c)) = 'run) ∧ (pos = dv (offset (p-pc (l)), 1))) → (p-set-pc (lr->p (lr-set-temp (lr-eval (t, lr-set-pos (l, pos), c),

car (p-temp-stk (lr-eval (t, lr-set-pos (l, pos), c))),

caddr (lr-expr (l)))),

p-final-pc (flag, l, 0))

= p (lr->p (l), p-clock1 (t, lr-set-pos (l, pos), c) + 1))

Theorem: get-comp-temp-test (listp (expr) ∧ (car (expr) = s-temp-test)) → (get (m, comp-body-1 (t, expr, n))

= if m < 4

then get (m,

list (list ('push-local, caddr (expr)),

                    list ('push-constant,

identity (lr-undef-addr)),

                    '(eq),
                    list ('test-bool-and-jump,
                       'f,

lr-make-label (n

                                   + 6

+ lr-p-c-size (t,

cadr (expr))))))

elseif m < (lr-p-c-size (t, cadr (expr)) + 4)

then get (m − 4, comp-body-1 (t, cadr (expr), n + 4)) else get (m − (lr-p-c-size (t, cadr (expr)) + 4),

list (list ('set-local, caddr (expr)),

list ('jump,

lr-make-label (n

                                   + 7

+ lr-p-c-size (t,

cadr (expr)))),

list ('push-local, caddr (expr)))) endif)

Theorem: lr-p-c-size-temp-test-opener (listp (expr) ∧ (car (expr) = s-temp-test)) → (lr-p-c-size (t, expr) = (lr-p-c-size (t, cadr (expr)) + 7))

Theorem: get-+-lr-p-pc-1-lessp-3-temp-test-assoc-comp-programs (listp (lr-expr (l)) ∧ (car (lr-expr (l)) = s-temp-test) ∧ good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ (n < 4) ∧ (progs = p-prog-segment (l)) ∧ (body = program-body (p-current-program (l))) ∧ (pos = offset (p-pc (l)))) → (unlabel (get (lr-p-pc-1 (body, pos) + n,

program-body (assoc (area-name (p-pc (l)),

comp-programs (progs)))))

= get (n,

list (list ('push-local, caddr (lr-expr (l))), identity (list ('push-constant, lr-undef-addr)),

               '(eq),
               list ('test-bool-and-jump,
                  'f,

lr-make-label (lr-p-pc-1 (body, pos)

                              + 6

+ lr-p-c-size (t, cadr (lr-expr (l))))))))

Theorem: car-comp-body-lr-expr-3-temp-test (listp (expr) ∧ (car (expr) = s-temp-test)) → (car (comp-body-1 (t, expr, n)) = list ('push-local, caddr (expr)))

Theorem: get-+-lr-p-pc-1-n-2-size-temp-test-assoc-comp-programs (listp (lr-expr (l)) ∧ (car (lr-expr (l)) = s-temp-test) ∧ good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ (n ≮ 4) ∧ (6 ≮ n) ∧ (progs = p-prog-segment (l)) ∧ (body = program-body (p-current-program (l))) ∧ (pos = offset (p-pc (l)))) → (unlabel (get (lr-p-pc-1 (body, pos)

+ n

+ lr-p-c-size (t, cadr (lr-expr (l))),

program-body (assoc (area-name (p-pc (l)),

comp-programs (progs)))))

= get (n − 4,

list (list ('set-local, caddr (lr-expr (l))),

list ('jump,

lr-make-label (lr-p-pc-1 (body, pos)

                              + 7

+ lr-p-c-size (t,

cadr (lr-expr (l))))),

list ('push-local, caddr (lr-expr (l))))))

Event: Disable get-comp-temp-test.

Event: Disable lr-p-c-size-temp-test-opener.

Theorem: definedp-caddr-lr-expr-bindings-ctrl-stk-rewrite (lr-programs-properp (l, table) ∧ ((car (lr-expr (l)) = s-temp-fetch)

∨ (car (lr-expr (l)) = s-temp-test))

∧ good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ proper-p-statep (lr->p (l))) → definedp (caddr (lr-expr (l)), bindings (car (p-ctrl-stk (l))))

Theorem: member-lr-good-pointerps-type-addr-untag-whole ((addr ∈ list) ∧ (type (addr) = 'addr) ∧ (untag (addr) = rest) ∧ (addr ≠ list ('addr, rest))) → (¬ lr-good-pointerps (list, data-seg))

Theorem: find-label-temp-test-end-lr-expr-car-temp-test (listp (lr-expr (l)) ∧ (car (lr-expr (l)) = s-temp-test) ∧ (body = program-body (p-current-program (l))) ∧ (pos = offset (p-pc (l))) ∧ (expr = lr-expr (l)) ∧ lr-programs-properp (l, table) ∧ good-posp1 (pos, body) ∧ (7 ≮ n)) → (find-label (lr-make-label (lr-p-pc-1 (body, pos)

+ n

+ lr-p-c-size (t, cadr (expr))),

program-body (assoc (area-name (p-pc (l)),

comp-programs (p-prog-segment (l)))))

= (lr-p-pc-1 (body, pos) + n + lr-p-c-size (t, cadr (expr))))

Theorem: lr-p-proper-statep-lr-good-pointerps-strip-cdrs-binding (lr-p-proper-statep (p-temp-stk (l), p-ctrl-stk (l), p-data-segment (l), table) ∧ proper-p-statep (lr->p (l))) → lr-good-pointerps (strip-cdrs (bindings (car (p-ctrl-stk (l)))),

p-data-segment (l))

Theorem: lr-eval-p-pc-equivalence-helper-7 ((flag ≠ 'list) ∧ listp (lr-expr (l)) ∧ (car (lr-expr (l)) = s-temp-test) ∧ (p-max-temp-stk-size (l) ≮ (2 + length (p-temp-stk (l)))) ∧ proper-p-statep (lr->p (l)) ∧ good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ lr-p-proper-statep (p-temp-stk (l),

p-ctrl-stk (l),

p-data-segment (l), table)

∧ (p-psw (lr-do-temp-fetch (l)) = 'run)) → (p-set-pc (lr->p (lr-do-temp-fetch (l)), p-final-pc (flag, l, 0))

= p (lr->p (l), 5))

Theorem: lr-p-pc-dv-1-s-temp-test (listp (lr-expr (l)) ∧ (car (lr-expr (l)) = s-temp-test) ∧ good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table)) → (lr-p-pc-1 (program-body (p-current-program (l)), dv (offset (p-pc (l)), 1))

= (lr-p-pc-1 (program-body (p-current-program (l)), offset (p-pc (l))) + 4))

Theorem: lr-eval-p-pc-equivalence-helper-8-helper-1 ((p-psw (l) = 'run) ∧ listp (lr-expr (l)) ∧ (car (lr-expr (l)) = s-temp-test) ∧ (p-max-temp-stk-size (l) ≮ (2 + length (p-temp-stk (l)))) ∧ (local-var-value (caddr (lr-expr (l)), p-ctrl-stk (l)) = lr-undef-addr) ∧ proper-p-statep (lr->p (l)) ∧ good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table)) → (lr->p (lr-set-pos (l, dv (offset (p-pc (l)), 1))) = p (lr->p (l), 4))

Theorem: lr-eval-p-pc-equivalence-helper-8-helper-2-helper (4 + lr-p-c-size (t, expr) + 1) = (5 + lr-p-c-size (t, expr))

Theorem: lr-eval-p-pc-equivalence-helper-8-helper-2 let lr-eval be lr-eval (t, lr-set-pos (l, dv (offset (p-pc (l)), 1)), c) in ((flag ≠ 'list) ∧ listp (lr-expr (l)) ∧ (car (lr-expr (l)) = s-temp-test) ∧ (p-max-temp-stk-size (l) ≠ 0) ∧ (p-max-temp-stk-size (l) ∈ N) ∧ (p-max-temp-stk-size (l) ≠ 1) ∧ (((p-max-temp-stk-size (l) − 1) − 1) ≮ length (p-temp-stk (l))) ∧ proper-p-statep (lr->p (l)) ∧ good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ (p-psw (lr-eval) = 'run)) → (p-set-pc (lr->p (lr-set-temp (lr-eval,

car (p-temp-stk (lr-eval)), caddr (lr-expr (l)))),

p-final-pc (flag, l, 0))

= p (p-set-pc (lr->p (lr-eval),

p-final-pc (t,

lr-set-pos (l,

dv (offset (p-pc (l)), 1)),

0)),

2)) endlet

Event: Disable lr-eval-p-pc-equivalence-helper-8-helper-2-helper.

Theorem: lr-eval-p-pc-equivalence-helper-8 ((p-psw (l) = 'run) ∧ (flag ≠ 'list) ∧ listp (lr-expr (l)) ∧ (car (lr-expr (l)) = s-temp-test) ∧ (p-max-temp-stk-size (l) ≮ (2 + length (p-temp-stk (l)))) ∧ (¬ lr-eval-temp-setp (l)) ∧ (p (lr->p (lr-set-pos (l, pos)), p-clock1 (t, lr-set-pos (l, pos), c))

= p-set-pc (lr->p (lr-eval (t, lr-set-pos (l, pos), c)),

p-final-pc (t, lr-set-pos (l, pos), 0)))

∧ proper-p-statep (lr->p (l)) ∧ good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ lr-p-proper-statep (p-temp-stk (l),

p-ctrl-stk (l),

p-data-segment (l), table)

∧ (p-psw (lr-eval (t, lr-set-pos (l, pos), c)) = 'run) ∧ (pos = dv (offset (p-pc (l)), 1))) → (p-set-pc (lr->p (lr-set-temp (lr-eval (t, lr-set-pos (l, pos), c),

car (p-temp-stk (lr-eval (t, lr-set-pos (l, pos), c))),

caddr (lr-expr (l)))),

p-final-pc (flag, l, 0))

= p (lr->p (l), 4 + p-clock1 (t, lr-set-pos (l, pos), c) + 2))

Theorem: comp-body-1-car-expr-temp-fetch (listp (expr) ∧ (car (expr) = s-temp-fetch)) → (comp-body-1 (t, expr, n) = list (list ('push-local, caddr (expr))))

Theorem: get-lr-p-pc-1-comp-body-1-temp-fetch (good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ listp (lr-expr (l)) ∧ (car (lr-expr (l)) = s-temp-fetch)

∧ lr-programs-properp (l, table) ∧ (prog = assoc (area-name (p-pc (l)), p-prog-segment (l)))) → (get (lr-p-pc-1 (program-body (prog), offset (p-pc (l))),

comp-body-1 (t, program-body (prog), 0)) = list ('push-local, caddr (lr-expr (l))))

Theorem: lr-eval-p-pc-equivalence-helper-9 ((p-psw (l) = 'run) ∧ (flag ≠ 'list) ∧ listp (lr-expr (l)) ∧ (car (lr-expr (l)) = s-temp-fetch) ∧ good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ (p-psw (lr-do-temp-fetch (l)) = 'run)) → (p-set-pc (lr->p (lr-do-temp-fetch (l)), p-final-pc (flag, l, 0))

= p (lr->p (l), 1))

Theorem: lr-eval-p-pc-equivalence-helper-10 ((p-psw (l) = 'run) ∧ (flag ≠ 'list) ∧ listp (lr-expr (l)) ∧ (car (lr-expr (l)) = 'quote) ∧ good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ (length (p-temp-stk (l)) < p-max-temp-stk-size (l))) → (p-set-pc (lr->p (lr-set-tstk (l, cons (cadr (lr-expr (l)), p-temp-stk (l)))),

p-final-pc (flag, l, 0))

= p (lr->p (l), 1))

Theorem: lr-expr-cur-expr-if-same (car (cur-expr (offset (p-pc (l)), program-body (p-current-program (l)))) = 'if) = (car (lr-expr (l)) = 'if)

Theorem: lr-p-pc-lr-set-pos-dv-1-car-lr-expr-funcall (listp (lr-expr (l)) ∧ (car (lr-expr (l)) ≠ 'if) ∧ (car (lr-expr (l)) ≠ s-temp-eval) ∧ (car (lr-expr (l)) ≠ s-temp-test) ∧ (car (lr-expr (l)) ≠ s-temp-fetch) ∧ (car (lr-expr (l)) ≠ 'quote) ∧ good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table)) → (lr-p-pc (lr-set-pos (l, dv (offset (p-pc (l)), 1))) = lr-p-pc (l))

Theorem: lr->p-lr-set-pos-dv-1-car-lr-expr-funcall (listp (lr-expr (l)) ∧ (car (lr-expr (l)) ≠ 'if) ∧ (car (lr-expr (l)) ≠ s-temp-eval) ∧ (car (lr-expr (l)) ≠ s-temp-test) ∧ (car (lr-expr (l)) ≠ s-temp-fetch) ∧ (car (lr-expr (l)) ≠ 'quote) ∧ good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table)) → (lr->p (lr-set-pos (l, dv (offset (p-pc (l)), 1))) = lr->p (l))

Theorem: p-set-pc-lr->p-equal-p-fact (p-set-pc (lr->p (p-state (pc1 ,

ctrl-stk, temp-stk, prog-seg, data-seg, max-ctrl, max-temp, word-size, psw)),

pc2 )

= p) = ((p-pc (p) = pc2 )

∧ (p-ctrl-stk (p) = ctrl-stk) ∧ (p-temp-stk (p) = temp-stk) ∧ (p-data-segment (p) = data-seg) ∧ (p-prog-segment (p) = comp-programs (prog-seg)) ∧ (p-max-ctrl-stk-size (p) = max-ctrl) ∧ (p-max-temp-stk-size (p) = max-temp) ∧ (p-word-size (p) = word-size) ∧ (p-psw (p) = psw))

Event: Disable p-set-pc-lr->p-equal-p-fact.

Theorem: lr->p-p-run-subr-p-run-subr-clock (good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ listp (lr-expr (l)) ∧ (car (lr-expr (l)) ≠ 'if) ∧ subrp (car (lr-expr (l)))) → (p-run-subr (car (lr-expr (l)),

p-set-pc (lr->p (new-l),

add-addr (lr-p-pc (l), lr-p-c-size-list (arity (car (lr-expr (l))),

lr-expr (l)))))

= p (p-set-pc (lr->p (new-l),

add-addr (lr-p-pc (l),

lr-p-c-size-list (arity (car (lr-expr (l))), lr-expr (l)))),

p-run-subr-clock (l, new-l)))

Theorem: p-pc-run-car (proper-p-statep (lr->p (l)) ∧ (p-psw (l) = 'run) ∧ (p-psw (p (p-set-pc (lr->p (l), pc), p-car-clock (p-set-pc (lr->p (l), pc))))

    = 'run)

∧ lr-programs-properp (l, table) ∧ (unlabel (get (offset (pc),

program-body (assoc (area-name (pc),

p-prog-segment (lr->p (l))))))

    = '(call car)))

→ (p-pc (p (p-set-pc (lr->p (l), pc), p-car-clock (p-set-pc (lr->p (l), pc)))) = add-addr (pc, 1))

Theorem: p-pc-run-cdr (proper-p-statep (lr->p (l)) ∧ (p-psw (l) = 'run) ∧ (p-psw (p (p-set-pc (lr->p (l), pc), p-cdr-clock (p-set-pc (lr->p (l), pc))))

    = 'run)

∧ lr-programs-properp (l, table) ∧ (unlabel (get (offset (pc),

program-body (assoc (area-name (pc),

p-prog-segment (lr->p (l))))))

    = '(call cdr)))

→ (p-pc (p (p-set-pc (lr->p (l), pc), p-cdr-clock (p-set-pc (lr->p (l), pc)))) = add-addr (pc, 1))

Theorem: p-pc-run-cons (proper-p-statep (lr->p (l)) ∧ (p-psw (l) = 'run) ∧ (p-psw (p (p-set-pc (lr->p (l), pc), p-cons-clock (p-set-pc (lr->p (l), pc))))

    = 'run)

∧ lr-programs-properp (l, table) ∧ (unlabel (get (offset (pc),

program-body (assoc (area-name (pc),

p-prog-segment (lr->p (l))))))

    = '(call cons)))

→ (p-pc (p (p-set-pc (lr->p (l), pc), p-cons-clock (p-set-pc (lr->p (l), pc)))) = add-addr (pc, 1))

Theorem: p-pc-run-false (proper-p-statep (lr->p (l)) ∧ (p-psw (l) = 'run) ∧ (p-psw (p (p-set-pc (lr->p (l), pc), p-false-clock (p-set-pc (lr->p (l), pc))))

    = 'run)

∧ lr-programs-properp (l, table) ∧ (unlabel (get (offset (pc),

program-body (assoc (area-name (pc),

p-prog-segment (lr->p (l))))))

    = '(call false)))

→ (p-pc (p (p-set-pc (lr->p (l), pc), p-false-clock (p-set-pc (lr->p (l), pc)))) = add-addr (pc, 1))

Theorem: p-pc-run-falsep (proper-p-statep (lr->p (l)) ∧ (p-psw (l) = 'run) ∧ (p-psw (p (p-set-pc (lr->p (l), pc), p-falsep-clock (p-set-pc (lr->p (l), pc))))

    = 'run)

∧ lr-programs-properp (l, table) ∧ (unlabel (get (offset (pc),

program-body (assoc (area-name (pc),

p-prog-segment (lr->p (l))))))

    = '(call falsep)))

→ (p-pc (p (p-set-pc (lr->p (l), pc), p-falsep-clock (p-set-pc (lr->p (l), pc)))) = add-addr (pc, 1))

Theorem: p-pc-run-listp (proper-p-statep (lr->p (l)) ∧ (p-psw (l) = 'run) ∧ (p-psw (p (p-set-pc (lr->p (l), pc), p-listp-clock (p-set-pc (lr->p (l), pc))))

    = 'run)

∧ lr-programs-properp (l, table) ∧ (unlabel (get (offset (pc),

program-body (assoc (area-name (pc),

p-prog-segment (lr->p (l))))))

    = '(call listp)))

→ (p-pc (p (p-set-pc (lr->p (l), pc), p-listp-clock (p-set-pc (lr->p (l), pc)))) = add-addr (pc, 1))

Theorem: p-pc-run-nlistp (proper-p-statep (lr->p (l)) ∧ (p-psw (l) = 'run) ∧ (p-psw (p (p-set-pc (lr->p (l), pc), p-nlistp-clock (p-set-pc (lr->p (l), pc))))

    = 'run)

∧ lr-programs-properp (l, table)

∧ (unlabel (get (offset (pc),

program-body (assoc (area-name (pc),

p-prog-segment (lr->p (l))))))

    = '(call nlistp)))

→ (p-pc (p (p-set-pc (lr->p (l), pc), p-nlistp-clock (p-set-pc (lr->p (l), pc)))) = add-addr (pc, 1))

Theorem: p-pc-run-true (proper-p-statep (lr->p (l)) ∧ (p-psw (l) = 'run) ∧ (p-psw (p (p-set-pc (lr->p (l), pc), p-true-clock (p-set-pc (lr->p (l), pc))))

    = 'run)

∧ lr-programs-properp (l, table) ∧ (unlabel (get (offset (pc),

program-body (assoc (area-name (pc),

p-prog-segment (lr->p (l))))))

    = '(call true)))

→ (p-pc (p (p-set-pc (lr->p (l), pc), p-true-clock (p-set-pc (lr->p (l), pc)))) = add-addr (pc, 1))

Theorem: p-pc-run-truep (proper-p-statep (lr->p (l)) ∧ (p-psw (l) = 'run) ∧ (p-psw (p (p-set-pc (lr->p (l), pc), p-truep-clock (p-set-pc (lr->p (l), pc))))

    = 'run)

∧ lr-programs-properp (l, table) ∧ (unlabel (get (offset (pc),

program-body (assoc (area-name (pc),

p-prog-segment (lr->p (l))))))

    = '(call truep)))

→ (p-pc (p (p-set-pc (lr->p (l), pc), p-truep-clock (p-set-pc (lr->p (l), pc)))) = add-addr (pc, 1))

Theorem: p-run-subr-p-pc-add-addr-lr-p-pc-lr-p-c-size let pos be dv (offset (p-pc (l)), 1) in (good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ listp (lr-expr (l)) ∧ subrp (car (lr-expr (l))) ∧ (car (lr-expr (l)) ≠ 'if) ∧ (car (lr-expr (l)) ≠ 'quote) ∧ proper-p-statep (lr->p (l)) ∧ (p-psw (lr-eval ('list, lr-set-pos (l, pos), c)) = 'run) ∧ (p-psw (p-run-subr (car (lr-expr (l)), p-set-pc (lr->p (lr-eval ('list,

lr-set-pos (l, pos), c)),

lr-return-pc (l))))

    = 'run))

→ (p-pc (p-run-subr (car (lr-expr (l)),

p-set-pc (lr->p (lr-eval ('list, lr-set-pos (l, pos), c)),

lr-return-pc (l))))

= add-addr (lr-return-pc (l), 1)) endlet

Theorem: lr-eval-p-pc-equivalence-helper-11 ((p-psw (l) = 'run) ∧ (flag ≠ 'list) ∧ (c ≠ 0) ∧ (c ∈ N) ∧ listp (lr-expr (l)) ∧ (car (lr-expr (l)) ≠ 'if) ∧ (car (lr-expr (l)) ≠ s-temp-eval) ∧ (car (lr-expr (l)) ≠ s-temp-test) ∧ (car (lr-expr (l)) ≠ s-temp-fetch) ∧ (car (lr-expr (l)) ≠ 'quote) ∧ subrp (car (lr-expr (l))) ∧ (p-psw (lr-eval ('list, lr-set-pos (l, pos), c)) = 'run) ∧ (p (lr->p (l), p-clock1 ('list, lr-set-pos (l, pos), c))

= p-set-pc (lr->p (lr-eval ('list, lr-set-pos (l, pos), c)),

p-final-pc ('list, lr-set-pos (l, pos), 0)))

∧ proper-p-statep (lr->p (l)) ∧ good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ (p-psw (lr-apply-subr (l, lr-eval ('list, lr-set-pos (l, pos), c)))

    = 'run)

∧ (pos = dv (offset (p-pc (l)), 1))) → (p-set-pc (lr->p (lr-apply-subr (l, lr-eval ('list, lr-set-pos (l, pos), c))),

p-final-pc (flag, l, 0))

= p (lr->p (l), p-clock1 ('list, lr-set-pos (l, pos), c) + p-run-subr-clock (l,

lr-eval ('list, lr-set-pos (l, pos), c))))

Theorem: p-set-pc-twice p-set-pc (p-set-pc (p, pc1 ), pc2 ) = p-set-pc (p, pc2 )

Theorem: lr-eval-p-pc-equivalence-helper-12-helper-1 (good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ listp (lr-expr (l)) ∧ (car (lr-expr (l)) ≠ 'if) ∧ (car (lr-expr (l)) ≠ 'quote) ∧ (¬ subrp (car (lr-expr (l)))) ∧ litatom (car (lr-expr (l))) ∧ (p-psw (lr-eval (t, lr-funcall (l, new-l), c − 1)) = 'run) ∧ (p-psw (new-l) = 'run) ∧ (p-prog-segment (l) = p-prog-segment (new-l))) → (p (p-set-pc (lr->p (new-l),

add-addr (lr-p-pc (l),

lr-p-c-size-list (arity (car (lr-expr (l))), lr-expr (l)))),

      1)

= lr->p (lr-funcall (l, new-l)))

Theorem: lr-expr-funcall ((p-psw (lr-funcall (l, new-l)) = 'run) ∧ (p-prog-segment (l) = p-prog-segment (new-l))) → (lr-expr (lr-funcall (l, new-l))

= program-body (assoc (user-fname (car (lr-expr (l))), p-prog-segment (l))))

Theorem: unlabel-car-last-comp-body unlabel (car (last (comp-body (body)))) = '(ret)

Theorem: unlabel-get-last-funcall-body-assoc-comp-programs (listp (lr-expr (l)) ∧ (¬ subrp (car (lr-expr (l)))) ∧ (car (lr-expr (l)) ≠ 'quote) ∧ litatom (car (lr-expr (l))) ∧ good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ (prog-seg = p-prog-segment (l))) → (unlabel (get (lr-p-c-size (t,

program-body (assoc (user-fname (car (lr-expr (l))), prog-seg))),

program-body (assoc (user-fname (car (lr-expr (l))),

comp-programs (prog-seg)))))

    = '(ret))

Theorem: lr-eval-preserves-cdr-p-ctrl-stk-lr-funcall (listp (lr-expr (l)) ∧ (¬ subrp (car (lr-expr (l))))

∧ (car (lr-expr (l)) ≠ 'if) ∧ (car (lr-expr (l)) ≠ 'quote) ∧ litatom (car (lr-expr (l))) ∧ proper-p-statep (lr->p (l)) ∧ good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ (p-psw (lr-eval (t, lr-funcall (l, new-l), c − 1)) = 'run) ∧ (p-psw (new-l) = 'run) ∧ (new-l = lr-eval ('list, lr-set-pos (l, dv (offset (p-pc (l)), 1)), c))) → (cdr (p-ctrl-stk (lr-eval (t, lr-funcall (l, new-l), c − 1)))

= p-ctrl-stk (new-l))

Theorem: lr-eval-preserves-ret-pc-car-p-ctrl-stk (proper-p-statep (lr->p (l)) ∧ good-posp (flag, offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ (p-psw (lr-eval (flag, l, c)) = 'run)) → (ret-pc (car (p-ctrl-stk (lr-eval (flag, l, c))))

= ret-pc (car (p-ctrl-stk (l))))

Theorem: lr-eval-preserves-ret-pc-car-p-ctrl-stk-lr-funcall (listp (lr-expr (l)) ∧ (¬ subrp (car (lr-expr (l)))) ∧ (car (lr-expr (l)) ≠ 'if) ∧ (car (lr-expr (l)) ≠ 'quote) ∧ litatom (car (lr-expr (l))) ∧ proper-p-statep (lr->p (l)) ∧ good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ (p-psw (lr-eval (t, lr-funcall (l, new-l), c − 1)) = 'run) ∧ (p-psw (new-l) = 'run) ∧ (new-l = lr-eval ('list, lr-set-pos (l, dv (offset (p-pc (l)), 1)), c))) → (ret-pc (car (p-ctrl-stk (lr-eval (t, lr-funcall (l, new-l), c − 1))))

= add-addr (lr-return-pc (l), 1))

Theorem: lr-eval-p-pc-equivalence-helper-12-helper-2 let new-l be lr-eval ('list, lr-set-pos (l, dv (offset (p-pc (l)), 1)), c) in (good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ listp (lr-expr (l)) ∧ (car (lr-expr (l)) ≠ 'if) ∧ (car (lr-expr (l)) ≠ 'quote) ∧ (¬ subrp (car (lr-expr (l)))) ∧ proper-p-statep (lr->p (l))

∧ litatom (car (lr-expr (l))) ∧ lr-proper-formalsp (cdr (p-prog-segment (l))) ∧ (p-psw (lr-eval (t, lr-funcall (l, new-l), c − 1)) = 'run) ∧ (p-psw (new-l) = 'run)) → (p (p-set-pc (lr->p (lr-eval (t, lr-funcall (l, new-l), c − 1)),

add-addr (lr-p-pc (lr-funcall (l, new-l)), lr-p-c-size (t,

lr-expr (lr-funcall (l, new-l))))),

      1)

= p-set-pc (lr->p (lr-pop-cstk (lr-eval (t, lr-funcall (l, new-l), c − 1))),

add-addr (lr-p-pc (l),

lr-p-c-size-list (arity (car (lr-expr (l))), lr-expr (l))

+ 1))) endlet

Theorem: lr-eval-p-pc-equivalence-helper-12 let fs be lr-funcall (l, lr-eval ('list, lr-set-pos (l, pos), c)) in ((p-psw (l) = 'run) ∧ (flag ≠ 'list) ∧ (c ≠ 0) ∧ (c ∈ N) ∧ listp (lr-expr (l)) ∧ (car (lr-expr (l)) ≠ 'if) ∧ (car (lr-expr (l)) ≠ s-temp-eval) ∧ (car (lr-expr (l)) ≠ s-temp-test) ∧ (car (lr-expr (l)) ≠ s-temp-fetch) ∧ (car (lr-expr (l)) ≠ 'quote) ∧ (¬ subrp (car (lr-expr (l)))) ∧ litatom (car (lr-expr (l))) ∧ (p-psw (lr-eval ('list, lr-set-pos (l, pos), c)) = 'run) ∧ (p (lr->p (fs), p-clock1 (t, fs, c − 1))

= p-set-pc (lr->p (lr-eval (t, fs, c − 1)),

p-final-pc (t, fs, 0)))

∧ (p (lr->p (l), p-clock1 ('list, lr-set-pos (l, pos), c))

= p-set-pc (lr->p (lr-eval ('list, lr-set-pos (l, pos), c)),

p-final-pc ('list, lr-set-pos (l, pos), 0)))

∧ proper-p-statep (lr->p (l)) ∧ good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ lr-proper-formalsp (cdr (p-prog-segment (l))) ∧ (p-psw (lr-eval (t, fs, c − 1)) = 'run)

∧ (pos = dv (offset (p-pc (l)), 1))) → (p-set-pc (lr->p (lr-pop-cstk (lr-eval (t, fs, c − 1))),

p-final-pc (flag, l, 0))

= p (lr->p (l), p-clock1 ('list, lr-set-pos (l, pos), c)

          + 1

+ p-clock1 (t, fs, c − 1)

+ 1)) endlet

Theorem: lr-eval-p-pc-equivalence (proper-p-statep (lr->p (l)) ∧ good-posp (flag, offset (p-pc (l)), program-body (p-current-program (l))) ∧ ((flag ≠ 'list)

∨ (car (cur-expr (butlast (offset (p-pc (l))),

program-body (p-current-program (l))))

        ≠ 'if))

∧ lr-programs-properp (l, table) ∧ lr-p-proper-statep (p-temp-stk (l),

p-ctrl-stk (l),

p-data-segment (l), table)

∧ lr-proper-formalsp (cdr (p-prog-segment (l))) ∧ (p-psw (lr-eval (flag, l, c)) = 'run)) → (p (lr->p (l), p-clock1 (flag, l, c))

= p-set-pc (lr->p (lr-eval (flag, l, c)), p-final-pc (flag, l, 0)))

Event: Disable lr-expr-cur-expr-if-same.

Definition: logic->p-clock (expr,

alist,

program-names, heap-size, max-temp-stk-size, max-ctrl-stk-size, word-size)

= (p-clock1 (t,

s->lr (logic->s (expr, alist, program-names), heap-size, max-temp-stk-size, max-ctrl-stk-size, word-size),

cdr (v&c$ (t, expr, alist)) + 1)

+ 2)

Definition: total-heap-reqs (expr, alist, program-names, heap-size) = lr-total-heap-reqs (expr,

alist,

program-names,

heap-size,

cdr (v&c$ (t, expr, alist)) + 1)

Definition: max-ctrl-reqs (expr, alist, program-names) = lr-max-ctrl-reqs (expr,

alist,

program-names,

cdr (v&c$ (t, expr, alist)) + 1)

Definition: max-temp-reqs (expr, alist, program-names) = lr-max-temp-reqs (expr,

alist,

program-names,

cdr (v&c$ (t, expr, alist)) + 1)

Definition: max-word-size-reqs (expr, alist, program-names, heap-size) = lr-max-word-size-reqs (expr,

alist,

program-names,

heap-size,

cdr (v&c$ (t, expr, alist)) + 1)

Theorem: s-formals-s-prog-logic->s s-formals (s-prog (logic->s (expr, alist, pnames))) = strip-cars (alist)

Theorem: deposit-answer-addr-preserves-lr-valp (adpp (untag (lr-answer-addr), data-seg) ∧ lr-valp (value, addr, data-seg)) → lr-valp (value,

addr,

deposit (anything, identity (lr-answer-addr), data-seg))

Theorem: p-last-2-instrs-main-program (adpp (untag (lr-answer-addr), p-data-segment (l)) ∧ (p-psw (l) = 'run) ∧ listp (p-temp-stk (l)) ∧ lr-valp (value, car (p-temp-stk (l)), p-data-segment (l))) → lr-valp (value, fetch (identity (lr-answer-addr),

p-data-segment (p (p-set-pc (lr->p (l),

tag ('pc,

cons (name (car (p-prog-segment (l))),

lr-p-c-size (t,

program-body (car (p-prog-segment (l))))))),

2))),

p-data-segment (p (p-set-pc (lr->p (l),

tag ('pc,

cons (name (car (p-prog-segment (l))),

lr-p-c-size (t,

program-body (car (p-prog-segment (l))))))),

2)))

Theorem: lr-programs-properp-s->lr-logic->s (l-proper-exprp (t, expr, pnames, strip-cars (alist)) ∧ l-proper-programsp (pnames) ∧ all-litatoms (strip-cars (alist)) ∧ l-data-seg-body-restrictedp (t, expr) ∧ l-restrict-subrps-progs (pnames) ∧ l-restrict-subrps (t, expr) ∧ l-restrictedp (pnames, alist) ∧ (heap-size ≮ s-total-heap-reqs (s-progs (logic->s (expr, alist, pnames)),

alist,

heap-size)))

→ lr-programs-properp (s->lr (logic->s (expr, alist, pnames), heap-size, max-ctrl, max-temp, word-size),

cdr (lr-data-seg-table (s-progs (logic->s (expr, alist, pnames)),

alist,

heap-size)))

Theorem: logic->p-ok-really-helper-1 (proper-p-statep (lr->p (l)) ∧ good-posp1 (offset (p-pc (l)), program-body (p-current-program (l))) ∧ lr-programs-properp (l, table) ∧ lr-p-proper-statep (p-temp-stk (l),

p-ctrl-stk (l),

p-data-segment (l), table)

∧ lr-proper-formalsp (cdr (p-prog-segment (l))) ∧ (p-psw (lr-eval (t, l, c)) = 'run) ∧ adpp (untag (lr-answer-addr), p-data-segment (l)) ∧ (area-name (p-pc (l)) = name (car (p-prog-segment (l)))) ∧ (offset (p-pc (l)) = nil) ∧ lr-valp (value,

car (p-temp-stk (lr-eval (t, l, c))), p-data-segment (lr-eval (t, l, c))))

→ lr-valp (value,

fetch (lr-answer-addr,

p-data-segment (p (p (lr->p (l), p-clock1 (t, l, c)), 2))), p-data-segment (p (p (lr->p (l), p-clock1 (t, l, c)), 2)))

Theorem: name-car-p-prog-segment-s->lr name (car (p-prog-segment (s->lr (s, heap-size, max-ctrl, max-temp, word-size)))) = name (car (s-progs (s)))

Theorem: p-pc-s->lr p-pc (s->lr (s, heap-size, max-temp, max-ctrl, word-size)) = tag ('pc, cons (s-pname (s), s-pos (s)))

Theorem: adpp-untag-lr-answer-addr-s->lr adpp (identity (untag (lr-answer-addr)),

p-data-segment (s->lr (s, heap-size, max-ctrl, max-temp, word-size)))

Theorem: lr-s-similar-statesp-s->lr-logic->s-lr-data-seg-table ((heap-size ≮ s-total-heap-reqs (s-progs (logic->s (expr, alist, pnames)),

alist,

heap-size))

∧ l-restrictedp (pnames, alist) ∧ l-data-seg-body-restrictedp (t, expr)) → lr-s-similar-statesp (alist,

nil,

s->lr (logic->s (expr, alist, pnames), heap-size, max-ctrl, max-temp, word-size),

cdr (lr-data-seg-table (s-progs (logic->s (expr, alist, pnames)),

alist,

heap-size)))

Theorem: s-eval-flag-run-v&c$-not-f-flag-t (v&c$ (t, expr, alist) ∧ (cdr (v&c$ (t, expr, alist)) < c) ∧ l-proper-programsp (pnames) ∧ l-proper-exprp (t, expr, pnames, strip-cars (alist)) ∧ all-litatoms (strip-cars (alist))) → (s-err-flag (s-eval (t, logic->s (expr, alist, pnames), c)) = 'run)

Theorem: lr-proper-formalsp-cdr-p-prog-segment-s->lr-logic->s (l-proper-programsp (pnames) ∧ l-proper-exprp (t, expr, pnames, strip-cars (alist)) ∧ all-litatoms (strip-cars (alist))) → lr-proper-formalsp (cdr (p-prog-segment (s->lr (logic->s (expr,

alist, pnames),

heap-size, max-ctrl, max-temp, word-size))))

Theorem: lr-s-similar-params-lr-good-pointerps-strip-cdrs lr-s-similar-params (s-params, lr-params, data-seg) → lr-good-pointerps (strip-cdrs (lr-params), data-seg)

Theorem: lr-p-proper-statep-s->lr ((heap-size ≮ s-total-heap-reqs (s-progs (s), s-params (s), heap-size)) ∧ s-restrictedp (s-progs (s), s-params (s)) ∧ (params = s-params (s))) → lr-p-proper-statep (p-temp-stk (s->lr (s,

heap-size, max-ctrl, max-temp, word-size)),

p-ctrl-stk (s->lr (s, heap-size, max-ctrl, max-temp, word-size)),

p-data-segment (s->lr (s, heap-size, max-ctrl, max-temp, word-size)), cdr (lr-data-seg-table (s-progs (s), params, heap-size)))

Theorem: proper-p-statep-lr->p-s->lr-logic->s (l-proper-exprp (t, expr, pnames, strip-cars (alist)) ∧ l-proper-programsp (pnames) ∧ all-litatoms (strip-cars (alist)) ∧ l-data-seg-body-restrictedp (t, expr) ∧ l-restrictedp (pnames, alist) ∧ l-restrict-subrps (t, expr) ∧ l-restrict-subrps-progs (pnames) ∧ (heap-size ≮ (s-total-heap-reqs (s-progs (logic->s (expr, alist, pnames)),

alist, heap-size)

+ s-eval-heap-r (t, logic->s (expr, alist, pnames), c)))

∧ (max-ctrl ≮ lr-max-ctrl-reqs (expr, alist, pnames, c)) ∧ (max-ctrl < exp (2, word-size)) ∧ (max-ctrl ∈ N) ∧ (max-temp ≮ lr-max-temp-reqs (expr, alist, pnames, c)) ∧ (max-temp < exp (2, word-size)) ∧ (max-temp ∈ N) ∧ (word-size ≮ lr-max-word-size-reqs (expr, alist, pnames, heap-size, c)) ∧ (word-size ∈ N)) → proper-p-statep (lr->p (s->lr (logic->s (expr, alist, pnames),

heap-size, max-ctrl, max-temp, word-size)))

Theorem: logic->p-ok-really (l-proper-exprp (t, expr, pnames, strip-cars (alist)) ∧ l-proper-programsp (pnames) ∧ all-litatoms (strip-cars (alist)) ∧ l-data-seg-body-restrictedp (t, expr) ∧ l-restrictedp (pnames, alist) ∧ v&c$ (t, expr, alist) ∧ l-restrict-subrps (t, expr) ∧ l-restrict-subrps-progs (pnames) ∧ (heap-size ≮ total-heap-reqs (expr, alist, pnames, heap-size)) ∧ (max-ctrl ≮ max-ctrl-reqs (expr, alist, pnames)) ∧ (max-ctrl < exp (2, word-size)) ∧ (max-ctrl ∈ N) ∧ (max-temp ≮ max-temp-reqs (expr, alist, pnames)) ∧ (max-temp < exp (2, word-size)) ∧ (max-temp ∈ N) ∧ (word-size ≮ max-word-size-reqs (expr, alist, pnames, heap-size)) ∧ (word-size ∈ N)) → lr-valp (car (v&c$ (t, expr, alist)), fetch (lr-answer-addr,

p-data-segment (p (logic->p (expr, alist, pnames, heap-size, max-ctrl, max-temp, word-size),

logic->p-clock (expr, alist, pnames, heap-size, max-ctrl, max-temp, word-size)))),

p-data-segment (p (logic->p (expr, alist, pnames, heap-size, max-ctrl, max-temp, word-size),

logic->p-clock (expr, alist, pnames, heap-size, max-ctrl, max-temp, word-size))))

Index

add-addr, 6, 7, 10, 11, 14, 15, 37, 44, 48, 53–55, 75–81, 91, 96–99, 102, 106, 109, 110, 112–115, 117–121, 126, 128, 153, 154, 160, 162, 181, 185, 186, 196, 199, 200, 218, 219, 225, 226, 230–232, 234, 240, 242, 250, 252, 255–258, 264– 266, 268–273, 289, 316, 341, 351, 354, 371–377

add-addr-add-addr, 53 add-addr-of-non-number, 53 add-addr-p-final-pc, 354 add1-add1-lr-boundary-nodep, 241 add1-addr, 14, 38, 47 add1-lr-boundary-nodep, 241 adp-name, 40, 44, 53, 101, 115 adp-name-cons, 101 adp-name-untag-add-addr, 53 adp-name-untag-sub-addr, 44 adp-offset, 40, 44 adp-offset-cons, 44 adp-offset-untag-add-addr, 44 adp-offset-untag-sub-addr, 44 adpp, 7, 47, 48, 52, 55, 75, 96, 99,

102–104, 106, 107, 109, 112, 114–118, 120–127, 130, 153– 156, 185, 196, 199, 200, 218– 221, 225, 231–233, 235, 240– 242, 249, 250, 254–258, 264– 268, 289, 308–311, 318, 339, 342, 379, 381

adpp-add-addr-0, 48 adpp-add-addr-fact-2, 106 adpp-adpp-sub-addr, 103 adpp-area-name-offset-same, 106 adpp-cons-heap-name-node-size-l

r-init-data-seg, 263 adpp-cons-pack-definedp-area-na

me, 48 adpp-cons-pack-opener, 218 adpp-deposit-a-list, 120 adpp-deposit-anything-at-all, 47 adpp-deposit-other-area, 115 adpp-fetch-lr-fp-addr-car-lr-co

mpile-quote, 241 adpp-lessp-offset-deposit, 47 adpp-lr-compile-quote, 220 adpp-same-signature, 48 adpp-same-signature-car-lr-compi

le-quote, 221 adpp-same-signature-lr-apply-su

br, 156 adpp-untag-add-addr-lr-nodep-not

-max-addr, 199 adpp-untag-add-addr-offset-car, 196 adpp-untag-add-addr-offset-cdr, 196 adpp-untag-add-addr-offset-on-f

ree-listp, 200 adpp-untag-answer-addr-car-lr-d

ata-seg-table, 318 adpp-untag-definedp-area-name, 47 adpp-untag-definedp-area-name-f

ree-ptr, 220 adpp-untag-lessp-offset, 48 adpp-untag-listp, 48 adpp-untag-lr-answer-addr-s->

lr, 381 adpp-untag-lr-fp-addr-lr-init-d

ata-seg, 225 adpp-untag-numberp-offset, 48 all-definedp, 327, 328 all-definedp-strip-cdrs-lr-init

-data-seg-table, 328 all-litatoms, 35, 220, 273, 274, 280,

284, 305, 306, 308, 309, 318, 329, 330, 332, 380, 382, 383

all-litatoms-all-user-fnamesp-p

listp, 309 all-litatoms-not-plist, 331, 332 all-litatoms-not-plist-lr-prope

r-programsp, 332 all-litatoms-s-formals-member-l

r-programs-properp, 306 all-litatoms-s-formals-member-s

-programs-properp, 305 all-litatoms-strip-cdrs-lr-make

-temp-name-alist, 280 -temp-name-alist-1, 280

all-numberps, 344 all-numberps-strip-cadrs-numberp

-cdr-assoc, 344 all-numberps-strip-cadrs-subr-a

rity-alist, 344 all-p-objectps, 49, 52, 73, 74, 310,

315, 316 all-p-objectps-append, 73 all-p-objectps-bad-type, 52 all-p-objectps-first-n, 74 all-p-objectps-get, 310 all-p-objectps-lr->p-similar-

states, 49 all-p-objectps-lr-init-heap-conte

nts, 316

nts-helper, 315

nts-helper-helper, 315 all-p-objectps-put, 310 all-p-objectps-reverse, 73 all-p-objects-lookup, 220, 234–239,

263 all-p-objects-lookup-cons-table, 234 all-p-objects-lookup-deposit, 236 all-p-objects-lookup-deposit-a-

list, 235 all-p-objects-lookup-lr-compile

-quote, 237 all-p-objects-lookup-lr-data-se

g-table-body, 238 g-table-list, 239

all-p-objects-lookup-strip-cdrs

-lr-init-data-seg-table, 263 all-undef-addr-strip-cdrs-lr-ma

ke-initial-temps, 324 all-undef-addrs, 35, 284, 292, 324,

344 all-undef-addrs-strip-cadrs-lr-

make-temp-var-dcls, 292 all-undef-addrs-strip-cadrs-temp -vars-programs-properp, 344 -vars-programs-properp-1, 344 all-user-fnamesp, 35, 51, 291, 292, 307–309, 332 all-user-fnamesp-strip-cars-s-c onstruct-programs, 332 append-butlast-list-car-last, 348 append-first-n-restn, 167 area-name, 7, 8, 15, 21, 23, 24, 33,

35, 38–40, 45, 47, 48, 52– 55, 57, 59, 63, 72, 75–94, 103–106, 108, 110, 113, 115– 118, 120, 121, 126, 127, 133, 134, 153, 154, 157, 163, 172, 187, 198–204, 218, 220, 226– 233, 240, 242, 249, 255, 256, 264–266, 268, 269, 289, 308– 311, 315, 316, 339, 343, 347, 352, 354–362, 364–366, 369, 371–373, 381

area-name-add-addr, 53 area-name-lr-p-pc, 45 area-name-lr-return-pc, 53 area-name-p-final-pc, 355 area-name-p-pc-lr-eval, 47 area-name-p-pc-lr-funcall, 91 area-name-sub-addr, 54 area-name-tag, 40 arity, 34, 57, 153, 163, 168–170, 180,

198–205, 207, 208, 211, 342– 345, 370, 371, 375, 377

arity-formals-not-quote, 169

ascii-0, 12, 31, 283

ascii-1, 12 ascii-9, 12 ascii-dash, 12, 31 assoc-append-1, 50 assoc-cdr, 288, 289 assoc-definedp-table-lr-compile

-quote, 240 assoc-definedp-table-lr-data-se g-table-body, 327

g-table-list, 327 assoc-definedp-table-lr-init-dat

a-seg-table, 240 assoc-put-assoc-3, 47 axiom-53, 1

bindings, 23, 61, 62, 74, 91, 92, 94, 95, 122, 123, 130, 134, 135, 141, 142, 144, 145, 150, 151, 183, 191, 336, 337, 353, 366

bindings-make-p-call-frame, 74 butlast, 7, 56, 166, 282, 295, 296,

304, 348, 349, 378

caar-lr-compile-programs, 211 cadddr-max-r, 190 car-append, 57 car-car-lr-compile-programs-pro

gs, 132 car-comp-body-1-litatom, 347 car-comp-body-lr-expr-3-temp-te

st, 365 car-last-first-n-add1-get, 166 car-lr-compile-body, 129 car-lr-expr-s->lr1, 137 car-reverse-last, 166 car-untag-lr-p-pc, 45 car-untag-lr-return-pc, 54 car-untag-p-pc-lr-eval, 86 car-untag-p-pc-lr-funcall, 91 cddr-add-addr, 53 cddr-lr-return-pc, 54 cddr-nil-lr-p-pc, 45 cddr-nil-make-p-call-frame, 74 cddr-sub-addr, 54 cdr-assoc-member-strip-cdrs, 107 cdr-compile-quote-list-t0-lr-init

-data-seg-cons-table, 271 cdr-p-temp-stk-lr-apply-subr, 160 cdr-p-temp-stk-p-run-subr, 159 cdr-untag-lr-p-pc-lr-funcall, 90 change-elements, 1 comp-body, 33, 58, 59, 72, 93, 284,

375 comp-body-1, 32, 33, 57–59, 66–72,

84, 285, 286, 288, 292, 308, 309, 347, 354, 362, 364, 365, 368, 369 comp-body-1-car-expr-if, 354 comp-body-1-car-expr-temp-eval, 362 comp-body-1-car-expr-temp-fetch, 368 comp-body-1-list-not-listp, 285 comp-if, 31, 32, 57, 66–68, 286, 351,

354, 356 comp-programs, 33, 36, 44, 45, 51,

59–61, 63, 73, 85, 86, 89, 91–93, 187, 210, 285–292, 307, 308, 310, 347, 354, 356, 357, 359, 362, 364–366, 370, 375

comp-programs-1, 33, 45, 59–61, 210,

281, 308 comp-programs-assoc-cons-opener, 210 comp-temp-test, 31, 33, 66, 68, 288 count-codelist, 13 count-codelist-make-symbol, 13 count-codelist1, 12, 13, 146, 147 count-codelist1-append-non-listp, 147 count-codelist1-cdr-gensym, 147 count-codelist1-cons, 146 count-list, 15, 16 cur-expr, 7, 56, 62, 63, 65, 67–72,

85, 129, 158, 282, 295–304, 348, 349, 356, 369, 378

cur-expr-add1-opener, 356 cur-expr-lr-compile-body-t, 129 cur-expr-nlistp-pos, 85

definedp, 16, 33–35, 42, 45, 47, 48, 50, 51, 53, 57, 59–61, 63, 74, 84, 85, 91, 92, 94, 101– 104, 107, 112, 116, 120, 132– 135, 141–145, 147, 149–151, 156, 163, 169, 187, 199, 206, 208, 210, 212, 216–224, 234, 237–243, 245, 249–256, 259– 264, 267–279, 286–292, 294, 295, 301, 302, 306–308, 310, 311, 313–315, 317, 320–322, 324–328, 331, 344, 366

definedp-0, 210 definedp-append, 45 definedp-area-name-member-p-cur

rent-program, 59 definedp-caddr-lr-expr-bindings

-ctrl-stk, 63

-ctrl-stk-rewrite, 365 definedp-cadr-cur-expr-quote-lr

-data-seg-table, 302

-data-seg-table-body, 301 -data-seg-table-list, 302

definedp-car-lr-compile-quote, 219 definedp-cdr-assoc-lr-good-pointe

rps, 336 definedp-cdr-lr-compile-quote-t, 264 definedp-comp-programs-1-define

dp-orig, 45 definedp-comp-programs-definedp

-lr-programs-properp, 91 -orig, 45

definedp-deposit, 47 definedp-deposit-a-list, 120 definedp-listp-cdr-assoc-lr-prope

r-p-areasp, 102 definedp-litatom-lr-proper-p-are

as, 101 definedp-lr-compile-programs, 112 definedp-lr-data-seg-body-list-

n-not-lessp, 301 definedp-lr-funcall-prog-segment, 91 definedp-lr-heap-name-lr-init-d

ata-seg, 234 definedp-lr-make-temp-name-alist, 151

-1, 151 definedp-name-p-objectp-tag-0-l

r-proper-p-areasp, 237 definedp-object-cdr-lr-compile-q

uote-list, 254 definedp-pairlist, 151 definedp-s-temps-s-eval, 147 definedp-strip-cars-append-membe

r-x, 134

r-x-2, 149 definedp-table-definedp-car-lr-data-seg-table-body, 221 data-seg-table-list, 221 definedp-table-definedp-car-lr-i nit-data-seg-table, 234 definedp-table-definedp-cdr-lr-compile-quote, 219 data-seg-table-body, 220 data-seg-table-body-n, 301 data-seg-table-list, 220 definedp-table-definedp-cdr-lr-i nit-data-seg-table, 221 definedp-table-lr-compile-quote

-self, 240 definedp-user-fname-s-construct

-programs, 331 definition, 37 definitions-subrps-lr-programs-p

roperp, 51 delete, 96, 107, 117, 181, 228, 229, 249, 250, 252

delete-all, 331 delete-append, 228 deposit, 14, 15, 47, 53, 78, 81, 102,

107, 110, 114–121, 125, 185, 186, 218, 231, 232, 236, 237, 241, 255, 256, 268, 310, 338, 339, 379

deposit-a-list, 14, 15, 47, 78, 81, 120, 121, 126–128, 162, 186, 218, 220, 221, 231, 232, 235, 236, 242, 249, 254, 257–261, 311– 313, 316, 339, 341

deposit-a-list-cons-opener, 47

deposit-a-list-nil, 47

deposit-answer-addr-preserves-l

r-valp, 379 deposit-cons, 218 deposit-deposit, 109 deposit-free-ptr-preserves-lr-v

alp, 107 deposit-good-node-preserves-lr-p roper-free-listp, 121 deposit-ref-count-move-inward-2, 119 deposit-ref-count-move-outward, 110 difference-decreases, 35 disjointp, 141–145 disjointp-commutative, 145 disjointp-cons-arg2, 143 disjointp-lr-make-temp-name-ali

st-1, 143 st-2, 145

disjointp-nlistp-arg2, 143 disjointp-plist-arg-2, 144 dl, 31 dv, 40–42, 44, 62, 73, 110–112, 136–

140, 144, 145, 148, 152, 156, 158–160, 164, 165, 168, 171, 173, 179, 180, 188–190, 192– 195, 205–215, 282, 295–299, 302, 334, 335, 340, 342, 343, 345, 346, 350, 353–363, 367– 370, 373, 374, 376, 378

equal-add-addr-fact, 226 equal-append-final-0, 146 equal-append-initial, 146 equal-append-same-length-fact, 134 equal-ascii-0-lr-convert-digit-t

o-ascii, 283 equal-cddr-p-frame-nil, 3 equal-lengths-same-signature-ca

r-lr-compile-quote, 221 equal-p-psw-lr-eval-run-lr-eval

-lr-set-error, 137 equal-plus-lessp-fact, 205 equal-plus-remainder-0-fact, 55 exp, 88, 195, 196, 318, 329, 332, 383 exp-log-2-lessp-add1-fact-1, 196 exp-log-lessp-fact-1, 196

fall-off-proofp, 306 fall-off-proofp-append-cons-ret, 306 fetch, 6, 7, 10, 11, 15, 17, 27, 52, 53,

55, 75–84, 96–98, 102, 104, 106, 109, 112–114, 121, 126, 128, 153, 154, 160–163, 181, 182, 186–189, 191, 196, 198– 207, 217–219, 221, 225, 230, 232, 235, 240–242, 249–266, 268–272, 275–280, 289, 294, 295, 310–315, 320–328, 341, 380, 381, 384 fetch-0-addr-compile-quote-list -init-data-seg, 271 fetch-add-addr-deposit-a-list-n

ode, 126 fetch-add-addr-ref-count-f-addr -lr-init-data-seg, 269 fetch-add-addr-ref-count-lr-0-a ddr-lr-init-data-seg, 270 fetch-add-addr-ref-count-lr-t-a ddr-lr-init-data-seg, 270 fetch-add-addr-ref-count-offset

-lr-init-data-seg-help-1, 226 fetch-cons, 217 fetch-deposit, 53 fetch-deposit-a-list, 218 fetch-deposit-a-list-node, 126 fetch-f-addr-compile-quote-list -init-data-seg, 271 fetch-fp-addr-compile-quote-list

-t0-lr-init-data-seg-cons-table, 272 fetch-init-init-data-seg-genera

lized, 229 fetch-init-init-data-seg-sub-ad

dr, 232 fetch-lr-f-addr-lr-init-data-se

g, 269 fetch-lr-fp-addr-compile-quote-

0, 268 fetch-lr-fp-addr-compile-quote-t, 264 fetch-lr-fp-addr-lr-init-data-se

g, 225 fetch-lr-nodep-add-addr, 106 fetch-offset-lr-t-addr-ref-count

-offset-compile-quote-t, 264 fetch-ref-count-0-addr-compile-q uote-list-init-data-seg, 271 fetch-ref-count-f-addr-compile-q uote-list-init-data-seg, 272 fetch-ref-count-lr-init-data-se

g-free-list, 266 fetch-ref-count-t-addr-compile-q

uote-list-init-data-seg, 270 fetch-t-addr-compile-quote-list

-init-data-seg, 270 fetch-unbox-nat-0-addr-compile-q

uote-list-init-data-seg, 271 find-label, 357, 359, 366 find-label-else-start-lr-expr-c

ar-if, 359 find-label-lr-make-label-label-i

nstrs, 357 find-label-past-else-lr-expr-ca

r-if, 357 find-label-temp-test-end-lr-exp

r-car-temp-test, 366 find-labelp, 64, 283, 284 find-labelp-lr-make-label-comp-

body, 284 find-labelp-lr-make-label-label

-instrs, 284 find-non-proper-instr, 8, 9 find-non-proper-programs, 8, 9 first-n, 73, 74, 166, 167, 344 firstn, 8, 9, 13, 23, 67, 68, 70, 71,

108, 134, 135, 140, 141, 144 firstn-lr-p-c-size-restn-lr-p-p

c-1-comp-body-1, 71 c-1-comp-body-1-helper-1, 67 c-1-comp-body-1-helper-4, 68 c-1-comp-body-1-helper-5, 68 c-1-comp-body-1-helper-6, 69 c-1-comp-body-1-helper-7, 70 c-1-comp-body-1-helper-8, 70

firstn-put-assoc, 140 firstn-restn-plus-comp-if-1, 67 firstn-restn-plus-comp-if-2, 67 firstn-restn-small-enough-cdr-c

omp-body-1-list, 70 firstn-unlabel-instrs-comp-body

-1-lr-p-pc-1-helper-2, 67 -1-lr-p-pc-1-helper-3, 68

fix-data-segment, 8, 9 fix-program-segment, 8 formal-vars, 9, 23, 33, 35, 38, 56,

57, 59–61, 63, 91, 132, 134, 141, 165, 168, 169, 212, 287– 289, 291, 292, 306, 309

formal-vars-assoc-comp-programs, 60 -1, 60 -lr-programs-properp, 91

formal-vars-lr-compile-programs, 132 formal-vars-p-current-program-s

->lr1, 132

gensym, 13, 14, 147, 280 gensym-is-new, 14 get, 2, 21, 40, 52, 53, 56, 60, 65,

66, 68–72, 75–85, 126, 129, 153, 163, 166, 187, 198, 200– 204, 217, 218, 226, 296, 300– 303, 310, 347, 348, 350, 351, 354, 356, 362, 364, 365, 369, 371–373, 375

get-+-lr-p-pc-1-lessp-3-temp-te

st-assoc-comp-programs, 364 get-+-lr-p-pc-1-n-2-size-temp-te

st-assoc-comp-programs, 365 get-append, 72 get-cdr-lr-init-heap-contents, 226 get-comp-body-lr-compile-progra

ms, 187 get-comp-if, 351 get-comp-if-helper, 351 get-comp-if-helper-helper, 350 get-comp-temp-test, 364 get-firstn-different-lists, 71 get-label-instrs, 71 get-last-funcall-cur-expr, 84 get-lr-compile-body, 129 get-lr-compile-body-list, 129 get-lr-p-c-size-lessp-lr-p-c-si

ze-comp-body-1, 72 get-lr-p-c-size-lessp-restn-lr-p

-pc-1-comp-body-1, 354 get-lr-p-pc-1-comp-body-1-cur-e

xpr-comp-body, 72 get-lr-p-pc-1-comp-body-1-quote, 72 get-lr-p-pc-1-comp-body-1-temp-

fetch, 368 get-offset-return-pc-program-bo

dy-assoc-comp-programs, 84 get-plus, 71 get-plus-lr-p-c-size-cadr-caddr

-4-comp-body-cur-expr, 356 get-plus-lr-p-pc-1-lr-pc-size-c

adr-assoc-comp-body-if-4, 356 get-sub1-length-car-last, 166 good-alistp, 307 good-alistp-lr-programs-properp, 307 good-posp, 4, 56, 58, 73, 95, 122–

125, 130–132, 141, 148, 155, 170–172, 175, 176, 182–184, 190–192, 215, 216, 302, 304, 337, 346, 349, 376, 378

good-posp-cons-lessp-4-if-lr-pr

ograms-properp, 62 good-posp-dv-1-funcall-lr-expr, 73 good-posp-dv-1-funcall-opened, 302 good-posp-dv-1-temps-lr-expr, 62 good-posp-list-nx-offset-progra

m-body, 58 good-posp-list-nx-t-simple, 56 good-posp-list-t-offset-program

-body, 58 good-posp-lr-compile-body, 132 good-posp1, 56–58, 61–65, 67–73, 84–

95, 114, 121–124, 129, 134– 141, 144–146, 148, 150–160, 163–165, 168–171, 173–176, 183, 185, 187, 188, 190, 192– 195, 205–212, 214, 215, 296– 299, 301–304, 336–339, 341– 343, 345–350, 352–370, 373– 377, 380

good-posp1-cons-lessp-4-if-lr-p

roper-exprp, 62 good-posp1-cons-lessp-4-if-s-pr

oper-exprp, 296 good-posp1-dv-1-temp-eval-test, 298 good-posp1-dv-1-temps-lr-expr, 144 good-posp1-expand-list-temps, 129 good-posp1-lr-compile-body, 129 good-posp1-lr-proper-exprp-get-

cadddr, 68

ihint-2, 110–112 increment-num-list-count-code-li

st1, 13 increment-numlist, 12, 13 induct-hint-1, 166 induct-hint-10, 69 induct-hint-11, 134 induct-hint-13, 140, 141 induct-hint-14, 142 induct-hint-15, 155 induct-hint-16, 254 induct-hint-17, 225 induct-hint-18, 195, 196 induct-hint-19, 226 induct-hint-2, 269 induct-hint-20, 300 induct-hint-22, 283 induct-hint-23, 283, 284 induct-hint-3, 295, 296 induct-hint-4, 112 induct-hint-6, 59 induct-hint-7, 65, 66 induct-hint-8, 153 induct-hint-9, 71

l-data-seg-body-restrictedp, 330–332,

380, 381, 383 l-data-seg-body-restrictedp-delete

-all, 331 l-data-seg-body-restrictedp-s-d

ata-seg-body-restrictedp, 331 l-data-seg-list-restrictedp, 330, 331 l-data-seg-list-restrictedp-s-d

ata-seg-list-restrictedp, 331 l-eval, 4 l-proper-exprp, 330–332, 380, 382,

383 l-proper-programsp, 329–332, 380, 382,

383 l-proper-programsp-1, 331 l-proper-programsp-s-progs-logi

c->s, 330 l-restrict-subrps, 216, 331, 332, 380,

383 l-restrict-subrps-progs, 216, 331, 332,

380, 383 l-restrict-subrps-progs-delete-

all, 331 l-restrict-subrps-progs-s-restri

ct-subrps-progs, 331 ct-subrps-progs-logic->s, 331

l-restrict-subrps-s-restrict-su

brps, 331 l-restrictedp, 330, 332, 380, 381, 383 label-instrs, 31, 33, 58, 59, 71, 93,

284, 285, 309, 357 label-instrs-append, 284 label-instrs-proper-labeled-p-i

nstructionsp, 285 labelledp, 285 last, 7, 56, 166, 167, 205, 282, 295,

296, 298, 304, 348, 349, 375 lastcdr, 130 legal-labelp, 8, 71 legal-labelp-label-make-label, 71 length, 8, 10, 13, 15, 21, 23, 24, 31,

32, 34, 38, 41, 47, 48, 52, 56–60, 63–72, 74, 75, 84, 86, 89, 93, 96, 99, 102–104, 107, 111, 112, 116, 120, 121, 123, 129, 130, 134, 135, 139, 149, 153–156, 158–160, 163, 164, 166–170, 173, 180, 182– 184, 192, 198–205, 207–213, 215, 217, 218, 220, 221, 224, 226, 242, 248–250, 252, 253, 264, 267, 268, 270, 273, 281– 284, 286, 296, 298, 300–303, 310–313, 315, 318, 319, 324, 328, 329, 341–345, 349, 351– 353, 356, 357, 359, 366–369

length-3-cdr-cddr-not-nil, 296 length-add1-add1-cddr-fact, 167 length-butlast, 166 length-car-lr-compile-quote, 224 length-cdr-assoc-lr-heap-name-l

r-init-data-seg, 226 length-cdr-comp-if-comp-body, 57 length-cdr-lr-expr-funcall, 153 length-cdr-lr-expr-funcall-s->

lr1, 155 length-comp-body-1-lr-p-c-size, 58 length-comp-body-lr-p-c-size, 58 length-comp-if-alt, 66 length-comp-temp-test, 66 length-delete-member, 96 length-deposit, 116 length-deposit-a-list, 220 length-formal-vars-lr-proper-fo

rmalsp-arity, 169 length-label-instrs, 58 length-last, 205 length-last-fact, 298 length-lr-all-nodes, 273 length-lr-compile-body-list, 129 length-lr-compile-body-t, 129 length-lr-convert-num-to-ascii, 283 length-lr-do-temp-fetch, 63 length-lr-init-heap-contents, 217 length-lr-make-initial-temps, 281 length-lr-make-temp-name-alist, 209 length-lr-make-temp-name-alist-

1, 208 length-lr-make-temp-var-dcls, 208 length-lr-push-tstk, 64 length-make-temps-entries, 209 length-p-temp-stk-lr-apply-subr, 168 length-p-temp-stk-lr-eval, 170 length-p-temp-stk-lr-eval-flag-

list, 170 list-alt, 345 not-list, 184

length-p-temp-stk-lr-eval-lr-fu

ncall, 211 length-p-temp-stk-lr-eval-lr-set

-pos, 353

-pos-flag-t, 215 length-p-temp-stk-lr-funcall, 169 length-p-temp-stk-lr-pop-tstk-l

r-eval-flag-t, 192 length-p-temp-stk-p-run-subr, 168 length-p-temp-stk-p-run-subr-he

lper-1, 167 length-pair-formals-with-addres

ses, 281 length-pair-temps-with-initial-v

alues, 75 length-pairlist, 75 length-popn, 74 length-popn-lessp-fact, 93 length-s-eval-list, 155 length-strip-cars, 112 length-strip-cdrs, 281 lessp-1-not-zerop-exp, 195 lessp-1-not-zerop-log, 195 lessp-3-lr-p-c-size-car-if, 354 lessp-4-not-zerop-not-1-not-2-3, 64

-get-car-pos, 65 lessp-cdr-untag-lr-return-pc-lr

-p-c-size, 86 lessp-count-list-cdr-count-list

-whole, 16 lessp-count-not-list-car-count-

list-whole, 16 lessp-difference-fact-1, 105 lessp-difference-lr-boundary-of

fsetp-fact-1, 105 lessp-difference-node-size-sub-

addr, 105 addr-2, 228 addr-3, 230

lessp-index-lessp-lr-p-c-size-li

st, 65 lessp-length-deposit, 102 lessp-lr-boundary-offsetp-3, 265 lessp-lr-boundary-offsetp-nodep

-plus-node-size-fact-1, 250 -plus-node-size-fact-2, 102

lessp-lr-node-on-boundaryp-node

-size, 105 lessp-lr-p-c-size-list-lessp-su

b1-length, 59 lessp-lr-p-pc-1-lr-p-c-size, 60 lessp-lr-p-pc-1-lr-p-c-size-helpe

r-1, 60 lessp-max-arg2, 211 lessp-minimum-heap-size-not-0-f

-t-must-be-undef-alt-1, 265 -t-must-be-undef-alt-1-help, 265

lessp-number-cons-cur-expr-dv-1

-listp, 282 lessp-number-cons-cur-expr-dv-2

-listp, 282 lessp-number-cons-cur-expr-dv-3

-listp, 282 lessp-number-cons-restn-cdr, 282 lessp-offset-lr-init-data-seg-a

dpp-untag-lessp-offset, 266 lessp-offset-lr-return-pc-lr-p-

c-size-good-posp, 93 lessp-plus-lr-p-c-size-cadr-cad

dr-3-car-if, 355 lessp-plus-lr-p-c-size-lr-p-pc-

1-helper, 65 1-temps, 69 1, 65

lessp-plus-lr-p-pc-1-lr-p-c-size

-3-1-lr-expr-car-if, 359 lessp-plus-remainder-0-fact, 199 lessp-sub1-lessp-fact, 227 lessp-times-difference-fact, 225 lessp-times-difference-node-on-

boundaryp-fact, 225 lessp-times-plus-fact, 227 lessp-x-sub1-facts, 311 list-ascii-0, 12, 14 list-ascii-1, 12 listp-cdr-make-p-call-frame, 74 listp-cdr-p-frame, 3 listp-comp-body, 93 listp-comp-body-1, 57 listp-label-instrs, 93 listp-lr-all-nodes, 273 listp-lr-compile-body, 129 listp-lr-compile-programs, 211 listp-lr-expr-list-s->lr1, 132 listp-lr-expr-s->lr1, 136 listp-p-ctrl-stk-lr-funcall, 90 listp-p-temp-stk-lr-do-temp-fet

ch, 64 listp-p-temp-stk-lr-push-tstk, 63 listp-p-temp-stk-proper-ctrl-st

k-lr-apply-subr, 85 k-p-run-subr, 85

listp-pairlist, 165 listp-plist-car, 348 listp-put-assoc, 119 listp-untag-add-addr, 53 listp-untag-lr-p-pc, 45 listp-untag-lr-return-pc, 54 listp-untag-sub-addr, 54 litatom-car-gensym, 280 litatom-lr-compile-body, 131 litatom-lr-expr-s->lr1, 134 litatom-lr-expr-s->lr1-s-expr, 136 local-var-value, 25, 41, 134, 151, 367 log, 180, 181, 195, 196, 245, 293,

294, 312, 313 logic->lr-ok-really, 332 logic->p, 333, 384 logic->p-clock, 378, 384 logic->p-ok-really, 383 logic->p-ok-really-helper-1, 380 logic->s, 319, 330–333, 378–383 logic-fname, 168, 169 lr->p, 36, 37, 44, 45, 60–64, 73, 75–

90, 92–95, 107, 109, 114, 121–125, 130, 131, 134, 135, 137, 141, 144–146, 148, 150, 151, 154–161, 163, 164, 168, 170–176, 182–185, 187, 188, 190–195, 198–207, 210–212, 214–216, 274, 281, 282, 292– 294, 308–310, 319, 323, 333, 334, 336–338, 340–343, 345– 347, 352, 353, 355, 357–363, 366–378, 380, 381, 383

lr->p-lr-set-pos-dv-1-car-lr-e xpr-funcall, 370 xpr-if, 353 xpr-temp-eval, 362 lr->p-p-run-subr-p-run-subr-c

lock, 370 lr-0-addr, 6, 27, 75, 76, 79, 80, 99,

102, 161, 218, 219, 265, 270– 273, 340

lr-abs, 10, 11

lr-add-to-data-seg, 15, 17

lr-add1-tag, 5, 9, 10, 17, 98, 219,

245, 256, 257, 260, 271, 312 lr-all-nodes, 226, 228, 229, 231–234, 266, 267, 273 lr-all-nodes-lessp-max-addr-ope

ner, 229 lr-all-nodes-nil, 228 lr-all-nodes-not-lessp-min-offset

-max-addr, 232 lr-all-nodes-offset-max-addr-ope

ner-helper, 229 lr-all-nodes-offset-same-max, 229 lr-answer-addr, 6, 15, 33, 59, 230,

231, 233, 309, 310, 316, 318, 379–381, 384 lr-apply-subr, 37, 42, 46, 85, 87–

90, 122, 124, 153, 155–158, 160, 164, 165, 168, 189, 208, 214, 343, 374 lr-apply-subr-preserves-lr-p-pr oper-statep, 343

lr-apply-subr-preserves-lr-prope r-free-listp, 122 r-heapp, 156 r-heapp2, 154

lr-apply-subr-preserves-lr-valp, 124 lr-boundary-nodep, 7, 54, 55, 102–

107, 109, 112–114, 117, 121, 122, 124–127, 130, 153–155, 162, 199, 221–233, 235, 237– 242, 249–256, 259, 264–270, 273–279, 289, 315, 317, 320– 322, 339, 342 lr-boundary-nodep-add-addr-lr-n

ode-size, 54 lr-boundary-nodep-equal-plus-fa

ct, 113 ct-zero, 113

lr-boundary-nodep-lessp-lr-node -size-0, 225 -size-1, 225 -size-2, 225

lr-boundary-nodep-lessp-plus-fa

ct, 199 lr-boundary-nodep-not-lessp-fact

-helper, 225 lr-boundary-nodep-sub-addr, 54 lr-boundary-nodep-tag-cons-time

s-lr-node-size, 230 lr-boundary-offsetp, 7, 55, 102, 103,

105, 115, 125, 227–229, 241, 250, 265, 266, 269, 273

lr-boundary-offsetp-difference-lr-node-size, 269 not-equal-lessp-fact-1, 227 not-equal-lessp-fact-2, 103

lr-boundary-offsetp-equal-plus-fact, 55 fact-zero, 125

lr-boundary-offsetp-plus, 241 lr-boundary-offsetp-sub1-length

-heap-name, 102 lr-boundary-offsetp-times-lr-no

de-size-anything, 102 lr-boundaryp-nodep-difference-n

ode-size, 227 lr-car-offset, 6, 10, 27, 28, 75, 79,

97, 98, 106, 160, 162, 181, 196, 341

lr-cdr-offset, 6, 10, 27, 76, 80, 97, 98, 106, 160, 162, 181, 196, 341

lr-check-f-addrp, 97, 125, 126 lr-check-f-addrp-deposit-a-list, 126 lr-check-f-addrp-deposit-anythi

ng-anywhere, 125 lr-check-f-addrp-lr-undef-addr-

lr-init-data-seg, 264 lr-check-free-nodes, 96, 115, 118, 119,

229, 231, 232, 234 lr-check-free-nodes-delete-depo

sit, 118 lr-check-free-nodes-deposit-a-li

st-lr-nodep, 231 lr-check-free-nodes-deposit-free

-ptr, 118 lr-check-free-nodes-deposit-lr-

nodep, 119 lr-check-free-nodes-deposit-non

-ref-count, 115 lr-check-free-nodes-lr-free-list

-nodes-init-data-seg, 230 lr-check-free-nodes-plist-node-

list, 229 lr-check-listp-addrp, 97, 98, 125, 127 lr-check-listp-addrp-deposit-a-

list-cons, 127

list-other-place, 127 lr-check-listp-addrp-deposit-free

-ptr-0, 125 lr-check-numberp-addrp, 97, 98, 125,

127, 257 lr-check-numberp-addrp-deposit-

a-list-cons, 126

a-list-cons-same-addr, 256 free-ptr-0, 125

lr-check-resourcesp, 182, 191–195, 207,

211, 214–216 lr-check-resourcesp-funcall, 195 lr-check-resourcesp-list-set-exp

r-nx, 191 lr-check-resourcesp-listp-s-exp

r-list, 182 lr-check-resourcesp-lr-funcall-

s-fun-call-state, 213 lr-check-resourcesp-lr-funcall-p

-psw-run, 210 lr-check-resourcesp-lr-pop-tstk

-lr-eval-1, 192 -lr-eval-2, 193

lr-check-resourcesp-lr-push-tst k-flag-run, 191 lr-check-resourcesp-s-set-pos-i

f-cadr, 191 lr-check-resourcesp-s-temp-eval, 194 lr-check-resourcesp-s-temp-test, 194 lr-check-result, 99, 131, 136, 137, 148,

151, 152, 154–156, 164, 165, 171, 174–176, 190, 198, 200– 204

lr-check-result-f-not-lr-f-addr, 137 lr-check-result-flag-list-cons-v

alue, 131 lr-check-result-lr-apply-subr, 164 lr-check-result-lr-do-temp-fetc

h, 151 lr-check-result-lr-funcall, 173 lr-check-result-lr-proper-heapp, 175 lr-check-result-lr-push-tstk, 135 lr-check-result-lr-push-tstk-qu

ote, 152 lr-check-result-nil, 131 lr-check-result-not-f-lr-f-addr, 137 lr-check-result-t-chain, 137 lr-check-result1, 99, 100, 112, 130,

153, 154, 159, 160, 163, 164, 166, 167, 325

lr-check-result1-append, 112 lr-check-result1-append-2, 166 lr-check-result1-butlast, 166 lr-check-result1-first-n-temp-st

k, 167 lr-check-result1-lr-good-pointe

rp-get-n-lessp-cadr, 154 rp-get-n-lessp-car, 153

lr-check-result1-lr-valp-get-n-

lessp-length, 153 lr-check-result1-reverse-length

-1-opener, 160 -2-opener, 160

lr-check-result1-singleton-list

-opener, 130 lr-check-undef-addrp, 97, 125, 126,

264 lr-check-undef-addrp-deposit-a-

list, 126 lr-check-undef-addrp-deposit-an ything-anywhere, 125 lr-compile-body, 19, 20, 22, 128, 129,

131, 132, 155, 216, 296–300, 303–305, 318

lr-compile-programs, 20, 22, 101, 112, 128, 132, 169, 171, 187, 208, 211, 305, 318

lr-compile-quote, 16, 18, 219–224, 237, 238, 240–245, 247, 251–255, 259, 261, 262, 264, 265, 267– 273, 275, 280, 311, 313, 317, 325, 326 lr-compile-quote-flag-list-cons

-opener, 252 lr-compile-quote-flag-list-nil-

opener, 252 lr-compile-quote-lr-good-pointe

rp-tablep, 253

rp-tablep-help-1, 251 rp-tablep-help-2, 252 rp-tablep-help-3, 253 lr-compile-quote-preserves-lr-p roper-heapp, 261 roper-heapp2, 259 lr-compile-quote-preserves-lr-v

alp, 260 lr-compile-quote-preserves-prope r-p-data-segmentp, 313 lr-cons-tag, 5, 9, 10, 14, 27–29, 75–

77, 79–83, 98, 106, 127, 128, 160–162, 180, 196, 245, 260, 312, 341

lr-convert-digit-to-ascii, 31, 283, 284 lr-convert-digit-to-ascii-equal, 283 lr-convert-num-to-ascii, 31, 283, 284 lr-convert-num-to-ascii-equal-a

rg1, 283 rg2, 284 rg2-helper-1, 284 rg2-lengths, 284 rg2-lengths-helper-1, 284 lr-count-free-nodes, 181, 182, 185–

189, 191, 198–207, 248–253, 255, 259, 261–263, 267, 273, 275–280, 294, 295, 311, 313– 315, 320–323, 325–328

lr-count-free-nodes-append-lr-a

ll-nodes-fact, 273 lr-count-free-nodes-at-most, 248 lr-count-free-nodes-delete-depo

sit, 186 lr-count-free-nodes-deposit-a-li

st-lr-nodep, 249 lr-count-free-nodes-deposit-free

-ptr, 185 lr-count-free-nodes-deposit-lr-

nodep, 186 lr-count-free-nodes-deposit-non

-ref-count, 185 lr-count-free-nodes-lr-all-node

s, 266 lr-count-free-nodes-lr-compile-q

uote-s-heap-reqs, 250 uote-s-heap-reqs-flag-t, 274 uote-s-heap-reqs-help1, 250

lr-count-free-nodes-lr-data-seg -table-body-s-heap-reqs, 275 -table-list-s-heap-reqs, 321 -table-list-s-heap-reqs-1, 322 -table-list-s-heap-reqs-help, 320

lr-count-free-nodes-lr-init-dat a-seg-table-s-heap-reqs-1, 322 a-seg-table-s-init-heap-reqs, 279

lr-count-free-nodes-max-addr-lr

-free-list-nodes, 186 lr-count-free-nodes-s-init-heap

-reqs, 262 lr-count-lr-free-list-nodes-lr-

apply-subr, 188 lr-count-lr-free-list-nodes-p-r

un-cons, 186 un-subr, 187

lr-data-seg-body-list-n, 300 lr-data-seg-table, 18, 22, 273, 274,

280, 281, 295, 302, 304–306, 318–320, 323, 324, 328, 380– 382 lr-data-seg-table-body, 17, 18, 220,

221, 223, 238, 243, 244, 246, 274–278, 294, 300, 301, 314, 321, 326, 327 lr-data-seg-table-body-add1-ope

ner, 301 lr-data-seg-table-body-flag-t-f

lag-t, 301 lr-data-seg-table-body-lr-good-p ointerp-tablep, 276 ointerp-tablep-help1, 276 lr-data-seg-table-body-n, 300, 301 lr-data-seg-table-body-preserve

s-lr-valp, 326

s-proper-p-data-segmentp, 314 lr-data-seg-table-list, 18, 19, 220, 221,

224, 234, 239, 279, 295, 302, 314, 317, 321, 322, 327, 328

lr-data-seg-table-list-lr-good-p

ointerp-tablep-helper-1, 277 lr-data-seg-table-list-preserve s-lr-s-similar-params, 327 s-lr-valp, 326 s-proper-p-data-segmentp, 314 lr-do-temp-fetch, 25, 41–44, 63, 64,

108, 139, 140, 149, 151, 194, 367, 369 lr-do-temp-fetch-lr-check-resou rcesp-temp-test, 194 lr-do-temp-fetch-run-lr-eval-te

mp-setp, 151 lr-eval, 40–42, 44, 46, 47, 86, 87, 90,

92–95, 110, 112, 122–125, 128, 130, 131, 133, 134, 136– 142, 144–146, 148, 152–154, 156–160, 163, 164, 167–176, 183–185, 187, 188, 190–193, 205–208, 210, 211, 214–216, 320, 324, 329, 333–335, 337, 340, 341, 343, 345–347, 352, 353, 355, 357–363, 367, 368, 373–378, 381

lr-eval-if-p-psw-1, 44

lr-eval-leaves-listp-p-ctrl-stk

-lr->p-lr-set-pos, 337 lr-eval-leaves-listp-p-temp-stk, 137

-lr-set-pos, 176 lr-eval-litatom-opener, 134 lr-eval-p-pc-equivalence, 378 lr-eval-p-pc-equivalence-helper

-1, 352 -1-5, 352 -10, 369 -11, 374 -12, 377 -12-helper-1, 375 -12-helper-2, 376 -2, 352 -3, 352 -4, 358 -4-helper-1, 355 -4-helper-2, 357 -5, 361 -5-get-lr-p-c-size, 362 -5-helper-1, 360 -5-helper-2, 360 -6, 363 -6-helper, 362 -7, 366 -8, 368 -8-helper-1, 367 -8-helper-2, 367 -8-helper-2-helper, 367 -9, 369

lr-eval-preserves-adpp, 123 lr-eval-preserves-adpp-lr-set-p

os, 123 lr-eval-preserves-cdr-p-ctrl-st

k, 122 k-lr-funcall, 375 k-lr-set-pos, 123

lr-eval-preserves-definedp-first

n-bindings-car-p-ctrl-stk, 141 lr-eval-preserves-definedp-fn-bi

ndings-car-ctrl-stk-set-pos, 141 lr-eval-preserves-length-assoc-

data-segment, 123 lr-eval-preserves-length-bindin

gs-car-p-ctrl-stk, 183 lr-eval-preserves-lr-max-node, 122 lr-eval-preserves-lr-max-node-l

r-set-pos, 124 lr-eval-preserves-lr-p-proper-st

atep, 346 lr-eval-preserves-lr-proper-free

-listp, 124

-listp-lr-set-pos, 124 lr-eval-preserves-lr-proper-heapp, 182

-lr-set-pos, 184 lr-eval-preserves-lr-s-similar-const-table, 171 statesp, 183 statesp-lr-set-pos, 184 lr-eval-preserves-lr-s-similar-p

arams, 172 lr-eval-preserves-lr-s-similar-te

mps, 172 lr-eval-preserves-lr-valp, 125 lr-eval-preserves-lr-valp-lr-set

-expr, 130 lr-eval-preserves-proper-p-statep

-lr->p, 95

-lr->p-lr-set-expr, 130 -lr->p-lr-set-pos, 123 -lr->p-rewrite, 122 lr-eval-preserves-ret-pc-car-p-

ctrl-stk, 376

ctrl-stk-lr-funcall, 376 lr-eval-preserves-strip-cars-bi

ndings-car-p-ctrl-stk, 122

ndings-car-p-ctrl-stk-lr-set-pos,

123 lr-eval-preserves-strip-cars-lr

-temps-car-p-ctrl-stk, 148 lr-eval-s->lr1-flag-list-opene

r-1, 175 r-2, 175

lr-eval-s->lr1-if-opener-1, 137 lr-eval-s->lr1-if-opener-2, 138 lr-eval-s->lr1-if-opener-3, 138 lr-eval-s->lr1-preserves-p-ct rl-stk-size, 184

rl-stk-size-lr-set-pos, 192 lr-eval-s->lr1-quote-opener, 140 lr-eval-s->lr1-temp-eval-opene

r, 139 lr-eval-s->lr1-temp-fetch-ope

ner, 140 lr-eval-s->lr1-temp-test-opene

r, 139 lr-eval-s-eval-equivalence, 176 lr-eval-s-eval-equivalence-lr-c

heck-result-flag-list, 190 lr-eval-s-eval-equivalence-s->

lr, 319 lr-eval-s-eval-flag-run, 216 lr-eval-s-eval-flag-run-s->lr, 323 lr-eval-s-eval-flag-t-s-ans-f-l

r-set-pos, 185 lr-eval-s-eval-flag-t-s-ans-non

-f-lr-set-pos, 185 lr-eval-s-eval-heap-r-lr-count-

lr-free-list-nodes, 190 lr-eval-subrp-user-funcall-opene

r, 152 lr-eval-t-lr-funcall-p-psw-run, 92 lr-eval-temp-setp, 25, 41, 111, 139,

150, 151, 335, 368 lr-eval-zerop-clock, 133 lr-expr, 7, 25, 37, 40–42, 44, 57, 61–

64, 72, 73, 84–95, 114, 121, 122, 124, 134, 136, 137, 139, 140, 142, 144–146, 148, 150– 160, 164, 165, 168, 169, 195, 206, 212, 333–338, 340–343, 345–347, 349–371, 373–377

lr-expr-cur-expr-if-same, 369 lr-expr-flag-list-car, 40 lr-expr-funcall, 375 lr-expr-list, 7, 40, 41, 58, 94, 131,

132, 170, 334, 349, 351, 352 lr-expr-list-lr-set-pos-dv-1, 40 lr-expr-lr-set-expr, 40 lr-expr-lr-set-expr-nx, 40 lr-expr-lr-set-pos-t, 40 lr-f-addr, 6, 15, 18, 26, 28, 29, 31, 41, 76–79, 81–84, 97, 99, 102, 111, 137, 138, 161, 185, 219, 225, 234, 244, 245, 247, 256, 265, 266, 269, 271, 272, 280, 316, 334, 340, 351, 354, 355, 357, 358, 360, 361

lr-false-tag, 5, 9, 10, 15, 30, 97, 98,

219, 245, 269, 272, 293, 316 lr-fetch-fp, 6, 8–10, 96 lr-fix-data-segment, 9, 10 lr-fp-addr, 6, 15, 17, 77, 78, 80, 81,

96, 104, 107, 109, 118, 121, 125, 162, 182, 185–191, 198– 207, 220, 221, 225, 230, 231, 233, 235, 240–242, 249–255, 259–265, 268, 269, 272, 275– 280, 294, 295, 311–316, 320– 328, 338, 339, 341 lr-free-list-nodes, 96, 102, 103, 115–

119, 182, 186–189, 191, 198– 207, 231, 233, 249–253, 255, 259, 261–263, 268, 273, 275– 280, 294, 295, 311, 313–315, 320–323, 325–328 lr-free-list-nodes-deposit-0, 267 lr-free-list-nodes-deposit-a-li st-lr-nodep, 231 lr-free-list-nodes-deposit-free

-ptr, 118 lr-free-list-nodes-deposit-lr-n

odep, 119 lr-free-list-nodes-deposit-lr-re f-count-offset, 116 lr-free-list-nodes-deposit-non-

ref-count, 115 lr-free-list-nodes-deposit-t, 268 lr-free-list-nodes-lr-compile-q

uote-t0, 272 lr-free-list-nodes-lr-init-data

-seg, 233 lr-free-list-nodes-lr-init-heap -contents, 233 -contents-generalized, 232 lr-free-list-nodes-member-greate

r-offset, 116 lr-funcall, 37, 42, 43, 90–95, 112,

153, 165, 169–175, 211, 212, 214, 335, 345, 346, 375–377

lr-good-pointerp, 7, 55, 97, 98, 106, 112, 127, 128, 137, 153, 160– 162, 196, 241, 255–258, 336– 339

lr-good-pointerp-cdr-assoc-car-

lr-compile-quote-list, 254 lr-good-pointerp-deposit-a-list

-node, 339 lr-good-pointerp-deposit-non-ad

d-addr-not-good-pointerp, 256 lr-good-pointerp-deposit-non-re

f-not-good-pointerp, 255 lr-good-pointerp-deposit-ref-co

unt-not-good-pointerp, 255 lr-good-pointerp-lessp-offset-m

ax-heap-node, 106 lr-good-pointerp-lr-undef-addr, 258 lr-good-pointerp-opener, 55 lr-good-pointerp-table-cons, 242 lr-good-pointerp-tablep, 241, 242, 253–

255, 259–261, 269, 277–279, 325–327, 336, 338

lr-good-pointerp-tablep-definedp

-table, 241 lr-good-pointerp-tablep-deposit

-a-list, 242 -free-ptr, 241

lr-good-pointerp-tablep-f-lr-f-

addr-lr-init-data-seg, 269 lr-good-pointerp-type-tag-nat, 161 lr-good-pointerps, 336–345, 366, 382 lr-good-pointerps-all-undef-add

rs, 344 lr-good-pointerps-append, 344 lr-good-pointerps-cdr, 340 lr-good-pointerps-cons-fetch-ca

r-temp-stk-cdr-car, 341 r-temp-stk-cdr-cdr, 341

lr-good-pointerps-cons-fetch-fp -addr-deposit-a-list-cons, 341 lr-good-pointerps-cons-lr-0-add r-lr-proper-heapp, 340 lr-good-pointerps-cons-lr-f-add r-lr-proper-heapp, 340 lr-good-pointerps-cons-lr-t-add r-lr-proper-heapp, 340 lr-good-pointerps-deposit-a-list

-node, 339 lr-good-pointerps-deposit-free-pt

r, 338 lr-good-pointerps-first-n, 344 lr-good-pointerps-popn, 345 lr-good-pointerps-put-assoc, 337 lr-good-pointerps-reverse, 344 lr-heap-name, 6–10, 15, 55, 96, 102–

104, 107, 121, 126, 127, 130, 153, 154, 199, 221–226, 228– 234, 237–242, 248–256, 259– 261, 264, 266–270, 272–279, 289, 311–313, 315–317, 320– 322

lr-if-ok, 24, 41, 43, 95, 110, 136, 138, 139, 175, 176, 192, 193, 215, 334, 353, 355, 357, 358, 360, 361

lr-init-data-seg, 15, 18, 225, 226, 233, 234, 244, 245, 247, 263–267, 269–273, 280, 316, 317, 320

lr-init-data-seg-table, 18, 221, 224, 234, 240, 245, 247, 263, 267, 278–280, 295, 315, 317, 323, 325, 326, 328 lr-init-data-seg-table-lr-good-p ointerp-tablep, 278 lr-init-data-seg-table-preserve

s-lr-valp, 325

s-proper-p-data-segmentp, 314 lr-init-heap-contents, 14, 15, 217, 218, 226, 230–233, 315, 316

lr-init-heap-contents-add1-opene

r, 218 lr-init-tag, 5, 14, 218 lr-initial-cstk, 19, 22 lr-make-initial-temps, 19, 259, 274,

281, 324 lr-make-label, 31, 32, 71, 72, 85, 187,

284, 309, 347, 351, 354, 356, 357, 359, 364–366

lr-make-label-equal, 284 lr-make-label-not-numberp, 71 lr-make-program, 11, 20, 33 lr-make-temp-name-alist, 14, 20, 22,

128, 132, 133, 145–148, 150, 151, 209, 280, 281, 305, 318

lr-make-temp-name-alist-1, 14, 143, 145, 147, 148, 151, 171, 208, 280, 281

lr-make-temp-name-alist-1-plist

-arg-1, 281 lr-make-temp-name-alist-plist-a

rg-1, 281 lr-make-temp-var-dcls, 20, 132, 133,

135, 171, 208, 292 lr-max-ctrl-reqs, 319, 332, 379, 383 lr-max-node, 96, 99, 102, 104, 107,

109, 112, 114, 116, 121, 122, 124, 125, 130, 154, 155, 162, 182, 186–189, 191, 198–205, 207, 220–225, 230, 235, 237– 242, 249–255, 257–264, 267, 268, 274–280, 294, 295, 311, 313–315, 317, 320–323, 325– 328, 342

lr-max-node-adpp-definedp-lr-he

ap-name, 104 lr-max-node-car-lr-compile-quote, 224 lr-max-node-car-lr-data-seg-tab

le, 320 le-body, 223 le-list, 322

lr-max-node-car-lr-init-data-se

g-table, 267 lr-max-node-deposit, 116 lr-max-node-deposit-a-list, 220 lr-max-node-lr-init-data-seg, 225 lr-max-node-lr-nodep-opener-fact

s, 104 lr-max-node-same-signature, 116 lr-max-temp-reqs, 319, 332, 379, 383 lr-max-word-size-reqs, 319, 332, 379,

383 lr-minimum-heap-size, 6, 103, 264,

265, 273 lr-minimum-heapp, 99, 102, 103, 107,

108, 161, 162, 242, 248, 251– 253, 255, 258–260, 263, 274– 279, 315, 320, 321

lr-minimum-heapp-lr-compile-quote,

242 lr-minimum-heapp-lr-data-seg-ta

ble-body, 274 lr-minimum-heapp-lr-init-data-se

g, 263 lr-minimum-heapp-not-equal-lengt

h-1, 248 lr-minimum-heapp-opener-2, 103 lr-minimum-heapp-opener-3, 103 lr-minimum-heapp-opener-adpp-lr

-0-addr, 102 -f-addr, 102 -t-addr, 102 -undef-addr, 102

lr-minimum-heapp-same-signature, 108 lr-minus-tag, 6 lr-negative-guts-offset, 7, 11 lr-new-cons, 14, 17 lr-new-node, 6, 14, 15, 17, 218 lr-node-listp, 103, 107, 115, 118, 119,

185, 186, 232, 233, 249 lr-node-listp-delete, 107 lr-node-listp-deposit-anything-

at-all, 107 lr-node-listp-lr-all-nodes, 233 lr-node-listp-lr-free-list-node

s, 103 lr-node-size, 6, 7, 9, 14, 15, 54, 55,

96–99, 102, 103, 105, 113– 115, 119, 125, 126, 185, 199, 200, 217, 218, 225–230, 232– 234, 250, 253, 255, 256, 264– 266, 268–270, 272, 273, 312, 313, 315, 316, 320 lr-nodep, 7, 55, 97, 99, 103, 105,

106, 112–115, 118, 119, 128, 154, 155, 161, 162, 185, 186, 254, 257–260, 342

lr-nodep-car-lr-compile-quote, 254 lr-nodep-deposit-a-list, 254 lr-nodep-lr-proper-heapp-nodep, 105 lr-nodep-member-lr-node-listp, 103 lr-nodep-member-lr-node-listp-a

dpp-untag-listp, 115 dpp-untag-numberp-offset, 115

lr-nodep-member-lr-node-listp-l

r-boundaryp-offsetp, 115 lr-nodep-opener, 55 lr-nodify, 9, 10 lr-nodify-tag, 9 lr-p-c-size, 20, 21, 32, 35, 37, 57, 58,

60, 65–72, 286, 288, 292, 348–352, 354–362, 364–367, 375, 377, 380

lr-p-c-size-flag-list, 58 lr-p-c-size-flag-not-list-not-0, 35 lr-p-c-size-ge-plus-2-size-cadr

-car-if, 350 lr-p-c-size-list, 21, 57–60, 65, 66, 69–

71, 84, 348, 349, 352, 371, 375, 377

lr-p-c-size-list-0, 59 lr-p-c-size-list-0-opener, 57 lr-p-c-size-list-add1-opener, 57 lr-p-c-size-list-car-opener, 69 lr-p-c-size-list-funcall-not-le

ssp-fact, 66 lr-p-c-size-nlistp-body, 67 lr-p-c-size-not-1-car-if, 350 lr-p-c-size-s-temp-test-eval-ca

dr-not-lessp-fact, 66 lr-p-c-size-temp-test-opener, 364 lr-p-pc, 21, 36, 37, 44, 45, 61–64,

90, 347, 351, 369–371, 375, 377

lr-p-pc-1, 21, 22, 60, 65, 67–72, 347– 350, 352, 354–362, 364–367, 369 lr-p-pc-1-append, 348 lr-p-pc-1-append-helper-1, 348 lr-p-pc-1-append-helper-2, 348 lr-p-pc-1-append-helper-3, 348 lr-p-pc-1-append-helper-4, 348 lr-p-pc-1-body-0, 60 lr-p-pc-1-car-expr-if-2, 356 lr-p-pc-1-dv-1-car-lr-expr-if, 350 lr-p-pc-1-dv-1-car-lr-expr-temp

-eval, 362 lr-p-pc-1-dv-2-car-lr-expr-if, 350 lr-p-pc-1-dv-3-car-lr-expr-if, 350 lr-p-pc-1-listp-offset, 349 lr-p-pc-1-nil, 349 lr-p-pc-1-nx, 349 lr-p-pc-1-nx-helper, 349 lr-p-pc-1-plist, 348 lr-p-pc-dv-1-s-temp-test, 367 lr-p-pc-lr-do-temp-fetch, 64 lr-p-pc-lr-pop-tstk, 62 lr-p-pc-lr-push-tstk, 61 lr-p-pc-lr-set-pos-dv-1-car-lr-e

xpr-funcall, 369 lr-p-pc-lr-set-temp, 63 lr-p-proper-statep, 336–338, 343, 345–

347, 353, 355, 358–361, 366, 368, 378, 380, 382

lr-p-proper-statep-cdr-assoc-ca

ddr-lr-expr-bindings, 337 lr-p-proper-statep-cdr-lr-ctrl-

stk, 346 lr-p-proper-statep-cdr-temp-stk, 337 lr-p-proper-statep-cons-p-frame

-put-assoc, 337 lr-p-proper-statep-listp-p-temp

-stk-type-car-addr, 353 lr-p-proper-statep-lr-funcall, 345 lr-p-proper-statep-lr-good-pointe

rps-strip-cdrs-binding, 366 lr-p-proper-statep-lr-push-tstk

-cdr-assoc-lr-expr, 336 lr-p-proper-statep-p-temps-stk-

lr-push-tstk-quote, 338 lr-p-proper-statep-s->lr, 382 lr-pack-tag, 6, 9, 10 lr-params, 23, 95, 100, 108, 131, 133,

135, 136, 140, 142, 149, 157, 165, 172

lr-params-lr-apply-subr, 157 lr-params-lr-do-temp-fetch, 149 lr-params-lr-eval, 95 lr-params-lr-funcall, 165 lr-params-lr-pop-tstk, 108 lr-params-lr-push-tstk, 131 lr-params-lr-set-error, 133 lr-params-lr-set-expr, 108 lr-params-lr-set-expr-lr-pop-cst

k, 172 lr-params-lr-set-pos, 136 lr-params-lr-set-temp, 140 lr-params-p-frame-not-definedp-p

ut-assoc-anything, 141 lr-pop-cstk, 25, 42, 44, 94, 153, 172,

173, 377, 378 lr-pop-tstk, 24, 39, 41, 62, 94, 108,

111, 136, 138, 175, 192–194, 334, 335, 353, 355, 357, 358, 360, 361

lr-pop-tstk-lr-if-ok, 353 lr-programs-properp, 35, 47, 51, 56,

57, 61–64, 72, 73, 75–95, 114, 121–125, 130, 131, 135, 137, 141, 144, 145, 148, 150, 152–160, 163, 164, 168–176, 182–185, 187, 188, 190–195, 198, 200–208, 210–212, 214– 216, 282, 292–294, 306, 309, 310, 319, 320, 323, 336–339, 341–347, 349, 350, 352–378, 380

lr-programs-properp-1, 35, 56, 57,

63, 305–308, 344 lr-programs-properp-1-all-user-

fnamesp-not-user-fnamep, 51 lr-programs-properp-1-lr-compile

-programs, 305 lr-programs-properp-1-lr-proper

-exprp, 56 lr-programs-properp-all-user-fn

amesp-strip-cars-cdr, 309 lr-programs-properp-caar-main, 309 lr-programs-properp-definedp-ca

r-untag-p-pc, 61 lr-programs-properp-definedp-su

brp-runtime-support, 206 lr-programs-properp-expr-quote-t

ype-addr, 64 lr-programs-properp-funcall-not

-caar-prog-seg, 169 lr-programs-properp-lr->p-s->

lr1-definedp-s-pname, 145 lr-programs-properp-lr-eval, 47 lr-programs-properp-lr-funcall, 94 lr-programs-properp-lr-if-ok, 95 lr-programs-properp-lr-pop-tstk, 94 lr-programs-properp-lr-programs

-properp-1, 56 lr-programs-properp-lr-proper-e

xprp-lr-expr, 57 lr-programs-properp-lr-set-erro

r, 175 lr-programs-properp-lr-set-expr, 94 lr-programs-properp-lr-set-pos, 90 lr-programs-properp-member-lr-e

xpr-temps, 150 lr-programs-properp-not-definedp

-subrp-runtime-support, 163 lr-programs-properp-s->lr, 319 lr-programs-properp-s->lr-logi

c->s, 380 lr-programs-properp-s->lr-ope

ned, 306 lr-programs-properp-s->lr1-de

finedp-cdr-s-progs, 208 finedp-s-progs, 212

lr-proper-ctrl-stkp, 336, 339, 340 lr-proper-ctrl-stkp-deposit-a-li

st-node, 339 lr-proper-ctrl-stkp-deposit-free

-ptr, 339 lr-proper-exprp, 34, 35, 56–58, 62, 65, 67–72, 152, 287–292, 296– 300, 303–305, 307, 348, 349

lr-proper-exprp-cadr-temps, 68 lr-proper-exprp-car-if-cadddr, 58 lr-proper-exprp-car-if-caddr, 58 lr-proper-exprp-car-if-cadr, 58 lr-proper-exprp-flag-list-cdr-f

uncall, 290 lr-proper-exprp-flag-list-cons, 296 lr-proper-exprp-flag-list-nil, 296 lr-proper-exprp-flag-not-list-c

ons-funcall, 303 ons-if, 297 ons-if-helper, 296 ons-temp-eval, 298 ons-temp-fetch, 298 ons-temp-test, 299

lr-proper-exprp-flag-not-list-n

ot-listp, 304 lr-proper-exprp-length-cur-expr, 57 lr-proper-exprp-list-lr-proper-

get-t, 56 lr-proper-exprp-list-quote-opene

r, 152 lr-proper-exprp-lr-proper-exprp

-cur-expr, 56 lr-proper-exprp-p-lr-compile-pr

ograms, 304

ograms-flag-t, 305 ograms-helper-1, 296 ograms-helper-2, 302

lr-proper-exprp-program-body-not

-listp, 307 lr-proper-exprp-t-lr-proper-get

-t, 56 lr-proper-formalsp, 168–170, 343, 345,

347, 353, 355, 358–361, 377, 378, 381, 382

lr-proper-formalsp-cdr-p-prog-se

gment-s->lr-logic->s, 382 lr-proper-formalsp-lr-compile-p

rograms, 169 lr-proper-free-listp, 96, 99, 104, 107,

109, 114, 121, 122, 124, 125, 130, 154, 155, 162, 221–224, 234, 235, 237–239, 241, 242, 249–254, 259, 260, 264, 267, 268, 274–279, 317, 320–322, 342

lr-proper-free-listp-car-lr-compi

le-quote, 222 lr-proper-free-listp-car-lr-init -data-seg-table, 224 lr-proper-free-listp-length-sub 1-not-lessp, 242 lr-proper-free-listp-lr-count-f ree-nodes-max-addr, 249 ree-nodes-max-addr-alt, 250

lr-proper-free-listp-lr-init-dat a-seg, 234 a-seg-helper, 234

lr-proper-free-listp-member-free -addr-lr-free-list-nodes, 249 lr-proper-free-listp-opener-1, 104 lr-proper-free-listp-opener-2, 104 lr-proper-free-listp-opener-2-a dpp-untag-listp, 104 dpp-untag-numberp-offset, 104 rea-name-alt, 241 lr-proper-free-listp-opener-2-l

r-nodep, 254 lr-proper-free-listp-type-fetch

-free-ptr, 109 lr-proper-heapp, 99, 100, 107, 112,

131, 135, 137, 143, 149–152, 156–158, 161–164, 171–173, 175, 176, 182–191, 193–196, 200, 205–207, 211, 214, 216, 259–263, 271, 274, 278–282, 284, 286, 288, 289, 292–295, 307–315, 322, 324–328, 336, 338, 340, 341, 343, 344

lr-proper-heapp-car-lr-data-seg -table, 280 -table-body, 278 -table-helper-1, 280 -table-list, 278

lr-proper-heapp-car-lr-init-dat

a-seg-table, 279 lr-proper-heapp-lr-compile-quote

-ft-lr-init-data-seg, 271 lr-proper-heapp-lr-good-pointerp

-lr-proper-heapp-nodep, 137 lr-proper-heapp-lr-valp-0, 161 lr-proper-heapp-lr-valp-f, 161 lr-proper-heapp-lr-valp-f-helpe

r, 161 lr-proper-heapp-lr-valp-lr-f-ad

dr, 161 lr-proper-heapp-lr-valp-lr-t-ad

dr, 161 lr-proper-heapp-nodep, 97, 98, 105,

106, 125, 128, 137, 161, 257, 258, 269

lr-proper-heapp-nodep-deposit-a -list-cons, 128 -list-numberp, 257 -list-truep, 258

lr-proper-heapp-nodep-deposit-f

ree-ptr-0, 125 lr-proper-heapp-nodep-lr-init-d

ata-seg-helper, 269 lr-proper-heapp-nodep-lr-undef-

addr-lr-init-data-seg, 269 lr-proper-heapp-nodep-tag-cons, 106 lr-proper-heapp-opener-1, 107 lr-proper-heapp-opener-3, 107 lr-proper-heapp-opener-4, 112 lr-proper-heapp1, 98, 99 lr-proper-heapp2, 98, 99, 105, 107,

125, 128, 154, 155, 257–259, 261, 270, 342

lr-proper-heapp2-deposit-a-list -cons, 128 -numberp, 257 -truep, 258

lr-proper-heapp2-deposit-free-pt

r-0, 125 lr-proper-heapp2-lr-init-data-se

g, 270 g-helper, 270 lr-proper-p-areasp, 42, 101, 102, 104,

107, 109, 116, 120, 121, 137, 143, 149, 150, 161, 162, 196, 200, 219, 221–224, 234, 237– 242, 249–254, 256–265, 267, 268, 274–279, 281, 284, 286, 288, 289, 292–295, 307–318, 320–322, 324–328, 340, 341, 344

lr-proper-p-areasp-car-lr-compi

le-quote, 219 lr-proper-p-areasp-car-lr-data-

seg-table, 281 seg-table-body, 223 seg-table-list, 234

lr-proper-p-areasp-car-lr-init-

data-seg-table, 234 lr-proper-p-areasp-deposit-a-li

st, 120 lr-proper-p-areasp-deposit-anyt

hing-anywhere, 107 lr-proper-p-areasp-lr-heap-name

-lr-init-data-seg, 234 lr-push-tstk, 24, 25, 41–43, 60–64,

73, 108, 131, 134–136, 140, 152, 167, 191, 195, 336, 338

lr-push-tstk-length, 167 lr-push-tstk-lr-check-resourcesp

-quote, 195 lr-ref-count-offset, 6, 7, 15, 28, 55,

77, 81, 96, 97, 102, 106, 109, 110, 112–115, 117–119, 121, 128, 153, 154, 181, 185, 186, 219, 230–232, 240, 242, 250, 252, 255–258, 264–266, 268–272, 289

lr-return-pc, 37, 53, 54, 85, 86, 91, 93, 114, 121, 154, 159, 168, 187, 206, 333, 334, 338, 340, 342, 343, 374, 376

lr-s-similar-const-table, 100, 101, 151, 158, 171, 218, 240, 241, 259– 263, 272, 289, 292, 294, 295, 307–311, 313, 314, 324–326, lr-s-similar-const-table-cdr-ca

r-lr-data-seg-table, 295 lr-s-similar-const-table-compile

-quote-t0-init-data-seg, 272 lr-s-similar-const-table-cons, 218 lr-s-similar-const-table-deposit

-cons, 259 -lr-fp-addr, 240

lr-s-similar-const-table-implie

s-lr-good-pointerp-tablep, 259 lr-s-similar-const-table-lr-app

ly-subr, 157 lr-s-similar-const-table-lr-compi

le-quote, 261 lr-s-similar-const-table-lr-dat

a-seg-table-body, 294 a-seg-table-list, 294

lr-s-similar-const-table-lr-goo

d-pointerp-opener, 240 lr-s-similar-const-table-lr-init

-data-seg-table, 295 lr-s-similar-const-table-lr-valp

-assoc, 151

-member-strip-cdrs, 289 lr-s-similar-const-table-nil, 218 lr-s-similar-const-table-p-obje

ctp-definedp, 311 lr-s-similar-const-table-type-a

ddr-member-strip-cdrs, 289 lr-s-similar-params, 100, 101, 134,

135, 157, 166, 167, 172, 326– 328, 382

lr-s-similar-params-assoc-define

dp, 134 lr-s-similar-params-lr-apply-su

br, 156 lr-s-similar-params-lr-funcall, 167 lr-s-similar-params-lr-funcall-

helper-1, 167 lr-s-similar-params-lr-good-poi

nterps-strip-cdrs, 382 lr-s-similar-params-lr-valp-get, 166 lr-s-similar-params-pair-formal s-lr-init-data-seg, 326 s-with-addresses, 328

lr-s-similar-statesp, 100, 133–136, 144, 146, 148–152, 158, 172, 173, 176, 183–185, 188–191, 193, 194, 205–207, 214, 216, 320, 324, 328, 381 lr-s-similar-statesp-lr-apply-s

ubr, 158 lr-s-similar-statesp-lr-funcall, 171 lr-s-similar-statesp-lr-if-ok, 176 lr-s-similar-statesp-lr-pop-tst

k, 136 lr-s-similar-statesp-lr-push-tst

k-litatom, 134 lr-s-similar-statesp-lr-s-set-p

os, 136 lr-s-similar-statesp-lr-s-simil ar-params-opener, 135 ar-temps-opener, 135 lr-s-similar-statesp-lr-set-err

or, 133 lr-s-similar-statesp-lr-set-exp

r, 133

r-lr-pop-cstk, 173 lr-s-similar-statesp-s->lr-lo

gic->s-lr-data-seg-table, 381 lr-s-similar-statesp-s->lr-lr -data-seg-table, 328 lr-s-similar-statesp-s->lr1-l r-similar-temps, 146 lr-s-similar-statesp-s-change-te

mp, 148

mp-helper-1, 146 mp-helper-2, 144

lr-s-similar-temps, 100, 101, 135, 143, 144, 146, 149, 150, 157, 171, 173, 324 lr-s-similar-temps-lr-apply-sub

r, 157 lr-s-similar-temps-lr-funcall, 171 lr-s-similar-temps-make-temps-e ntries-initial-temps, 324 lr-s-similar-temps-make-temps-p

air-temps, 170 lr-s-similar-temps-put-assoc-put

-assoc-helper, 143 -assoc-helper-1, 143

lr-s-simlar-statesp-lr-do-temp-

fetch, 149 lr-set-error, 23–25, 39, 41, 42, 107,

133, 136, 137, 140, 153, 175 lr-set-error-lr->p, 107 lr-set-error-lr-set-error, 133 lr-set-expr, 23, 38, 40–42, 94, 95,

108, 130, 131, 133, 136, 138, 153, 172, 173, 175, 334, 335, 347, 352, 355–358, 360, 361

lr-set-expr-s->lr1-s-set-expr, 133

-lr-pop-tstk, 136 lr-set-pos, 24, 39–42, 44, 62, 90, 93–

95, 122–124, 136–142, 144, 145, 148, 152, 154, 156–160, 163, 164, 167, 168, 170, 172, 173, 175, 176, 184, 185, 187, 188, 190, 192, 193, 205–208, 210, 211, 214, 215, 334, 335, 337, 340, 341, 343, 345, 346, 353–355, 357–363, 367–370, 373, 374, 376–378

lr-set-temp, 25, 41, 43, 63, 108, 139,

140, 144, 148, 363, 367, 368 lr-set-tstk, 24, 38, 353, 369 lr-t-addr, 6, 26, 29, 76–79, 82–84,

98, 99, 102, 161, 219, 265, 270, 271, 340

lr-temps, 23, 95, 101, 108, 131, 133, 135, 136, 140, 144–146, 148– 150, 157, 165, 172

lr-temps-lr-apply-subr, 157 lr-temps-lr-do-temp-fetch, 149 lr-temps-lr-eval, 95 lr-temps-lr-funcall, 165 lr-temps-lr-pop-tstk, 108 lr-temps-lr-push-tstk, 131 lr-temps-lr-set-error, 133 lr-temps-lr-set-expr, 108 lr-temps-lr-set-expr-lr-pop-cst

k, 172 lr-temps-lr-set-pos, 136 lr-temps-lr-set-temp, 140 lr-temps-p-frame-put-assoc, 145 lr-total-heap-reqs, 319, 332, 379 lr-true-tag, 5, 9, 10, 17, 30, 77, 84,

98, 163, 181, 219, 245, 258, 261, 270, 294, 313

lr-type-contents-p, 26 lr-unbox-nat-offset, 7, 10, 97, 98, 219,

271 lr-undef-addr, 6, 15, 17, 19, 20, 25,

31, 35, 97, 99, 100, 102, 142, 143, 149, 150, 258, 260, 261, 264–266, 269, 312, 313, 316, 364, 367

lr-undefined-tag, 5, 15, 97, 265, 316 lr-unpack-offset, 6, 10 lr-valp, 98–100, 107, 114, 124, 125,

130, 134, 135, 143, 150, 151, 153, 160–164, 166, 167, 218, 219, 260, 261, 289, 320, 325– 327, 329, 333, 379–381, 384

lr-valp-0-lr-0-addr-opener, 218 lr-valp-addr-0, 135 lr-valp-apply-subr-lr-apply-sub

r, 163 lr-valp-car-p-temp-stk-p-run-su

br, 163

br-cons-helper, 162 lr-valp-cdr-assoc-firstn-cdr-as

soc, 135 lr-valp-cons, 162 lr-valp-deposit-a-list-cons, 162 lr-valp-deposit-a-list-cons-con

s, 260 lr-valp-deposit-a-list-cons-num

berp, 260 lr-valp-deposit-a-list-cons-truep, 261 lr-valp-deposit-fetch-free-pointe

r, 114

r-offset, 113

r-offset-helper-1, 112 lr-valp-equal-value-fact, 161 lr-valp-f-lr-f-addr-opener, 219 lr-valp-fetch-tag-cons-lr-valp-

car-cdr, 160 lr-valp-fetch-tag-not-cons-lr-v

alp-car-cdr-0, 161 alp-listp, 161

lr-valp-fetch-tag-not-true-lr-v

alp-listp, 163 lr-valp-lr-compile-quote, 324 lr-valp-lr-compile-quote-flag-t, 325 lr-valp-lr-good-pointerp, 153 lr-valp-lr-s-eval-lr-s-similar-te

mps, 150 lr-valp-not-tag-cons-not-listp, 161 lr-valp-not-tag-true-not-listp, 163 lr-valp-t-lr-t-addr-opener, 219 lrps, 10

make-p-call-frame, 38, 74, 210 make-symbol, 12, 13, 147 make-temps-entries, 170–172, 209, 324,

328, 329 mark-instr, 8, 9 max-count-codelist, 13 max-ctrl-reqs, 379, 383 max-r, 178–182, 190 max-temp-reqs, 379, 383 max-word-size-reqs, 379, 383 member-area-name-offset-same, 117 member-assoc-area-name-cdr-lr-p

rograms-properp, 347 member-cdr-assoc-strip-cdrs-defi

nedp, 151 member-definedp-car, 306 member-disjointp-cons-arg2, 145 member-disjointp-non-member-1, 141 member-f-definedp-0, 307 member-lr-all-nodes, 228 member-lr-all-nodes-helper, 227 member-lr-free-list-nodes-type-

addr, 102 member-lr-good-pointerps-type-a

ddr-untag-whole, 366 member-make-symbol-max-count-co

de-list, 13 member-no-duplicatesp-assoc-equ

al, 307 member-strip-cdrs-lr-good-pointe

rp-tablep, 338 my-get-put, 2

name, 8, 9, 33, 59, 132, 168, 306, 309, 318–320, 324, 328, 329, 331, 380, 381 name-car-lr-compile-programs-pr

ogs, 132 name-car-p-prog-segment-s->lr, 381 name-car-s-progs-logic->s, 331 name-formal-vars-temp-var-dcls-p rogram-body-cons, 59 no-duplicatesp, 117, 143, 147, 149,

150, 307, 308, 310, 318, 329, 332

no-duplicatesp-lr-free-list-node

s, 117 no-duplicatesp-occurences-1, 117 no-duplicatesp-remove-duplicate

s, 310 no-duplicatesp-strip-cars-s-con struct-programs, 332 no-duplicatesp-strip-cars-s-pro

gs-logic->s, 332 no-duplicatesp-strip-cdrs-lr-ma ke-temp-name-alist, 147 ke-temp-name-alist-1, 147 not-adpp-untag-add-addr-adpp-unt

ag, 120 not-adpp-untag-node-not-definedp

-lr-heap-name, 116 not-definedp-not-listp, 291 not-definedp-user-fname-p-runti me-support-programs, 210 not-disjointp-member-arg1-cons-

arg2, 144 not-equal-0-count-list, 16 not-equal-lr-s-eval-temp-setp-n ot-lr-s-similar-temps, 149 not-equal-make-symbol-car-gensy

m, 147 not-equal-x-add1-add1-x, 114 not-equal-x-add1-x, 114 not-iff-lr-s-temp-setp-not-lr-s

-similar-statesp, 150 -similar-statesp-helper, 150

not-labelledp-instrs, 285 not-labelledp-instrs-append, 285 not-labelledp-instrs-comp-body-

1, 285 not-lessp-difference-lr-boundar

y-offsetp-fact, 265 not-lessp-help-fact, 207 not-lessp-length-p-temp-stk-lr-

apply-subr, 89 not-lessp-length-proper-p-statep

-lr-eval-lr-set-pos, 353 not-lessp-lr-count-free-nodes-l

r-data-seg-table-heap-r, 323 r-eval-list-lr-set-pos, 205

not-lessp-lr-p-c-size-flag-t-1, 71 not-lessp-max-r-cadddr, 182 not-lessp-max-r-caddr, 182 not-lessp-max-r-cadr, 182 not-lessp-max-r-car, 182 not-lessp-p-ctrl-stk-size-make-p

-call-frame, 210 not-lessp-p-max-ctrl-stk-size-l

r-funcall, 92 not-lessp-p-max-temp-stk-size-l

r-funcall, 93 r-push-tstk, 60

not-lessp-plus-arity-length-for mals, 208 mals-alt, 211

not-lessp-x-x, 71 not-listp-p-prog-segment-lr-exp

r, 84 not-listp-p-temp-stk-not-lr-che

ck-result1, 159 not-listp-prog-segment-not-lr-p

rograms-properp, 347 not-listp-s-progs-not-s-good-st

atep, 217 not-lr-check-resourcesp-temp-te

st-bad-max-temp-stk-size, 215 not-lr-valp-lr-undef-addr, 143 not-member-car-gensym-lr-make-te

mp-name-alist-1-cdr, 147 not-member-lr-all-nodes-too-sma

ll-addr, 228 not-member-make-symbol-lr-make-te

mp-name-alist-1-incr, 147 not-member-no-duplicates-cdr-as

soc, 149

soc-helper, 149 not-member-occurences-0, 117 not-p-max-node-fetch-fp-addr-not

-errorp-p-run-cons, 187 not-proper-p-statep-not-listp-p

-ctrl-stk, 75 not-psw-run-lr-eval, 128 not-same-signature-deposit-a-li

st-too-large-addr, 120 not-same-signature-deposit-too-

large-addr, 120 number-cons, 40, 282 number-cons-lr-expr-t-list, 40 numberp-arity, 344 numberp-car-cadr-caddr-cadddr-s

-apply-subr-r, 181 numberp-cdr-lr-p-pc, 45 numberp-cdr-untag-return-pc, 54 numberp-lessp-2-not-1-must-be-0, 265 numberp-lessp-4-not-3-not-2-not

-1-must-be-0, 265 numberp-max-r, 181 numberp-offset-return-pc, 54 numberp-offset-sub-addr, 115 numberp-s-eval-temp-ctrl-ws-heap

-r, 181

-r-opened, 195 nx, 40, 41, 56, 58, 110, 131, 133,

155, 175, 179, 191, 295, 334, 349, 352

object-addrs, 324, 325 occurrences, 117 offset, 6–10, 15, 21, 40–42, 44, 48,

53, 54, 57, 58, 61–64, 72, 73, 75–98, 101, 104–107, 109, 110, 113–118, 120–127, 131, 137, 141, 148, 150, 153, 154, 156–160, 163, 168–172, 183, 184, 187, 198–204, 206, 218, 220, 221, 225–234, 241, 242, 249, 250, 253, 256, 264–269, 273, 310–313, 315, 334–343, 345–347, 349, 350, 352–378, 380, 381

offset-add-addr, 53 offset-lr-max-node, 104 offset-p-pc-lr-funcall, 92 offset-sub-addr, 54 offset-tag, 40 offset-tag-cons, 101

p, 36, 37, 46, 75–84, 187, 198–205, 347, 352, 353, 355, 358–363, 367–369, 371–375, 377, 378, 380, 381, 384

p-accessor-clock, 27 p-accessor-code, 26, 27 p-accessors-lr->p, 44 p-accessors-lr-apply-subr, 46 p-accessors-lr-do-temp-fetch, 43 p-accessors-lr-funcall, 42 p-accessors-lr-if-ok, 43 p-accessors-lr-pop-cstk, 44 p-accessors-lr-pop-tstk, 39 p-accessors-lr-push-tstk, 43 p-accessors-lr-set-error, 39 p-accessors-lr-set-expr, 38 p-accessors-lr-set-pos, 39 p-accessors-lr-set-temp, 43 p-accessors-lr-set-tstk, 38 p-accessors-p-halt, 45 p-accessors-p-run-subr, 46 p-accessors-p-set-pc, 46 p-accessors-s->lr1, 101 p-call-okp, 37 p-car-clock, 27, 36, 75, 79, 80, 198,

333, 371 p-car-code, 27, 30, 51, 292 p-cdr-clock, 27, 36, 76, 80, 199, 333,

371 p-cdr-code, 27, 30, 51, 293 p-clock1, 334, 335, 352, 358, 359,

361–363, 368, 374, 377, 378, 381

p-cons-clock, 28, 36, 77, 80, 81, 187, 200, 333, 371 p-cons-code, 27, 30, 51, 293 p-ctrl-stk, 9, 10, 22–25, 36–39, 41,

43–46, 50, 61–63, 75–85, 87, 88, 90–92, 94, 95, 100, 101, 122, 123, 130, 134, 135, 141, 142, 144–146, 148, 150, 151, 165, 182–184, 191, 192, 198– 204, 207, 210, 212, 324, 328, 336–338, 340, 343, 345–347, 353, 355, 358, 360, 361, 366– 368, 370, 376, 378, 380, 382

p-ctrl-stk-size, 87, 92, 182, 184, 192, 198–204, 207, 209, 210, 212, 324, 328

p-ctrl-stk-size-0, 209

p-ctrl-stk-size-p-ctrl-stk-lr-f

uncall, 212 p-ctrl-stk-size-p-ctrl-stk-s->

lr, 328 p-current-instruction, 53 p-current-instruction-opener, 52 p-current-program, 7, 9, 21, 23, 40,

52, 57–59, 61–64, 72, 73, 85–95, 108, 114, 121–125, 130–133, 137, 141, 142, 148, 150, 153–160, 168–172, 175, 176, 183, 184, 192, 206, 336– 339, 341–343, 345–347, 349, 350, 352–370, 373–378, 380

p-current-program-lr-apply-subr, 87 p-current-program-lr-do-temp-fet

ch, 108 p-current-program-lr-eval, 87 p-current-program-lr-pop-tstk, 108 p-current-program-lr-push-tstk, 108 p-current-program-lr-set-error, 133 p-current-program-lr-set-expr, 40 p-current-program-lr-set-pos, 40 p-current-program-lr-set-temp, 108 p-current-program-p-state, 52 p-data-segment, 9–11, 22–25, 27, 36–

39, 42–46, 48–50, 63, 75– 84, 86, 87, 90, 94, 95, 101, 109, 114, 121–125, 130, 131, 135, 136, 144, 146, 148, 150– 152, 154–165, 171–176, 182– 185, 187–191, 193–195, 198– 207, 211, 214, 216, 235, 281, 282, 284, 292–294, 308–318, 320, 329, 333, 336–338, 340– 343, 345–347, 355, 358, 360, 361, 366, 368, 370, 378–382, 384

p-false-clock, 28, 36, 79, 81, 201, 333,

372 p-false-code, 28, 30, 51, 293 p-falsep-clock, 29, 36, 78, 82, 202,

333, 372 p-falsep-code, 28, 30, 51, 293 p-final-pc, 351–356, 358–363, 367–

369, 374, 377, 378 p-frame, 3, 19, 142, 144, 145, 337 p-good-resultp, 50–52, 75–79 p-good-resultp-p-halt-errorp-ope

ner, 52 p-good-resultp-p-state-opener, 51 p-good-resultp-run-car, 75 p-good-resultp-run-cdr, 75 p-good-resultp-run-cons, 77 p-good-resultp-run-false, 78 p-good-resultp-run-falsep, 78 p-good-resultp-run-listp, 76 p-good-resultp-run-nlistp, 76 p-good-resultp-run-true, 79 p-good-resultp-run-truep, 77 p-halt, 37, 38, 45, 46, 52 p-last-2-instrs-main-program, 379 p-listp-clock, 29, 37, 76, 82, 203, 333,

372 p-listp-code, 29, 30, 51, 293 p-max-ctrl-stk-size, 10, 22–25, 36–

39, 43–46, 87, 88, 92, 95, 101, 131, 182, 198–204, 207, 210, 370 p-max-ctrl-stk-size-lr-eval, 46 p-max-temp-stk-size, 10, 22–25, 36–

39, 41, 43–46, 60, 63, 64, 88, 89, 93, 95, 101, 111, 131, 139, 182, 198, 200–204, 207, 215, 353, 366–370

p-max-temp-stk-size-lr-eval, 46 p-nlistp-clock, 29, 37, 76, 83, 203, 333, 372, 373 p-nlistp-code, 29, 30, 51, 293 p-objectp, 48, 60–63, 78, 220, 222,

223, 234–237, 239, 240, 262, 310, 311 p-objectp-bad-type, 78 p-objectp-car-lr-compile-quote, 222 p-objectp-cdr-assoc-bindings-pr

oper-p-alistp, 63 p-objectp-cdr-assoc-car-lr-compi

le-quote, 262 p-objectp-cdr-assoc-litatom-prope

r-p-alistp, 61 p-objectp-lookup-deposit, 236 p-objectp-lookup-deposit-a-list, 235 p-objectp-lookup-lr-init-data-se

g-table, 239 p-objectp-opener-alt-lr-proper-

free-listp, 235 p-objectp-similar-p-states, 48 p-objectp-type, 352 p-pc, 7, 9, 10, 21, 23–25, 35, 37–

47, 50, 53, 54, 57–59, 61– 64, 72, 73, 84–95, 101, 108, 114, 121–125, 131, 133, 134, 137, 141, 148, 150, 153, 154, 156–160, 163, 168–172, 183, 184, 206, 308, 334–343, 345– 347, 349, 350, 352–378, 380, p-pc-run-car, 371 p-pc-run-cdr, 371 p-pc-run-cons, 371 p-pc-run-false, 372 p-pc-run-falsep, 372 p-pc-run-listp, 372 p-pc-run-nlistp, 372 p-pc-run-true, 373 p-pc-run-truep, 373 p-pc-s->lr, 381 p-plus, 347 p-prog-segment, 10, 23–25, 35–39,

42–46, 48–51, 56, 57, 59, 61, 63, 72, 73, 75–95, 101, 108, 114, 121, 131, 133, 134, 154, 157, 163, 165, 169, 170, 172, 187, 198, 200–204, 212, 283, 308–310, 338, 342–345, 347, 353–362, 364–366, 369– 373, 375, 377, 378, 380–382

p-prog-segment-lr-eval, 46 p-psw, 9, 10, 23–26, 36–46, 50, 60,

62–64, 73, 75–95, 101, 111, 114, 121–125, 128, 130, 131, 133, 135, 137, 138, 141, 142, 144, 145, 148, 151–160, 163– 165, 167–176, 183–185, 187– 195, 198–208, 210–212, 214– 216, 320, 324, 334–338, 340, 342, 343, 345, 346, 352, 353, 355, 357–361, 363, 367–379, 381

p-psw-lr-eval-flag-list-flag-t, 94 p-psw-lr-pop-tstk-lr-eval-flag-t, 175 p-psw-not-run, 46 p-psw-p-halt-x-y-error-msg, 46 p-psw-run-lr-apply-subr-lr-chec

k-resourcesp, 207 p-psw-run-lr-if-ok-p-psw-run, 176 p-psw-run-p-psw-lr-if-ok-not-ru

n-check-resourcesp, 215 p-psw-run-p-run-subr-lr-check-re

sourcesp, 206 p-psw-run-run-car-lr-check-reso

urcesp, 197 p-psw-run-run-cdr-lr-check-reso

urcesp, 198 p-psw-run-run-cons-lr-check-res

ourcesp, 200 p-psw-run-run-false-lr-check-re

sourcesp, 200 p-psw-run-run-falsep-lr-check-re

sourcesp, 201 p-psw-run-run-listp-lr-check-re

sourcesp, 202 p-psw-run-run-nlistp-lr-check-re

sourcesp, 203 p-psw-run-run-true-lr-check-res

ourcesp, 203 p-psw-run-run-truep-lr-check-re

sourcesp, 204 p-recognizer-clock, 26, 29, 30 p-recognizer-code, 26, 29, 30 p-run-subr, 36, 37, 46, 85, 86, 89,

90, 114, 121, 154, 159, 163, 168, 188, 207, 338, 340, 342, 343, 371, 374 p-run-subr-clock, 333, 335, 371, 374 p-run-subr-p-pc-add-addr-lr-p-p

c-lr-p-c-size, 373 p-run-subr-preserves-lr-good-poi

nterp-tablep, 338 nterps, 341

p-run-subr-preserves-lr-proper-ctrl-stkp, 339 free-listp, 121 heapp, 342 heapp2, 154 heapp2-alt, 342

p-run-subr-preserves-lr-valp, 114 p-runtime-support-programs, 30, 33,

34, 84, 85, 163, 187, 206, 210, 216, 217, 290, 291, 309

p-set-pc, 36, 37, 46, 75–86, 114, 121, 154, 159, 163, 168, 187, 198– 205, 207, 333, 334, 338, 340, 342, 343, 347, 352, 353, 355, 358–363, 367–375, 377, 378, 380

p-set-pc-lr->p-equal-p-fact, 370 p-set-pc-lr->p-lr-set-expr, 347 p-set-pc-twice, 374 p-state, 10, 22–26, 36–38, 51–53, 196,

197, 222, 223, 235–240, 262, 263, 274, 285–292, 306–308, 370

p-statep, 11 p-temp-stk, 9–11, 22–25, 27, 36–39,

41, 43–46, 50, 60, 61, 63, 64, 73, 75–85, 89, 92, 93, 95, 101, 111, 130, 131, 136– 140, 148, 151, 152, 154–156, 159–165, 167–171, 174–176, 182, 184, 185, 190, 192, 198– 205, 207, 212, 215, 320, 329, 333, 334, 336, 338, 342, 343, 345–347, 353, 355, 357, 358, 360, 361, 363, 366–370, 378– 382

p-temp-stk-lr-do-temp-fetch-p-p

sw-run, 151 p-temp-stk-lr-pop-tstk, 39 p-temp-stk-p-ctrl-stk-p-data-se

gment-run-car, 79 gment-run-cdr, 80 gment-run-cons, 80 gment-run-false, 81 gment-run-falsep, 81 gment-run-listp, 82 gment-run-nlistp, 82 gment-run-true, 83 gment-run-truep, 83

p-test-bool-and-jump-okp, 196, 197 p-test-bool-and-jump-okp-f-cons

-bool-f, 197 -bool-t, 197

p-test-bool-and-jump-okp-t-cons -bool-f, 197 -bool-t, 196

p-true-clock, 29, 37, 79, 83, 204, 333, 373 p-true-code, 29, 30, 51, 294 p-truep-clock, 30, 37, 77, 84, 205,

334, 373 p-truep-code, 30, 51, 294 p-word-size, 10, 22–26, 36–39, 43–

50, 63, 86, 88, 95, 101, 131, 182, 198–205, 207, 216, 292– 294, 309, 310, 312–318, 370

p-word-size-lr-eval, 47 pair-formal-vars-with-actuals, 74, 165 pair-formals-with-addresses, 19, 220,

259, 273, 281, 326, 328 pair-formals-with-addresses-lr-

data-seg-table-list, 327 pair-temps-with-initial-values, 74, 75,

165, 171, 344 pairlist-plist-1, 170 plist, 13, 74, 134, 144, 146, 148, 170,

217, 229, 259, 281, 348 plist-delete, 229 plist-listp-x-append-x-not-0, 146 plist-lr-convert-num-to-ascii, 283 plist-strip-cdrs, 281 plistp, 34, 64, 66, 73, 130, 146, 155,

216, 233, 259, 281–283, 285, 296, 309

plistp-comp-body-1, 66 plistp-comp-if, 66 plistp-comp-programs-1, 281 plistp-comp-temp-test, 66 plistp-first-n, 73 plistp-label-instrs, 285 plistp-lastcdr-nil, 130 plistp-lr-all-nodes, 233 plistp-lr-compile-body, 155 plistp-lr-compile-body-1, 216 plistp-lr-expr-s->lr1, 155 plistp-pair-formals-with-addres

ses, 259 plistp-pairlist, 73 plistp-strip-cars, 309 plus-constant-fact-helper-1, 68 plus-times-fact-1, 105 pop, 24, 25, 39, 44, 99, 336 pop-p-ctrl-stk-lr-funcall, 92 popn, 38, 74, 93, 173, 345 popn-nlistp, 93 popn-restn, 173 pps, 9 program-body, 7–9, 21, 33, 35, 53,

56–59, 61–64, 72–95, 114, 121–125, 128, 130–132, 137, 141, 148, 150, 153–160, 163, 168–172, 175, 176, 183, 184, 187, 192, 198, 200–204, 206, 283, 286, 288, 292, 307–309, 318, 336–339, 341–343, 345– 347, 349, 350, 352–378, 380

program-body-assoc-cdr-lr-compi

le-programs, 318 program-body-assoc-comp-program

s, 59 s-1, 59

program-body-assoc-lr-compile-p

rograms, 128 program-body-p-current-program-

s->lr1, 132 proper-labeled-p-instructionsp, 49, 64,

282, 285–292, 306, 308 proper-labeled-p-instructionsp-

append, 282 comp-body-1, 292 comp-body-1-helper-1, 285 comp-body-1-helper-2, 286 comp-body-1-helper-3, 287 comp-body-1-helper-4, 287 comp-body-1-helper-5, 289 comp-body-1-helper-6-1, 290 comp-body-1-helper-6-2, 290 comp-body-1-helper-7, 291 find-labelp-non-litatom, 64 label-ret, 306 lr->p-similar-states, 49 nil, 285

proper-p-alistp, 50, 60–63, 92, 220,

274 proper-p-alistp-all-litatoms-al

l-p-objectps-lookup, 220 proper-p-alistp-lr->p-similar

-states, 50 proper-p-alistp-lr-funcall, 92 proper-p-alistp-lr-make-initial

-temps, 274 proper-p-alistp-p-objectp, 60 proper-p-alistp-pair-formal-wit

h-addresses, 273 proper-p-alistp-put-assoc, 62 proper-p-ctrl-stkp, 50, 88, 92 proper-p-ctrl-stkp-lr->p-simi

lar-states, 50 proper-p-ctrl-stkp-lr-apply-sub

r, 88 proper-p-ctrl-stkp-lr-funcall, 92 proper-p-data-segmentp, 49, 52, 90,

109, 310–318 proper-p-data-segmentp-bad-type, 52 proper-p-data-segmentp-deposit, 310 proper-p-data-segmentp-deposit-

a-list-cons, 311 a-list-cons-cons, 311 a-list-cons-numberp, 312 a-list-cons-truep, 312 helper, 310

proper-p-data-segmentp-fetch, 310 proper-p-data-segmentp-implies-

lr-proper-p-areasp, 109 proper-p-data-segmentp-lr->p-

similar-states, 49 proper-p-data-segmentp-lr-apply

-subr, 90 proper-p-data-segmentp-lr-data-

seg-table, 318 proper-p-data-segmentp-lr-init-

data-seg, 316

data-seg-compile-t0, 317 data-seg-helper, 316

proper-p-framep, 63, 86, 87, 92 proper-p-framep-lr->p-similar

-states, 86 proper-p-framep-lr-apply-subr, 87 proper-p-framep-top-p-ctrl-stk-

lr-funcall, 91 proper-p-instructionp, 8, 49, 64, 281–

283, 308 proper-p-instructionp-add-addr, 281 proper-p-instructionp-deposit, 281 proper-p-instructionp-eq, 281 proper-p-instructionp-fetch, 281 proper-p-instructionp-jump-labe

l, 283 proper-p-instructionp-pop-globa

l-free-ptr, 281 proper-p-instructionp-push-const

ant-opener, 64 proper-p-instructionp-push-glob

al-free-ptr, 282 proper-p-instructionp-push-loca

l-temp-car, 282 l-temp-cdr, 282 l-temp-cons, 282

proper-p-instructionp-ret, 281 proper-p-instructionp-set-globa

l, 308 proper-p-instructionp-set-local

-temp-cons, 282 proper-p-instructionp-similar-p

-states, 49 proper-p-instructionp-test-bool

-and-jump-label, 283 proper-p-prog-segmentp, 49, 64, 73,

74, 89, 92, 308–310 proper-p-prog-segmentp-append, 64 proper-p-prog-segmentp-comp-pro

grams, 310 grams-1, 308 grams-1-helper, 307

proper-p-prog-segmentp-length-p

rogram-body, 74 proper-p-prog-segmentp-lr->p-

similar-states, 49 proper-p-prog-segmentp-lr-apply

-subr, 88 proper-p-prog-segmentp-p-runtime

-support-programs, 309 proper-p-programp, 8, 292–294, 309 proper-p-programp-append-car-pr

og-segment, 308 proper-p-programp-p-car-code, 292 proper-p-programp-p-cdr-code, 292 proper-p-programp-p-cons-code, 293 proper-p-programp-p-false-code, 293 proper-p-programp-p-falsep-code, 293 proper-p-programp-p-listp-code, 293 proper-p-programp-p-nlistp-code, 293 proper-p-programp-p-true-code, 293 proper-p-programp-p-truep-code, 294 proper-p-push-constant-instructi

onp, 64 proper-p-state-p-p-run-subr-ope

ner-1, 89 ner-2, 89 ner-3, 90

proper-p-statep, 61–64, 73, 75–83, 85–90, 93–95, 109, 114, 121– 125, 130, 131, 133–135, 137, 141, 144–146, 148, 150, 151, 154–161, 163, 164, 168, 170– 176, 182–185, 187, 188, 190– 195, 198, 200–207, 210–212, 214–216, 319, 323, 336–338, 340–343, 345, 346, 352, 353, 355, 357, 358, 360, 361, 363, 366–368, 371–374, 376–378, 380, 383 proper-p-statep-bad-type-1, 75 proper-p-statep-bad-type-2, 78 proper-p-statep-lessp-length-p-te

mp-stk-max-temp-stk-size, 353 proper-p-statep-lr->p-equal-w

ord-size-0, 88 proper-p-statep-lr->p-implies -lr-proper-p-areasp, 109 proper-p-statep-lr->p-lessp-ct

rl-stk-size, 87 proper-p-statep-lr->p-lessp-m ax-ctrl-stk-size, 88 ax-temp-stk-size, 88 proper-p-statep-lr->p-lr-eval

-list, 158

-list-helper, 158 proper-p-statep-lr->p-lr-pop-t

stk, 62 proper-p-statep-lr->p-lr-push

-tstk, 61 proper-p-statep-lr->p-lr-set-e

xpr, 95 proper-p-statep-lr->p-lr-set-p

os, 62 proper-p-statep-lr->p-member-

formals-definedp-bindings, 135 proper-p-statep-lr->p-not-0-p

-temp-stk, 130 proper-p-statep-lr->p-numberp

-max-ctrl-stk-size, 87 -max-temp-stk-size, 88 -word-size, 88

proper-p-statep-lr->p-plistp-p

-temp-stk, 130 proper-p-statep-lr->p-s->lr, 318

-logic->s, 383 1-strip-cars-bindings-ctrl-stk, 145

proper-p-statep-lr->p-strip-c

ars-bindings-ctrl-stk, 134 proper-p-statep-lr-apply-subr, 90 proper-p-statep-lr-apply-subr-st

ate, 86 proper-p-statep-lr-do-temp-fetc

h, 64 proper-p-statep-lr-funcall, 93 proper-p-statep-lr-if-ok, 95 proper-p-statep-lr-push-tstk-qu

ote, 73 proper-p-statep-lr-set-error, 133 proper-p-statep-lr-set-expr-lr-p

op-cstk, 94 proper-p-statep-lr-set-temp, 63 proper-p-statep-p-run-subr, 85 proper-p-statep-p-set-pc, 352 proper-p-statep-p-set-pc-equal-p

-set-pc, 352 proper-p-temp-stkp, 49, 50, 60, 61,

63, 73, 74, 89, 92, 93, 130 proper-p-temp-stkp-all-p-objectp

s, 74 proper-p-temp-stkp-lr->p-lr-p

ush-tstk, 60 proper-p-temp-stkp-lr->p-simi

lar-states, 49 proper-p-temp-stkp-lr-apply-sub

r, 89 proper-p-temp-stkp-lr-funcall, 93 proper-p-temp-stkp-lr-push-tstk

-assoc-bindings, 61 proper-p-temp-stkp-p-temp-stk-l

r-do-temp-fetch, 63 r-push-tstk-quote, 73

proper-p-temp-stkp-plistp-p-temp

-stk, 130 proper-p-temp-stkp-popn, 74 proper-p-temp-var-dclsp, 49, 284, 307 proper-p-temp-var-dclsp-all-lit

atoms-all-undef-addrs, 284 proper-p-temp-var-dclsp-lr->p

-similar-states, 49 properp-p-temp-var-dclps-member

-lr-programs-properp, 307 push, 24, 38, 151 put, 2, 109, 218, 310 put-assoc, 47, 62, 109, 119, 140, 142–

146, 337 put-assoc-opener-1, 142 put-assoc-opener-2, 142 put-assoc-put-assoc-1, 109 put-assoc-put-assoc-2, 109 put-assoc-restn, 144 put-not-listp, 109 put-put, 109 put-value, 8, 10 put-zero, 109

remainder-difference-not-equal-

lessp-fact, 227 remove-duplicates, 310, 331 restn, 7, 13, 23, 67–71, 99, 108, 112,

144, 149, 159, 160, 167, 173, 282, 295, 304

restn-add1-opener-alt, 159 restn-comp-body-1-list-fact, 69 ret-pc, 74, 88, 91, 92, 144, 376 ret-pc-make-p-call-frame, 74 reverse, 73, 100, 160, 163, 164, 166,

167, 170, 344 reverse-butlast, 166 reverse-reverse-alt, 170

s->lr, 22, 319, 323, 328, 329, 333,

378, 380–383 s->lr-ok, 329 s->lr1, 22, 23, 101, 110–112, 132–

140, 144–146, 148, 150–153, 155, 156, 163–165, 170–176, 182–185, 187–195, 205–208, 210–212, 214–216, 274, 306

s->lr1-lr-funcall-s-fun-call-

state, 165 s->lr1-s-set-pos-lr-set-pos, 136 s-add-temp-r, 178–180 s-all-progs-temps-setp, 4, 183, 192,

216, 324, 329, 330 s-all-temps-setp, 4, 183, 192, 216,

324, 329 s-ans, 148, 155, 156, 164, 165, 172,

174, 176, 179, 185, 190, 193, 197–205, 320, 329

s-apply-car-r, 177 s-apply-cdr-r, 177, 178 s-apply-cons-r, 177, 178 s-apply-false-r, 177, 178 s-apply-falsep-r, 177, 178 s-apply-listp-r, 177, 178 s-apply-nlistp-r, 177, 178 s-apply-subr-r, 177, 180, 181, 188,

189, 198–206, 214 s-apply-true-r, 177, 178 s-apply-truep-r, 177, 178 s-body, 4, 18, 20, 22, 128, 132, 134–

140, 144–146, 148, 150–152, 155, 156, 163–165, 170, 171, 173–176, 182–185, 187, 188, 190–195, 205–212, 214–217, 223, 244, 246, 248, 277, 295, 296, 302–305, 318, 324, 329, 330

s-body-car-s-progs-logic->s, 330 s-change-temp, 144, 148 s-check-temps-setp, 4, 183, 192, 216,

324, 329 s-collect-all-temps, 183, 192 s-construct-programs, 331, 332 s-data-seg-body-restrictedp, 248, 277, 278, 294, 314, 326, 331

s-data-seg-list-restrictedp, 248, 278,

294, 314, 326, 327, 331 s-err-flag, 4, 22, 101, 110, 111, 133–

136, 147, 148, 155, 156, 165, 171, 174–176, 178–180, 182, 183, 190–193, 195, 205–207, 209–216, 324, 329, 382 s-eval, 4, 101, 110–112, 133, 136,

147, 148, 155, 156, 164, 165, 171–174, 176, 179, 180, 183– 185, 188–195, 205–207, 209– 212, 214–216, 320, 324, 329, 382

s-eval-ctrl-heap-temp-ws-s-fun-call-state-opener, 212 s-eval-ctrl-r, 180–182, 209, 210, 213, 319, 324, 329 s-eval-ctrl-r-funcall-opener, 209 s-eval-err-flag-not-run-fact, 101 s-eval-flag-run-car-s-apply-sub r-r-not-zero, 214 s-eval-flag-run-flag-t-s-check-te

mps-setp, 183 s-eval-flag-run-flag-t-subsetp-s-collect-all-temps, 183 s-eval-flag-run-s-eval-temp-r-n

ot-zero, 215 s-eval-flag-run-v&c$-not-f-fl

ag-t, 382 s-eval-heap-r, 180–182, 189, 191, 206,

207, 213, 319, 324, 329, 383 s-eval-r, 178–180, 195 s-eval-subsetp-s-collect-temp-a list-s-set-pos-if, 192 s-eval-temp-r, 180–182, 213, 215, 319,

324, 329 s-eval-ws-r, 180–182, 213, 319, 324,

329 s-expand-temps, 4 s-expr, 4, 110–112, 134–140, 144–

146, 148, 150–153, 155, 156, 163–165, 170–174, 179, 180, 183, 187–195, 205–216, 332

s-expr-list, 4, 110, 132, 155, 170, 175,

178, 182, 191, 216 s-expr-logic->s, 332 s-formals, 20, 128, 132, 133, 135,

145, 146, 150, 171, 208, 209, 213, 305, 318, 328, 329, 332, 379

s-formals-car-s-progs-logic->

s, 332 s-formals-s-prog-logic->s, 379 s-fun-call-state, 112, 165, 174, 180,

209, 213, 214 s-good-state-logic->s, 329 s-good-statep, 4, 132, 138–140, 144,

146, 148, 150–152, 164, 170, 171, 174, 176, 183–185, 188– 195, 205–212, 214–217, 281, 306, 318–320, 324, 329, 330

s-good-statep-formals-assoc-cdr

-s-progs, 209 s-good-statep-length-cdr-s-expr

-funcall, 170 s-good-statep-length-s-temp-list, 281 s-good-statep-program-body-car-

lr-compile-programs, 132 s-heap-reqs, 242–245, 250–253, 255,

259, 261–263, 267, 275, 311, 313, 325, 326

s-heap-reqs-body, 243, 244, 275–278,

294, 314, 320, 326 s-heap-reqs-flag-list-cons-opene

r, 252 s-heap-reqs-flag-list-nil-opene

r, 252 s-heap-reqs-list, 244, 245, 277–279,

294, 314, 321, 322, 327 s-heap-reqs-object-0, 267 s-heap-reqs-object-t, 250 s-init-data-seg-restrictedp, 248, 263,

273, 278, 279, 295, 314, 325, 326, 328, 330

s-init-heap-reqs, 244, 245, 263, 278– 280, 295, 315, 322, 323, 325, 326, 328

s-init-ws-reqs, 246, 247, 263, 315 s-l-eval-equiv-hyps, 4 s-l-eval-flag-run-hyps, 4 s-max-subr-reqs, 180, 198–205, 207,

216, 247, 292, 293, 309, 310, 312, 315–318, 324

s-params, 4, 22, 135, 136, 151, 152, 172, 173, 176, 180, 183–185, 188–191, 193, 194, 205–207, 214, 216, 306, 318–320, 323, 324, 328–330, 382

s-params-logic->s, 330 s-pname, 22, 101, 133, 135, 144–146,

150, 156, 187, 320, 324, 328, 329, 331, 381

s-pname-logic->s, 331 s-pos, 4, 22, 101, 110–112, 132–140,

144–146, 148, 150–153, 155, 156, 163–165, 170, 171, 173– 176, 178–180, 182–184, 187– 195, 205–216, 320, 324, 329, 331, 381

s-pos-logic->s, 331 s-prog, 4, 22, 132–140, 144–146, 148,

150–152, 155, 156, 163–165, 170, 171, 173–176, 182–185, 187, 188, 190–195, 205–212, 214–216, 281, 318, 379

s-programs-okp, 169, 208, 212, 305 s-programs-okp-formals-not-f, 208 s-programs-properp, 305 s-progs, 4, 22, 101, 132, 133, 135,

144–146, 150, 156, 165, 171, 172, 183, 187, 192, 208–210, 212, 213, 216, 217, 273, 274, 306, 318–320, 323, 324, 328– 332, 380–383

s-proper-exprp, 217, 296, 298, 299,

303, 304 s-proper-exprp-plist-temp-list, 217 s-restrict-subrps, 217, 302–305, 331 s-restrict-subrps-list-lr-prope

r-get-t, 302 s-restrict-subrps-progs, 217, 305, 306,

318, 319, 329, 331 s-restrict-subrps-s-body-member

-s-restrict-subrps-progs, 305 s-restrict-subrps-s-restrict-su

brps-cur-expr, 303 s-restrict-subrps-t-lr-proper-get

-t, 303 s-restricted-objectp, 247, 248, 253,

255, 259–262, 311–313, 324, 325, 330

s-restrictedp, 248, 280, 295, 302, 304– 306, 318–320, 323, 324, 328, 329, 382

s-set-expr, 110, 111, 133, 136, 155,

179, 191, 193, 194 s-set-pos, 110–112, 136, 148, 156,

164, 165, 170–173, 179, 180, 184, 185, 188–190, 192–195, 205–207, 209–215

s-temp-eval, 17, 19–21, 32, 34, 41, 56, 62, 66, 68–70, 73, 84, 111, 129, 139, 142, 144–146, 148, 150, 152, 156, 163, 164, 179, 187, 190, 194, 195, 205, 214, 217, 243, 246, 248, 287, 290, 296, 298–300, 302, 303, 335, 343, 348, 349, 362, 363, 369, 370, 374, 377

s-temp-fetch, 17, 19–21, 32, 34, 42, 56, 63, 64, 66, 69, 70, 73, 84, 111, 129, 140, 146, 150– 152, 156, 163, 164, 180, 187, 190, 194, 195, 205, 214, 217, 243, 246, 248, 286, 290, 295, 298, 300, 302, 303, 335, 337, 343, 348, 349, 365, 368–370, 374, 377

s-temp-list, 20, 128, 132, 133, 145, 146, 150, 171, 172, 209, 210, 213, 281, 305, 318, 328–330

s-temp-list-car-s-progs-logic->

s, 330 s-temp-setp, 150, 179, 194 s-temp-test, 17, 19–21, 33, 34, 41,

56, 62–64, 66, 68–70, 73, 84, 111, 129, 139, 142, 144– 146, 148, 150–152, 156, 163, 164, 179, 187, 190, 194, 195, 205, 214, 215, 217, 243, 246, 248, 286, 287, 290, 296, 298– 300, 302, 303, 335, 337, 343, 348, 349, 364–370, 374, 377

s-temps, 4, 22, 135, 144, 147, 148, 150–152, 172, 173, 176, 179, 180, 183–185, 188–194, 205– 207, 214, 216, 281, 318–320, 323, 324, 328–330

s-temps-logic->s, 330

s-total-heap-reqs, 244, 273, 280, 295, 302, 304–306, 318–320, 323, 324, 328, 329, 380–383 s-total-ws-reqs, 247, 273, 318, 319,

329 s-total-ws-reqs-not-lessp-s-max

-subr-reqs, 318 s-ws-reqs, 245–247, 262, 313 s-ws-reqs-body, 245, 246, 314 s-ws-reqs-flag-not-list-t, 313 s-ws-reqs-list, 246, 247, 314 same-signature, 48–50, 63, 86, 87,

94, 95, 108, 116, 119, 120, 156, 221–224, 267, 311–318, 320

same-signature-car-lr-compile-q uote, 223 uote-generalized, 221 uote-helper, 221 uote-reducer, 317 same-signature-car-lr-data-seg-t able, 320 able-body, 223 able-list, 224 able-list-helper, 223 able-list-reducer, 317

same-signature-car-lr-init-data -seg-table, 267 -seg-table-help-1, 267 -seg-table-reducer, 317

same-signature-commutative, 86 same-signature-cons, 119 same-signature-deposit, 116 same-signature-deposit-a-list, 120 same-signature-lr-apply-subr, 86 same-signature-nil, 119 same-signature-p-run-subr, 86 set-local-var-value, 25, 43 signature, 119 strip-cadrs, 35, 284, 292, 344 strip-cars-append, 74 strip-cars-bindings-top-p-ctrl-

stk-lr-funcall, 91 strip-cars-equal-definedp-equal, 141 strip-cars-firstn, 108 strip-cars-lr-compile-programs, 132 strip-cars-lr-make-initial-temp

s, 259 strip-cars-lr-make-temp-name-ali

st, 148 st-1, 148

strip-cars-lr-make-temp-var-dcl

s, 135 strip-cars-lr-temps-strip-cars-te

mp-var-dcls, 146 strip-cars-nil-fact, 140 strip-cars-pair-formals-with-ad

dresses, 259 strip-cars-pair-temps-with-initi

al-values, 74 strip-cars-pairlist, 74 strip-cars-restn, 108 strip-cdrs, 19, 34, 107, 135, 142, 143,

145–147, 149–152, 220, 263, 280, 281, 289, 297–300, 304, 305, 324, 327, 328, 336–338, 343, 344, 366, 382

strip-cdrs-append, 343

strip-cdrs-pair-temps-with-initi

al-values, 344 strip-cdrs-pairlist, 343 strip-logic-fnames, 35, 56, 57, 208, 289–292, 307, 308 strip-logic-fnames-cdr-lr-compi le-programs, 208 strip-logic-fnames-lr-compile-p

rograms, 208 sub-addr, 44, 54, 96, 98, 103, 105, 115, 116, 225–227, 232 sub-addr-area-name-offset-same, 116 sub1-plus-not-zerop-fact-1, 120 subr-arity-alist, 344 subseqp, 13 subseqp-append, 13 subsetp, 183, 185, 192, 304–306, 308 subsetp-cdr, 306 subsetp-not-member-both, 185

tag, 6, 14, 15, 17, 21–24, 26–29, 37– 40, 75–77, 79–84, 96, 101, 106, 127, 128, 160–163, 186, 218, 225, 229–234, 256–258, 260, 261, 264–266, 268–273, 312, 313, 316, 320, 341, 352, 355, 358, 360, 361, 380, 381

tag-type-name-offset-equal-same, 230 temp-alist-to-set, 4, 183, 192, 216,

324, 329 temp-var-dcls, 9, 33, 35, 38, 56, 57,

59–61, 63, 91, 132–134, 142, 150, 165, 171, 212, 287–289, 292, 307, 309, 344 temp-var-dcls-assoc-comp-progra

ms, 61 ms-1, 60 ms-lr-programs-properp, 91 temp-var-dcls-assoc-p-current-p rogram-s->lr1, 133 temp-var-dcls-lr-compile-progra

ms, 132 times-quotient-lessp-fact-1, 196 top, 11, 27, 41, 63, 75, 76, 78–81,

92, 99–101, 111, 138–140, 146, 334, 336

top-stk, 11 top1, 77, 81 total-heap-reqs, 379, 383 type, 7, 26, 34, 45, 48, 52–55, 64, 75,

78, 96, 97, 102–106, 109, 112–114, 116–118, 121, 126– 128, 152–154, 161, 162, 186, 219, 226–233, 240, 242, 249, 255–258, 260, 261, 264–268, 289, 302, 315, 339, 341, 353, 366

type-add-addr, 53 type-lr-p-pc, 45 type-lr-return-pc, 54 type-sub-addr, 54

unlabel, 8, 53, 71, 75–84, 163, 187, 198, 200–204, 354, 362, 364, 365, 371–373, 375

unlabel-car-last-comp-body, 375 unlabel-get-last-funcall-body-a

ssoc-comp-programs, 375 unlabel-get-lr-p-pc-program-bod

y-assoc-comp-programs, 347 unlabel-list-label, 71 untag, 7, 9–11, 26, 44, 45, 47, 48,

52–55, 61, 75, 78, 86, 90, 91, 96–99, 102–107, 109, 112– 118, 120–122, 124–128, 130, 153–155, 162, 186, 196, 199, 200, 219, 220, 225, 227–233, 235, 240–242, 249, 250, 254– 258, 260, 261, 264–268, 289, 309–311, 318, 339, 342, 366, 379, 381

untag-addr-addr-tag, 106 user-fname, 33, 37, 84, 85, 91, 92,

165, 169, 171, 172, 187, 208– 210, 212, 213, 291, 331, 375 user-fnamep, 51

value, 8–10, 15, 19, 96, 120, 264

x-y-error-msg, 38, 46

zerop-lr-convert-digit-to-ascii, 283 zerop-lr-convert-num-to-ascii, 283