Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
3ed2498
feat: the `cfc_pull` tactic
j-loreaux Aug 28, 2026
d2aa8aa
Merge remote-tracking branch 'origin/master' into cfc-pull
j-loreaux Aug 29, 2026
e9d9946
vastly simplify the documentation for the `cfc_pull` tactic syntax
j-loreaux Aug 30, 2026
cc3e525
simplify by making ring and element arguments required
j-loreaux Aug 30, 2026
cfda1ff
improve categorization in `SideGoalKind.ofType`
j-loreaux Aug 31, 2026
ccc76c7
make `Result` take a `CFCApp` and make `CFCApp` extend `Mode`
j-loreaux Aug 31, 2026
da5d42d
use fully-qualified names
j-loreaux Aug 31, 2026
6773efe
start simplifying `Attr`
j-loreaux Aug 31, 2026
cadb54e
use better names for the ffields of `CFCApp`
j-loreaux Aug 31, 2026
e79449c
various clean-up to `Attr.lean`
j-loreaux Aug 31, 2026
73de0e7
fix
j-loreaux Aug 31, 2026
31d843a
start cleaning up `Core.lean`
j-loreaux Aug 31, 2026
7de142e
more simplification
j-loreaux Sep 1, 2026
f2eba05
make `SideGoalKind`s part of the `State`
j-loreaux Sep 1, 2026
149560a
simplify some of `Core.lean`
j-loreaux Sep 1, 2026
9b93d5e
inline `isLemmaMVar`
j-loreaux Sep 1, 2026
83df7cd
fix
j-loreaux Sep 1, 2026
3d4e71e
simplify some documentation
j-loreaux Sep 1, 2026
48d60a9
minor cleanup
j-loreaux Sep 1, 2026
eac49d0
remove more unnecessary words
j-loreaux Sep 1, 2026
2920537
remove max recursion depth guards
j-loreaux Sep 1, 2026
63b8bf4
refactor: attribute `cfc_pull`'s candidate failures with trace nodes
j-loreaux Sep 2, 2026
7613d50
clean-up `Core.lean` more
j-loreaux Sep 9, 2026
9fab10d
lots more fixes and simplifications
j-loreaux Sep 9, 2026
391b026
simplify a few other files
j-loreaux Sep 9, 2026
884d05b
remove `Spec` and `Design` mostly
j-loreaux Sep 9, 2026
b64da06
move the scope into the `Core` file
j-loreaux Sep 9, 2026
91bbd7c
rename `Frontend` and make it the file to import
j-loreaux Sep 9, 2026
d000a6b
`mk_all`
j-loreaux Sep 9, 2026
dadda5b
cull examples, tracing and failures
j-loreaux Sep 9, 2026
bc3c8a0
clean up
j-loreaux Sep 9, 2026
6b303f3
add the ability to look through homomorphisms
j-loreaux Sep 9, 2026
b1b0294
allow use of the morphism class versions of `map_cfc`
j-loreaux Sep 10, 2026
d841133
Merge branch 'master' into cfc-pull
j-loreaux Sep 10, 2026
07d9998
fix
j-loreaux Sep 10, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion LeanOA.lean
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ public import LeanOA.Masa
public import LeanOA.Mathlib.Algebra.Group.Idempotent
public import LeanOA.Mathlib.Algebra.Order.Star.Conjugate
public import LeanOA.Mathlib.Analysis.CStarAlgebra.ApproximateUnit
public import LeanOA.Mathlib.Analysis.CStarAlgebra.ContinuousFunctionalCalculus.Basic
public import LeanOA.Mathlib.Analysis.CStarAlgebra.ContinuousFunctionalCalculus.Order
public import LeanOA.Mathlib.Analysis.CStarAlgebra.Module.Defs
public import LeanOA.Mathlib.Analysis.CStarAlgebra.MulNonneg
Expand All @@ -31,18 +30,25 @@ public import LeanOA.Mathlib.Analysis.LocallyConvex.Polar
public import LeanOA.Mathlib.Analysis.LocallyConvex.WeakBilin
public import LeanOA.Mathlib.Analysis.LocallyConvex.WithSeminorms
public import LeanOA.Mathlib.Analysis.Normed.Group.Uniform
public import LeanOA.Mathlib.Analysis.SpecialFunctions.ContinuousFunctionalCalculus.CFCPull.ComplexSqrt
public import LeanOA.Mathlib.Analysis.SpecialFunctions.ContinuousFunctionalCalculus.CFCPull.Lemmas
public import LeanOA.Mathlib.Analysis.SpecialFunctions.ContinuousFunctionalCalculus.CFCPull.Tags
public import LeanOA.Mathlib.Analysis.SpecialFunctions.ContinuousFunctionalCalculus.Rpow.Basic
public import LeanOA.Mathlib.Data.Real.Archimedean
public import LeanOA.Mathlib.Data.Set.Function
public import LeanOA.Mathlib.Misc
public import LeanOA.Mathlib.Order.Hom.Basic
public import LeanOA.Mathlib.Tactic.CFCPull
public import LeanOA.Mathlib.Tactic.CFCPull.Attr
public import LeanOA.Mathlib.Tactic.CFCPull.Core
public import LeanOA.Mathlib.Topology.Algebra.Module.LinearMap
public import LeanOA.Mathlib.Topology.Algebra.Module.PolarTopology
public import LeanOA.Mathlib.Topology.Algebra.Module.Spaces.UniformConvergenceCLM
public import LeanOA.Mathlib.Topology.Algebra.Module.WeakBilin
public import LeanOA.Mathlib.Topology.Algebra.Module.WeakDual
public import LeanOA.Mathlib.Topology.Algebra.UniformConvergence
public import LeanOA.Mathlib.Topology.ContinuousMap.ContinuousMapZero
public import LeanOA.MathlibTest.CFCPull
public import LeanOA.Notation
public import LeanOA.PositiveContinuousLinearMap
public import LeanOA.TendstoZero.Defs
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
/-
Copyright (c) 2026 Jireh Loreaux. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Jireh Loreaux
-/
module

