feat: implement isEquiv in Lean

This commit is contained in:
Leonardo de Moura 2019-10-30 14:55:40 -07:00
parent 2f4a1f1239
commit 875d7657d9

View file

@ -49,6 +49,11 @@ def isIMax : Level → Bool
| imax _ _ => true
| _ => false
def isMaxIMax : Level → Bool
| max _ _ => true
| imax _ _ => true
| _ => false
def isParam : Level → Bool
| param _ => true
| _ => false
@ -144,12 +149,6 @@ protected constant beq (a : @& Level) (b : @& Level) : Bool := default _
instance : HasBeq Level := ⟨Level.beq⟩
/- Return true if `a` and `b` denote the same level.
Check is currently incomplete.
TODO: implement in Lean. -/
@[extern "lean_level_eqv"]
constant isEquiv (a : @& Level) (b : @& Level) : Bool := default _
/-- `occurs u l` return `true` iff `u` occurs in `l`. -/
def occurs : Level → Level → Bool
| u, l@(succ l₁) => u == l || occurs u l₁
@ -259,6 +258,12 @@ partial def normalize : Level → Level
addOffset (mkIMaxAux l₁ l₂) k
| _ => unreachable!
/- Return true if `u` and `v` denote the same level.
Check is currently incomplete. -/
def isEquiv (u v : Level) : Bool :=
u == v || u.normalize == v.normalize
/- Level to Format -/
namespace LevelToFormat
inductive Result