]> matita.cs.unibo.it Git - helm.git/blob - helm/ocaml/cic_notation/grafiteAst.ml
use uniform naming for referencing cicNotation* modules
[helm.git] / helm / ocaml / cic_notation / grafiteAst.ml
1 (* Copyright (C) 2004, HELM Team.
2  * 
3  * This file is part of HELM, an Hypertextual, Electronic
4  * Library of Mathematics, developed at the Computer Science
5  * Department, University of Bologna, Italy.
6  * 
7  * HELM is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  * 
12  * HELM is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with HELM; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
20  * MA  02111-1307, USA.
21  * 
22  * For details, see the HELM World-Wide-Web page,
23  * http://helm.cs.unibo.it/
24  *)
25
26 module Ast = CicNotationPt
27
28 type direction = [ `LeftToRight | `RightToLeft ]
29 type 'term reduction_kind =
30  [ `Normalize | `Reduce | `Simpl | `Unfold of 'term option | `Whd ]
31
32 type loc = Ast.location
33
34 type ('term, 'ident) pattern = 'term option * ('ident * 'term) list * 'term
35
36 type ('term, 'ident) type_spec =
37    | Ident of 'ident
38    | Type of UriManager.uri * int 
39
40 type ('term, 'ident) tactic =
41   | Absurd of loc * 'term
42   | Apply of loc * 'term
43   | Assumption of loc
44   | Auto of loc * int option * int option * string option (* depth, width, paramodulation ALB *)
45   | Change of loc * ('term,'ident) pattern * 'term
46   | Clear of loc * 'ident
47   | ClearBody of loc * 'ident
48   | Compare of loc * 'term
49   | Constructor of loc * int
50   | Contradiction of loc
51   | Cut of loc * 'ident option * 'term
52   | DecideEquality of loc
53   | Decompose of loc * ('term, 'ident) type_spec list * 'ident * 'ident list
54   | Discriminate of loc * 'term
55   | Elim of loc * 'term * 'term option * int option * 'ident list
56   | ElimType of loc * 'term * 'term option * int option * 'ident list
57   | Exact of loc * 'term
58   | Exists of loc
59   | Fail of loc
60   | Fold of loc * 'term reduction_kind * 'term * ('term, 'ident) pattern
61   | Fourier of loc
62   | FwdSimpl of loc * string * 'ident list
63   | Generalize of loc * ('term, 'ident) pattern * 'ident option
64   | Goal of loc * int (* change current goal, argument is goal number 1-based *)
65   | IdTac of loc
66   | Injection of loc * 'term
67   | Intros of loc * int option * 'ident list
68   | LApply of loc * int option * 'term list * 'term * 'ident option
69   | Left of loc
70   | LetIn of loc * 'term * 'ident
71   | Reduce of loc * 'term reduction_kind * ('term, 'ident) pattern 
72   | Reflexivity of loc
73   | Replace of loc * ('term, 'ident) pattern * 'term
74   | Rewrite of loc * direction * 'term * ('term, 'ident) pattern
75   | Right of loc
76   | Ring of loc
77   | Split of loc
78   | Symmetry of loc
79   | Transitivity of loc * 'term
80
81 type thm_flavour = Cic.object_flavour
82
83   (** <name, inductive/coinductive, type, constructor list>
84   * true means inductive, false coinductive *)
85 type 'term inductive_type = string * bool * 'term * (string * 'term) list
86
87 type search_kind = [ `Locate | `Hint | `Match | `Elim ]
88
89 type print_kind = [ `Env | `Coer ]
90
91 type 'term macro = 
92   (* Whelp's stuff *)
93   | WHint of loc * 'term 
94   | WMatch of loc * 'term 
95   | WInstance of loc * 'term 
96   | WLocate of loc * string
97   | WElim of loc * 'term
98   (* real macros *)
99 (*   | Abort of loc *)
100   | Print of loc * string
101   | Check of loc * 'term 
102   | Hint of loc
103   | Quit of loc
104 (*   | Redo of loc * int option
105   | Undo of loc * int option *)
106 (*   | Print of loc * print_kind *)
107   | Search_pat of loc * search_kind * string  (* searches with string pattern *)
108   | Search_term of loc * search_kind * 'term  (* searches with term pattern *)
109
110 type alias_spec =
111   | Ident_alias of string * string        (* identifier, uri *)
112   | Symbol_alias of string * int * string (* name, instance no, description *)
113   | Number_alias of int * string          (* instance no, description *)
114
115 type obj =
116   | Inductive of (string * Ast.term) list *
117       Ast.term inductive_type list
118       (** parameters, list of loc * mutual inductive types *)
119   | Theorem of thm_flavour * string * Ast.term *
120       Ast.term option
121       (** flavour, name, type, body
122        * - name is absent when an unnamed theorem is being proved, tipically in
123        *   interactive usage
124        * - body is present when its given along with the command, otherwise it
125        *   will be given in proof editing mode using the tactical language
126        *)
127   | Record of (string * Ast.term) list * string * Ast.term *
128       (string * Ast.term) list
129
130 type ('term,'obj) command =
131   | Default of loc * string * UriManager.uri list
132   | Include of loc * string
133   | Set of loc * string * string
134   | Drop of loc
135   | Qed of loc
136       (** name.
137        * Name is needed when theorem was started without providing a name
138        *)
139   | Coercion of loc * 'term
140   | Alias of loc * alias_spec
141       (** parameters, name, type, fields *) 
142   | Obj of loc * 'obj
143   | Notation of loc * direction option * Ast.term * Gramext.g_assoc *
144       int * Ast.term
145       (* direction, l1 pattern, associativity, precedence, l2 pattern *)
146   | Interpretation of loc *
147       string * (string * Ast.argument_pattern list) *
148         Ast.cic_appl_pattern
149       (* description (i.e. id), symbol, arg pattern, appl pattern *)
150
151     (* DEBUGGING *)
152   | Dump of loc (* dump grammar on stdout *)
153     (* DEBUGGING *)
154   | Render of loc * UriManager.uri (* render library object *)
155
156 type ('term, 'ident) tactical =
157   | Tactic of loc * ('term, 'ident) tactic
158   | Do of loc * int * ('term, 'ident) tactical
159   | Repeat of loc * ('term, 'ident) tactical
160   | Seq of loc * ('term, 'ident) tactical list (* sequential composition *)
161   | Then of loc * ('term, 'ident) tactical * ('term, 'ident) tactical list
162   | First of loc * ('term, 'ident) tactical list
163       (* try a sequence of loc * tacticals until one succeeds, fail otherwise *)
164   | Try of loc * ('term, 'ident) tactical (* try a tactical and mask failures *)
165   | Solve of loc * ('term, 'ident) tactical list
166
167
168 type ('term, 'obj, 'ident) code =
169   | Command of loc * ('term,'obj) command
170   | Macro of loc * 'term macro 
171   | Tactical of loc * ('term, 'ident) tactical
172              
173 type ('term, 'obj, 'ident) comment =
174   | Note of loc * string
175   | Code of loc * ('term, 'obj, 'ident) code
176              
177 type ('term, 'obj, 'ident) statement =
178   | Executable of loc * ('term, 'obj, 'ident) code
179   | Comment of loc * ('term, 'obj, 'ident) comment
180