1 (* Copyright (C) 2005, HELM Team.
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.
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.
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.
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,
22 * For details, see the HELM World-Wide-Web page,
23 * http://helm.cs.unibo.it/
26 (** CIC Notation Parse Tree *)
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 ]
33 type location = Lexing.position * Lexing.position
36 [ `Loc of location (* source file location *)
37 | `IdRef of string (* ACic pointer *)
49 | AttributedTerm of term_attribute * term
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 *)
63 | Meta of int * meta_subst list
64 | Num of string * int (* literal, instance *)
66 | Symbol of string * int (* canonical name, instance *)
68 | UserInput (* place holder for user input, used by MatitaConsole, not to be
70 | Uri of string * subst list option (* as Ident, for long names *)
72 (* Syntax pattern extensions *)
75 | Layout of layout_pattern
77 | Variable of pattern_variable
79 and capture_variable = Cic.name * term option (* name, type *)
80 and meta_subst = term option
81 and subst = string * term
82 and case_pattern = string * capture_variable list
89 | Below of term * term
90 | Above of term * term
94 (* | array of term * literal option * literal option
95 |+ column separator, row separator +| *)
97 | Root of term * term (* argument, index *)
99 | Box of box_kind * term list
103 | List0 of term * literal option
104 | List1 of term * literal option
108 | Fold of fold_kind * term * string list * term
109 (* base case pattern, recursive case bound names, recursive case pattern *)
110 | Default of term * term (* "some" case pattern, "none" case pattern *)
112 and pattern_variable =
113 (* level 1 and 2 variables *)
118 (* level 1 variables *)
119 | Ascription of term * string
121 (* level 2 variables *)
124 type argument_pattern =
126 | EtaArg of string option * argument_pattern (* eta abstraction *)
128 type cic_appl_pattern =
129 | UriPattern of string
130 | ArgPattern of argument_pattern
131 | ApplPattern of cic_appl_pattern list
135 | StringValue of string
137 | OptValue of value option
138 | ListValue of value list
144 | OptType of value_type
145 | ListType of value_type
147 type declaration = string * value_type