Skip to main content

axiom/WrapInt8

Reference for mo:core/axiom/WrapInt8 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/WrapInt8

Status

  • Spec-only axiom module

Public API

Types

  • Int8

Lemmas

wrapSpec(x : Int8) : ()

Establishes bits(x) == bits(x) % 256 in the current proof context.

Contract

ensures bits(x) == bits(x) % 256;

Use when: a proof needs this fact explicitly and the solver has not derived it automatically.

add(a : Int8, b : Int8) : ()

Establishes bits(Int8.addWrap(a, b)) == (bits(a) + bits(b)) % 256 in the current proof context.

Contract

ensures bits(Int8.addWrap(a, b)) == (bits(a) + bits(b)) % 256;

Use when: a proof needs this fact explicitly and the solver has not derived it automatically.

sub(a : Int8, b : Int8) : ()

Establishes bits(Int8.subWrap(a, b)) == (bits(a) + 256 - bits(b)) % 256 in the current proof context.

Contract

ensures bits(Int8.subWrap(a, b)) == (bits(a) + 256 - bits(b)) % 256;

Use when: a proof needs this fact explicitly and the solver has not derived it automatically.

mul(a : Int8, b : Int8) : ()

Establishes bits(Int8.mulWrap(a, b)) == (bits(a) * bits(b)) % 256 in the current proof context.

Contract

ensures bits(Int8.mulWrap(a, b)) == (bits(a) * bits(b)) % 256;

Use when: a proof needs this fact explicitly and the solver has not derived it automatically.

noOverflowAdd(a : Int8, b : Int8) : ()

Establishes toSigned(Int8.addWrap(a, b)) == toSigned(a) + toSigned(b) in the current proof context.

Contract

requires -128 <= toSigned(a) + toSigned(b);
requires toSigned(a) + toSigned(b) <= 127;
ensures toSigned(Int8.addWrap(a, b)) == toSigned(a) + toSigned(b);

Use when: a proof needs this fact explicitly and the solver has not derived it automatically.

noOverflowMul(a : Int8, b : Int8) : ()

Establishes toSigned(Int8.mulWrap(a, b)) == toSigned(a) * toSigned(b) in the current proof context.

Contract

requires -128 <= toSigned(a) * toSigned(b);
requires toSigned(a) * toSigned(b) <= 127;
ensures toSigned(Int8.mulWrap(a, b)) == toSigned(a) * toSigned(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/WrapInt8.
  • Exposes 6 trusted lemmas.