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 type inductiveFun = relevance * string * int * term * term
64 (* if coinductive, the int has no meaning and must be set to -1 *)
66 type constructor = relevance * string * term (* id, type *)
69 relevance * string * term * constructor list
70 (* relevance, typename, arity, constructors *)
72 type def_flavour = (* presentational *)
73 [ `Definition | `Fact | `Lemma | `Theorem | `Corollary | `Example ]
75 type def_pragma = (* pragmatic of the object *)
77 | `Elim of sort (* elimination principle; universe is not relevant *)
78 | `Projection (* record projection *)
79 | `InversionPrinciple (* inversion principle *)
82 | `Regular ] (* Local = hidden technicality *)
84 type ind_pragma = (* pragmatic of the object *)
85 [ `Record of (string * bool * int) list | `Regular ]
86 (* inductive type that encodes a record; the arguments are the record
87 * fields names and if they are coercions and then the coercion arity *)
89 type generated = [ `Generated | `Provided ]
91 type c_attr = generated * def_flavour * def_pragma
92 type f_attr = generated * def_flavour
93 type i_attr = generated * ind_pragma
95 (* invariant: metasenv and substitution have disjoint domains *)
97 | Constant of relevance * string * term option * term * c_attr
98 | Fixpoint of bool * inductiveFun list * f_attr
99 (* true -> fix, funcs, arrts *)
100 | Inductive of bool * int * inductiveType list * i_attr
101 (* true -> inductive, leftno, types *)
103 (* the int must be 0 if the object has no body *)
104 type obj = NUri.uri * int * metasenv * substitution * obj_kind