public import Mathlib.Analysis.Complex.SqrtDeriv
public import LeanOA.Mathlib.Analysis.SpecialFunctions.ContinuousFunctionalCalculus.CFCPull.Tags
public import LeanOA.Mathlib.Tactic.CFCPull

/-! # `CFC.sqrt` via the complex functional calculus -/

public section

open scoped NNReal

namespace Complex

/-- `Complex.sqrt` is continuous on the closed right half-plane. -/
lemma continuousOn_sqrt_setOf_re_nonneg : ContinuousOn sqrt {z | 0 ≤ z.re} :=
fun _z hz ↦ (continuousAt_sqrt (.inl hz)).continuousWithinAt

end Complex

section NonUnital

variable {A : Type*} [TopologicalSpace A] [NonUnitalRing A] [StarRing A] [PartialOrder A]
[StarOrderedRing A] [Module ℂ A] [IsScalarTower ℂ A A] [SMulCommClass ℂ A A]
[NonUnitalContinuousFunctionalCalculus ℂ A IsStarNormal] [NonnegSpectrumClass ℝ A] {a : A}

/-- The `ℂ`-quasispectrum of a nonnegative element lies in the closed right half-plane, where
`Complex.sqrt` is continuous. -/
@[fun_prop]
lemma Complex.continuousOn_sqrt_quasispectrum (ha : 0 ≤ a) :
ContinuousOn Complex.sqrt (quasispectrum ℂ a) := by
refine Complex.continuousOn_sqrt_setOf_re_nonneg.mono ?_
rw [← ha.isSelfAdjoint.quasispectrumRestricts.algebraMap_image]
rintro - ⟨x, hx, rfl⟩
simpa using quasispectrum_nonneg_of_nonneg a ha x hx

variable [IsSemitopologicalRing A] [T2Space A]

/-- `CFC.sqrt` is the non-unital calculus over `ℂ` applied to `Complex.sqrt`. This is not
tagged `@[cfc_pull]` because it could generate side goals involving continuity of `Complex.sqrt`,
which are not easily discharged by `fun_prop`. -/
lemma CFC.sqrt_eq_cfcₙ_complex_sqrt (ha : 0 ≤ a) :
CFC.sqrt a = cfcₙ (fun x : ℂ ↦ x.sqrt) a := by
cfc_pull ℂ a
refine cfcₙ_congr ?_
rw [← (ha.isSelfAdjoint.quasispectrumRestricts.comp rfl (.nnreal_of_nonneg ha)).algebraMap_image]
rintro - ⟨x, hx, rfl⟩
rw [IsScalarTower.algebraMap_apply ℝ≥0 ℝ ℂ]
aesop (add simp [Complex.sqrt_of_nonneg])

end NonUnital

section Unital

variable {A : Type*} [TopologicalSpace A] [Ring A] [StarRing A] [PartialOrder A]
[StarOrderedRing A] [Algebra ℂ A] [ContinuousFunctionalCalculus ℂ A IsStarNormal]
[NonnegSpectrumClass ℝ A] {a : A}

