Idris2/tests/idris2/linear015/Issue1861.idr
2021-11-25 17:07:05 +00:00

20 lines
530 B
Idris

import Data.Vect
import Data.Nat
export
lemmaPlusOneRight : (n : Nat) -> n + 1 = S n
lemmaPlusOneRight n = rewrite plusCommutative n 1 in Refl
public export
consLin : (1 _ : Unit) -> (1 _ : Vect n Unit) -> Vect (S n) Unit
consLin () [] = [()]
consLin () (x :: xs) = () :: x :: xs
consNonLin : Unit -> Vect n Unit -> Vect (n+1) Unit
consNonLin u us = rewrite lemmaPlusOneRight n in u `consLin` us
consLin2 : (1 _ : Unit) -> (1 _ : Vect n Unit) -> Vect (n+1) Unit
consLin2 u us = rewrite lemmaPlusOneRight n in u `consLin` us