def length_take
import bend-collections-laws-math@1.0.0.0/proofs/lib/list.bend as Listimport 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
244def length_take(-A: Data, +xs: List<&2, A>, +k: Nat, +h: {Nat.is_le(k, SC.length(A, xs)) == True{} : Bool}) -> {SC.length(A, List.take(&2, A, xs, k)) == k : Nat}:
245 match xs k:
246 case Nil{} 0n:
247 {==}
248 case Nil{} 1n+p:
249 Empty.absurd({0n == 1n+p : Nat}, L.false_true(h))
250 case Con{x, t} 0n:
251 {==}
252 case Con{x, +t} 1n+p:
253 N.succ_cong(SC.length(A, List.take(&2, A, t, p)), p, length_take(A, t, p, h))
Uses (9)
Used by (0)
No other definition uses this definition.