def nth_append_left
bend-collections-laws-crypto@1.0.0.0 · proofs/lib/list.bend:62
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
62def nth_append_left(-A: Data, +xs: List<&2, A>, +ys: List<&2, A>, +i: Nat, +h: {Nat.is_lt(i, SC.length(A, xs)) == True{} : Bool}) -> {SC.nth(A, SC.append(A, xs, ys), i) == SC.nth(A, xs, i) : Maybe<&2, A>}:
63 match xs i:
64 case Nil{} _:
65 Empty.absurd({SC.nth(A, ys, i) == None{} : Maybe<&2, A>}, N.lt_zero_absurd(i, h))
66 case Con{h1, t} 0n:
67 {==}
68 case Con{h1, t} 1n+p:
69 nth_append_left(A, t, ys, p, h)