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 Integer | 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 Integer 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
159||| Error reports are a list of report parts
160data ErrorReportPart = TextPart String
163 | SubReport (List ErrorReportPart)
164%name ErrorReportPart part, p
166data Tactic = Try Tactic Tactic
167 -- ^ try the first tactic and resort to the second one on failure
168 | GoalType String Tactic
169 -- ^ only run if the goal has the right type
171 -- ^ resolve function name, find matching arguments in the
172 -- context and compute the proof target
174 -- ^ apply both tactics in sequence
176 -- ^ intelligently construct the proof target from the context
178 -- ^ build a proof by applying contructors up to a maximum depth
180 -- ^ resolve a type class
182 -- ^ infer the proof target from the context
184 -- ^ introduce all variables into the context
186 -- ^ introduce a named variable into the context, use the
187 -- first one if the given name is not found
189 -- ^ invoke the reflected rep. of another tactic
191 -- ^ turn a value into its reflected representation
193 -- ^ use a %reflection function
195 -- ^ turn a raw value back into a term
197 -- ^ use the given value to conclude the proof
199 -- ^ focus a named hole
201 -- ^ rewrite using the reflected rep. of a equality proof
203 -- ^ do induction on the particular expression
205 -- ^ do case analysis on particular expression
207 -- ^ name a reflected term
208 | LetTacTy TTName TT TT
209 -- ^ name a reflected term and type it
211 -- ^ normalise the context
214 | Fail (List ErrorReportPart)
215%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