def times_classify

bendtorch-core@0.1.0.0 · src/tensor/signed_PROOF.bend:343

import bendtorch-core@0.1.0.0/src/tensor/signed_PROOF.bend as SignedPROOF
import Base
import bendtorch-core@0.1.0.0/src/shape/core.bend as Shape
import bendtorch-core@0.1.0.0/src/shape/nat_proofs.bend as NatProofs
import bendtorch-core@0.1.0.0/src/tensor/signed.bend as Signed
import bendtorch-core@0.1.0.0/src/tensor/signed_LAWS.bend as Laws

343# times on a classified product classifies the product times the size.
344def times_classify(+bound: Nat, +size: Nat, +product: Nat) ->
345  {Signed.times(bound, size, Laws.classify(bound, product)) == Laws.classify(bound, Nat.mul(size, product)) : Signed.Product}:
346  match size:
347    case 0n:
348      {==}
349    case 1n+less:
350      match product:
351        case 0n:
352          %Equal.sym(Nat, Nat.mul(1n+less, 0n), 0n, NatProofs.mul_zero_right(1n+less)) :
353            {Signed.ZeroProduct{} == Laws.classify(bound, _) : Signed.Product}
354          {==}
355        case 1n+rest:
356          times_within(bound, less, rest, Shape.bool_case(Nat.is_le(1n+rest, bound)))

Uses (10)

Used by (1)