]> matita.cs.unibo.it Git - helm.git/blob - helm/ocaml/cic_notation/cicNotationPt.ml
snapshot
[helm.git] / helm / ocaml / cic_notation / cicNotationPt.ml
1 (* Copyright (C) 2005, 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 (** CIC Notation Parse Tree *)
27
28 type binder_kind = [ `Lambda | `Pi | `Exists | `Forall ]
29 type induction_kind = [ `Inductive | `CoInductive ]
30 type sort_kind = [ `Prop | `Set | `Type | `CProp ]
31 type fold_kind = [ `Left | `Right ]
32
33 type location = Lexing.position * Lexing.position
34
35 type term_attribute =
36   [ `Loc of location  (* source file location *)
37   | `IdRef of string  (* ACic pointer *)
38   ]
39
40 type literal =
41   [ `Symbol of string
42   | `Keyword of string
43   | `Number of string
44   ]
45
46 type term =
47   (* CIC AST *)
48
49   | AttributedTerm of term_attribute * term
50
51   | Appl of term list
52   | Binder of binder_kind * capture_variable * term (* kind, name, body *)
53   | Case of term * string option * term option * (case_pattern * term) list
54       (* what to match, inductive type, out type, <pattern,action> list *)
55   | LetIn of capture_variable * term * term  (* name, body, where *)
56   | LetRec of induction_kind * (capture_variable * term * int) list * term
57       (* (name, body, decreasing argument) list, where *)
58   | Ident of string * subst list option
59       (* literal, substitutions.
60       * Some [] -> user has given an empty explicit substitution list 
61       * None -> user has given no explicit substitution list *)
62   | Implicit
63   | Meta of int * meta_subst list
64   | Num of string * int (* literal, instance *)
65   | Sort of sort_kind
66   | Symbol of string * int  (* canonical name, instance *)
67
68   | UserInput (* place holder for user input, used by MatitaConsole, not to be
69               used elsewhere *)
70   | Uri of string * subst list option (* as Ident, for long names *)
71
72   (* Syntax pattern extensions *)
73
74   | Layout of layout_pattern
75   | Magic of magic_term
76   | Variable of pattern_variable
77
78 and capture_variable = Cic.name * term option (* name, type *)
79 and meta_subst = term option
80 and subst = string * term
81 and case_pattern = string * capture_variable list
82
83 and box_kind = H | V
84
85 and layout_pattern =
86   | Sub of term * term
87   | Sup of term * term
88   | Below of term * term
89   | Above of term * term
90   | Frac of term * term
91   | Atop of term * term
92 (*   | Array of term * literal option * literal option
93       |+ column separator, row separator +| *)
94   | Sqrt of term
95   | Root of term * term (* argument, index *)
96   | Break
97   | Box of box_kind * term list
98
99 and magic_term =
100   (* level 1 magics *)
101   | List0 of term * literal option
102   | List1 of term * literal option
103   | Opt of term
104
105   (* level 2 magics *)
106   | Fold of fold_kind * term * string list * term
107     (* base case pattern, recursive case bound names, recursive case pattern *)
108   | Default of term * term  (* "some" case pattern, "none" case pattern *)
109
110 and pattern_variable =
111   (* level 1 and 2 variables *)
112   | NumVar of string
113   | IdentVar of string
114   | TermVar of string
115
116   (* level 1 variables *)
117   | Ascription of term * string
118
119   (* level 2 variables *)
120   | FreshVar of string
121