blob: 84e5a2c865dbaedbc71b955976f4ab1638879346 [file]
/-
Copyright (c) 2020 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Leonardo de Moura
-/
import Lean.Meta.Basic
/- Helper methods for inductive datatypes -/
namespace Lean.Meta
/- Return true if the types of the given constructors are compatible. -/
def compatibleCtors (ctorName₁ ctorName₂ : Name) : MetaM Bool := do
let ctorInfo₁ ← getConstInfoCtor ctorName₁
let ctorInfo₂ ← getConstInfoCtor ctorName₂
if ctorInfo₁.induct != ctorInfo₂.induct then
return false
else
let (_, _, ctorType₁) ← forallMetaTelescope ctorInfo₁.type
let (_, _, ctorType₂) ← forallMetaTelescope ctorInfo₂.type
isDefEq ctorType₁ ctorType₂
end Lean.Meta