blob: 2959699c995d7b6e5dd0feb68d0f320b292f8eb7 [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.ExprDefEq
/- 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