2 ||M|| This file is part of HELM, an Hypertextual, Electronic
3 ||A|| Library of Mathematics, developed at the Computer Science
4 ||T|| Department, University of Bologna, Italy.
6 ||T|| HELM is free software; you can redistribute it and/or
7 ||A|| modify it under the terms of the GNU General Public License
8 \ / version 2 or (at your option) any later version.
9 \ / This software is distributed as is, NO WARRANTY.
10 V_______________________________________________________________ *)
12 (* $Id: nCicReduction.ml 8250 2008-03-25 17:56:20Z tassi $ *)
14 (********************************* TERMS ************************************)
16 type sort = Prop | Type of int | CProp
18 type implicit_annotation = [ `Closed | `Type | `Hole | `Term ]
20 type lc_kind = Irl of int | Ctx of term list
22 and local_context = int * lc_kind (* shift (0 -> no shift),
23 subst (None means id) *)
25 | Rel of int (* DeBruijn index, 1 based *)
26 | Meta of int * local_context
27 | Appl of term list (* arguments *)
28 | Prod of string * term * term (* binder, source, target *)
29 | Lambda of string * term * term (* binder, source, target *)
30 | LetIn of string * term * term * term (* binder, type, term, body *)
31 (* Cast \def degenerate LetIn *)
32 | Const of NReference.reference (* ref has (indtype|constr)no *)
33 | Sort of sort (* sort *)
34 | Implicit of implicit_annotation (* ... *)
35 | Match of NReference.reference * (* ind. reference, *)
36 term * term * (* outtype, ind. term *)
37 term list (* patterns *)
40 (********************************* TYPING ***********************************)
42 type context_entry = (* A declaration or definition *)
43 | Decl of term (* type *)
44 | Def of term * term (* body, type *)
46 type hypothesis = string * context_entry
48 type context = hypothesis list
50 type conjecture = int * string option * context * term
52 type metasenv = conjecture list
54 type subst_entry = string option * context * term * term
56 type substitution = (int * subst_entry) list
59 (******************************** OBJECTS **********************************)
61 type relevance = bool list (* relevance of arguments for conversion *)
63 (* relevance, name, recno, ty, bo *)
64 type inductiveFun = relevance * string * int * term * term
65 (* if coinductive, the int has no meaning and must be set to -1 *)
67 type constructor = relevance * string * term (* id, type *)
70 relevance * string * term * constructor list
71 (* relevance, typename, arity, constructors *)
73 type def_flavour = (* presentational *)
74 [ `Definition | `Fact | `Lemma | `Theorem | `Corollary | `Example ]
76 type def_pragma = (* pragmatic of the object *)
78 | `Elim of sort (* elimination principle; universe is not relevant *)
79 | `Projection (* record projection *)
80 | `InversionPrinciple (* inversion principle *)
83 | `Regular ] (* Local = hidden technicality *)
85 type ind_pragma = (* pragmatic of the object *)
86 [ `Record of (string * bool * int) list | `Regular ]
87 (* inductive type that encodes a record; the arguments are the record
88 * fields names and if they are coercions and then the coercion arity *)
90 type generated = [ `Generated | `Provided ]
92 type c_attr = generated * def_flavour * def_pragma
93 type f_attr = generated * def_flavour
94 type i_attr = generated * ind_pragma
96 (* invariant: metasenv and substitution have disjoint domains *)
98 | Constant of relevance * string * term option * term * c_attr
99 | Fixpoint of bool * inductiveFun list * f_attr
100 (* true -> fix, funcs, arrts *)
101 | Inductive of bool * int * inductiveType list * i_attr
102 (* true -> inductive, leftno, types *)
104 (* the int must be 0 if the object has no body *)
105 type obj = NUri.uri * int * metasenv * substitution * obj_kind