File: .lake/packages/lean4/src/lean/Lean/Meta/Injective.lean

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.Injective.0.Lean.Meta.mkAnd?
code: private def mkAnd? (args : Array Expr) : Option Expr 
goal: Option Lean.Expr

full_name: Lean.Meta.elimOptParam
code: def elimOptParam (type : Expr) : CoreM Expr 
goal: Lean.CoreM Lean.Expr

full_name: Lean.Meta.occursOrInType.go
code: /-- Returns true if `e` occurs either in `t`, or in the type of a sub-expression of `t`.
  Consider the following example:
  ```lean
  inductive Tyₛ : Type (u+1)
  | SPi : (T : Type u) -> (T -> Tyₛ) -> Tyₛ

  inductive Tmₛ.{u} :  Tyₛ.{u} -> Type (u+1)
  | app : Tmₛ (.SPi T A) -> (arg : T) -> Tmₛ (A arg)```
  ```
  When looking for fixed arguments in `Tmₛ.app`, if we only consider occurences in the term `Tmₛ (A arg)`,
  `T` is considered non-fixed despite the fact that `A : T -> Tyₛ`.
  This leads to an ill-typed injectivity theorem signature:
  ```lean
  theorem Tmₛ.app.inj {T : Type u} {A : T → Tyₛ} {a : Tmₛ (Tyₛ.SPi T A)} {arg : T} {T_1 : Type u} {a_1 : Tmₛ (Tyₛ.SPi T_1 A)} :
  Tmₛ.app a arg = Tmₛ.app a_1 arg →
    T = T_1 ∧ HEq a a_1 := fun x => Tmₛ.noConfusion x fun T_eq A_eq a_eq arg_eq => eq_of_heq a_eq
  ```
  Instead of checking the type of every subterm, we only need to check the type of free variables, since free variables introduced in
  the constructor may only appear in the type of other free variables introduced after them.
-/
def occursOrInType (lctx : LocalContext) (e : Expr) (t : Expr) : Bool 
goal: Bool

full_name: Lean.Meta.occursOrInType
code: /-- Returns true if `e` occurs either in `t`, or in the type of a sub-expression of `t`.
  Consider the following example:
  ```lean
  inductive Tyₛ : Type (u+1)
  | SPi : (T : Type u) -> (T -> Tyₛ) -> Tyₛ

  inductive Tmₛ.{u} :  Tyₛ.{u} -> Type (u+1)
  | app : Tmₛ (.SPi T A) -> (arg : T) -> Tmₛ (A arg)```
  ```
  When looking for fixed arguments in `Tmₛ.app`, if we only consider occurences in the term `Tmₛ (A arg)`,
  `T` is considered non-fixed despite the fact that `A : T -> Tyₛ`.
  This leads to an ill-typed injectivity theorem signature:
  ```lean
  theorem Tmₛ.app.inj {T : Type u} {A : T → Tyₛ} {a : Tmₛ (Tyₛ.SPi T A)} {arg : T} {T_1 : Type u} {a_1 : Tmₛ (Tyₛ.SPi T_1 A)} :
  Tmₛ.app a arg = Tmₛ.app a_1 arg →
    T = T_1 ∧ HEq a a_1 := fun x => Tmₛ.noConfusion x fun T_eq A_eq a_eq arg_eq => eq_of_heq a_eq
  ```
  Instead of checking the type of every subterm, we only need to check the type of free variables, since free variables introduced in
  the constructor may only appear in the type of other free variables introduced after them.
-/
def occursOrInType (lctx : LocalContext) (e : Expr) (t : Expr) : Bool 
goal: Bool

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.Injective.0.Lean.Meta.mkInjectiveTheoremTypeCore?.mkArgs2
code: private partial def mkInjectiveTheoremTypeCore? (ctorVal : ConstructorVal) (useEq : Bool) : MetaM (Option Expr) 
goal: Lean.MetaM (Option Lean.Expr)

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.Injective.0.Lean.Meta.mkInjectiveTheoremTypeCore?
code: private partial def mkInjectiveTheoremTypeCore? (ctorVal : ConstructorVal) (useEq : Bool) : MetaM (Option Expr) 
goal: Lean.MetaM (Option Lean.Expr)

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.Injective.0.Lean.Meta.mkInjectiveTheoremType?
code: private def mkInjectiveTheoremType? (ctorVal : ConstructorVal) : MetaM (Option Expr) 
goal: Lean.MetaM (Option Lean.Expr)

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.Injective.0.Lean.Meta.injTheoremFailureHeader
code: private def injTheoremFailureHeader (ctorName : Name) : MessageData 
goal: Lean.MessageData

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.Injective.0.Lean.Meta.throwInjectiveTheoremFailure
code: private def throwInjectiveTheoremFailure {α} (ctorName : Name) (mvarId : MVarId) : MetaM α 
goal: Lean.MetaM α

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.Injective.0.Lean.Meta.solveEqOfCtorEq
code: private def solveEqOfCtorEq (ctorName : Name) (mvarId : MVarId) (h : FVarId) : MetaM Unit 
goal: Lean.MetaM Unit

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.Injective.0.Lean.Meta.mkInjectiveTheoremValue
code: private def mkInjectiveTheoremValue (ctorName : Name) (targetType : Expr) : MetaM Expr 
goal: Lean.MetaM Lean.Expr

full_name: Lean.Meta.mkInjectiveTheoremNameFor
code: def mkInjectiveTheoremNameFor (ctorName : Name) : Name 
goal: Lean.Name

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.Injective.0.Lean.Meta.mkInjectiveTheorem
code: private def mkInjectiveTheorem (ctorVal : ConstructorVal) : MetaM Unit 
goal: Lean.MetaM Unit

full_name: Lean.Meta.mkInjectiveEqTheoremNameFor
code: def mkInjectiveEqTheoremNameFor (ctorName : Name) : Name 
goal: Lean.Name

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.Injective.0.Lean.Meta.mkInjectiveEqTheoremType?
code: private def mkInjectiveEqTheoremType? (ctorVal : ConstructorVal) : MetaM (Option Expr) 
goal: Lean.MetaM (Option Lean.Expr)

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.Injective.0.Lean.Meta.mkInjectiveEqTheoremValue
code: private def mkInjectiveEqTheoremValue (ctorName : Name) (targetType : Expr) : MetaM Expr 
goal: Lean.MetaM Lean.Expr

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.Injective.0.Lean.Meta.mkInjectiveEqTheorem
code: private def mkInjectiveEqTheorem (ctorVal : ConstructorVal) : MetaM Unit 
goal: Lean.MetaM Unit

full_name: Lean.Meta.genInjectivity
code: register_builtin_option genInjectivity : Bool := {
  defValue := true
  descr    := "generate injectivity theorems for inductive datatype constructors"
}
goal: Lean.Option Bool

full_name: Lean.Meta.initFn._@..lake.packages.lean4.src.lean.Lean.Meta.Injective._hyg.1964
code: register_builtin_option genInjectivity : Bool := {
  defValue := true
  descr    := "generate injectivity theorems for inductive datatype constructors"
}
goal: IO (Lean.Option Bool)

full_name: Lean.Meta.mkInjectiveTheorems
code: def mkInjectiveTheorems (declName : Name) : MetaM Unit 
goal: Lean.MetaM Unit

full_name: Lean.Meta.initFn._@..lake.packages.lean4.src.lean.Lean.Meta.Injective._hyg.2306
code: builtin_initialize
  registerTraceClass `Meta.injective
goal: IO Unit