src/tensor/word_conversion.bend checks
raw source on the hub · import bendtorch-core@0.1.0.0/src/tensor/word_conversion.bend as Word_conversion
6 imports
import Base import ../storage/arith.bend as Arith import ../shape/core.bend as Shape import ./word_injective.bend as Injective import ../storage/model.bend as Model import ../shape/nat_proofs.bend as NatProof
Definitions
def word_has_zero source · line 8 · raw
@width:Nat -> @word:Word(width) -> Bool
def greater_low_bit_tail source · line 19 · raw
@comparison:Cmp -> @+bit:Bool -> @accepted:{Cmp.is_lt(Word.cmp.fin(True{}, bit, comparison)) == True{} : Bool} -> {Cmp.is_lt(comparison) == True{} : Bool}
def word_lt_has_zero source · line 34 · raw
@+width:Nat -> @+left:Word(width) -> @+right:Word(width) -> @accepted:{Cmp.is_lt(Word.cmp(width, left, right)) == True{} : Bool} -> {word_has_zero(width, left) == True{} : Bool}
def word_increment_exact source · line 47 · raw
@+width:Nat -> @+word:Word(width) -> @zero:{word_has_zero(width, word) == True{} : Bool} -> {Word.to_nat(width, Word.inc(width, word)) == 1n+Word.to_nat(width, word) : Nat}
def increment_below_exact source · line 60 · raw
@+word:U32 -> @+limit:U32 -> @below:{U32.is_lt(word, limit) == True{} : Bool} -> {U32.to_nat(U32.inc(word)) == 1n+U32.to_nat(word) : Nat}
def le_predecessor source · line 66 · raw
@+number:Nat -> @+bound:Nat -> @within:{Nat.is_le(1n+number, bound) == True{} : Bool} -> {Nat.is_le(number, bound) == True{} : Bool}
def le_successor_lt source · line 74 · raw
@+number:Nat -> @+bound:Nat -> @within:{Nat.is_le(1n+number, bound) == True{} : Bool} -> {Nat.is_lt(number, bound) == True{} : Bool}
def natural_word_exact source · line 82 · raw
@+number:Nat -> @+limit:U32 -> @+within:{Nat.is_le(number, U32.to_nat(limit)) == True{} : Bool} -> {U32.to_nat(U32.from_nat(number)) == number : Nat}
def le_reflexive source · line 98 · raw
@+number:Nat -> {Nat.is_le(number, number) == True{} : Bool}
def word_natural_exact source · line 105 · raw
@+word:U32 -> {U32.from_nat(U32.to_nat(word)) == word : U32}
def double_le source · line 109 · raw
@+left:Nat -> @+right:Nat -> @bound:{Nat.is_le(left, right) == True{} : Bool} -> {Nat.is_le(Nat.double(left), Nat.double(right)) == True{} : Bool}
def le_trans source · line 121 · raw
@+left:Nat -> @+middle:Nat -> @+right:Nat -> @first:{Nat.is_le(left, middle) == True{} : Bool} -> @second:{Nat.is_le(middle, right) == True{} : Bool} -> {Nat.is_le(left, right) == True{} : Bool}
def word_increment_le source · line 139 · raw
@+width:Nat -> @+word:Word(width) -> {Nat.is_le(Word.to_nat(width, Word.inc(width, word)), 1n+Word.to_nat(width, word)) == True{} : Bool}
def increment_le source · line 151 · raw
@+word:U32 -> {Nat.is_le(U32.to_nat(U32.inc(word)), 1n+U32.to_nat(word)) == True{} : Bool}
def natural_word_le source · line 157 · raw
@+number:Nat -> {Nat.is_le(U32.to_nat(U32.from_nat(number)), number) == True{} : Bool}
def lt_le source · line 166 · raw
@+number:Nat -> @+bound:Nat -> @below:{Nat.is_lt(number, bound) == True{} : Bool} -> {Nat.is_le(number, bound) == True{} : Bool}
def naturals_words_fitting source · line 178 · raw
@+dims:List<&2, U32> -> @+values:List<&2, Nat> -> @+fit:{True{} == 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.fit(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.naturals(dims), values) : Bool} -> {0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.naturals(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.words(values)) == values : List<&2, Nat>}
def add_zero source · line 203 · raw
@+number:Nat -> {Nat.add(number, 0n) == number : Nat}
def capacity_product source · line 210 · raw
@+left:Nat -> @+right:Nat -> {0x1689e5deb278c16abd3bd45eac101ef3/src/storage/model.capacity(Nat.add(left, right)) == Nat.mul(0x1689e5deb278c16abd3bd45eac101ef3/src/storage/model.capacity(left), 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/model.capacity(right)) : Nat}
def small_power source · line 225 · raw
{0x1689e5deb278c16abd3bd45eac101ef3/src/storage/model.capacity(8n) == 256n : Nat}
def chunk_power source · line 228 · raw
{0x1689e5deb278c16abd3bd45eac101ef3/src/storage/model.capacity(12n) == 4096n : Nat}
def add4096 source · line 231 · raw
@-tail:Nat -> {Nat.add(4096n, tail) == Nat.add(4096n, tail) : Nat}
def literal_product_step source · line 234 · raw
@-count:Nat -> @-previous:Nat -> @-value:Nat -> @product:{Nat.mul(count, 4096n) == previous : Nat} -> @chunk:{Nat.add(4096n, previous) == value : Nat} -> {Nat.mul(1n+count, 4096n) == value : Nat}
def literal_product_zero source · line 241 · raw
{Nat.mul(0n, 4096n) == 0n : Nat}
def literal_product_16 source · line 244 · raw
{Nat.mul(16n, 4096n) == 65536n : Nat}
def literal_product_32 source · line 263 · raw
{Nat.mul(32n, 4096n) == 131072n : Nat}
def literal_product_48 source · line 282 · raw
{Nat.mul(48n, 4096n) == 196608n : Nat}
def literal_product_64 source · line 301 · raw
{Nat.mul(64n, 4096n) == 262144n : Nat}
def literal_product_80 source · line 320 · raw
{Nat.mul(80n, 4096n) == 327680n : Nat}
def literal_product_96 source · line 339 · raw
{Nat.mul(96n, 4096n) == 393216n : Nat}
def literal_product_112 source · line 358 · raw
{Nat.mul(112n, 4096n) == 458752n : Nat}
def literal_product_128 source · line 377 · raw
{Nat.mul(128n, 4096n) == 524288n : Nat}
def literal_product_144 source · line 396 · raw
{Nat.mul(144n, 4096n) == 589824n : Nat}
def literal_product_160 source · line 415 · raw
{Nat.mul(160n, 4096n) == 655360n : Nat}
def literal_product_176 source · line 434 · raw
{Nat.mul(176n, 4096n) == 720896n : Nat}
def literal_product_192 source · line 453 · raw
{Nat.mul(192n, 4096n) == 786432n : Nat}
def literal_product_208 source · line 472 · raw
{Nat.mul(208n, 4096n) == 851968n : Nat}
def literal_product_224 source · line 491 · raw
{Nat.mul(224n, 4096n) == 917504n : Nat}
def literal_product_240 source · line 510 · raw
{Nat.mul(240n, 4096n) == 983040n : Nat}
def literal_product_256 source · line 529 · raw
{Nat.mul(256n, 4096n) == 1048576n : Nat}
def capacity_word_bits source · line 548 · raw
{1048576 == U32{0x1689e5deb278c16abd3bd45eac101ef3/src/storage/arith.unit(32n, 20n)} : U32}
def u32_unit_nat source · line 551 · raw
@+bit:Nat -> @below:{Nat.is_lt(bit, 32n) == True{} : Bool} -> {0x1689e5deb278c16abd3bd45eac101ef3/src/storage/model.capacity(bit) == U32.to_nat(U32{0x1689e5deb278c16abd3bd45eac101ef3/src/storage/arith.unit(32n, bit)}) : Nat}
def capacity_word_model source · line 555 · raw
{U32.to_nat(1048576) == 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/model.capacity(20n) : Nat}
def capacity_product_at source · line 560 · raw
@+left:Nat -> @+right:Nat -> @+sum:Nat -> @equal:{Nat.add(left, right) == sum : Nat} -> {0x1689e5deb278c16abd3bd45eac101ef3/src/storage/model.capacity(sum) == Nat.mul(0x1689e5deb278c16abd3bd45eac101ef3/src/storage/model.capacity(left), 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/model.capacity(right)) : Nat}
def capacity_model_product source · line 567 · raw
{0x1689e5deb278c16abd3bd45eac101ef3/src/storage/model.capacity(20n) == Nat.mul(256n, 4096n) : Nat}
def capacity_word_nat source · line 574 · raw
{U32.to_nat(1048576) == 1048576n : Nat}
def capacity_within source · line 579 · raw
@+number:Nat -> @within:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.LE(number, 1048576n) -> {Nat.is_le(number, U32.to_nat(1048576)) == True{} : Bool}
def capacity_natural_word_exact source · line 585 · raw
@+number:Nat -> @within:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.LE(number, 1048576n) -> {U32.to_nat(U32.from_nat(number)) == number : Nat}
def shape_capacity source · line 589 · raw
@+shape:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Shape -> 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.LE(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.elements(shape), 1048576n)
def shape_count_exact source · line 595 · raw
@+shape:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Shape -> {U32.to_nat(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.count(shape)) == 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.elements(shape) : Nat}
def shape_count_within source · line 598 · raw
@+shape:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Shape -> {U32.is_le(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.count(shape), 1048576) == True{} : Bool}