Skip to content

Instantly share code, notes, and snippets.

@mkwatson
Last active May 7, 2018 22:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mkwatson/dfd375513f47edb6f57d370dd8dd4729 to your computer and use it in GitHub Desktop.
Save mkwatson/dfd375513f47edb6f57d370dd8dd4729 to your computer and use it in GitHub Desktop.
myReverse : Vect n elem -> Vect n elem
myReverse [] = []
myReverse {n = S k} (x :: xs)
= let result = myReverse xs ++ [x] in
rewrite plusCommutative 1 k in ?myReverse_rhs_2
{- my holes
elem : Type
k : Nat
x : elem
xs : Vect k elem
result : Vect (k + 1) elem
_rewrite_rule : fromInteger 1 + k = k + fromInteger 1
-----------------------------------------------------------------------------------
myReverse_rhs_2 : (\replaced => Vect replaced elem) (plus k (fromInteger 1))
-}
{- copied from textbook page 224
elem : Type
k : Nat
x : elem
xs : Vect k elem
result : Vect (plus k 1) elem
_rewrite_rule : plus k 1 = S k
--------------------------------------
myReverse_rhs_2 : Vect (plus k 1) elem
-}
@mkwatson
Copy link
Author

mkwatson commented May 7, 2018

I'm using Idris Version 1.1.1

@mkwatson
Copy link
Author

mkwatson commented May 7, 2018

I'm also using Emacs idris-mode 20171212.759

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment