File: .lake/packages/lean4/src/lean/Lean/Elab/Tactic/NormCast.lean

full_name: Lean.Elab.Tactic.NormCast.initFn._@..lake.packages.lean4.src.lean.Lean.Elab.Tactic.NormCast._hyg.6
code: builtin_initialize registerTraceClass `Tactic.norm_cast
goal: IO Unit

full_name: Lean.Elab.Tactic.NormCast.proveEqUsing
code: /-- Proves `a = b` using the given simp set. -/
def proveEqUsing (s : SimpTheorems) (a b : Expr) : MetaM (Option Simp.Result) 
goal: Lean.MetaM (Option Lean.Meta.Simp.Result)

full_name: Lean.Elab.Tactic.NormCast.proveEqUsingDown
code: /-- Proves `a = b` by simplifying using move and squash lemmas. -/
def proveEqUsingDown (a b : Expr) : MetaM (Option Simp.Result) 
goal: Lean.MetaM (Option Lean.Meta.Simp.Result)

full_name: Lean.Elab.Tactic.NormCast.mkCoe
code: /-- Constructs the expression `(e : ty)`. -/
def mkCoe (e : Expr) (ty : Expr) : MetaM Expr 
goal: Lean.MetaM Lean.Expr

full_name: Lean.Elab.Tactic.NormCast.isCoeOf?
code: /--
Checks whether an expression is the coercion of some other expression,
and if so returns that expression.
-/
def isCoeOf? (e : Expr) : MetaM (Option Expr) 
goal: Lean.MetaM (Option Lean.Expr)

full_name: Lean.Elab.Tactic.NormCast.isNumeral?
code: /--
Checks whether an expression is a numeral in some type,
and if so returns that type and the natural number.
-/
def isNumeral? (e : Expr) : Option (Expr × Nat) 
goal: Option (Lean.Expr × Nat)

full_name: Lean.Elab.Tactic.NormCast.splittingProcedure
code: /--
This is the main heuristic used alongside the elim and move lemmas.
The goal is to help casts move past operators by adding intermediate casts.
An expression of the shape:
```
op (↑(x : α) : γ) (↑(y : β) : γ)
```
is rewritten to:
```
op (↑(↑(x : α) : β) : γ) (↑(y : β) : γ)
```
when
```
(↑(↑(x : α) : β) : γ) = (↑(x : α) : γ)
```
can be proven with a squash lemma
-/
def splittingProcedure (expr : Expr) : MetaM Simp.Result 
goal: Lean.MetaM Lean.Meta.Simp.Result

full_name: Lean.Elab.Tactic.NormCast.prove
code: /--
Discharging function used during simplification in the "squash" step.
-/
-- TODO: normCast takes a list of expressions to use as lemmas for the discharger
-- TODO: a tactic to print the results the discharger fails to prove
def prove (e : Expr) : SimpM (Option Expr) 
goal: Lean.Meta.SimpM (Option Lean.Expr)

full_name: Lean.Elab.Tactic.NormCast.upwardAndElim
code: /--
Core rewriting function used in the "squash" step, which moves casts upwards
and eliminates them.

It tries to rewrite an expression using the elim and move lemmas.
On failure, it calls the splitting procedure heuristic.
-/
partial def upwardAndElim (up : SimpTheorems) (e : Expr) : SimpM Simp.Step 
goal: Lean.Meta.SimpM Lean.Meta.Simp.Step

full_name: Lean.Elab.Tactic.NormCast.numeralToCoe
code: /--
If possible, rewrites `(n : α)` to `(Nat.cast n : α)` where `n` is a numeral and `α ≠ ℕ`.
Returns a pair of the new expression and proof that they are equal.
-/
def numeralToCoe (e : Expr) : MetaM Simp.Result 
goal: Lean.MetaM Lean.Meta.Simp.Result

full_name: Lean.Elab.Tactic.NormCast.derive
code: /--
The core simplification routine of `normCast`.
-/
def derive (e : Expr) : MetaM Simp.Result 
goal: Lean.MetaM Lean.Meta.Simp.Result

full_name: Lean.Elab.Tactic.NormCast.elabModCast
code: @[builtin_term_elab modCast] def elabModCast : TermElab 
goal: Lean.Elab.Term.TermElab

full_name: Lean.Elab.Tactic.NormCast.normCastTarget
code: /-- Implementation of the `norm_cast` tactic when operating on the main goal. -/
def normCastTarget : TacticM Unit 
goal: Lean.Elab.Tactic.TacticM Unit

full_name: Lean.Elab.Tactic.NormCast.normCastHyp
code: /-- Implementation of the `norm_cast` tactic when operating on a hypothesis. -/
def normCastHyp (fvarId : FVarId) : TacticM Unit 
goal: Lean.Elab.Tactic.TacticM Unit

full_name: Lean.Elab.Tactic.NormCast.evalNormCast0
code: @[builtin_tactic normCast0]
def evalNormCast0 : Tactic 
goal: Lean.Elab.Tactic.Tactic

full_name: Lean.Elab.Tactic.NormCast.evalConvNormCast
code: @[builtin_tactic Lean.Parser.Tactic.Conv.normCast]
def evalConvNormCast : Tactic 
goal: Lean.Elab.Tactic.Tactic

full_name: Lean.Elab.Tactic.NormCast.evalPushCast
code: @[builtin_tactic pushCast]
def evalPushCast : Tactic 
goal: Lean.Elab.Tactic.Tactic

full_name: Lean.Elab.Tactic.NormCast.elabAddElim
code: @[builtin_command_elab Parser.Tactic.normCastAddElim] def elabAddElim : CommandElab 
goal: Lean.Elab.Command.CommandElab