diff options
| author | herbelin | 2008-04-27 16:46:15 +0000 |
|---|---|---|
| committer | herbelin | 2008-04-27 16:46:15 +0000 |
| commit | ca3812d7804f3936bb420e96fad034983ede271a (patch) | |
| tree | 2e22e79f2225fcf3b7afcc29f99e844bd2460328 /checker | |
| parent | d7e7e6756b46998e864cc00355d1946b69a43c1a (diff) | |
Correction du bug des types singletons pas sous-type de Set
(i.e. "Inductive unit := tt." conduisait à "t:Prop" alors que le
principe de la hiérarchie d'univers est d'être cumulative -- et que
Set en soit le niveau 0).
Une solution aurait été de poser Prop <= Set mais on adopte une autre
solution. Pour éviter le côté contre-intuitif d'avoir unit dans Type
et Prop <= Set, on garde la représentation de Prop au sein de la
hiérarchie prédicative sous la forme "Type (max ([],[])" (le niveau
sans aucune contrainte inférieure, appelons Type -1) et on adapte les
fonctions de sous-typage et de typage pour qu'elle prenne en compte la
règle Type -1 <= Prop (cf reduction.ml, reductionops.ml, et effets
incidents dans Termops.refresh_universes et Univ.super).
Petite uniformisation des noms d'univers et de sortes au passage
(univ.ml, univ.mli, term.ml, term.mli et les autres fichiers).
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@10859 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'checker')
| -rw-r--r-- | checker/indtypes.ml | 2 | ||||
| -rw-r--r-- | checker/inductive.ml | 12 | ||||
| -rw-r--r-- | checker/typeops.ml | 6 |
3 files changed, 10 insertions, 10 deletions
diff --git a/checker/indtypes.ml b/checker/indtypes.ml index 305aa4e587..12ae25ca3d 100644 --- a/checker/indtypes.ml +++ b/checker/indtypes.ml @@ -140,7 +140,7 @@ let small_unit constrsinfos = let extract_level (_,_,_,lc,lev) = (* Enforce that the level is not in Prop if more than two constructors *) - if Array.length lc >= 2 then sup base_univ lev else lev + if Array.length lc >= 2 then sup type0_univ lev else lev let inductive_levels arities inds = let levels = Array.map pi3 arities in diff --git a/checker/inductive.ml b/checker/inductive.ml index c2301777d2..febe312f27 100644 --- a/checker/inductive.ml +++ b/checker/inductive.ml @@ -127,8 +127,8 @@ Remark: Set (predicative) is encoded as Type(0) let sort_as_univ = function | Type u -> u -| Prop Null -> neutral_univ -| Prop Pos -> base_univ +| Prop Null -> lower_univ +| Prop Pos -> type0_univ let cons_subst u su subst = try (u, sup su (List.assoc u subst)) :: List.remove_assoc u subst @@ -182,8 +182,8 @@ let instantiate_universes env ctx ar argsorts = let ctx,subst = make_subst env (ctx,ar.poly_param_levels,args) in let level = subst_large_constraints subst ar.poly_level in ctx, - if is_empty_univ level then Prop Null - else if is_base_univ level then Prop Pos + if is_lower_univ level then Prop Null + else if is_type0_univ level then Prop Pos else Type level let type_of_inductive_knowing_parameters env mip paramtyps = @@ -204,11 +204,11 @@ let type_of_inductive env (_,mip) = let cumulate_constructor_univ u = function | Prop Null -> u - | Prop Pos -> sup base_univ u + | Prop Pos -> sup type0_univ u | Type u' -> sup u u' let max_inductive_sort = - Array.fold_left cumulate_constructor_univ neutral_univ + Array.fold_left cumulate_constructor_univ lower_univ (************************************************************************) (* Type of a constructor *) diff --git a/checker/typeops.ml b/checker/typeops.ml index 5b289e0e16..27a3e287d4 100644 --- a/checker/typeops.ml +++ b/checker/typeops.ml @@ -50,7 +50,7 @@ let assumption_of_judgment env j = (* Prop and Set *) -let judge_of_prop = Sort (Type prop_univ) +let judge_of_prop = Sort (Type type1_univ) (* Type of Type(i). *) @@ -179,9 +179,9 @@ let sort_of_product env domsort rangsort = rangsort else (* Rule is (Type_i,Set,Type_i) in the Set-predicative calculus *) - Type (sup u1 base_univ) + Type (sup u1 type0_univ) (* Product rule (Prop,Type_i,Type_i) *) - | (Prop Pos, Type u2) -> Type (sup base_univ u2) + | (Prop Pos, Type u2) -> Type (sup type0_univ u2) (* Product rule (Prop,Type_i,Type_i) *) | (Prop Null, Type _) -> rangsort (* Product rule (Type_i,Type_i,Type_i) *) |