/-- The `ℂ`-spectrum of a nonnegative element lies in the closed right half-plane, where
`Complex.sqrt` is continuous. -/
@[fun_prop]
lemma Complex.continuousOn_sqrt_spectrum (ha : 0 ≤ a) :
ContinuousOn Complex.sqrt (spectrum ℂ a) := by
refine Complex.continuousOn_sqrt_setOf_re_nonneg.mono ?_
rw [← ha.isSelfAdjoint.spectrumRestricts.algebraMap_image]
rintro - ⟨x, hx, rfl⟩
simpa using spectrum_nonneg_of_nonneg ha hx

variable [IsSemitopologicalRing A] [T2Space A]

/-- `CFC.sqrt` is the unital calculus over `ℂ` applied to `Complex.sqrt`. This is not
tagged `@[cfc_pull]` because it could generate side goals involving continuity of `Complex.sqrt`,
which are not easily discharged by `fun_prop`. -/
lemma CFC.sqrt_eq_cfc_complex_sqrt (ha : 0 ≤ a) :
CFC.sqrt a = cfc (fun x : ℂ ↦ x.sqrt) a := by
cfc_pull -unital [CFC.sqrt_eq_cfcₙ_complex_sqrt] ℂ a

end Unital
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
/-
Copyright (c) 2026 Jireh Loreaux. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Jireh Loreaux
-/
module

public import Mathlib.Analysis.SpecialFunctions.ContinuousFunctionalCalculus.Abs
public import Mathlib.Analysis.SpecialFunctions.ContinuousFunctionalCalculus.ExpLog.Basic

/-!
# Lemmas needed by the `cfc_pull` tactic

Some lemmas missing from Mathlib needed for the `cfc_pull` tactic.
-/

@[expose] public section

open scoped NNReal
open Topology ContinuousMap ContinuousMapZero

section Extend

variable {R A : Type*} {p : A → Prop} [CommSemiring R] [StarRing R] [MetricSpace R]
[IsTopologicalSemiring R] [ContinuousStar R] [TopologicalSpace A]

section Unital

variable [Ring A] [StarRing A] [Algebra R A] [ContinuousFunctionalCalculus R A p]

/-- The `g := 0` case of `cfcHom_eq_cfc_extend`. -/
lemma cfcHom_eq_cfc_extend_zero {a : A} (ha : p a) (f : C(spectrum R a, R)) :
cfcHom ha f = cfc (Function.extend Subtype.val f 0) a :=
cfcHom_eq_cfc_extend 0 ha f

end Unital

section NonUnital

variable [Nontrivial R] [NonUnitalRing A] [StarRing A] [Module R A] [IsScalarTower R A A]
[SMulCommClass R A A] [NonUnitalContinuousFunctionalCalculus R A p]

/-- The `g := 0` case of `cfcₙHom_eq_cfcₙ_extend`. -/
lemma cfcₙHom_eq_cfcₙ_extend_zero {a : A} (ha : p a) (f : C(quasispectrum R a, R)₀) :
cfcₙHom ha f = cfcₙ (Function.extend Subtype.val f 0) a :=
cfcₙHom_eq_cfcₙ_extend 0 ha f

end NonUnital

end Extend

namespace CFC

section Quasispectrum

-- TODO: these two results and the `grind` pattern should move next to
-- `NonnegSpectrumClass.quasispectrum_nonneg_of_nonneg`.

lemma quasispectrum_nonpos_of_nonpos {𝕜 A : Type*} [CommRing 𝕜]
[PartialOrder 𝕜] [IsOrderedAddMonoid 𝕜] [NonUnitalRing A] [PartialOrder A]
[IsOrderedAddMonoid A] [Module 𝕜 A] [NonnegSpectrumClass 𝕜 A]
[IsScalarTower 𝕜 A A] [SMulCommClass 𝕜 A A] (a : A) (ha : a ≤ 0) :
∀ x ∈ quasispectrum 𝕜 a, x ≤ 0 := by
have := quasispectrum_nonneg_of_nonneg (𝕜 := 𝕜) (-a) (by simpa using ha)
simpa [Unitization.quasispectrum_eq_spectrum_inr 𝕜, ← spectrum.neg_eq]

lemma nonpos_of_mem_quasispectrum {𝕜 A : Type*} [CommRing 𝕜]
[PartialOrder 𝕜] [IsOrderedAddMonoid 𝕜] [NonUnitalRing A] [PartialOrder A]
[IsOrderedAddMonoid A] [Module 𝕜 A] [NonnegSpectrumClass 𝕜 A]
[IsScalarTower 𝕜 A A] [SMulCommClass 𝕜 A A] {a : A} (ha : a ≤ 0) {x : 𝕜}
(hx : x ∈ quasispectrum 𝕜 a) : x ≤ 0 := quasispectrum_nonpos_of_nonpos a ha x hx

