def nth_update_same

bend-collections-laws-crypto@1.0.0.0 · proofs/lib/list.bend:118

import bend-collections-laws-crypto@1.0.0.0/proofs/lib/list.bend as List
import Base
import bend-collections-laws-crypto@1.0.0.0/proofs/lib/nat.bend as N
import bend-collections-laws-crypto@1.0.0.0/spec/lib/common.bend as SC

118def nth_update_same(-A: Data, +xs: List<&2, A>, +i: Nat, +v: A, +h: {Nat.is_lt(i, SC.length(A, xs)) == True{} : Bool}) -> {SC.nth(A, SC.update(A, xs, i, v), i) == Some{v} : Maybe<&2, A>}:
119  match xs i:
120    case Nil{} _:
121      Empty.absurd({SC.nth(A, Nil{}, i) == Some{v} : Maybe<&2, A>}, N.lt_zero_absurd(i, h))
122    case Con{h1, t} 0n:
123      {==}
124    case Con{h1, t} 1n+p:
125      nth_update_same(A, t, p, v, h)

Uses (10)

Used by (1)