]> matita.cs.unibo.it Git - helm.git/blob - helm/software/components/ng_kernel/nCic.ml
8d974ca101b4ddcee1969e25edc35d797450b275
[helm.git] / helm / software / components / ng_kernel / nCic.ml
1 (* Copyright (C) 2000, HELM Team.
2  * 
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.
6  * 
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.
11  * 
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.
16  *
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,
20  * MA  02111-1307, USA.
21  * 
22  * For details, see the HELM World-Wide-Web page,
23  * http://cs.unibo.it/helm/.
24  *)
25
26 type sort =
27  | Prop
28  | Set
29  | Type of int
30  | CProp
31
32 type implicit_annotation = [ `Closed | `Type | `Hole | `Term ]
33
34 type local_context = int * (term list) option         (* shift (0 -> no shift), 
35                                                          subst (None means id) *) 
36 and term =
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                   (* reference contains indtypeno/constrno *)
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             *)
50
51
52
53 type context_entry =                            (* A declaration or definition *)
54  | Decl of term
55  | Def of term * term option                   (* body, type (if known) *)
56
57 type hypothesis = string * context_entry               (* None means no more accessible *)
58
59 type context = hypothesis list
60
61 type conjecture = int * string option * context * term
62
63 type metasenv = conjecture list
64
65 type substitution = (int * (string option * context * term * term)) list
66
67
68
69
70 type inductiveFun =
71  string * int * term * term   (* if coinductive, the int has no meaning and must be set to -1 *)
72
73 type constructor = string * term                                (* id, type *)
74
75 type inductiveType = 
76  string * bool * term *       (* typename, inductive, arity *)
77  constructor list            (* constructors              *)
78
79 type def_flavour = (* presentational *)
80   [ `Definition
81   | `Fact
82   | `Lemma
83   | `Remark
84   | `Theorem
85   ]
86
87 type def_pragma = (* pragmatic of the object *)
88   [ `Coercion of int
89   | `Elim of sort       (** elimination principle; if sort is Type, the universe is not relevant *)
90   | `Projection         (** record projection *)
91   | `InversionPrinciple (** inversion principle *)
92   | `Variant
93   ]
94  
95 type ind_pragma = (* pragmatic of the object *)
96   [ `Record of (string * bool * int) list (** 
97     inductive type that encodes a record; the arguments are
98     the record fields names and if they are coercions and
99     then the coercion arity *)
100   ]
101
102 type generated = [ `Generated | `Provided ]
103
104 type c_attr = generated * def_flavour * def_pragma
105 type f_attr = generated * def_flavour
106 type i_attr = generated * ind_pragma
107
108 type obj =
109  | Constant  of NUri.uri * metasenv * substitution * string * term option * term * c_attr
110  | Fixpoint  of NUri.uri * metasenv * substitution * bool * inductiveFun list * f_attr
111  | Inductive of NUri.uri * metasenv * substitution * inductiveType list * i_attr
112