diff options
| author | Pierre-Marie Pédrot | 2014-08-09 15:51:21 +0200 |
|---|---|---|
| committer | Pierre-Marie Pédrot | 2014-08-09 15:59:01 +0200 |
| commit | 56a6727525e860a155b6ae73da152e558b3ea976 (patch) | |
| tree | d4a2c5e3d64fb5c7bbb409f6c89c61dd23b174b6 /kernel | |
| parent | eec72af81a84f7b56b04027693684eebe139a607 (diff) | |
Cleaning up interface of ContextSet.
Names and arguments were uniformized, and some functions were redesigned to
take their typical use-case into account.
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/univ.ml | 12 | ||||
| -rw-r--r-- | kernel/univ.mli | 5 |
2 files changed, 12 insertions, 5 deletions
diff --git a/kernel/univ.ml b/kernel/univ.ml index 86aebbce93..d3201bcb9d 100644 --- a/kernel/univ.ml +++ b/kernel/univ.ml @@ -1879,11 +1879,17 @@ struct let diff (univs, cst) (univs', cst') = LSet.diff univs univs', Constraint.diff cst cst' - let add_constraints (univs, cst) cst' = + let add_universe u (univs, cst) = + LSet.add u univs, cst + + let add_constraints cst' (univs, cst) = univs, Constraint.union cst cst' - let add_universes univs ctx = - union (of_instance univs) ctx + let add_instance inst (univs, cst) = + let v = Instance.to_array inst in + let fold accu u = LSet.add u accu in + let univs = Array.fold_left fold univs v in + (univs, cst) let to_context (ctx, cst) = (Instance.of_array (Array.of_list (LSet.elements ctx)), cst) diff --git a/kernel/univ.mli b/kernel/univ.mli index 655f87bb56..3779c055d0 100644 --- a/kernel/univ.mli +++ b/kernel/univ.mli @@ -340,8 +340,9 @@ sig val union : t -> t -> t val diff : t -> t -> t - val add_constraints : t -> constraints -> t - val add_universes : Instance.t -> t -> t + val add_universe : universe_level -> t -> t + val add_constraints : constraints -> t -> t + val add_instance : Instance.t -> t -> t (** Arbitrary choice of linear order of the variables *) val to_context : t -> universe_context |
