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 *)
44 (* INTERNAL REPRESENTATION OF CIC OBJECTS AND TERMS *)
53 Rel of int (* DeBrujin index *)
54 | Var of UriManager.uri (* uri *)
55 | Meta of int * (term option) list (* numeric id, *)
57 | Sort of sort (* sort *)
59 | Cast of term * term (* value, type *)
60 | Prod of name * term * term (* binder, source, target *)
61 | Lambda of name * term * term (* binder, source, target *)
62 | LetIn of name * term * term (* binder, term, target *)
63 | Appl of term list (* arguments *)
64 | Const of UriManager.uri * int (* uri, number of cookings*)
65 | Abst of UriManager.uri (* uri *)
66 | MutInd of UriManager.uri * int * int (* uri, cookingsno, typeno*)
67 | MutConstruct of UriManager.uri * int * (* uri, cookingsno, *)
68 int * int (* typeno, consno *)
69 (*CSC: serve cookingsno?*)
70 | MutCase of UriManager.uri * int * (* ind. uri, cookingsno, *)
71 int * (* ind. typeno, *)
72 term * term * (* outtype, ind. term *)
73 term list (* patterns *)
74 | Fix of int * inductiveFun list (* funno, functions *)
75 | CoFix of int * coInductiveFun list (* funno, functions *)
77 Definition of string * term * term * (* id, value, type, *)
78 (int * UriManager.uri list) list (* parameters *)
79 | Axiom of string * term *
80 (int * UriManager.uri list) list (* id, type, parameters *)
81 | Variable of string * term option * term (* name, body, type *)
82 | CurrentProof of string * metasenv * (* name, conjectures, *)
83 term * term (* value, type *)
84 | InductiveDefinition of inductiveType list * (* inductive types, *)
85 (int * UriManager.uri list) list * int (* parameters, n ind. pars *)
87 string * bool * term * (* typename, inductive, arity *)
88 constructor list (* constructors *)
90 string * term * bool list option ref (* id, type, really recursive *)
92 string * int * term * term (* name, ind. index, type, body *)
94 string * term * term (* name, type, body *)
96 and metasenv = (int * context * term) list (* a metasenv is a list of declarations of metas *)
98 and annmetasenv = (int * anncontext * annterm) list (* a metasenv is a list of declarations of metas *)
101 ARel of id * int * string (* DeBrujin index, binder *)
102 | AVar of id * UriManager.uri (* uri *)
103 | AMeta of id * int * (annterm option) list (* numeric id, *)
105 | ASort of id * sort (* sort *)
106 | AImplicit of id (* *)
107 | ACast of id * annterm * annterm (* value, type *)
108 | AProd of id * name * annterm * annterm (* binder, source, target *)
109 | ALambda of id * name * annterm * annterm (* binder, source, target *)
110 | ALetIn of id * name * annterm * annterm (* binder, term, target *)
111 | AAppl of id * annterm list (* arguments *)
112 | AConst of id * UriManager.uri * int (* uri, number of cookings*)
113 | AAbst of id * UriManager.uri (* uri *)
114 | AMutInd of id * UriManager.uri * int * int (* uri, cookingsno, typeno*)
115 | AMutConstruct of id * UriManager.uri * int * (* uri, cookingsno, *)
116 int * int (* typeno, consno *)
117 (*CSC: serve cookingsno?*)
118 | AMutCase of id * UriManager.uri * int * (* ind. uri, cookingsno *)
119 int * (* ind. typeno, *)
120 annterm * annterm * (* outtype, ind. term *)
121 annterm list (* patterns *)
122 | AFix of id * int * anninductiveFun list (* funno, functions *)
123 | ACoFix of id * int * anncoInductiveFun list (* funno, functions *)
125 ADefinition of id * string * (* id, *)
126 annterm * annterm * (* value, type, *)
127 (int * UriManager.uri list) list exactness (* parameters *)
128 | AAxiom of id * string * annterm * (* id, type *)
129 (int * UriManager.uri list) list (* parameters *)
131 string * annterm option * annterm (* name, body, type *)
132 | ACurrentProof of id *
133 string * annmetasenv * (* name, conjectures, *)
134 annterm * annterm (* value, type *)
135 | AInductiveDefinition of id *
136 anninductiveType list * (* inductive types , *)
137 (int * UriManager.uri list) list * int (* parameters,n ind. pars*)
138 and anninductiveType =
139 string * bool * annterm * (* typename, inductive, arity *)
140 annconstructor list (* constructors *)
142 string * annterm * bool list option ref (* id, type, really recursive *)
143 and anninductiveFun =
144 string * int * annterm * annterm (* name, ind. index, type, body *)
145 and anncoInductiveFun =
146 string * annterm * annterm (* name, type, body *)
150 Possible of 'a (* an approximation to something *)
151 | Actual of 'a (* something *)
153 and context_entry = (* Contexts are lists of context_entry *)
157 and context = ((name * context_entry) option) list
159 and anncontext_entry = (* Contexts are lists of context_entry *)
163 and anncontext = ((name * anncontext_entry) option) list;;