]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/ocaml/cic/cic.ml
...
[helm.git] / helm / ocaml / cic / cic.ml
index 64b7f857cce087cc7f5925654939c2a613768434..2429dcfeddb51b4bc2ec24fb6aa6e52143a0d03e 100644 (file)
@@ -40,6 +40,8 @@ type id = string  (* the abstract type of the (annotated) node identifiers *)
 type anntarget =
    Object of annobj
  | Term of annterm
+ | Conjecture of annconjecture
+ | Hypothesis of annhypothesis
 
 (* INTERNAL REPRESENTATION OF CIC OBJECTS AND TERMS *)
 and sort =
@@ -52,7 +54,8 @@ and name =
 and term =
    Rel of int                                       (* DeBrujin index *)
  | Var of UriManager.uri                            (* uri *)
- | Meta of int                                      (* numeric id *)
+ | Meta of int * (term option) list                 (* numeric id,    *)
+                                                    (*  local context *)
  | Sort of sort                                     (* sort *)
  | Implicit                                         (* *)
  | Cast of term * term                              (* value, type *)
@@ -61,10 +64,11 @@ and term =
  | LetIn of name * term * term                      (* binder, term, target *)
  | Appl of term list                                (* arguments *)
  | Const of UriManager.uri * int                    (* uri, number of cookings*)
- | Abst of UriManager.uri                           (* uri *)
  | MutInd of UriManager.uri * int * int             (* uri, cookingsno, typeno*)
+                                                    (* typeno is 0 based *)
  | MutConstruct of UriManager.uri * int *           (* uri, cookingsno, *)
     int * int                                       (*  typeno, consno  *)
+                                                    (* consno is 1 based *)
  (*CSC: serve cookingsno?*)
  | MutCase of UriManager.uri * int *                (* ind. uri, cookingsno, *)
     int *                                           (*  ind. typeno,         *)
@@ -78,7 +82,7 @@ and obj =
  | Axiom of string * term *
     (int * UriManager.uri list) list              (* id, type, parameters     *)
  | Variable of string * term option * term        (* name, body, type         *)
- | CurrentProof of string * (int * term) list *   (* name, conjectures,       *)
+ | CurrentProof of string * metasenv *            (* name, conjectures,       *)
     term * term                                   (*  value, type             *)
  | InductiveDefinition of inductiveType list *    (* inductive types,         *)
     (int * UriManager.uri list) list * int        (*  parameters, n ind. pars *)
@@ -92,10 +96,19 @@ and inductiveFun =
 and coInductiveFun =
  string * term * term                         (* name, type, body *)
 
+(* a metasenv is a list of declarations of metas *)
+and conjecture = int * context * term
+and metasenv = conjecture list
+
+(* a metasenv is a list of declarations of metas *)
+and annconjecture = id * int * anncontext * annterm
+and annmetasenv = annconjecture list
+
 and annterm =
    ARel of id * int * string                        (* DeBrujin index, binder *)
  | AVar of id * UriManager.uri                      (* uri *)
- | AMeta of id * int                                (* numeric id *)
+ | AMeta of id * int * (annterm option) list        (* numeric id,    *)
+                                                    (*  local context *)
  | ASort of id * sort                               (* sort *)
  | AImplicit of id                                  (* *)
  | ACast of id * annterm * annterm                  (* value, type *)
@@ -104,10 +117,11 @@ and annterm =
  | ALetIn of id * name * annterm * annterm          (* binder, term, target *)
  | AAppl of id * annterm list                       (* arguments *)
  | AConst of id * UriManager.uri * int              (* uri, number of cookings*)
- | AAbst of id * UriManager.uri                     (* uri *)
  | AMutInd of id * UriManager.uri * int * int       (* uri, cookingsno, typeno*)
+                                                    (* typeno is 0 based *)
  | AMutConstruct of id * UriManager.uri * int *     (* uri, cookingsno, *)
     int * int                                       (*  typeno, consno  *)
+                                                    (* consno is 1 based *)
  (*CSC: serve cookingsno?*)
  | AMutCase of id * UriManager.uri * int *          (* ind. uri, cookingsno  *)
     int *                                           (*  ind. typeno,         *)
@@ -124,7 +138,7 @@ and annobj =
  | AVariable of id *
     string * annterm option * annterm               (* name, body, type *)
  | ACurrentProof of id *
-    string * (int * annterm) list *                 (*  name, conjectures, *)
+    string * annmetasenv *                          (*  name, conjectures, *)
     annterm * annterm                               (*  value, type        *)
  | AInductiveDefinition of id *
     anninductiveType list *                         (* inductive types ,      *)
@@ -143,4 +157,21 @@ and annotation =
 and 'a exactness =
    Possible of 'a                            (* an approximation to something *)
  | Actual of 'a                              (* something *)
-;;
+
+and context_entry =                            (* A declaration or definition *)
+   Decl of term
+ | Def of term
+
+and hypothesis =
+ (name * context_entry) option               (* None means no more accessible *)
+
+and context = hypothesis list
+
+and anncontext_entry =                         (* A declaration or definition *)
+   ADecl of annterm
+ | ADef of annterm
+
+and annhypothesis =
+ id * (name * anncontext_entry) option       (* None means no more accessible *)
+
+and anncontext = annhypothesis list;;