]> matita.cs.unibo.it Git - helm.git/commitdiff
put_inductive_definition implemented and exposed.
authorClaudio Sacerdoti Coen <claudio.sacerdoticoen@unibo.it>
Tue, 3 Dec 2002 14:50:31 +0000 (14:50 +0000)
committerClaudio Sacerdoti Coen <claudio.sacerdoticoen@unibo.it>
Tue, 3 Dec 2002 14:50:31 +0000 (14:50 +0000)
It is a very UNSAFE solution to the problem of computing inner-types of
non-debrujined mutual inductive types (whose constructors referes to
the not-yet-defined inductive type block): you can use this function to
add the block to the environment; then you compute the inner-types; and
finally you save the object and register it to the getter.

helm/ocaml/cic_proof_checking/cicEnvironment.ml
helm/ocaml/cic_proof_checking/cicEnvironment.mli

index e9050cd8c1867ac6f0686abc2094facedfabcd9f..823aa3a40880b8500f6723fad1a8bfc76361ecff 100644 (file)
@@ -61,6 +61,7 @@ module Cache :
    val frozen_to_cooked :
     uri:UriManager.uri -> unit
    val find_cooked : key:UriManager.uri -> Cic.obj
+   val add_cooked : key:UriManager.uri -> Cic.obj -> unit
   end 
 =
   struct
@@ -130,6 +131,7 @@ module Cache :
      Not_found -> raise (CouldNotUnfreeze (UriManager.string_of_uri uri))
    ;;
    let find_cooked ~key:uri = CacheOfCookedObjects.find uri;;
+   let add_cooked ~key:uri obj = CacheOfCookedObjects.add uri obj;;
   end
 ;;
 
@@ -225,3 +227,11 @@ let get_obj uri =
   Not_found ->
    find_or_add_unchecked_to_cache uri
 ;; 
+
+exception OnlyPutOfInductiveDefinitionsIsAllowed
+
+let put_inductive_definition uri obj =
+ match obj with
+    Cic.InductiveDefinition _ -> Cache.add_cooked uri obj
+  | _ -> raise OnlyPutOfInductiveDefinitionsIsAllowed
+;;
index fbc53955ba80483c15311d4206cb144fe8e367d3..e93db958210ef5fa820d502f4317d2567f868a6c 100644 (file)
@@ -61,8 +61,19 @@ val is_type_checked : ?trust:bool -> UriManager.uri -> type_checked_obj
 (* again in the future (is_type_checked will return true)             *)
 val set_type_checking_info : UriManager.uri -> unit
 
-(* get_cooked_obj ~trust uri *)
+(* get_cooked_obj ~trust uri                                        *)
 (* returns the object if it is already type-checked or if it can be *)
 (* trusted (if [trust] = true and the trusting function accepts it) *)
 (* Otherwise it raises Not_found                                    *)
 val get_cooked_obj : ?trust:bool -> UriManager.uri -> Cic.obj
+
+(* FUNCTIONS USED ONLY IN THE TOPLEVEL/PROOF-ENGINE *)
+
+exception OnlyPutOfInductiveDefinitionsIsAllowed
+
+(* put_inductive_definition uri obj                                      *)
+(* put [obj] (that must be an InductiveDefinition and show URI is [uri]) *)
+(* in the environment.                                                   *)
+(* WARNING: VERY UNSAFE.                                                 *)
+(* This function should be called only on a well-typed definition.       *)
+val put_inductive_definition : UriManager.uri -> Cic.obj -> unit