]> matita.cs.unibo.it Git - helm.git/blob - matita/components/grafite/grafiteAst.ml
QED takes a boolean parameter governing indexing.
[helm.git] / matita / components / grafite / 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 (* $Id$ *)
27
28 type direction = [ `LeftToRight | `RightToLeft ]
29
30 type loc = Stdpp.location
31
32 type nterm = NotationPt.term
33
34 type npattern = 
35  nterm option * (string * nterm) list * nterm option
36
37 type auto_params = nterm list option * (string*string) list
38
39 type ntactic =
40    | NApply of loc * nterm
41    | NSmartApply of loc * nterm
42    | NAssert of loc * ((string * [`Decl of nterm | `Def of nterm * nterm]) list * nterm) list
43    | NCases of loc * nterm * npattern  
44    | NCase1 of loc * string
45    | NChange of loc * npattern * nterm
46    | NClear of loc * string list
47    | NConstructor of loc * int option * nterm list
48    | NCut of loc * nterm
49 (* | NDiscriminate of loc * nterm
50    | NSubst of loc * nterm *)
51    | NDestruct of loc * string list option * string list
52    | NElim of loc * nterm * npattern  
53    | NGeneralize of loc * npattern
54    | NId of loc
55    | NIntro of loc * string
56    | NIntros of loc * string list
57    | NInversion of loc * nterm * npattern  
58    | NLApply of loc * nterm
59    | NLetIn of loc * npattern * nterm * string
60    | NReduce of loc * [ `Normalize of bool | `Whd of bool ] * npattern
61    | NRewrite of loc * direction * nterm * npattern
62    | NAuto of loc * auto_params
63    | NDot of loc
64    | NSemicolon of loc
65    | NBranch of loc
66    | NShift of loc
67    | NPos of loc * int list
68    | NPosbyname of loc * string
69    | NWildcard of loc
70    | NMerge of loc
71    | NSkip of loc
72    | NFocus of loc * int list
73    | NUnfocus of loc
74    | NTry of loc * ntactic
75    | NAssumption of loc
76    | NRepeat of loc * ntactic
77    | NBlock of loc * ntactic list
78
79 type nmacro =
80   | NCheck of loc * nterm
81   | Screenshot of loc * string
82   | NAutoInteractive of loc * auto_params
83   | NIntroGuess of loc
84
85 (** To be increased each time the command type below changes, used for "safe"
86  * marshalling *)
87 let magic = 36
88
89 (* composed magic: term + command magics. No need to change this value *)
90 let magic = magic + 10000 * NotationPt.magic
91
92 type alias_spec =
93   | Ident_alias of string * string        (* identifier, uri *)
94   | Symbol_alias of string * int * string (* name, instance no, description *)
95   | Number_alias of int * string          (* instance no, description *)
96
97 type inclusion_mode = WithPreferences | WithoutPreferences | OnlyPreferences (* aka aliases *)
98
99 type command =
100   | Include of loc * inclusion_mode * string (* _,buri,_,path *)
101   | UnificationHint of loc * nterm * int (* term, precedence *)
102   | NObj of loc * nterm NotationPt.obj
103   | NDiscriminator of loc * nterm
104   | NInverter of loc * string * nterm * bool list option * nterm option
105   | NUnivConstraint of loc * NUri.uri * NUri.uri
106   | NCopy of loc * string * NUri.uri * (NUri.uri * NUri.uri) list
107   | NCoercion of loc * string * bool * nterm * nterm * (string * nterm) * nterm
108   | NQed of loc * bool
109   (* ex lexicon commands *)
110   | Alias of loc * alias_spec
111       (** parameters, name, type, fields *) 
112   | Notation of loc * direction option * nterm * Gramext.g_assoc *
113       int * nterm
114       (* direction, l1 pattern, associativity, precedence, l2 pattern *)
115   | Interpretation of loc *
116       string * (string * NotationPt.argument_pattern list) *
117         NotationPt.cic_appl_pattern
118       (* description (i.e. id), symbol, arg pattern, appl pattern *)
119
120 type code =
121   | NCommand of loc * command
122   | NMacro of loc * nmacro 
123   | NTactic of loc * ntactic list
124              
125 type comment =
126   | Note of loc * string
127   | Code of loc * code
128              
129 type statement =
130   | Executable of loc * code
131   | Comment of loc * comment
132
133 let description_of_alias =
134  function
135     Ident_alias (_,desc)
136   | Symbol_alias (_,_,desc)
137   | Number_alias (_,desc) -> desc