3import Language.Reflection
8--------------------------------------------------------------------------------
10--------------------------------------------------------------------------------
12data Elem : a -> Vect a k -> Type where
13 Here : {xs : Vect a k} -> Elem x (x::xs)
14 There : {xs : Vect a k} -> Elem x xs -> Elem x (y::xs)
16findElem : Nat -> List (TTName, Binder TT) -> TT -> Tactic
17findElem O ctxt goal = Refine "Here" `Seq` Solve
18findElem (S n) ctxt goal = GoalType "Elem" (Try (Refine "Here" `Seq` Solve) (Refine "There" `Seq` (Solve `Seq` findElem n ctxt goal)))
20replaceElem : (xs : Vect t k) -> Elem x xs -> (y : t) -> (ys : Vect t k ** Elem y ys)
21replaceElem (x::xs) Here y = (y :: xs ** Here)
22replaceElem (x::xs) (There xinxs) y with (replaceElem xs xinxs y)
23 | (ys ** yinys) = (x :: ys ** There yinys)
25replaceByElem : (xs : Vect t k) -> Elem x xs -> t -> Vect t k
26replaceByElem (x::xs) Here y = y :: xs
27replaceByElem (x::xs) (There xinxs) y = x :: replaceByElem xs xinxs y
29mapElem : {xs : Vect t k} -> {f : t -> u} -> Elem x xs -> Elem (f x) (map f xs)
31mapElem (There e) = There (mapElem e)
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list