(moddb-mod-totalinsts modidx moddb) → totalinsts
Function:
(defun moddb-mod-totalinsts (modidx moddb) (declare (xargs :stobjs (moddb))) (declare (xargs :guard (and (natp modidx) (moddb-basics-ok moddb)))) (declare (xargs :guard (< modidx (moddb->nmods moddb)))) (let ((__function__ 'moddb-mod-totalinsts)) (declare (ignorable __function__)) (b* (((unless (mbt (< (lnfix modidx) (moddb->nmods moddb)))) 0) ((stobj-get totalinsts) ((elab-mod (moddb->modsi modidx moddb))) (elab-mod->totalinsts elab-mod))) totalinsts)))
Theorem:
(defthm natp-of-moddb-mod-totalinsts (b* ((totalinsts (moddb-mod-totalinsts modidx moddb))) (natp totalinsts)) :rule-classes :type-prescription)
Theorem:
(defthm moddb-mod-totalinsts-in-terms-of-instoffset (implies (moddb-mods-ok moddb) (equal (moddb-mod-totalinsts modidx moddb) (moddb-mod-inst-instoffset (moddb-mod-ninsts modidx moddb) modidx moddb))) :rule-classes ((:definition :install-body nil :clique (moddb-mod-inst-instoffset moddb-mod-totalinsts) :controller-alist ((moddb-mod-inst-instoffset t t nil) (moddb-mod-totalinsts t nil)))))
Theorem:
(defthm moddb-mod-inst-instoffset-recursive (implies (moddb-mods-ok moddb) (equal (moddb-mod-inst-instoffset instidx modidx moddb) (if (or (>= (nfix modidx) (nfix (moddb->nmods moddb))) (zp instidx) (zp (elab-mod$a-ninsts (moddb->modsi modidx moddb)))) 0 (+ (moddb-mod-inst-instoffset (1- instidx) modidx moddb) (let* ((submod-idx (elab-mod$a->inst-modidx (1- instidx) (moddb->modsi modidx moddb)))) (if (and (< submod-idx (nfix modidx)) (<= (nfix instidx) (elab-mod$a-ninsts (moddb->modsi modidx moddb)))) (+ 1 (moddb-mod-totalinsts submod-idx moddb)) 0)))))) :rule-classes ((:definition :install-body nil :clique (moddb-mod-inst-instoffset moddb-mod-totalinsts) :controller-alist ((moddb-mod-inst-instoffset t t nil) (moddb-mod-totalinsts t nil)))))
Theorem:
(defthm moddb-mod-inst-instoffset-monotonic (implies (and (<= (nfix n) (nfix m)) (moddb-mods-ok moddb)) (<= (moddb-mod-inst-instoffset n modidx moddb) (moddb-mod-inst-instoffset m modidx moddb))) :rule-classes (:rewrite :linear))
Theorem:
(defthm moddb-totalinsts-rewrite (implies (< (nfix modidx) (nfix (moddb->nmods moddb))) (nat-equiv (g :totalinsts (nth modidx (nth *moddb->modsi* moddb))) (moddb-mod-totalinsts modidx moddb))))
Theorem:
(defthm moddb-mod-totalinsts-of-nfix-modidx (equal (moddb-mod-totalinsts (nfix modidx) moddb) (moddb-mod-totalinsts modidx moddb)))
Theorem:
(defthm moddb-mod-totalinsts-nat-equiv-congruence-on-modidx (implies (nat-equiv modidx modidx-equiv) (equal (moddb-mod-totalinsts modidx moddb) (moddb-mod-totalinsts modidx-equiv moddb))) :rule-classes :congruence)
Theorem:
(defthm moddb-mod-totalinsts-of-moddb-fix-moddb (equal (moddb-mod-totalinsts modidx (moddb-fix moddb)) (moddb-mod-totalinsts modidx moddb)))
Theorem:
(defthm moddb-mod-totalinsts-moddb-equiv-congruence-on-moddb (implies (moddb-equiv moddb moddb-equiv) (equal (moddb-mod-totalinsts modidx moddb) (moddb-mod-totalinsts modidx moddb-equiv))) :rule-classes :congruence)