1module Language.Reflection
6 -- ^ User-provided name
7 | NS TTName (List String)
10 -- ^ Machine chosen names
12 -- ^ Name of somethng which is never used in scope
16userSuppliedName : String -> TTName
20 -- ^ universe variable
22 -- ^ explicit universe variable
25-- | Primitive constants
26data Const = I Int | BI Nat | Fl Float | Ch Char | Str String
27 | IType | BIType | FlType | ChType | StrType
28 | B8 Bits8 | B16 Bits16 | B32 Bits32 | B64 Bits64
29 | B8Type | B16Type | B32Type | B64Type
30 | PtrType | VoidType | Forgot
34abstract class ReflConst (a : Type) where
37instance ReflConst Int where
40instance ReflConst Nat where
43instance ReflConst Float where
46instance ReflConst Char where
49instance ReflConst String where
52instance ReflConst Bits8 where
55instance ReflConst Bits16 where
58instance ReflConst Bits32 where
61instance ReflConst Bits64 where
65reflectConstant: (ReflConst a) => a -> Const
66reflectConstant = toConst
69-- | Types of named references
71 -- ^ reference which is just bound, e.g. by intro
73 -- ^ reference to a variable
75 -- ^ constructor with tag and number
77 -- ^ type constructor with tag and number
80-- | Types annotations for bound variables in different
93instance Functor Binder where
94 map f (Lam x) = Lam (f x)
95 map f (Pi x) = Pi (f x)
96 map f (Let x y) = Let (f x) (f y)
97 map f (NLet x y) = NLet (f x) (f y)
98 map f (Hole x) = Hole (f x)
99 map f (GHole x) = GHole (f x)
100 map f (Guess x y) = Guess (f x) (f y)
101 map f (PVar x) = PVar (f x)
102 map f (PVTy x) = PVTy (f x)
104instance Foldable Binder where
105 foldr f z (Lam x) = f x z
106 foldr f z (Pi x) = f x z
107 foldr f z (Let x y) = f x (f y z)
108 foldr f z (NLet x y) = f x (f y z)
109 foldr f z (Hole x) = f x z
110 foldr f z (GHole x) = f x z
111 foldr f z (Guess x y) = f x (f y z)
112 foldr f z (PVar x) = f x z
113 foldr f z (PVTy x) = f x z
115instance Traversable Binder where
116 traverse f (Lam x) = [| Lam (f x) |]
117 traverse f (Pi x) = [| Pi (f x) |]
118 traverse f (Let x y) = [| Let (f x) (f y) |]
119 traverse f (NLet x y) = [| NLet (f x) (f y) |]
120 traverse f (Hole x) = [| Hole (f x) |]
121 traverse f (GHole x) = [| GHole (f x) |]
122 traverse f (Guess x y) = [| Guess (f x) (f y) |]
123 traverse f (PVar x) = [| PVar (f x) |]
124 traverse f (PVTy x) = [| PVTy (f x) |]
127-- | Reflection of the well typed core language
128data TT = P NameType TTName TT
132 | Bind TTName (Binder TT) TT
133 -- ^ type annotated named bindings
135 -- ^ (named) application of a function to a value
139 -- ^ argument projection; runtime only
143 -- ^ impossible terms
149-- | Raw terms without types
151 | RBind TTName (Binder Raw) Raw
159data Tactic = Try Tactic Tactic
160 -- ^ try the first tactic and resort to the second one on failure
161 | GoalType String Tactic
162 -- ^ only run if the goal has the right type
164 -- ^ resolve function name, find matching arguments in the
165 -- context and compute the proof target
167 -- ^ apply both tactics in sequence
169 -- ^ intelligently construct the proof target from the context
171 -- ^ infer the proof target from the context
173 -- ^ introduce all variables into the context
175 -- ^ introduce a named variable into the context, use the
176 -- first one if the given name is not found
178 -- ^ invoke the reflected rep. of another tactic
180 -- ^ turn a value into its reflected representation
182 -- ^ turn a raw value back into a term
184 -- ^ use the given value to conclude the proof
186 -- ^ focus a named hole
188 -- ^ rewrite using the reflected rep. of a equality proof
190 -- ^ do induction on the particular expression
192 -- ^ name a reflected term
193 | LetTacTy TTName TT TT
194 -- ^ name a reflected term and type it
196 -- ^ normalise the context
197%name Tactic tac, tac'
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