(moddb-add-module1 elab-mod moddb) → (mv elab-mod1 moddb1)
Function:
(defun moddb-add-module1 (elab-mod moddb) (declare (xargs :stobjs (elab-mod moddb))) (declare (xargs :guard (and (moddb-basics-ok moddb) (< (moddb->nmods moddb) (moddb->mods-length moddb)) (not (moddb-modname-get-index (elab-mod->name elab-mod) moddb))))) (let ((__function__ 'moddb-add-module1)) (declare (ignorable __function__)) (b* ((moddb (moddb-fix moddb)) (elab-mod (elab-mod-fix elab-mod)) ((unless (mbt (not (moddb-modname-get-index (elab-mod->name elab-mod) moddb)))) (mv elab-mod moddb)) (idx (lnfix (moddb->nmods moddb))) (moddb (update-moddb->nmods (+ 1 idx) moddb)) (moddb (moddb->modname-idxes-put (elab-mod->name elab-mod) idx moddb))) (stobj-let ((new-elab-mod (moddb->modsi idx moddb))) (new-elab-mod elab-mod) (swap-elab-mods new-elab-mod elab-mod) (mv elab-mod moddb)))))
Theorem:
(defthm moddb-add-module1-of-elab-mod$a-fix-elab-mod (equal (moddb-add-module1 (elab-mod$a-fix elab-mod) moddb) (moddb-add-module1 elab-mod moddb)))
Theorem:
(defthm moddb-add-module1-elab-mod$a-equiv-congruence-on-elab-mod (implies (elab-mod$a-equiv elab-mod elab-mod-equiv) (equal (moddb-add-module1 elab-mod moddb) (moddb-add-module1 elab-mod-equiv moddb))) :rule-classes :congruence)
Theorem:
(defthm moddb-add-module1-of-moddb-fix-moddb (equal (moddb-add-module1 elab-mod (moddb-fix moddb)) (moddb-add-module1 elab-mod moddb)))
Theorem:
(defthm moddb-add-module1-moddb-equiv-congruence-on-moddb (implies (moddb-equiv moddb moddb-equiv) (equal (moddb-add-module1 elab-mod moddb) (moddb-add-module1 elab-mod moddb-equiv))) :rule-classes :congruence)
Theorem:
(defthm acl2::mv-nth-of-moddb-norm-moddb-under-moddb-norm-equiv (moddb-norm-equiv (mv-nth 1 (moddb-add-module1 elab-mod (moddb-norm moddb))) (mv-nth 1 (moddb-add-module1 elab-mod moddb))))
Theorem:
(defthm acl2::mv-nth-moddb-norm-equiv-congruence-on-moddb-under-moddb-norm-equiv (implies (moddb-norm-equiv moddb acl2::moddb-equiv) (moddb-norm-equiv (mv-nth 1 (moddb-add-module1 elab-mod moddb)) (mv-nth 1 (moddb-add-module1 elab-mod acl2::moddb-equiv)))) :rule-classes :congruence)
Theorem:
(defthm take-of-n+1-update-nth (equal (take (+ 1 (nfix n)) (update-nth n v x)) (append (take n x) (list v))))
Theorem:
(defthm moddb-add-module1-under-moddb-norm-equiv (moddb-norm-equiv (mv-nth 1 (moddb-add-module1 elab-mod moddb)) (if (moddb-modname-get-index (g :name elab-mod) moddb) moddb (list (+ 1 (nfix (nth *moddb->nmods* moddb))) (append (take (nth *moddb->nmods* moddb) (nth *moddb->modsi* moddb)) (list elab-mod))))))
Theorem:
(defthm moddb-basics-ok-of-moddb-add-module1 (implies (and (moddb-basics-ok moddb) (< (nfix (moddb->nmods moddb)) (moddb->mods-length moddb))) (moddb-basics-ok (mv-nth 1 (moddb-add-module1 elab-mod moddb)))))
Theorem:
(defthm moddb-mod-inst-wireoffset-of-update-nmods (implies (and (< (nfix modidx) (nfix (nth *moddb->nmods* moddb))) (<= (nfix (nth *moddb->nmods* moddb)) (nfix newnmods))) (equal (moddb-mod-inst-wireoffset inst modidx (update-nth *moddb->nmods* newnmods moddb)) (moddb-mod-inst-wireoffset inst modidx moddb))))
Theorem:
(defthm moddb-mod-inst-wireoffset-of-update-mod (implies (< (nfix modidx) (nfix updidx)) (equal (moddb-mod-inst-wireoffset inst modidx (update-nth *moddb->modsi* (update-nth updidx newmod mods) moddb)) (moddb-mod-inst-wireoffset inst modidx (update-nth *moddb->modsi* mods moddb)))))
Theorem:
(defthm moddb-mod-inst-wireoffset-of-update-table (equal (moddb-mod-inst-wireoffset inst modidx (update-nth *moddb->modname-idxes-get* tab moddb)) (moddb-mod-inst-wireoffset inst modidx moddb)))
Theorem:
(defthm moddb-mod-inst-instoffset-of-update-nmods (implies (and (< (nfix modidx) (nfix (nth *moddb->nmods* moddb))) (<= (nfix (nth *moddb->nmods* moddb)) (nfix newnmods))) (equal (moddb-mod-inst-instoffset inst modidx (update-nth *moddb->nmods* newnmods moddb)) (moddb-mod-inst-instoffset inst modidx moddb))))
Theorem:
(defthm moddb-mod-inst-instoffset-of-update-mod (implies (< (nfix modidx) (nfix updidx)) (equal (moddb-mod-inst-instoffset inst modidx (update-nth *moddb->modsi* (update-nth updidx newmod mods) moddb)) (moddb-mod-inst-instoffset inst modidx (update-nth *moddb->modsi* mods moddb)))))
Theorem:
(defthm moddb-mod-inst-instoffset-of-update-table (equal (moddb-mod-inst-instoffset inst modidx (update-nth *moddb->modname-idxes-get* tab moddb)) (moddb-mod-inst-instoffset inst modidx moddb)))
Theorem:
(defthm moddb-mods-ok-of-moddb-add-module1-empty (implies (and (moddb-mods-ok moddb) (equal 0 (elab-mod$a-ninsts elab-mod)) (equal (elab-mod$a-nwires elab-mod) (nfix (g :totalwires elab-mod))) (zp (g :totalinsts elab-mod))) (moddb-mods-ok (mv-nth 1 (moddb-add-module1 elab-mod moddb)))))
Theorem:
(defthm elab-mods->names-of-append (equal (elab-mods->names (append a b)) (append (elab-mods->names a) (elab-mods->names b))))
Theorem:
(defthm index-of-append (equal (index-of k (append a b)) (or (index-of k a) (let ((bind (index-of k b))) (and bind (+ (len a) bind))))))
Theorem:
(defthm index-of-cons (equal (index-of k (cons a b)) (if (equal k a) 0 (let ((bind (index-of k b))) (and bind (+ 1 bind))))))
Theorem:
(defthm moddb-modname-get-index-of-moddb-add-module1 (equal (moddb-modname-get-index name (mv-nth 1 (moddb-add-module1 elab-mod moddb))) (or (moddb-modname-get-index name moddb) (and (equal (modname-fix name) (modname-fix (g :name elab-mod))) (nfix (nth *moddb->nmods* moddb))))))
Theorem:
(defthm nmods-of-moddb-add-module1 (implies (not (moddb-modname-get-index (g :name elab-mod) moddb)) (equal (nth *moddb->nmods* (mv-nth 1 (moddb-add-module1 elab-mod moddb))) (+ 1 (nfix (moddb->nmods moddb))))))