def split_at_element

stelliferous@0.0.2.0 · proofs/nat_order.bend:71

import stelliferous@0.0.2.0/proofs/nat_order.bend as NatOrder
import Base
import stelliferous@0.0.2.0/proofs/word_encoding.bend as WordEncoding

71def split_at_element(+total: Nat,+index: Nat,inside: {Nat.is_lt(index,total) == True{} : Bool}) ->
72  {Nat.add(index,1n+Nat.sub(total,1n+index)) == total : Nat}:
73  match total index:
74    case 0n 0n: Empty.absurd({1n == 0n : Nat},WordEncoding.false_true(inside))
75    case 1n+ +rest 0n:
76      Equal.cong(Nat,Nat,n => 1n+n,Nat.sub(rest,0n),rest,subtract_zero(rest))
77    case 0n 1n+ +index:
78      Empty.absurd({Nat.add(1n+index,1n) == 0n : Nat},WordEncoding.false_true(inside))
79    case 1n+ +rest 1n+ +index:
80      Equal.cong(Nat,Nat,n => 1n+n,Nat.add(index,1n+Nat.sub(rest,1n+index)),rest,split_at_element(rest,index,inside))

Uses (9)

Used by (0)

No other definition uses this definition.