def sc_nth_some

bend-collections-laws-math@1.0.0.0 · proofs/lib/list.bend:406

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

406# nth below the length is not None
407def sc_nth_some(-A: Data, +xs: List<&2, A>, +i: Nat, +h: {Nat.is_lt(i, SC.length(A, xs)) == True{} : Bool}, +e: {SC.nth(A, xs, i) == None{} : Maybe<&2, A>}) -> Empty:
408  match xs i:
409    case Nil{} _:
410      N.lt_zero_absurd(i, h)
411    case Con{a, t} 0n:
412      L.none_some(A, a, Equal.sym(Maybe<&2, A>, Some{a}, None{}, e))
413    case Con{a, t} 1n+j:
414      sc_nth_some(A, t, j, h, e)

Uses (11)

Used by (0)

No other definition uses this definition.