Supporting proofs for simpadd0.
Here we prove some general supporting theorems that justify the correctness of the transformation, and that can be leveraged to generate proofs when the transformation is run.
First, we show that an expression satisfying c$::expr-zerop successfully translates via the language definition mapping. This is the expression recognized as ``zero'' by this transformation.
Then we prove, via a few theorems that build on each other,
that executing an expression of the form
A subtlety of the theorem about
the equivalence of executing
Theorem:
(defthm ldm-expr-when-expr-zerop (implies (c$::expr-zerop expr) (equal (c$::ldm-expr expr) (mv nil (c::expr-const (c::const-int (c::make-iconst :value 0 :base (c::iconst-base-oct) :unsignedp nil :length (c::iconst-length-none))))))))
Theorem:
(defthm c::sintp-alt-def (equal (c::sintp x) (and (c::valuep x) (c::value-case x :sint))))
Theorem:
(defthm c::add-integer-values-of-sint-and-sint0 (implies (and (c::valuep val) (c::value-case val :sint) (equal sint0 (c::value-sint 0))) (equal (c::add-integer-values val sint0) val)))
Theorem:
(defthm c::uaconvert-values-of-sint-and-sint0 (implies (and (c::valuep val) (c::value-case val :sint) (equal sint0 (c::value-sint 0))) (equal (c::uaconvert-values val sint0) (mv val sint0))))
Theorem:
(defthm c::add-arithmetic-values-of-sint-and-sint0 (implies (and (c::valuep val) (c::value-case val :sint) (equal sint0 (c::value-sint 0))) (equal (c::add-arithmetic-values val sint0) val)))
Theorem:
(defthm c::add-values-of-sint-and-sint0 (implies (and (c::valuep val) (c::value-case val :sint) (equal sint0 (c::value-sint 0))) (equal (c::add-values val sint0) val)))
Theorem:
(defthm exec-of-var+zero-to-exec-var (implies (and (c::objdesign-of-var var compst) (c$::expr-zerop zero)) (b* ((val (c::read-object (c::objdesign-of-var var compst) compst))) (implies (and (c::valuep val) (c::value-case val :sint)) (equal (c::expr-value->value (c::exec-expr-pure (c::expr-binary (c::binop-add) (c::expr-ident var) (mv-nth 1 (c$::ldm-expr zero))) compst)) (c::expr-value->value (c::exec-expr-pure (c::expr-ident var) compst)))))))