aboutsummaryrefslogtreecommitdiff
path: root/engine
diff options
context:
space:
mode:
authorAmin Timany2017-03-30 18:12:43 +0200
committerEmilio Jesus Gallego Arias2017-06-16 04:45:19 +0200
commit4dd4f186895d16510f217778bb83933be8956082 (patch)
tree94c4b2b18c013be0305e37a49c2bf63f475a8a64 /engine
parent44f462aa380de847452c0809d15c86649d5d6a7a (diff)
New datastructure for universes of inductive types
Diffstat (limited to 'engine')
-rw-r--r--engine/universes.ml20
-rw-r--r--engine/universes.mli11
2 files changed, 31 insertions, 0 deletions
diff --git a/engine/universes.ml b/engine/universes.ml
index f201081862..955e1d8b5b 100644
--- a/engine/universes.ml
+++ b/engine/universes.ml
@@ -1118,3 +1118,23 @@ let solve_constraints_system levels level_bounds level_min =
done;
done;
v
+
+
+(** Operations for universe_info_ind *)
+
+(** Given a universe context representing constraints of an inductive
+ this function produces a UInfoInd.t that with the trivial subtyping relation. *)
+let univ_inf_ind_from_universe_context univcst =
+ let freshunivs = Instance.of_array
+ (Array.map (fun _ -> new_univ_level ())
+ (Instance.to_array (UContext.instance univcst)))
+ in UInfoInd.from_universe_context univcst freshunivs
+
+(** This function adds universe constraints to the universe
+ constraints of the given universe_info_ind. However one must be
+ CAUTIOUS as it resets the subtyping constraints to equality. *)
+let univ_inf_ind_union uinfind univcst' =
+ let freshunivs = Instance.of_array
+ (Array.map (fun _ -> new_univ_level ())
+ (Instance.to_array (UContext.instance univcst')))
+ in UInfoInd.union uinfind univcst' freshunivs
diff --git a/engine/universes.mli b/engine/universes.mli
index 83ca1ea606..17a9deb3a2 100644
--- a/engine/universes.mli
+++ b/engine/universes.mli
@@ -227,3 +227,14 @@ val pr_universe_opt_subst : universe_opt_subst -> Pp.std_ppcmds
val solve_constraints_system : universe option array -> universe array -> universe array ->
universe array
+
+(** Operations for universe_info_ind *)
+
+(** Given a universe context representing constraints of an inductive
+ this function produces a UInfoInd.t that with the trivial subtyping relation. *)
+val univ_inf_ind_from_universe_context : universe_context -> universe_info_ind
+
+(** This function adds universe constraints to the universe
+ constraints of the given universe_info_ind. However one must be
+ CAUTIOUS as it resets the subtyping constraints to equality. *)
+val univ_inf_ind_union : universe_info_ind -> universe_context -> universe_info_ind