From 12d89ea0b96710f27737639889379bf97a1a8a07 Mon Sep 17 00:00:00 2001 From: Leonardo de Moura Date: Wed, 9 Jul 2014 20:41:41 -0700 Subject: [PATCH] fix(kernel/level): is_geq predicate Signed-off-by: Leonardo de Moura --- src/kernel/level.cpp | 4 ++-- tests/lean/run/coe2.lean | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 tests/lean/run/coe2.lean diff --git a/src/kernel/level.cpp b/src/kernel/level.cpp index 7e6526a8b..4a9ed4d26 100644 --- a/src/kernel/level.cpp +++ b/src/kernel/level.cpp @@ -673,10 +673,10 @@ bool is_geq_core(level l1, level l2) { return true; if (is_max(l2)) return is_geq(l1, max_lhs(l2)) && is_geq(l1, max_rhs(l2)); + if (is_max(l1) && (is_geq(max_lhs(l1), l2) || is_geq(max_rhs(l1), l2))) + return true; if (is_imax(l2)) return is_geq(l1, imax_lhs(l2)) && is_geq(l1, imax_rhs(l2)); - if (is_max(l1)) - return is_geq(max_lhs(l1), l2) || is_geq(max_rhs(l1), l2); if (is_imax(l1)) return is_geq(imax_rhs(l1), l2); auto p1 = to_offset(l1); diff --git a/tests/lean/run/coe2.lean b/tests/lean/run/coe2.lean new file mode 100644 index 000000000..9a7ddc9eb --- /dev/null +++ b/tests/lean/run/coe2.lean @@ -0,0 +1,20 @@ +import standard + +namespace setoid + inductive setoid : Type := + | mk_setoid: Π (A : Type), (A → A → Bool) → setoid + + definition carrier (s : setoid) + := setoid_rec (λ a eq, a) s + + definition eqv {s : setoid} : carrier s → carrier s → Bool + := setoid_rec (λ a eqv, eqv) s + + infix `≈`:50 := eqv + + coercion carrier + + inductive morphism (s1 s2 : setoid) : Type := + | mk_morphism : Π (f : s1 → s2), (∀ x y, x ≈ y → f x ≈ f y) → morphism s1 s2 + +end \ No newline at end of file