28 lines
809 B
Text
28 lines
809 B
Text
/-
|
|
Copyright (c) 2020 Microsoft Corporation. All rights reserved.
|
|
Released under Apache 2.0 license as described in the file LICENSE.
|
|
Authors: Leonardo de Moura
|
|
-/
|
|
module
|
|
|
|
prelude
|
|
public import Lean.Meta.Basic
|
|
|
|
public section
|
|
|
|
/-! # 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
|