grind_pattern nonpos_of_mem_quasispectrum => x ∈ quasispectrum 𝕜 a

end Quasispectrum

section Sqrt

variable {A : Type*} [PartialOrder A] [NonUnitalRing A] [TopologicalSpace A] [StarRing A]
[Module ℝ A] [SMulCommClass ℝ A A] [IsScalarTower ℝ A A] [StarOrderedRing A]
[NonUnitalContinuousFunctionalCalculus ℝ A IsSelfAdjoint] [NonnegSpectrumClass ℝ A]

lemma sqrt_def (a : A) : sqrt a = cfcₙ NNReal.sqrt a := rfl

lemma abs_def (a : A) : abs a = cfcₙ NNReal.sqrt (star a * a) := rfl

end Sqrt

section Log

variable {A : Type*} [NormedRing A] [StarRing A] [NormedAlgebra ℝ A]
[ContinuousFunctionalCalculus ℝ A IsSelfAdjoint]

lemma log_def (a : A) : log a = cfc Real.log a := rfl

end Log

end CFC

section Norm

open CFC
open scoped ComplexOrder

section Unital

variable {A : Type*}
[Ring A] [TopologicalSpace A] [StarRing A] [PartialOrder A]
[StarOrderedRing A] [IsTopologicalRing A] [T2Space A]

lemma cfc_real_comp_norm [Algebra ℝ A] [NonnegSpectrumClass ℝ A]
[ContinuousFunctionalCalculus ℝ A IsSelfAdjoint] (f : ℝ → ℝ) (a : A)
(ha : IsSelfAdjoint a := by cfc_tac)
(hf : ContinuousOn f ((‖·‖) '' spectrum ℝ a) := by cfc_cont_tac) :
cfc (f ‖·‖) a = cfc f (abs a) :=
cfc_comp_norm f a

lemma cfc_complex_comp_norm [Algebra ℂ A] [NonnegSpectrumClass ℝ A]
[ContinuousFunctionalCalculus ℂ A IsStarNormal] (f : ℂ → ℂ) (a : A)
(ha : IsStarNormal a := by cfc_tac)
(hf : ContinuousOn f ((‖·‖) '' spectrum ℂ a) := by cfc_cont_tac) :
cfc (f ‖·‖) a = cfc f (abs a) :=
cfc_comp_norm f a

end Unital

section NonUnital

variable {A : Type*} [NonUnitalRing A] [TopologicalSpace A] [StarRing A] [PartialOrder A]
[StarOrderedRing A] [IsTopologicalRing A] [T2Space A]

lemma cfcₙ_real_comp_norm [Module ℝ A] [SMulCommClass ℝ A A] [IsScalarTower ℝ A A]
[NonnegSpectrumClass ℝ A] [NonUnitalContinuousFunctionalCalculus ℝ A IsSelfAdjoint]
(f : ℝ → ℝ) (a : A)
(ha : IsSelfAdjoint a := by cfc_tac)
(hf : ContinuousOn f ((‖·‖) '' quasispectrum ℝ a) := by cfc_cont_tac) :
cfcₙ (f ‖·‖) a = cfcₙ f (abs a) :=
cfcₙ_comp_norm f a

lemma cfcₙ_complex_comp_norm [Module ℂ A] [SMulCommClass ℂ A A] [IsScalarTower ℂ A A]
[NonnegSpectrumClass ℝ A] [NonUnitalContinuousFunctionalCalculus ℂ A IsStarNormal]
(f : ℂ → ℂ) (a : A)
(ha : IsStarNormal a := by cfc_tac)
(hf : ContinuousOn f ((‖·‖) '' quasispectrum ℂ a) := by cfc_cont_tac) :
cfcₙ (f ‖·‖) a = cfcₙ f (abs a) :=
cfcₙ_comp_norm f a

end NonUnital

end Norm

@[fun_prop]
lemma StarAlgHom.continuous_restrictScalars {R S A B : Type*} [TopologicalSpace A]
[TopologicalSpace B] [CommSemiring R] [CommSemiring S] [Semiring A] [Semiring B] [Algebra R S]
[Algebra S A] [Algebra S B] [Algebra R A] [Algebra R B] [IsScalarTower R S A]
[IsScalarTower R S B] [Star A] [Star B] {f : A →⋆ₐ[S] B} (hf : Continuous f) :
Continuous (f.restrictScalars R) :=
hf
Loading
Loading