def u32_refines

bend-collections-laws-math@1.0.0.0 · proofs/lib/lemmas/proofs/word_multiplication.bend:59

import bend-collections-laws-math@1.0.0.0/proofs/lib/lemmas/proofs/word_multiplication.bend as WordMultiplication
import Base
import bend-collections-laws-math@1.0.0.0/proofs/lib/lemmas/spec/numeric.bend as S
import bend-collections-laws-math@1.0.0.0/proofs/lib/lemmas/proofs/numeric.bend as Numeric

59def u32_refines(a: U32, b: U32) -> {U32.mul(a, b) == U32{S.from_nat(32n, Nat.mul(U32.to_nat(a), U32.to_nat(b)))} : U32}:
60  match a b:
61    case U32{+x} U32{+y}:
62      %Equal.sym(Nat, Word.to_nat(32n, x), S.unsigned(32n, x), Numeric.primitive_word_interpretation(32n, x)) : {U32.mul(U32{x}, U32{y}) == U32{S.from_nat(32n, Nat.mul(_, Word.to_nat(32n, y)))} : U32}
63      %Equal.sym(Nat, Word.to_nat(32n, y), S.unsigned(32n, y), Numeric.primitive_word_interpretation(32n, y)) : {U32.mul(U32{x}, U32{y}) == U32{S.from_nat(32n, Nat.mul(S.unsigned(32n, x), _))} : U32}
64      Equal.cong(Word(32n), U32, w => U32{w}, Word.mul(32n, x, y), S.from_nat(32n, Nat.mul(S.unsigned(32n, x), S.unsigned(32n, y))), refines(32n, x, y))

Uses (14)

Used by (1)