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 (********************************* TERMS ************************************)
28 type sort = Prop | Set | Type of int | CProp
30 type implicit_annotation = [ `Closed | `Type | `Hole | `Term ]
32 type lc_kind = Irl of int | Ctx of term list
34 and local_context = int * lc_kind (* shift (0 -> no shift),
35 subst (None means id) *)
37 | Rel of int (* DeBruijn index, 1 based *)
38 | Meta of int * local_context
39 | Appl of term list (* arguments *)
40 | Prod of string * term * term (* binder, source, target *)
41 | Lambda of string * term * term (* binder, source, target *)
42 | LetIn of string * term * term * term (* binder, type, term, body *)
43 (* Cast \def degenerate LetIn *)
44 | Const of NReference.reference (* ref has (indtype|constr)no *)
45 | Sort of sort (* sort *)
46 | Implicit of implicit_annotation (* ... *)
47 | Match of NReference.reference * (* ind. reference, *)
48 term * term * (* outtype, ind. term *)
49 term list (* patterns *)
52 (********************************* TYPING ***********************************)
54 type context_entry = (* A declaration or definition *)
55 | Decl of term (* type *)
56 | Def of term * term (* body, type *)
58 type hypothesis = string * context_entry
60 type context = hypothesis list
62 type conjecture = int * string option * context * term
64 type metasenv = conjecture list
66 type subst_entry = string option * context * term * term
68 type substitution = (int * subst_entry) list
71 (******************************** OBJECTS **********************************)
73 type relevance = bool list (* relevance of arguments for conversion *)
75 type inductiveFun = relevance * string * int * term * term
76 (* if coinductive, the int has no meaning and must be set to -1 *)
78 type constructor = relevance * string * term (* id, type *)
81 relevance * string * term * constructor list
82 (* relevance, typename, arity, constructors *)
84 type def_flavour = (* presentational *)
85 [ `Definition | `Fact | `Lemma | `Theorem | `Corollary | `Example ]
87 type def_pragma = (* pragmatic of the object *)
89 | `Elim of sort (* elimination principle; universe is not relevant *)
90 | `Projection (* record projection *)
91 | `InversionPrinciple (* inversion principle *)
94 | `Regular ] (* Local = hidden technicality *)
96 type ind_pragma = (* pragmatic of the object *)
97 [ `Record of (string * bool * int) list | `Regular ]
98 (* inductive type that encodes a record; the arguments are the record
99 * fields names and if they are coercions and then the coercion arity *)
101 type generated = [ `Generated | `Provided ]
103 type c_attr = generated * def_flavour * def_pragma
104 type f_attr = generated * def_flavour
105 type i_attr = generated * ind_pragma
107 (* invariant: metasenv and substitution have disjoint domains *)
109 | Constant of relevance * string * term option * term * c_attr
110 | Fixpoint of bool * inductiveFun list * f_attr
111 (* true -> fix, funcs, arrts *)
112 | Inductive of bool * int * inductiveType list * i_attr
113 (* true -> inductive, leftno, types *)
115 (* the int must be 0 if the object has no body *)
116 type obj = NUri.uri * int * metasenv * substitution * obj_kind