1 (* Copyright (C) 2000, 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://cs.unibo.it/helm/.
26 (******************************************************************************)
30 (* Claudio Sacerdoti Coen <sacerdot@cs.unibo.it> *)
33 (* This module defines the internal representation of the objects (variables, *)
34 (* blocks of (co)inductive definitions and constants) and the terms of cic *)
36 (******************************************************************************)
38 (* STUFF TO MANAGE IDENTIFIERS *)
39 type id = string (* the abstract type of the (annotated) node identifiers *)
40 type 'term explicit_named_substitution = (UriManager.uri * 'term) list
43 Object of annobj (* if annobj is a Constant, this is its type *)
44 | ConstantBody of annobj
46 | Conjecture of annconjecture
47 | Hypothesis of annhypothesis
49 (* INTERNAL REPRESENTATION OF CIC OBJECTS AND TERMS *)
58 Rel of int (* DeBrujin index *)
59 | Var of UriManager.uri * (* uri, *)
60 term explicit_named_substitution (* explicit named subst. *)
61 | Meta of int * (term option) list (* numeric id, *)
63 | Sort of sort (* sort *)
65 | Cast of term * term (* value, type *)
66 | Prod of name * term * term (* binder, source, target *)
67 | Lambda of name * term * term (* binder, source, target *)
68 | LetIn of name * term * term (* binder, term, target *)
69 | Appl of term list (* arguments *)
70 | Const of UriManager.uri * (* uri, *)
71 term explicit_named_substitution (* explicit named subst. *)
72 | MutInd of UriManager.uri * int * (* uri, typeno, *)
73 term explicit_named_substitution (* explicit named subst. *)
74 (* typeno is 0 based *)
75 | MutConstruct of UriManager.uri * (* uri, *)
76 int * int * (* typeno, consno *)
77 term explicit_named_substitution (* explicit named subst. *)
78 (* typeno is 0 based *)
79 (* consno is 1 based *)
80 | MutCase of UriManager.uri * (* ind. uri, *)
81 int * (* ind. typeno, *)
82 term * term * (* outtype, ind. term *)
83 term list (* patterns *)
84 | Fix of int * inductiveFun list (* funno, functions *)
85 | CoFix of int * coInductiveFun list (* funno, functions *)
87 Constant of string * term option * term * (* id, body, type, *)
88 UriManager.uri list (* parameters *)
89 | Variable of string * term option * term * (* name, body, type *)
90 UriManager.uri list (* parameters *)
91 | CurrentProof of string * metasenv * (* name, conjectures, *)
92 term * term * UriManager.uri list (* value, type, parameters *)
93 | InductiveDefinition of inductiveType list * (* inductive types, *)
94 UriManager.uri list * int (* parameters, n ind. pars *)
96 string * bool * term * (* typename, inductive, arity *)
97 constructor list (* constructors *)
99 string * term (* id, type *)
101 string * int * term * term (* name, ind. index, type, body *)
103 string * term * term (* name, type, body *)
105 (* a metasenv is a list of declarations of metas *)
106 and conjecture = int * context * term
107 and metasenv = conjecture list
109 (* a metasenv is a list of declarations of metas *)
110 and annconjecture = id * int * anncontext * annterm
111 and annmetasenv = annconjecture list
114 ARel of id * id * int * (* idref, DeBrujin index, *)
116 | AVar of id * UriManager.uri * (* uri, *)
117 annterm explicit_named_substitution (* explicit named subst. *)
118 | AMeta of id * int * (annterm option) list (* numeric id, *)
120 | ASort of id * sort (* sort *)
121 | AImplicit of id (* *)
122 | ACast of id * annterm * annterm (* value, type *)
123 | AProd of id * name * annterm * annterm (* binder, source, target *)
124 | ALambda of id * name * annterm * annterm (* binder, source, target *)
125 | ALetIn of id * name * annterm * annterm (* binder, term, target *)
126 | AAppl of id * annterm list (* arguments *)
127 | AConst of id * UriManager.uri * (* uri, *)
128 annterm explicit_named_substitution (* explicit named subst. *)
129 | AMutInd of id * UriManager.uri * int * (* uri, typeno *)
130 annterm explicit_named_substitution (* explicit named subst. *)
131 (* typeno is 0 based *)
132 | AMutConstruct of id * UriManager.uri * (* uri, *)
133 int * int * (* typeno, consno *)
134 annterm explicit_named_substitution (* explicit named subst. *)
135 (* typeno is 0 based *)
136 (* consno is 1 based *)
137 | AMutCase of id * UriManager.uri * (* ind. uri, *)
138 int * (* ind. typeno, *)
139 annterm * annterm * (* outtype, ind. term *)
140 annterm list (* patterns *)
141 | AFix of id * int * anninductiveFun list (* funno, functions *)
142 | ACoFix of id * int * anncoInductiveFun list (* funno, functions *)
144 AConstant of id * id option * string * (* name, *)
145 annterm option * annterm * (* body, type, *)
146 UriManager.uri list (* parameters *)
148 string * annterm option * annterm * (* name, body, type *)
149 UriManager.uri list (* parameters *)
150 | ACurrentProof of id * id *
151 string * annmetasenv * (* name, conjectures, *)
152 annterm * annterm * UriManager.uri list (* value,type,parameters *)
153 | AInductiveDefinition of id *
154 anninductiveType list * (* inductive types , *)
155 UriManager.uri list * int (* parameters,n ind. pars*)
156 and anninductiveType =
157 string * bool * annterm * (* typename, inductive, arity *)
158 annconstructor list (* constructors *)
160 string * annterm (* id, type *)
161 and anninductiveFun =
162 id * string * int * annterm * annterm (* name, ind. index, type, body *)
163 and anncoInductiveFun =
164 id * string * annterm * annterm (* name, type, body *)
168 and context_entry = (* A declaration or definition *)
173 (name * context_entry) option (* None means no more accessible *)
175 and context = hypothesis list
177 and anncontext_entry = (* A declaration or definition *)
182 id * (name * anncontext_entry) option (* None means no more accessible *)
184 and anncontext = annhypothesis list;;