From fd2e9fd5f859f729765706f1f56df0fa080c0513 Mon Sep 17 00:00:00 2001 From: Matthieu Sozeau Date: Thu, 4 Jan 2018 05:40:08 -0800 Subject: Relax conversion of constructors according to the pCuIC model - Nothing to check in conversion as they have a common supertype by typing. - In inference, enforce that one is lower than the other. --- pretyping/evarconv.ml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'pretyping') diff --git a/pretyping/evarconv.ml b/pretyping/evarconv.ml index 0a63985bf1..3c8acb1a78 100644 --- a/pretyping/evarconv.ml +++ b/pretyping/evarconv.ml @@ -530,8 +530,14 @@ and evar_eqappr_x ?(rhs_is_already_stuck = false) ts env evd pbty UnifFailure (evd, NotSameHead) else begin - let evd' = check_leq_inductives evd cumi u u' in - Success (check_leq_inductives evd' cumi u' u) + (** Both constructors should be liftable to the same supertype + at which we compare them, but we don't have access to that type in + untyped unification. We hence enforce that one is lower than the other. + Note the criterion is more relaxed in conversion. *) + try Success (check_leq_inductives evd cumi u u') + with Univ.UniverseInconsistency _ -> + try Success (check_leq_inductives evd cumi u' u) + with Univ.UniverseInconsistency e -> UnifFailure (evd, UnifUnivInconsistency e) end end in -- cgit v1.2.3 From ce87e338529f4dd174f1c870b83162bac6d2b9ae Mon Sep 17 00:00:00 2001 From: Matthieu Sozeau Date: Thu, 8 Mar 2018 07:23:03 -0300 Subject: Leave cumul constructor universes as is during unif if we cannot coerce one constructor type to the other. By invariant they have a common supertype --- pretyping/evarconv.ml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'pretyping') diff --git a/pretyping/evarconv.ml b/pretyping/evarconv.ml index 3c8acb1a78..fe2e86a482 100644 --- a/pretyping/evarconv.ml +++ b/pretyping/evarconv.ml @@ -532,12 +532,13 @@ and evar_eqappr_x ?(rhs_is_already_stuck = false) ts env evd pbty begin (** Both constructors should be liftable to the same supertype at which we compare them, but we don't have access to that type in - untyped unification. We hence enforce that one is lower than the other. - Note the criterion is more relaxed in conversion. *) + untyped unification. We hence try to enforce that one is lower + than the other, also unifying more universes in the process. + If this fails we just leave the universes as is, as in conversion. *) try Success (check_leq_inductives evd cumi u u') with Univ.UniverseInconsistency _ -> try Success (check_leq_inductives evd cumi u' u) - with Univ.UniverseInconsistency e -> UnifFailure (evd, UnifUnivInconsistency e) + with Univ.UniverseInconsistency e -> Success evd end end in -- cgit v1.2.3