axiom/WrapNat8
Reference for mo:core/axiom/WrapNat8 in the core library.
This page lists trusted proof lemmas. Calling one adds its ensures facts after its requires clauses are proven; the lemma body itself is part of the trusted base, not a verifier-checked derivation. Use these when ordinary SMT arithmetic needs a precise algebraic step.
Import
mo:core/axiom/WrapNat8
Status
- Spec-only axiom module
Public API
Types
Nat8
Lemmas
wrapSpec(x : Nat8) : ()
Establishes toNat(x) == toNat(x) % 256 in the current proof context.
Contract
ensures toNat(x) == toNat(x) % 256;
Use when: a proof needs this fact explicitly and the solver has not derived it automatically.
add(a : Nat8, b : Nat8) : ()
Establishes toNat(Nat8.addWrap(a, b)) == (toNat(a) + toNat(b)) % 256 in the current proof context.
Contract
ensures toNat(Nat8.addWrap(a, b)) == (toNat(a) + toNat(b)) % 256;
Use when: a proof needs this fact explicitly and the solver has not derived it automatically.
sub(a : Nat8, b : Nat8) : ()
Establishes toNat(Nat8.subWrap(a, b)) == (toNat(a) + 256 - toNat(b)) % 256 in the current proof context.
Contract
ensures toNat(Nat8.subWrap(a, b)) == (toNat(a) + 256 - toNat(b)) % 256;
Use when: a proof needs this fact explicitly and the solver has not derived it automatically.
mul(a : Nat8, b : Nat8) : ()
Establishes toNat(Nat8.mulWrap(a, b)) == (toNat(a) * toNat(b)) % 256 in the current proof context.
Contract
ensures toNat(Nat8.mulWrap(a, b)) == (toNat(a) * toNat(b)) % 256;
Use when: a proof needs this fact explicitly and the solver has not derived it automatically.
noOverflowAdd(a : Nat8, b : Nat8) : ()
Establishes toNat(Nat8.addWrap(a, b)) == toNat(a) + toNat(b) in the current proof context.
Contract
requires toNat(a) + toNat(b) < 256;
ensures toNat(Nat8.addWrap(a, b)) == toNat(a) + toNat(b);
Use when: a proof needs this fact explicitly and the solver has not derived it automatically.
noOverflowMul(a : Nat8, b : Nat8) : ()
Establishes toNat(Nat8.mulWrap(a, b)) == toNat(a) * toNat(b) in the current proof context.
Contract
requires toNat(a) * toNat(b) < 256;
ensures toNat(Nat8.mulWrap(a, b)) == toNat(a) * toNat(b);
Use when: a proof needs this fact explicitly and the solver has not derived it automatically.
Summary
- Spec-only axiom module under
mo:core/axiom/WrapNat8. - Exposes 6 trusted lemmas.