def hit

bendtorch-core@0.1.0.0 · src/tensor/from_values_contract.bend:117

import bendtorch-core@0.1.0.0/src/tensor/from_values_contract.bend as FromValuesContract
import Base
import bendtorch-core@0.1.0.0/src/storage/LAWS.bend as StorageLaws
import bendtorch-core@0.1.0.0/src/storage/arith.bend as Arith

117def hit(+cursor: Nat, +remaining: Nat, +limit: U32, +index: U32, +value: F32, +base: F32,
118  room: {Nat.is_le(Nat.add(cursor, 1n+remaining), U32.to_nat(limit)) == True{} : Bool},
119  at: {U32.to_nat(index) == cursor : Nat}) ->
120  {StorageLaws.latest(U32.to_nat(limit), StorageLaws.Write{U32.from_nat(cursor), value}, index, base) == value : F32}:
121  +room = room
122  %Equal.sym(Nat, U32.to_nat(U32.from_nat(cursor)), cursor, cursor_exact(cursor, remaining, limit, room)) :
123    {Bool.pick(F32, Bool.and(Nat.is_lt(_, U32.to_nat(limit)), Nat.is_eq(_, U32.to_nat(index))), value, base) == value : F32}
124  %Equal.sym(Nat, U32.to_nat(index), cursor, at) :
125    {Bool.pick(F32, Bool.and(Nat.is_lt(cursor, U32.to_nat(limit)), Nat.is_eq(cursor, _)), value, base) == value : F32}
126  %Equal.sym(Bool, Nat.is_lt(cursor, U32.to_nat(limit)), True{}, cursor_lt(cursor, remaining, U32.to_nat(limit), room)) :
127    {Bool.pick(F32, Bool.and(_, Nat.is_eq(cursor, cursor)), value, base) == value : F32}
128  %Equal.sym(Bool, Nat.is_eq(cursor, cursor), True{}, Arith.eq_refl(cursor)) :
129    {Bool.pick(F32, _, value, base) == value : F32}
130  {==}

Uses (18)

Used by (1)