FromValuesContract.written_at: def of bendtorch-core@0.1.0.0 Import: import bendtorch-core@0.1.0.0/src/tensor/from_values_contract.bend as FromValuesContract Lines 132-160 of bendtorch-core@0.1.0.0/src/tensor/from_values_contract.bend: https://jend.leeeet.dev/read.txt?path=bendtorch-core@0.1.0.0/src/tensor/from_values_contract.bend&start_line=132&end_line=160 import Base import bendtorch-core@0.1.0.0/src/storage/LAWS.bend as StorageLaws import bendtorch-core@0.1.0.0/src/storage/api.bend as Api import bendtorch-core@0.1.0.0/src/storage/arith.bend as Arith import bendtorch-core@0.1.0.0/src/tensor/word_conversion.bend as Conversion def written_at(+values: List<&2, F32>, +cursor: Nat, +limit: U32, +index: U32, +base: F32, +offset: Nat, +room: {Nat.is_le(Nat.add(cursor, List.length(&2, F32, values)), U32.to_nat(limit)) == True{} : Bool}, at: {U32.to_nat(index) == Nat.add(cursor, offset) : Nat}, below: {Nat.is_lt(offset, List.length(&2, F32, values)) == True{} : Bool}) -> {Some{StorageLaws.expected(writes(values, cursor), U32.to_nat(limit), index, base)} == List.get(&2, F32, values, offset) : Maybe<&2, F32>}: match values offset: case Nil{} _: Empty.absurd({Some{base} == None{} : Maybe<&2, F32>}, Arith.lt_zero(offset, below)) case +value <> +rest 0n: +exact = Equal.trans(Nat, U32.to_nat(index), Nat.add(cursor, 0n), cursor, at, Conversion.add_zero(cursor)) Equal.cong(F32, Maybe<&2, F32>, found => Some{found}, StorageLaws.expected(writes(rest, 1n+cursor), U32.to_nat(limit), index, StorageLaws.latest(U32.to_nat(limit), StorageLaws.Write{U32.from_nat(cursor), value}, index, base)), value, Equal.trans(F32, StorageLaws.expected(writes(rest, 1n+cursor), U32.to_nat(limit), index, StorageLaws.latest(U32.to_nat(limit), StorageLaws.Write{U32.from_nat(cursor), value}, index, base)), StorageLaws.latest(U32.to_nat(limit), StorageLaws.Write{U32.from_nat(cursor), value}, index, base), value, later_writes(rest, 1n+cursor, limit, index, StorageLaws.latest(U32.to_nat(limit), StorageLaws.Write{U32.from_nat(cursor), value}, index, base), room_next(cursor, List.length(&2, F32, rest), U32.to_nat(limit), room), %Equal.sym(Nat, U32.to_nat(index), cursor, exact) : {Nat.is_lt(_, 1n+cursor) == True{} : Bool} Arith.lt_succ(cursor, cursor, Api.le_refl(cursor))), hit(cursor, List.length(&2, F32, rest), limit, index, value, base, room, exact))) case +value <> +rest 1n+next: written_at(rest, 1n+cursor, limit, index, StorageLaws.latest(U32.to_nat(limit), StorageLaws.Write{U32.from_nat(cursor), value}, index, base), next, room_next(cursor, List.length(&2, F32, rest), U32.to_nat(limit), room), Equal.trans(Nat, U32.to_nat(index), Nat.add(cursor, 1n+next), 1n+Nat.add(cursor, next), at, Arith.add_succ(cursor, next)), below) Uses (29): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Empty.absurd https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Equal.cong https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Equal.sym https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Equal.trans https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=F32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List.get https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List.length https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Maybe https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat.add https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat.is_le https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat.is_lt https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.from_nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.to_nat https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/storage/LAWS.bend&name=Op https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/storage/LAWS.bend&name=expected https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/storage/LAWS.bend&name=latest https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/storage/api.bend&name=le_refl https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/storage/arith.bend&name=add_succ https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/storage/arith.bend&name=lt_succ https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/storage/arith.bend&name=lt_zero https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/from_values_contract.bend&name=hit https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/from_values_contract.bend&name=later_writes https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/from_values_contract.bend&name=room_next https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/from_values_contract.bend&name=writes https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/word_conversion.bend&name=add_zero