From ac1132c7ca29fc4e7aa4755555bbd395b5589c82 Mon Sep 17 00:00:00 2001 From: jstoobysmith <72603918+jstoobysmith@users.noreply.github.com> Date: Fri, 12 Jul 2024 16:22:06 -0400 Subject: [PATCH] refactor: Linting substrings --- HepLean/AnomalyCancellation/MSSMNu/Basic.lean | 2 +- .../MSSMNu/OrthogY3B3/Basic.lean | 6 ++-- .../MSSMNu/OrthogY3B3/PlaneWithY3B3.lean | 30 ++++++++-------- .../MSSMNu/OrthogY3B3/ToSols.lean | 2 +- .../MSSMNu/Permutations.lean | 2 +- HepLean/AnomalyCancellation/PureU1/Basic.lean | 9 ++--- .../PureU1/BasisLinear.lean | 2 +- .../AnomalyCancellation/PureU1/ConstAbs.lean | 2 +- .../PureU1/Even/BasisLinear.lean | 2 +- .../PureU1/Even/LineInCubic.lean | 8 ++--- .../PureU1/Even/Parameterization.lean | 4 +-- .../PureU1/LineInPlaneCond.lean | 2 +- .../PureU1/LowDim/Three.lean | 2 +- .../PureU1/Odd/LineInCubic.lean | 6 ++-- .../PureU1/Odd/Parameterization.lean | 2 +- .../PureU1/Permutations.lean | 18 +++++----- HepLean/AnomalyCancellation/SM/Basic.lean | 16 ++++----- .../AnomalyCancellation/SM/FamilyMaps.lean | 2 +- .../SM/NoGrav/One/LinearParameterization.lean | 7 ++-- .../AnomalyCancellation/SM/Permutations.lean | 4 +-- HepLean/AnomalyCancellation/SMNu/Basic.lean | 6 ++-- .../SMNu/Ordinary/DimSevenPlane.lean | 35 ++++++++----------- .../SMNu/Permutations.lean | 2 +- HepLean/FeynmanDiagrams/Basic.lean | 6 ++-- HepLean/FeynmanDiagrams/Momentum.lean | 2 +- HepLean/FlavorPhysics/CKMMatrix/Basic.lean | 2 +- .../FlavorPhysics/CKMMatrix/PhaseFreedom.lean | 10 +++--- .../FlavorPhysics/CKMMatrix/Relations.lean | 10 +++--- HepLean/FlavorPhysics/CKMMatrix/Rows.lean | 8 ++--- .../StandardParameters.lean | 8 ++--- HepLean/Mathematics/LinearMaps.lean | 4 +-- HepLean/Mathematics/SO3/Basic.lean | 4 +-- HepLean/SpaceTime/LorentzGroup/Basic.lean | 2 +- .../SpaceTime/LorentzGroup/Orthochronous.lean | 2 +- HepLean/SpaceTime/LorentzGroup/Proper.lean | 2 +- .../LorentzVector/AsSelfAdjointMatrix.lean | 4 +-- HepLean/SpaceTime/MinkowskiMetric.lean | 2 +- .../HiggsBoson/PointwiseInnerProd.lean | 2 +- .../StandardModel/HiggsBoson/Potential.lean | 6 ++-- scripts/hepLean_style_lint.lean | 20 +++++++++-- 40 files changed, 133 insertions(+), 132 deletions(-) diff --git a/HepLean/AnomalyCancellation/MSSMNu/Basic.lean b/HepLean/AnomalyCancellation/MSSMNu/Basic.lean index d347022..dd91e02 100644 --- a/HepLean/AnomalyCancellation/MSSMNu/Basic.lean +++ b/HepLean/AnomalyCancellation/MSSMNu/Basic.lean @@ -76,7 +76,7 @@ def toSMSpecies (i : Fin 6) : MSSMCharges.Charges →ₗ[ℚ] MSSMSpecies.Charge lemma toSMSpecies_toSpecies_inv (i : Fin 6) (f : (Fin 6 → Fin 3 → ℚ) × (Fin 2 → ℚ)) : (toSMSpecies i) (toSpecies.symm f) = f.1 i := by - change (Prod.fst ∘ toSpecies ∘ toSpecies.symm ) _ i= f.1 i + change (Prod.fst ∘ toSpecies ∘ toSpecies.symm) _ i= f.1 i simp /-- The `Q` charges as a map `Fin 3 → ℚ`. -/ diff --git a/HepLean/AnomalyCancellation/MSSMNu/OrthogY3B3/Basic.lean b/HepLean/AnomalyCancellation/MSSMNu/OrthogY3B3/Basic.lean index 5ec2a7d..9b770e6 100644 --- a/HepLean/AnomalyCancellation/MSSMNu/OrthogY3B3/Basic.lean +++ b/HepLean/AnomalyCancellation/MSSMNu/OrthogY3B3/Basic.lean @@ -56,7 +56,7 @@ def proj (T : MSSMACC.LinSols) : MSSMACC.AnomalyFreePerp := lemma proj_val (T : MSSMACC.LinSols) : (proj T).val = (dot B₃.val T.val - dot Y₃.val T.val) • Y₃.val + - ( (dot Y₃.val T.val - 2 * dot B₃.val T.val)) • B₃.val + + (dot Y₃.val T.val - 2 * dot B₃.val T.val) • B₃.val + dot Y₃.val B₃.val • T.val := by rfl @@ -110,7 +110,7 @@ lemma quad_self_proj (T : MSSMACC.Sols) : lemma quad_proj (T : MSSMACC.Sols) : quadBiLin (proj T.1.1).val (proj T.1.1).val = 2 * dot Y₃.val B₃.val * ((dot B₃.val T.val - dot Y₃.val T.val) * quadBiLin Y₃.val T.val + - (dot Y₃.val T.val - 2 * dot B₃.val T.val) * quadBiLin B₃.val T.val ) := by + (dot Y₃.val T.val - 2 * dot B₃.val T.val) * quadBiLin B₃.val T.val) := by nth_rewrite 1 [proj_val] repeat rw [quadBiLin.map_add₁] repeat rw [quadBiLin.map_smul₁] @@ -159,7 +159,7 @@ lemma cube_proj_proj_self (T : MSSMACC.Sols) : cubeTriLin (proj T.1.1).val (proj T.1.1).val T.val = 2 * dot Y₃.val B₃.val * ((dot B₃.val T.val - dot Y₃.val T.val) * cubeTriLin T.val T.val Y₃.val + - ( dot Y₃.val T.val- 2 * dot B₃.val T.val) * cubeTriLin T.val T.val B₃.val) := by + (dot Y₃.val T.val - 2 * dot B₃.val T.val) * cubeTriLin T.val T.val B₃.val) := by rw [proj_val] rw [cubeTriLin.map_add₁, cubeTriLin.map_add₂] erw [lineY₃B₃_doublePoint] diff --git a/HepLean/AnomalyCancellation/MSSMNu/OrthogY3B3/PlaneWithY3B3.lean b/HepLean/AnomalyCancellation/MSSMNu/OrthogY3B3/PlaneWithY3B3.lean index 2c1073a..bba6c75 100644 --- a/HepLean/AnomalyCancellation/MSSMNu/OrthogY3B3/PlaneWithY3B3.lean +++ b/HepLean/AnomalyCancellation/MSSMNu/OrthogY3B3/PlaneWithY3B3.lean @@ -155,23 +155,23 @@ def α₁ (T : MSSMACC.AnomalyFreePerp) : ℚ := (3 * cubeTriLin T.val T.val B₃.val * quadBiLin T.val T.val - 2 * cubeTriLin T.val T.val T.val * quadBiLin B₃.val T.val) - /-- A helper function to simplify following expressions. -/ - def α₂ (T : MSSMACC.AnomalyFreePerp) : ℚ := - (2 * cubeTriLin T.val T.val T.val * quadBiLin Y₃.val T.val - - 3 * cubeTriLin T.val T.val Y₃.val * quadBiLin T.val T.val) +/-- A helper function to simplify following expressions. -/ +def α₂ (T : MSSMACC.AnomalyFreePerp) : ℚ := + (2 * cubeTriLin T.val T.val T.val * quadBiLin Y₃.val T.val - + 3 * cubeTriLin T.val T.val Y₃.val * quadBiLin T.val T.val) - /-- A helper function to simplify following expressions. -/ - def α₃ (T : MSSMACC.AnomalyFreePerp) : ℚ := - 6 * ((cubeTriLin T.val T.val Y₃.val) * quadBiLin B₃.val T.val - - (cubeTriLin T.val T.val B₃.val) * quadBiLin Y₃.val T.val) +/-- A helper function to simplify following expressions. -/ +def α₃ (T : MSSMACC.AnomalyFreePerp) : ℚ := + 6 * ((cubeTriLin T.val T.val Y₃.val) * quadBiLin B₃.val T.val - + (cubeTriLin T.val T.val B₃.val) * quadBiLin Y₃.val T.val) - lemma lineQuad_cube (R : MSSMACC.AnomalyFreePerp) (c₁ c₂ c₃ : ℚ) : - accCube (lineQuad R c₁ c₂ c₃).val = - - 4 * ( c₁ * quadBiLin B₃.val R.val - c₂ * quadBiLin Y₃.val R.val) ^ 2 * - ( α₁ R * c₁ + α₂ R * c₂ + α₃ R * c₃ ) := by - rw [lineQuad_val] - rw [planeY₃B₃_cubic, α₁, α₂, α₃] - ring +lemma lineQuad_cube (R : MSSMACC.AnomalyFreePerp) (c₁ c₂ c₃ : ℚ) : + accCube (lineQuad R c₁ c₂ c₃).val = + - 4 * (c₁ * quadBiLin B₃.val R.val - c₂ * quadBiLin Y₃.val R.val) ^ 2 * + (α₁ R * c₁ + α₂ R * c₂ + α₃ R * c₃) := by + rw [lineQuad_val] + rw [planeY₃B₃_cubic, α₁, α₂, α₃] + ring /-- The line in the plane spanned by `Y₃`, `B₃` and `R` which is in the cubic. -/ def lineCube (R : MSSMACC.AnomalyFreePerp) (a₁ a₂ a₃ : ℚ) : diff --git a/HepLean/AnomalyCancellation/MSSMNu/OrthogY3B3/ToSols.lean b/HepLean/AnomalyCancellation/MSSMNu/OrthogY3B3/ToSols.lean index 78917a7..8485f8e 100644 --- a/HepLean/AnomalyCancellation/MSSMNu/OrthogY3B3/ToSols.lean +++ b/HepLean/AnomalyCancellation/MSSMNu/OrthogY3B3/ToSols.lean @@ -147,7 +147,7 @@ def InCubeSolProp (R : MSSMACC.Sols) : Prop := that solution satisfies `inCubeSolProp`. It appears in the definition of `inLineEqProj`. -/ def cubicCoeff (T : MSSMACC.Sols) : ℚ := 3 * (dot Y₃.val B₃.val) ^ 3 * (cubeTriLin T.val T.val Y₃.val ^ 2 + - cubeTriLin T.val T.val B₃.val ^ 2 ) + cubeTriLin T.val T.val B₃.val ^ 2) lemma inCubeSolProp_iff_cubicCoeff_zero (T : MSSMACC.Sols) : InCubeSolProp T ↔ cubicCoeff T = 0 := by diff --git a/HepLean/AnomalyCancellation/MSSMNu/Permutations.lean b/HepLean/AnomalyCancellation/MSSMNu/Permutations.lean index b5da680..8dde17f 100644 --- a/HepLean/AnomalyCancellation/MSSMNu/Permutations.lean +++ b/HepLean/AnomalyCancellation/MSSMNu/Permutations.lean @@ -60,7 +60,7 @@ lemma chargeMap_toSpecies (f : PermGroup) (S : MSSMCharges.Charges) (j : Fin 6) @[simp] def repCharges : Representation ℚ PermGroup (MSSMCharges).Charges where toFun f := chargeMap f⁻¹ - map_mul' f g :=by + map_mul' f g := by simp only [PermGroup, mul_inv_rev] apply LinearMap.ext intro S diff --git a/HepLean/AnomalyCancellation/PureU1/Basic.lean b/HepLean/AnomalyCancellation/PureU1/Basic.lean index 096b2e8..4e6e2c3 100644 --- a/HepLean/AnomalyCancellation/PureU1/Basic.lean +++ b/HepLean/AnomalyCancellation/PureU1/Basic.lean @@ -51,22 +51,19 @@ def accCubeTriLinSymm {n : ℕ} : TriLinearSymm (PureU1Charges n).Charges := Tri rw [← Finset.sum_add_distrib] apply Fintype.sum_congr intro i - ring - ) + ring) (by intro S L T simp only [PureU1Charges_numberCharges] apply Fintype.sum_congr intro i - ring - ) + ring) (by intro S L T simp only [PureU1Charges_numberCharges] apply Fintype.sum_congr intro i - ring - ) + ring) /-- The cubic anomaly equation. -/ @[simp] diff --git a/HepLean/AnomalyCancellation/PureU1/BasisLinear.lean b/HepLean/AnomalyCancellation/PureU1/BasisLinear.lean index fcf53fd..c58f1e5 100644 --- a/HepLean/AnomalyCancellation/PureU1/BasisLinear.lean +++ b/HepLean/AnomalyCancellation/PureU1/BasisLinear.lean @@ -117,7 +117,7 @@ def coordinateMap : ((PureU1 n.succ).LinSols) ≃ₗ[ℚ] Fin n →₀ ℚ where exact Rat.mul_zero (f k) simp -/-- The basis of `LinSols`.-/ +/-- The basis of `LinSols`. -/ noncomputable def asBasis : Basis (Fin n) ℚ ((PureU1 n.succ).LinSols) where repr := coordinateMap diff --git a/HepLean/AnomalyCancellation/PureU1/ConstAbs.lean b/HepLean/AnomalyCancellation/PureU1/ConstAbs.lean index d440305..fd04fe4 100644 --- a/HepLean/AnomalyCancellation/PureU1/ConstAbs.lean +++ b/HepLean/AnomalyCancellation/PureU1/ConstAbs.lean @@ -191,7 +191,7 @@ lemma AFL_odd_noBoundary {A : (PureU1 (2 * n + 1)).LinSols} (h : ConstAbsSorted lemma AFL_odd_zero {A : (PureU1 (2 * n + 1)).LinSols} (h : ConstAbsSorted A.val) : A.val (0 : Fin (2 * n + 1)) = 0 := by by_contra hn - exact (AFL_odd_noBoundary h hn ) (AFL_hasBoundary h hn) + exact (AFL_odd_noBoundary h hn) (AFL_hasBoundary h hn) theorem AFL_odd (A : (PureU1 (2 * n + 1)).LinSols) (h : ConstAbsSorted A.val) : A = 0 := by diff --git a/HepLean/AnomalyCancellation/PureU1/Even/BasisLinear.lean b/HepLean/AnomalyCancellation/PureU1/Even/BasisLinear.lean index 83dd9df..33fe0dc 100644 --- a/HepLean/AnomalyCancellation/PureU1/Even/BasisLinear.lean +++ b/HepLean/AnomalyCancellation/PureU1/Even/BasisLinear.lean @@ -689,7 +689,7 @@ lemma P!_in_span (f : Fin n → ℚ) : P! f ∈ Submodule.span ℚ (Set.range ba use f rfl -lemma smul_basis!AsCharges_in_span (S : (PureU1 (2 * n.succ )).LinSols) (j : Fin n) : +lemma smul_basis!AsCharges_in_span (S : (PureU1 (2 * n.succ)).LinSols) (j : Fin n) : (S.val (δ!₂ j) - S.val (δ!₁ j)) • basis!AsCharges j ∈ Submodule.span ℚ (Set.range basis!AsCharges) := by apply Submodule.smul_mem diff --git a/HepLean/AnomalyCancellation/PureU1/Even/LineInCubic.lean b/HepLean/AnomalyCancellation/PureU1/Even/LineInCubic.lean index 1cee03f..25685fe 100644 --- a/HepLean/AnomalyCancellation/PureU1/Even/LineInCubic.lean +++ b/HepLean/AnomalyCancellation/PureU1/Even/LineInCubic.lean @@ -69,7 +69,7 @@ lemma line_in_cubic_P_P_P! {S : (PureU1 (2 * n.succ)).LinSols} (h : LineInCubic /-- We say a `LinSol` satisfies `lineInCubicPerm` if all its permutations satisfy `lineInCubic`. -/ def LineInCubicPerm (S : (PureU1 (2 * n.succ)).LinSols) : Prop := - ∀ (M : (FamilyPermutations (2 * n.succ)).group ), + ∀ (M : (FamilyPermutations (2 * n.succ)).group), LineInCubic ((FamilyPermutations (2 * n.succ)).linSolRep M S) /-- If `lineInCubicPerm S` then `lineInCubic S`. -/ @@ -104,7 +104,7 @@ lemma lineInCubicPerm_swap {S : (PureU1 (2 * n.succ)).LinSols} rw [accCubeTriLinSymm.map_add₃, h1, accCubeTriLinSymm.map_smul₃] at h2 simpa using h2 -lemma P_P_P!_accCube' {S : (PureU1 (2 * n.succ.succ )).LinSols} +lemma P_P_P!_accCube' {S : (PureU1 (2 * n.succ.succ)).LinSols} (f : Fin n.succ.succ → ℚ) (g : Fin n.succ → ℚ) (hS : S.val = Pa f g) : accCubeTriLinSymm (P f) (P f) (basis!AsCharges (Fin.last n)) = - (S.val (δ!₂ (Fin.last n)) + S.val (δ!₁ (Fin.last n))) * (2 * S.val δ!₄ + @@ -114,12 +114,12 @@ lemma P_P_P!_accCube' {S : (PureU1 (2 * n.succ.succ )).LinSols} have h2 := Pa_δ!₁ f g (Fin.last n) have h3 := Pa_δ!₂ f g (Fin.last n) simp at h1 h2 h3 - have hl : f (Fin.succ (Fin.last (n ))) = - Pa f g δ!₄ := by + have hl : f (Fin.succ (Fin.last n)) = - Pa f g δ!₄ := by simp_all only [Fin.succ_last, neg_neg] erw [hl] at h2 have hg : g (Fin.last n) = Pa f g (δ!₁ (Fin.last n)) + Pa f g δ!₄ := by linear_combination -(1 * h2) - have hll : f (Fin.castSucc (Fin.last (n ))) = + have hll : f (Fin.castSucc (Fin.last n)) = - (Pa f g (δ!₂ (Fin.last n)) + Pa f g (δ!₁ (Fin.last n)) + Pa f g δ!₄) := by linear_combination h3 - 1 * hg rw [← hS] at hl hll diff --git a/HepLean/AnomalyCancellation/PureU1/Even/Parameterization.lean b/HepLean/AnomalyCancellation/PureU1/Even/Parameterization.lean index f6dd281..de0d425 100644 --- a/HepLean/AnomalyCancellation/PureU1/Even/Parameterization.lean +++ b/HepLean/AnomalyCancellation/PureU1/Even/Parameterization.lean @@ -93,7 +93,7 @@ lemma genericCase_exists (S : (PureU1 (2 * n.succ)).Sols) rw [hS'.1, hS'.2] at hC exact hC' hC -/-- A proposition on a solution which is true if `accCubeTriLinSymm (P g, P g, P! f) = 0`.-/ +/-- A proposition on a solution which is true if `accCubeTriLinSymm (P g, P g, P! f) = 0`. -/ def SpecialCase (S : (PureU1 (2 * n.succ)).Sols) : Prop := ∀ (g : Fin n.succ → ℚ) (f : Fin n → ℚ) (_ : S.val = P g + P! f) , accCubeTriLinSymm (P g) (P g) (P! f) = 0 @@ -125,7 +125,7 @@ theorem generic_case {S : (PureU1 (2 * n.succ)).Sols} (h : GenericCase S) : rw [parameterization] apply ACCSystem.Sols.ext rw [parameterizationAsLinear_val] - change S.val = _ • ( _ • P g + _• P! f) + change S.val = _ • (_ • P g + _• P! f) rw [anomalyFree_param _ _ hS] rw [neg_neg, ← smul_add, smul_smul, inv_mul_cancel, one_smul] exact hS diff --git a/HepLean/AnomalyCancellation/PureU1/LineInPlaneCond.lean b/HepLean/AnomalyCancellation/PureU1/LineInPlaneCond.lean index cccdc3f..4ac6507 100644 --- a/HepLean/AnomalyCancellation/PureU1/LineInPlaneCond.lean +++ b/HepLean/AnomalyCancellation/PureU1/LineInPlaneCond.lean @@ -52,7 +52,7 @@ lemma lineInPlaneCond_perm {S : (PureU1 (n)).LinSols} (hS : LineInPlaneCond S) not_false_eq_true] lemma lineInPlaneCond_eq_last' {S : (PureU1 (n.succ.succ)).LinSols} (hS : LineInPlaneCond S) - (h : ¬ (S.val ((Fin.last n).castSucc))^2 = (S.val ((Fin.last n).succ))^2 ) : + (h : ¬ (S.val ((Fin.last n).castSucc))^2 = (S.val ((Fin.last n).succ))^2) : (2 - n) * S.val (Fin.last (n + 1)) = - (2 - n)* S.val (Fin.castSucc (Fin.last n)) := by erw [sq_eq_sq_iff_eq_or_eq_neg] at h diff --git a/HepLean/AnomalyCancellation/PureU1/LowDim/Three.lean b/HepLean/AnomalyCancellation/PureU1/LowDim/Three.lean index 5e1db12..1e739b9 100644 --- a/HepLean/AnomalyCancellation/PureU1/LowDim/Three.lean +++ b/HepLean/AnomalyCancellation/PureU1/LowDim/Three.lean @@ -43,7 +43,7 @@ lemma cube_for_linSol (S : (PureU1 3).LinSols) : lemma three_sol_zero (S : (PureU1 3).Sols) : S.val (0 : Fin 3) = 0 ∨ S.val (1 : Fin 3) = 0 ∨ S.val (2 : Fin 3) = 0 := (cube_for_linSol S.1.1).mpr S.cubicSol -/-- Given a `LinSol` with a charge equal to zero a `Sol`.-/ +/-- Given a `LinSol` with a charge equal to zero a `Sol`. -/ def solOfLinear (S : (PureU1 3).LinSols) (hS : S.val (0 : Fin 3) = 0 ∨ S.val (1 : Fin 3) = 0 ∨ S.val (2 : Fin 3) = 0) : (PureU1 3).Sols := diff --git a/HepLean/AnomalyCancellation/PureU1/Odd/LineInCubic.lean b/HepLean/AnomalyCancellation/PureU1/Odd/LineInCubic.lean index 6d909eb..d706d3c 100644 --- a/HepLean/AnomalyCancellation/PureU1/Odd/LineInCubic.lean +++ b/HepLean/AnomalyCancellation/PureU1/Odd/LineInCubic.lean @@ -58,12 +58,12 @@ lemma line_in_cubic_P_P_P! {S : (PureU1 (2 * n + 1)).LinSols} (h : LineInCubic S ∀ (g : Fin n → ℚ) (f : Fin n → ℚ) (_ : S.val = P g + P! f), accCubeTriLinSymm (P g) (P g) (P! f) = 0 := by intro g f hS - linear_combination 2 / 3 * (lineInCubic_expand h g f hS 1 1 ) - - (lineInCubic_expand h g f hS 1 2 ) / 6 + linear_combination 2 / 3 * (lineInCubic_expand h g f hS 1 1) - + (lineInCubic_expand h g f hS 1 2) / 6 /-- We say a `LinSol` satisfies `lineInCubicPerm` if all its permutations satisfy `lineInCubic`. -/ def LineInCubicPerm (S : (PureU1 (2 * n + 1)).LinSols) : Prop := - ∀ (M : (FamilyPermutations (2 * n + 1)).group ), + ∀ (M : (FamilyPermutations (2 * n + 1)).group), LineInCubic ((FamilyPermutations (2 * n + 1)).linSolRep M S) /-- If `lineInCubicPerm S` then `lineInCubic S`. -/ diff --git a/HepLean/AnomalyCancellation/PureU1/Odd/Parameterization.lean b/HepLean/AnomalyCancellation/PureU1/Odd/Parameterization.lean index a4f28d2..236414f 100644 --- a/HepLean/AnomalyCancellation/PureU1/Odd/Parameterization.lean +++ b/HepLean/AnomalyCancellation/PureU1/Odd/Parameterization.lean @@ -124,7 +124,7 @@ theorem generic_case {S : (PureU1 (2 * n.succ + 1)).Sols} (h : GenericCase S) : rw [parameterization] apply ACCSystem.Sols.ext rw [parameterizationAsLinear_val] - change S.val = _ • ( _ • P g + _• P! f) + change S.val = _ • (_ • P g + _• P! f) rw [anomalyFree_param _ _ hS] rw [neg_neg, ← smul_add, smul_smul, inv_mul_cancel, one_smul] exact hS diff --git a/HepLean/AnomalyCancellation/PureU1/Permutations.lean b/HepLean/AnomalyCancellation/PureU1/Permutations.lean index fd44944..ff18496 100644 --- a/HepLean/AnomalyCancellation/PureU1/Permutations.lean +++ b/HepLean/AnomalyCancellation/PureU1/Permutations.lean @@ -51,7 +51,7 @@ open PureU1Charges in @[simp] def permCharges {n : ℕ} : Representation ℚ (PermGroup n) (PureU1 n).Charges where toFun f := chargeMap f⁻¹ - map_mul' f g :=by + map_mul' f g := by simp only [PermGroup, mul_inv_rev] apply LinearMap.ext intro S @@ -214,7 +214,7 @@ lemma permTwo_fst : (permTwo hij hij').toFun i' = i := by lemma permTwo_snd : (permTwo hij hij').toFun j' = j := by rw [permTwo, permOfInjection] have ht := Equiv.extendSubtype_apply_of_mem - ((permTwoInj hij' ).toEquivRange.symm.trans + ((permTwoInj hij').toEquivRange.symm.trans (permTwoInj hij).toEquivRange) j' (permTwoInj_snd hij') simp at ht simp [ht, permTwoInj_snd_apply] @@ -303,16 +303,15 @@ lemma Prop_two (P : ℚ × ℚ → Prop) {S : (PureU1 n).LinSols} {a b : Fin n} (hab : a ≠ b) (h : ∀ (f : (FamilyPermutations n).group), P ((((FamilyPermutations n).linSolRep f S).val a), - (((FamilyPermutations n).linSolRep f S).val b) - )) : ∀ (i j : Fin n) (_ : i ≠ j), + (((FamilyPermutations n).linSolRep f S).val b))) : ∀ (i j : Fin n) (_ : i ≠ j), P (S.val i, S.val j) := by intro i j hij - have h1 := h (permTwo hij hab ).symm + have h1 := h (permTwo hij hab).symm rw [FamilyPermutations_anomalyFreeLinear_apply, FamilyPermutations_anomalyFreeLinear_apply] at h1 simp at h1 change P - (S.val ((permTwo hij hab ).toFun a), - S.val ((permTwo hij hab ).toFun b)) at h1 + (S.val ((permTwo hij hab).toFun a), + S.val ((permTwo hij hab).toFun b)) at h1 erw [permTwo_fst,permTwo_snd] at h1 exact h1 @@ -321,9 +320,8 @@ lemma Prop_three (P : ℚ × ℚ × ℚ → Prop) {S : (PureU1 n).LinSols} (h : ∀ (f : (FamilyPermutations n).group), P ((((FamilyPermutations n).linSolRep f S).val a),( (((FamilyPermutations n).linSolRep f S).val b), - (((FamilyPermutations n).linSolRep f S).val c) - ))) : ∀ (i j k : Fin n) (_ : i ≠ j) (_ : j ≠ k) (_ : i ≠ k), - P (S.val i, (S.val j, S.val k)) := by + (((FamilyPermutations n).linSolRep f S).val c)))) : ∀ (i j k : Fin n) + (_ : i ≠ j) (_ : j ≠ k) (_ : i ≠ k), P (S.val i, (S.val j, S.val k)) := by intro i j k hij hjk hik have h1 := h (permThree hij hjk hik hab hbc hac).symm rw [FamilyPermutations_anomalyFreeLinear_apply, FamilyPermutations_anomalyFreeLinear_apply, diff --git a/HepLean/AnomalyCancellation/SM/Basic.lean b/HepLean/AnomalyCancellation/SM/Basic.lean index fa49b1c..eeba547 100644 --- a/HepLean/AnomalyCancellation/SM/Basic.lean +++ b/HepLean/AnomalyCancellation/SM/Basic.lean @@ -54,9 +54,9 @@ lemma charges_eq_toSpecies_eq (S T : (SMCharges n).Charges) : apply toSpeciesEquiv.injective exact (Set.eqOn_univ (toSpeciesEquiv S) (toSpeciesEquiv T)).mp fun ⦃x⦄ _ => h x -lemma toSMSpecies_toSpecies_inv (i : Fin 5) (f : (Fin 5 → Fin n → ℚ) ) : +lemma toSMSpecies_toSpecies_inv (i : Fin 5) (f : Fin 5 → Fin n → ℚ) : (toSpecies i) (toSpeciesEquiv.symm f) = f i := by - change (toSpeciesEquiv ∘ toSpeciesEquiv.symm ) _ i= f i + change (toSpeciesEquiv ∘ toSpeciesEquiv.symm) _ i= f i simp /-- The `Q` charges as a map `Fin n → ℚ`. -/ @@ -272,8 +272,7 @@ def cubeTriLin : TriLinearSymm (SMCharges n).Charges := TriLinearSymm.mk₃ intro i repeat erw [map_smul] simp [HSMul.hSMul, SMul.smul] - ring - ) + ring) (by intro S T R L simp only @@ -282,22 +281,19 @@ def cubeTriLin : TriLinearSymm (SMCharges n).Charges := TriLinearSymm.mk₃ intro i repeat erw [map_add] simp only [ACCSystemCharges.chargesAddCommMonoid_add, toSpecies_apply, Fin.isValue] - ring - ) + ring) (by intro S T L simp only [SMSpecies_numberCharges, toSpecies_apply, Fin.isValue] apply Fintype.sum_congr intro i - ring - ) + ring) (by intro S T L simp only [SMSpecies_numberCharges, toSpecies_apply, Fin.isValue] apply Fintype.sum_congr intro i - ring - ) + ring) /-- The cubic acc. -/ @[simp] diff --git a/HepLean/AnomalyCancellation/SM/FamilyMaps.lean b/HepLean/AnomalyCancellation/SM/FamilyMaps.lean index d500301..460d0a6 100644 --- a/HepLean/AnomalyCancellation/SM/FamilyMaps.lean +++ b/HepLean/AnomalyCancellation/SM/FamilyMaps.lean @@ -100,7 +100,7 @@ def speciesFamilyUniversial (n : ℕ) : /-- The embedding of the `1`-family charges into the `n`-family charges in a universal manor. -/ -def familyUniversal ( n : ℕ) : (SMCharges 1).Charges →ₗ[ℚ] (SMCharges n).Charges := +def familyUniversal (n : ℕ) : (SMCharges 1).Charges →ₗ[ℚ] (SMCharges n).Charges := chargesMapOfSpeciesMap (speciesFamilyUniversial n) end SM diff --git a/HepLean/AnomalyCancellation/SM/NoGrav/One/LinearParameterization.lean b/HepLean/AnomalyCancellation/SM/NoGrav/One/LinearParameterization.lean index 62c31f6..e1dbbcf 100644 --- a/HepLean/AnomalyCancellation/SM/NoGrav/One/LinearParameterization.lean +++ b/HepLean/AnomalyCancellation/SM/NoGrav/One/LinearParameterization.lean @@ -183,7 +183,8 @@ lemma grav (S : linearParameters) : end linearParameters -/-- The parameters for solutions to the linear ACCs with the condition that Q and E are non-zero.-/ +/-- The parameters for solutions to the linear ACCs with the condition that Q and E are + non-zero. -/ structure linearParametersQENeqZero where /-- The parameter `x`. -/ x : ℚ @@ -291,7 +292,7 @@ lemma cubic_v_or_w_zero (S : linearParametersQENeqZero) (h : accCube (bijection exact h2 h lemma cubic_v_zero (S : linearParametersQENeqZero) (h : accCube (bijection S).1.val = 0) - (hv : S.v = 0 ) : S.w = -1 := by + (hv : S.v = 0) : S.w = -1 := by rw [S.cubic, hv] at h simp at h have h' : (S.w + 1) * (1 * S.w * S.w + (-1) * S.w + 1) = 0 := by @@ -309,7 +310,7 @@ lemma cubic_v_zero (S : linearParametersQENeqZero) (h : accCube (bijection S).1. exact eq_neg_of_add_eq_zero_left h' lemma cube_w_zero (S : linearParametersQENeqZero) (h : accCube (bijection S).1.val = 0) - (hw : S.w = 0 ) : S.v = -1 := by + (hw : S.w = 0) : S.v = -1 := by rw [S.cubic, hw] at h simp at h have h' : (S.v + 1) * (1 * S.v * S.v + (-1) * S.v + 1) = 0 := by diff --git a/HepLean/AnomalyCancellation/SM/Permutations.lean b/HepLean/AnomalyCancellation/SM/Permutations.lean index 35fdc19..a683d7c 100644 --- a/HepLean/AnomalyCancellation/SM/Permutations.lean +++ b/HepLean/AnomalyCancellation/SM/Permutations.lean @@ -36,7 +36,7 @@ instance : Group (PermGroup n) := Pi.group /-- The image of an element of `permGroup n` under the representation on charges. -/ @[simps!] def chargeMap (f : PermGroup n) : (SMCharges n).Charges →ₗ[ℚ] (SMCharges n).Charges where - toFun S := toSpeciesEquiv.symm (fun i => toSpecies i S ∘ f i ) + toFun S := toSpeciesEquiv.symm (fun i => toSpecies i S ∘ f i) map_add' _ _ := rfl map_smul' _ _ := rfl @@ -44,7 +44,7 @@ def chargeMap (f : PermGroup n) : (SMCharges n).Charges →ₗ[ℚ] (SMCharges n @[simp] def repCharges {n : ℕ} : Representation ℚ (PermGroup n) (SMCharges n).Charges where toFun f := chargeMap f⁻¹ - map_mul' f g :=by + map_mul' f g := by simp only [PermGroup, mul_inv_rev] apply LinearMap.ext intro S diff --git a/HepLean/AnomalyCancellation/SMNu/Basic.lean b/HepLean/AnomalyCancellation/SMNu/Basic.lean index 569b2b6..825699a 100644 --- a/HepLean/AnomalyCancellation/SMNu/Basic.lean +++ b/HepLean/AnomalyCancellation/SMNu/Basic.lean @@ -31,7 +31,7 @@ namespace SMνCharges variable {n : ℕ} /-- An equivalence between `(SMνCharges n).charges` and `(Fin 6 → Fin n → ℚ)` -splitting the charges into species.-/ +splitting the charges into species. -/ @[simps!] def toSpeciesEquiv : (SMνCharges n).Charges ≃ (Fin 6 → Fin n → ℚ) := ((Equiv.curry _ _ _).symm.trans ((@finProdFinEquiv 6 n).arrowCongr (Equiv.refl ℚ))).symm @@ -54,9 +54,9 @@ lemma charges_eq_toSpecies_eq (S T : (SMνCharges n).Charges) : funext i exact h i -lemma toSMSpecies_toSpecies_inv (i : Fin 6) (f : (Fin 6 → Fin n → ℚ) ) : +lemma toSMSpecies_toSpecies_inv (i : Fin 6) (f : Fin 6 → Fin n → ℚ) : (toSpecies i) (toSpeciesEquiv.symm f) = f i := by - change (toSpeciesEquiv ∘ toSpeciesEquiv.symm ) _ i = f i + change (toSpeciesEquiv ∘ toSpeciesEquiv.symm) _ i = f i simp lemma toSpecies_one (S : (SMνCharges 1).Charges) (j : Fin 6) : diff --git a/HepLean/AnomalyCancellation/SMNu/Ordinary/DimSevenPlane.lean b/HepLean/AnomalyCancellation/SMNu/Ordinary/DimSevenPlane.lean index dc30736..f602a19 100644 --- a/HepLean/AnomalyCancellation/SMNu/Ordinary/DimSevenPlane.lean +++ b/HepLean/AnomalyCancellation/SMNu/Ordinary/DimSevenPlane.lean @@ -24,12 +24,11 @@ open BigOperators namespace PlaneSeven /-- A charge assignment forming one of the basis elements of the plane. -/ -def B₀ : (SM 3).Charges := toSpeciesEquiv.invFun ( fun s => fun i => +def B₀ : (SM 3).Charges := toSpeciesEquiv.invFun (fun s => fun i => match s, i with | 0, 0 => 1 | 0, 1 => - 1 - | _, _ => 0 - ) + | _, _ => 0) lemma B₀_cubic (S T : (SM 3).Charges) : cubeTriLin B₀ S T = 6 * (S (0 : Fin 18) * T (0 : Fin 18) - S (1 : Fin 18) * T (1 : Fin 18)) := by @@ -37,12 +36,11 @@ lemma B₀_cubic (S T : (SM 3).Charges) : cubeTriLin B₀ S T = ring /-- A charge assignment forming one of the basis elements of the plane. -/ -def B₁ : (SM 3).Charges := toSpeciesEquiv.invFun ( fun s => fun i => +def B₁ : (SM 3).Charges := toSpeciesEquiv.invFun (fun s => fun i => match s, i with | 1, 0 => 1 | 1, 1 => - 1 - | _, _ => 0 - ) + | _, _ => 0) lemma B₁_cubic (S T : (SM 3).Charges) : cubeTriLin B₁ S T = 3 * (S (3 : Fin 18) * T (3 : Fin 18) - S (4 : Fin 18) * T (4 : Fin 18)) := by @@ -50,12 +48,11 @@ lemma B₁_cubic (S T : (SM 3).Charges) : cubeTriLin B₁ S T = ring /-- A charge assignment forming one of the basis elements of the plane. -/ -def B₂ : (SM 3).Charges := toSpeciesEquiv.invFun ( fun s => fun i => +def B₂ : (SM 3).Charges := toSpeciesEquiv.invFun (fun s => fun i => match s, i with | 2, 0 => 1 | 2, 1 => - 1 - | _, _ => 0 - ) + | _, _ => 0) lemma B₂_cubic (S T : (SM 3).Charges) : cubeTriLin B₂ S T = 3 * (S (6 : Fin 18) * T (6 : Fin 18) - S (7 : Fin 18) * T (7 : Fin 18)) := by @@ -63,12 +60,11 @@ lemma B₂_cubic (S T : (SM 3).Charges) : cubeTriLin B₂ S T = ring /-- A charge assignment forming one of the basis elements of the plane. -/ -def B₃ : (SM 3).Charges := toSpeciesEquiv.invFun ( fun s => fun i => +def B₃ : (SM 3).Charges := toSpeciesEquiv.invFun (fun s => fun i => match s, i with | 3, 0 => 1 | 3, 1 => - 1 - | _, _ => 0 - ) + | _, _ => 0) lemma B₃_cubic (S T : (SM 3).Charges) : cubeTriLin B₃ S T = 2 * (S (9 : Fin 18) * T (9 : Fin 18) - S (10 : Fin 18) * T (10 : Fin 18)) := by @@ -77,12 +73,11 @@ lemma B₃_cubic (S T : (SM 3).Charges) : cubeTriLin B₃ S T = rfl /-- A charge assignment forming one of the basis elements of the plane. -/ -def B₄ : (SM 3).Charges := toSpeciesEquiv.invFun ( fun s => fun i => +def B₄ : (SM 3).Charges := toSpeciesEquiv.invFun (fun s => fun i => match s, i with | 4, 0 => 1 | 4, 1 => - 1 - | _, _ => 0 - ) + | _, _ => 0) lemma B₄_cubic (S T : (SM 3).Charges) : cubeTriLin B₄ S T = (S (12 : Fin 18) * T (12 : Fin 18) - S (13 : Fin 18) * T (13 : Fin 18)) := by @@ -91,12 +86,11 @@ lemma B₄_cubic (S T : (SM 3).Charges) : cubeTriLin B₄ S T = rfl /-- A charge assignment forming one of the basis elements of the plane. -/ -def B₅ : (SM 3).Charges := toSpeciesEquiv.invFun ( fun s => fun i => +def B₅ : (SM 3).Charges := toSpeciesEquiv.invFun (fun s => fun i => match s, i with | 5, 0 => 1 | 5, 1 => - 1 - | _, _ => 0 - ) + | _, _ => 0) lemma B₅_cubic (S T : (SM 3).Charges) : cubeTriLin B₅ S T = (S (15 : Fin 18) * T (15 : Fin 18) - S (16 : Fin 18) * T (16 : Fin 18)) := by @@ -105,12 +99,11 @@ lemma B₅_cubic (S T : (SM 3).Charges) : cubeTriLin B₅ S T = rfl /-- A charge assignment forming one of the basis elements of the plane. -/ -def B₆ : (SM 3).Charges := toSpeciesEquiv.invFun ( fun s => fun i => +def B₆ : (SM 3).Charges := toSpeciesEquiv.invFun (fun s => fun i => match s, i with | 1, 2 => 1 | 2, 2 => -1 - | _, _ => 0 - ) + | _, _ => 0) lemma B₆_cubic (S T : (SM 3).Charges) : cubeTriLin B₆ S T = 3 * (S (5 : Fin 18) * T (5 : Fin 18) - S (8 : Fin 18) * T (8 : Fin 18)) := by diff --git a/HepLean/AnomalyCancellation/SMNu/Permutations.lean b/HepLean/AnomalyCancellation/SMNu/Permutations.lean index 5a31565..16626d0 100644 --- a/HepLean/AnomalyCancellation/SMNu/Permutations.lean +++ b/HepLean/AnomalyCancellation/SMNu/Permutations.lean @@ -36,7 +36,7 @@ instance : Group (PermGroup n) := Pi.group /-- The image of an element of `permGroup n` under the representation on charges. -/ @[simps!] def chargeMap (f : PermGroup n) : (SMνCharges n).Charges →ₗ[ℚ] (SMνCharges n).Charges where - toFun S := toSpeciesEquiv.symm (fun i => toSpecies i S ∘ f i ) + toFun S := toSpeciesEquiv.symm (fun i => toSpecies i S ∘ f i) map_add' _ _ := rfl map_smul' _ _ := rfl diff --git a/HepLean/FeynmanDiagrams/Basic.lean b/HepLean/FeynmanDiagrams/Basic.lean index a5669ef..e390a76 100644 --- a/HepLean/FeynmanDiagrams/Basic.lean +++ b/HepLean/FeynmanDiagrams/Basic.lean @@ -289,7 +289,7 @@ instance diagramVertexPropDecidable @decidable_of_decidable_of_iff _ _ (@Fintype.decidableForallFintype _ _ (fun _ => @Fintype.decidableExistsFintype _ _ (fun _ => @And.decidable _ _ _ (@Fintype.decidablePiFintype _ _ - (fun _ => P.preFeynmanRuleDecEq𝓱𝓔) _ _ _)) _ ) _) + (fun _ => P.preFeynmanRuleDecEq𝓱𝓔) _ _ _)) _) _) (P.diagramVertexProp_iff F f).symm instance diagramEdgePropDecidable @@ -299,7 +299,7 @@ instance diagramEdgePropDecidable @decidable_of_decidable_of_iff _ _ (@Fintype.decidableForallFintype _ _ (fun _ => @Fintype.decidableExistsFintype _ _ (fun _ => @And.decidable _ _ _ (@Fintype.decidablePiFintype _ _ - (fun _ => P.preFeynmanRuleDecEq𝓱𝓔) _ _ _)) _ ) _) + (fun _ => P.preFeynmanRuleDecEq𝓱𝓔) _ _ _)) _) _) (P.diagramEdgeProp_iff F f).symm end PreFeynmanRule @@ -717,7 +717,7 @@ instance [IsFiniteDiagram F] : DecidableRel F.AdjRelation := fun _ _ => @Fintype.decidableExistsFintype _ _ (fun _ => @Fintype.decidableExistsFintype _ _ ( fun _ => @And.decidable _ _ (instDecidableEq𝓔OfIsFiniteDiagram _ _) $ @And.decidable _ _ (instDecidableEq𝓥OfIsFiniteDiagram _ _) - (instDecidableEq𝓥OfIsFiniteDiagram _ _)) _ ) _ + (instDecidableEq𝓥OfIsFiniteDiagram _ _)) _) _ /-- From a Feynman diagram the simple graph showing those vertices which are connected. -/ def toSimpleGraph : SimpleGraph F.𝓥 where diff --git a/HepLean/FeynmanDiagrams/Momentum.lean b/HepLean/FeynmanDiagrams/Momentum.lean index 27753d2..b12ebd4 100644 --- a/HepLean/FeynmanDiagrams/Momentum.lean +++ b/HepLean/FeynmanDiagrams/Momentum.lean @@ -109,7 +109,7 @@ instance (i : Fin 2) : Module ℝ (EdgeVertexMomentaMap F i) := | 0 => instModuleRealEdgeMomenta F | 1 => instModuleRealVertexMomenta F -/-- The direct sum of `EdgeMomenta` and `VertexMomenta`.-/ +/-- The direct sum of `EdgeMomenta` and `VertexMomenta`. -/ def EdgeVertexMomenta : Type := DirectSum (Fin 2) (EdgeVertexMomentaMap F) instance : AddCommGroup F.EdgeVertexMomenta := DirectSum.instAddCommGroup _ diff --git a/HepLean/FlavorPhysics/CKMMatrix/Basic.lean b/HepLean/FlavorPhysics/CKMMatrix/Basic.lean index 991c8fa..7f78ada 100644 --- a/HepLean/FlavorPhysics/CKMMatrix/Basic.lean +++ b/HepLean/FlavorPhysics/CKMMatrix/Basic.lean @@ -236,7 +236,7 @@ lemma td (V : CKMMatrix) (a b c d e f : ℝ) : simp only [Fin.isValue, cons_val', cons_val_zero, empty_val', cons_val_fin_one, vecCons_const, cons_val_two, tail_val', head_val', cons_val_one, head_cons, tail_cons, head_fin_const, zero_mul, add_zero, mul_zero] - change (0 * _ + _ ) * _ + (0 * _ + _ ) * 0 = _ + change (0 * _ + _) * _ + (0 * _ + _) * 0 = _ simp only [Fin.isValue, zero_mul, zero_add, mul_zero, add_zero] rw [exp_add] ring_nf diff --git a/HepLean/FlavorPhysics/CKMMatrix/PhaseFreedom.lean b/HepLean/FlavorPhysics/CKMMatrix/PhaseFreedom.lean index ac7d93b..4b08152 100644 --- a/HepLean/FlavorPhysics/CKMMatrix/PhaseFreedom.lean +++ b/HepLean/FlavorPhysics/CKMMatrix/PhaseFreedom.lean @@ -227,9 +227,9 @@ lemma fstRowThdColRealCond_holds_up_to_equiv (V : CKMMatrix) : obtain ⟨τ, hτ⟩ := V.uRow_cross_cRow_eq_tRow let U : CKMMatrix := phaseShiftApply V 0 - (- τ + arg [V]ud + arg [V]us + arg [V]tb ) - (- τ + arg [V]cb + arg [V]ud + arg [V]us ) - (- arg [V]ud ) + (- τ + arg [V]ud + arg [V]us + arg [V]tb) + (- τ + arg [V]cb + arg [V]ud + arg [V]us) + (- arg [V]ud) (- arg [V]us) (τ - arg [V]ud - arg [V]us - arg [V]cb - arg [V]tb) have hUV : Quotient.mk CKMMatrixSetoid U = ⟦V⟧ := by @@ -262,7 +262,7 @@ lemma ubOnePhaseCond_hold_up_to_equiv_of_ub_one {V : CKMMatrix} (hb : ¬ ([V]ud (hV : FstRowThdColRealCond V) : ∃ (U : CKMMatrix), V ≈ U ∧ ubOnePhaseCond U:= by let U : CKMMatrix := phaseShiftApply V 0 0 (- Real.pi + arg [V]cd + arg [V]cs + arg [V]ub) - (Real.pi - arg [V]cd ) (- arg [V]cs) (- arg [V]ub ) + (Real.pi - arg [V]cd) (- arg [V]cs) (- arg [V]ub) use U have hUV : Quotient.mk CKMMatrixSetoid U= ⟦V⟧ := by simp only [Quotient.eq] @@ -318,7 +318,7 @@ lemma ubOnePhaseCond_hold_up_to_equiv_of_ub_one {V : CKMMatrix} (hb : ¬ ([V]ud lemma cd_of_fstRowThdColRealCond {V : CKMMatrix} (hb : [V]ud ≠ 0 ∨ [V]us ≠ 0) (hV : FstRowThdColRealCond V) : [V]cd = (- VtbAbs ⟦V⟧ * VusAbs ⟦V⟧ / (VudAbs ⟦V⟧ ^2 + VusAbs ⟦V⟧ ^2)) + - (- VubAbs ⟦V⟧ * VudAbs ⟦V⟧ * VcbAbs ⟦V⟧ / (VudAbs ⟦V⟧ ^2 + VusAbs ⟦V⟧ ^2 )) + (- VubAbs ⟦V⟧ * VudAbs ⟦V⟧ * VcbAbs ⟦V⟧ / (VudAbs ⟦V⟧ ^2 + VusAbs ⟦V⟧ ^2)) * cexp (- arg [V]ub * I) := by have hτ : [V]t = cexp ((0 : ℝ) * I) • (conj ([V]u) ×₃ conj ([V]c)) := by simp only [ofReal_zero, zero_mul, exp_zero, one_smul] diff --git a/HepLean/FlavorPhysics/CKMMatrix/Relations.lean b/HepLean/FlavorPhysics/CKMMatrix/Relations.lean index 5602103..6ce84d4 100644 --- a/HepLean/FlavorPhysics/CKMMatrix/Relations.lean +++ b/HepLean/FlavorPhysics/CKMMatrix/Relations.lean @@ -84,7 +84,7 @@ lemma ud_us_neq_zero_iff_ub_neq_one (V : CKMMatrix) : simp_all have h1 := Complex.abs.nonneg [V]ub rw [h2] at h1 - have h2 : ¬ 0 ≤ ( -1 : ℝ) := by simp + have h2 : ¬ 0 ≤ (-1 : ℝ) := by simp exact h2 h1 lemma normSq_Vud_plus_normSq_Vus_neq_zero_ℝ {V : CKMMatrix} (hb : [V]ud ≠ 0 ∨ [V]us ≠ 0) : @@ -100,7 +100,7 @@ lemma normSq_Vud_plus_normSq_Vus_neq_zero_ℝ {V : CKMMatrix} (hb : [V]ud ≠ 0 exact hb h2 have h3 := Complex.abs.nonneg [V]ub rw [h2] at h3 - have h2 : ¬ 0 ≤ ( -1 : ℝ) := by simp + have h2 : ¬ 0 ≤ (-1 : ℝ) := by simp exact h2 h3 lemma VAbsub_neq_zero_Vud_Vus_neq_zero {V : Quotient CKMMatrixSetoid} @@ -154,11 +154,11 @@ lemma fst_row_orthog_thd_row (V : CKMMatrix) : lemma Vcd_mul_conj_Vud (V : CKMMatrix) : [V]cd * conj [V]ud = -[V]cs * conj [V]us - [V]cb * conj [V]ub := by - linear_combination (V.fst_row_orthog_snd_row ) + linear_combination (V.fst_row_orthog_snd_row) lemma Vcs_mul_conj_Vus (V : CKMMatrix) : [V]cs * conj [V]us = - [V]cd * conj [V]ud - [V]cb * conj [V]ub := by - linear_combination (V.fst_row_orthog_snd_row ) + linear_combination V.fst_row_orthog_snd_row end orthogonal @@ -344,7 +344,7 @@ lemma cb_tb_neq_zero_iff_ub_neq_one (V : CKMMatrix) : simp_all have h1 := Complex.abs.nonneg [V]ub rw [h2] at h1 - have h2 : ¬ 0 ≤ ( -1 : ℝ) := by simp + have h2 : ¬ 0 ≤ (-1 : ℝ) := by simp exact h2 h1 lemma VAbs_fst_col_eq_one_snd_eq_zero {V : Quotient CKMMatrixSetoid} {i : Fin 3} diff --git a/HepLean/FlavorPhysics/CKMMatrix/Rows.lean b/HepLean/FlavorPhysics/CKMMatrix/Rows.lean index b48d0b2..6fcbe60 100644 --- a/HepLean/FlavorPhysics/CKMMatrix/Rows.lean +++ b/HepLean/FlavorPhysics/CKMMatrix/Rows.lean @@ -240,7 +240,7 @@ lemma cRow_cross_tRow_eq_uRow (V : CKMMatrix) : lemma uRow_cross_cRow_eq_tRow (V : CKMMatrix) : ∃ (τ : ℝ), [V]t = cexp (τ * I) • (conj ([V]u) ×₃ conj ([V]c)) := by obtain ⟨g, hg⟩ := (mem_span_range_iff_exists_fun ℂ).mp (Basis.mem_span (rowBasis V) - (conj ([V]u) ×₃ conj ([V]c)) ) + (conj ([V]u) ×₃ conj ([V]c))) rw [Fin.sum_univ_three, rowBasis] at hg simp at hg have h0 := congrArg (fun X => conj [V]u ⬝ᵥ X) hg @@ -307,20 +307,20 @@ def ucCross : Fin 3 → ℂ := conj [phaseShiftApply V a b c d e f]u ×₃ conj [phaseShiftApply V a b c d e f]c lemma ucCross_fst (V : CKMMatrix) : (ucCross V a b c d e f) 0 = - cexp ((- a * I) + (- b * I) + ( - e * I) + (- f * I)) * (conj [V]u ×₃ conj [V]c) 0 := by + cexp ((- a * I) + (- b * I) + (- e * I) + (- f * I)) * (conj [V]u ×₃ conj [V]c) 0 := by simp [ucCross, crossProduct, Nat.succ_eq_add_one, Nat.reduceAdd, Fin.isValue, LinearMap.mk₂_apply, Pi.conj_apply, cons_val_zero, neg_mul, uRow, us, ub, cRow, cs, cb, exp_add, exp_sub, ← exp_conj, conj_ofReal] ring lemma ucCross_snd (V : CKMMatrix) : (ucCross V a b c d e f) 1 = - cexp ((- a * I) + (- b * I) + ( - d * I) + (- f * I)) * (conj [V]u ×₃ conj [V]c) 1 := by + cexp ((- a * I) + (- b * I) + (- d * I) + (- f * I)) * (conj [V]u ×₃ conj [V]c) 1 := by simp [ucCross, crossProduct, uRow, us, ub, cRow, cs, cb, ud, cd, exp_add, exp_sub, ← exp_conj, conj_ofReal] ring lemma ucCross_thd (V : CKMMatrix) : (ucCross V a b c d e f) 2 = - cexp ((- a * I) + (- b * I) + ( - d * I) + (- e * I)) * (conj [V]u ×₃ conj [V]c) 2 := by + cexp ((- a * I) + (- b * I) + (- d * I) + (- e * I)) * (conj [V]u ×₃ conj [V]c) 2 := by simp [ucCross, crossProduct, uRow, us, ub, cRow, cs, cb, ud, cd, exp_add, exp_sub, ← exp_conj, conj_ofReal] ring diff --git a/HepLean/FlavorPhysics/CKMMatrix/StandardParameterization/StandardParameters.lean b/HepLean/FlavorPhysics/CKMMatrix/StandardParameterization/StandardParameters.lean index 0c05432..e8d6b7b 100644 --- a/HepLean/FlavorPhysics/CKMMatrix/StandardParameterization/StandardParameters.lean +++ b/HepLean/FlavorPhysics/CKMMatrix/StandardParameterization/StandardParameters.lean @@ -373,8 +373,8 @@ lemma mulExpδ₁₃_on_param_abs (V : CKMMatrix) (δ₁₃ : ℝ) : complexAbs_sin_θ₂₃, complexAbs_cos_θ₂₃] lemma mulExpδ₁₃_on_param_neq_zero_arg (V : CKMMatrix) (δ₁₃ : ℝ) - (h1 : mulExpδ₁₃ ⟦standParam (θ₁₂ ⟦V⟧) (θ₁₃ ⟦V⟧) (θ₂₃ ⟦V⟧) δ₁₃⟧ ≠ 0 ) : - cexp (arg ( mulExpδ₁₃ ⟦standParam (θ₁₂ ⟦V⟧) (θ₁₃ ⟦V⟧) (θ₂₃ ⟦V⟧) δ₁₃⟧ ) * I) = + (h1 : mulExpδ₁₃ ⟦standParam (θ₁₂ ⟦V⟧) (θ₁₃ ⟦V⟧) (θ₂₃ ⟦V⟧) δ₁₃⟧ ≠ 0) : + cexp (arg (mulExpδ₁₃ ⟦standParam (θ₁₂ ⟦V⟧) (θ₁₃ ⟦V⟧) (θ₂₃ ⟦V⟧) δ₁₃⟧) * I) = cexp (δ₁₃ * I) := by have h1a := mulExpδ₁₃_on_param_δ₁₃ V δ₁₃ have habs := mulExpδ₁₃_on_param_abs V δ₁₃ @@ -383,7 +383,7 @@ lemma mulExpδ₁₃_on_param_neq_zero_arg (V : CKMMatrix) (δ₁₃ : ℝ) rw [habs, h1a] ring_nf nth_rewrite 1 [← abs_mul_exp_arg_mul_I (mulExpδ₁₃ - ⟦standParam (θ₁₂ ⟦V⟧) (θ₁₃ ⟦V⟧) (θ₂₃ ⟦V⟧) δ₁₃⟧ )] at h2 + ⟦standParam (θ₁₂ ⟦V⟧) (θ₁₃ ⟦V⟧) (θ₂₃ ⟦V⟧) δ₁₃⟧)] at h2 have habs_neq_zero : (Complex.abs (mulExpδ₁₃ ⟦standParam (θ₁₂ ⟦V⟧) (θ₁₃ ⟦V⟧) (θ₂₃ ⟦V⟧) δ₁₃⟧) : ℂ) ≠ 0 := by simp only [ne_eq, ofReal_eq_zero, map_eq_zero] @@ -505,7 +505,7 @@ lemma eq_standParam_of_fstRowThdColRealCond {V : CKMMatrix} (hb : [V]ud ≠ 0 rw [ud_us_neq_zero_iff_ub_neq_one] at hb simp [VAbs, hb] have h1 : ofReal (√(VAbs 0 0 ⟦V⟧ ^ 2 + VAbs 0 1 ⟦V⟧ ^ 2) * - ↑√(VAbs 0 0 ⟦V⟧ ^ 2 + VAbs 0 1 ⟦V⟧ ^ 2)) = ofReal ((VAbs 0 0 ⟦V⟧ ^ 2 + VAbs 0 1 ⟦V⟧ ^ 2) ) := by + ↑√(VAbs 0 0 ⟦V⟧ ^ 2 + VAbs 0 1 ⟦V⟧ ^ 2)) = ofReal (VAbs 0 0 ⟦V⟧ ^ 2 + VAbs 0 1 ⟦V⟧ ^ 2) := by rw [Real.mul_self_sqrt ] apply add_nonneg (sq_nonneg _) (sq_nonneg _) simp at h1 diff --git a/HepLean/Mathematics/LinearMaps.lean b/HepLean/Mathematics/LinearMaps.lean index ad781ef..efb5fac 100644 --- a/HepLean/Mathematics/LinearMaps.lean +++ b/HepLean/Mathematics/LinearMaps.lean @@ -70,7 +70,7 @@ def mk₂ (f : V × V → ℚ) (map_smul : ∀ a S T, f (a • S, T) = a * f (S, simp only rw [swap, map_add] exact Mathlib.Tactic.LinearCombination.add_pf (swap T1 S) (swap T2 S) - map_smul' :=by + map_smul' := by intro a T simp only [eq_ratCast, Rat.cast_eq_id, id_eq, smul_eq_mul] rw [swap, map_smul] @@ -173,7 +173,7 @@ namespace TriLinearSymm open BigOperators variable {V : Type} [AddCommMonoid V] [Module ℚ V] -instance instFun : FunLike (TriLinearSymm V) V (V →ₗ[ℚ] V →ₗ[ℚ] ℚ ) where +instance instFun : FunLike (TriLinearSymm V) V (V →ₗ[ℚ] V →ₗ[ℚ] ℚ) where coe f := f.toFun coe_injective' f g h := by cases f diff --git a/HepLean/Mathematics/SO3/Basic.lean b/HepLean/Mathematics/SO3/Basic.lean index b4bc14c..cb2407d 100644 --- a/HepLean/Mathematics/SO3/Basic.lean +++ b/HepLean/Mathematics/SO3/Basic.lean @@ -183,12 +183,12 @@ def toEnd (A : SO(3)) : End ℝ (EuclideanSpace ℝ (Fin 3)) := lemma one_is_eigenvalue (A : SO(3)) : A.toEnd.HasEigenvalue 1 := by rw [End.hasEigenvalue_iff_mem_spectrum] - erw [AlgEquiv.spectrum_eq (Matrix.toLinAlgEquiv (EuclideanSpace.basisFun (Fin 3) ℝ).toBasis ) A.1] + erw [AlgEquiv.spectrum_eq (Matrix.toLinAlgEquiv (EuclideanSpace.basisFun (Fin 3) ℝ).toBasis) A.1] exact one_in_spectrum A lemma exists_stationary_vec (A : SO(3)) : ∃ (v : EuclideanSpace ℝ (Fin 3)), - Orthonormal ℝ (({0} : Set (Fin 3)).restrict (fun _ => v )) + Orthonormal ℝ (({0} : Set (Fin 3)).restrict (fun _ => v)) ∧ A.toEnd v = v := by obtain ⟨v, hv⟩ := End.HasEigenvalue.exists_hasEigenvector $ one_is_eigenvalue A have hvn : ‖v‖ ≠ 0 := norm_ne_zero_iff.mpr hv.2 diff --git a/HepLean/SpaceTime/LorentzGroup/Basic.lean b/HepLean/SpaceTime/LorentzGroup/Basic.lean index 818fd66..0c4a2ef 100644 --- a/HepLean/SpaceTime/LorentzGroup/Basic.lean +++ b/HepLean/SpaceTime/LorentzGroup/Basic.lean @@ -239,7 +239,7 @@ open LorentzVector -/ -/-- The first column of a lorentz matrix as a `NormOneLorentzVector`. -/ +/-- The first column of a Lorentz matrix as a `NormOneLorentzVector`. -/ @[simps!] def toNormOneLorentzVector (Λ : LorentzGroup d) : NormOneLorentzVector d := ⟨Λ.1 *ᵥ timeVec, by rw [NormOneLorentzVector.mem_iff, Λ.2, minkowskiMetric.on_timeVec]⟩ diff --git a/HepLean/SpaceTime/LorentzGroup/Orthochronous.lean b/HepLean/SpaceTime/LorentzGroup/Orthochronous.lean index ce60f06..5987287 100644 --- a/HepLean/SpaceTime/LorentzGroup/Orthochronous.lean +++ b/HepLean/SpaceTime/LorentzGroup/Orthochronous.lean @@ -150,7 +150,7 @@ lemma mul_not_othchron_of_not_othchron_othchron {Λ Λ' : LorentzGroup d} (h : rw [IsOrthochronous_iff_futurePointing] at h h' exact NormOneLorentzVector.FuturePointing.metric_reflect_not_mem_mem h h' -/-- The homomorphism from `lorentzGroup` to `ℤ₂` whose kernel are the Orthochronous elements. -/ +/-- The homomorphism from `LorentzGroup` to `ℤ₂` whose kernel are the Orthochronous elements. -/ def orthchroRep : LorentzGroup d →* ℤ₂ where toFun := orthchroMap map_one' := orthchroMap_IsOrthochronous (by simp [IsOrthochronous]) diff --git a/HepLean/SpaceTime/LorentzGroup/Proper.lean b/HepLean/SpaceTime/LorentzGroup/Proper.lean index 8d139ae..8416e76 100644 --- a/HepLean/SpaceTime/LorentzGroup/Proper.lean +++ b/HepLean/SpaceTime/LorentzGroup/Proper.lean @@ -122,7 +122,7 @@ lemma IsProper_iff (Λ : LorentzGroup d) : IsProper Λ ↔ detRep Λ = 1 := by rw [detRep_apply, detRep_apply, detContinuous_eq_iff_det_eq] simp only [IsProper, lorentzGroupIsGroup_one_coe, det_one] -lemma id_IsProper : (@IsProper d) 1 := by +lemma id_IsProper : @IsProper d 1 := by simp [IsProper] lemma isProper_on_connected_component {Λ Λ' : LorentzGroup d} (h : Λ' ∈ connectedComponent Λ) : diff --git a/HepLean/SpaceTime/LorentzVector/AsSelfAdjointMatrix.lean b/HepLean/SpaceTime/LorentzVector/AsSelfAdjointMatrix.lean index a78a117..7894890 100644 --- a/HepLean/SpaceTime/LorentzVector/AsSelfAdjointMatrix.lean +++ b/HepLean/SpaceTime/LorentzVector/AsSelfAdjointMatrix.lean @@ -75,12 +75,12 @@ noncomputable def toSelfAdjointMatrix : ext i j fin_cases i <;> fin_cases j <;> field_simp [fromSelfAdjointMatrix', toMatrix, conj_ofReal] - exact conj_eq_iff_re.mp (congrArg (fun M => M 0 0) $ selfAdjoint.mem_iff.mp x.2 ) + exact conj_eq_iff_re.mp (congrArg (fun M => M 0 0) $ selfAdjoint.mem_iff.mp x.2) have h01 := congrArg (fun M => M 0 1) $ selfAdjoint.mem_iff.mp x.2 simp only [Fin.isValue, star_apply, RCLike.star_def] at h01 rw [← h01, RCLike.conj_eq_re_sub_im] rfl - exact conj_eq_iff_re.mp (congrArg (fun M => M 1 1) $ selfAdjoint.mem_iff.mp x.2 ) + exact conj_eq_iff_re.mp (congrArg (fun M => M 1 1) $ selfAdjoint.mem_iff.mp x.2) map_add' x y := by ext i j : 2 simp only [toSelfAdjointMatrix'_coe, add_apply, ofReal_add, of_apply, cons_val', empty_val', diff --git a/HepLean/SpaceTime/MinkowskiMetric.lean b/HepLean/SpaceTime/MinkowskiMetric.lean index c04e0d3..1512564 100644 --- a/HepLean/SpaceTime/MinkowskiMetric.lean +++ b/HepLean/SpaceTime/MinkowskiMetric.lean @@ -190,7 +190,7 @@ lemma self_spaceReflection_eq_zero_iff : ⟪v, v.spaceReflection⟫ₘ = 0 ↔ v /-- The metric tensor is non-degenerate. -/ lemma nondegenerate : (∀ w, ⟪w, v⟫ₘ = 0) ↔ v = 0 := by refine Iff.intro (fun h => ?_) (fun h => ?_) - · exact (self_spaceReflection_eq_zero_iff _ ).mp ((symm _ _).trans $ h v.spaceReflection) + · exact (self_spaceReflection_eq_zero_iff _).mp ((symm _ _).trans $ h v.spaceReflection) · simp [h] /-! diff --git a/HepLean/StandardModel/HiggsBoson/PointwiseInnerProd.lean b/HepLean/StandardModel/HiggsBoson/PointwiseInnerProd.lean index e94d3d9..2d03692 100644 --- a/HepLean/StandardModel/HiggsBoson/PointwiseInnerProd.lean +++ b/HepLean/StandardModel/HiggsBoson/PointwiseInnerProd.lean @@ -95,7 +95,7 @@ lemma smooth_innerProd (φ1 φ2 : HiggsField) : Smooth 𝓘(ℝ, SpaceTime) 𝓘 /-- Given a `HiggsField`, the map `SpaceTime → ℝ` obtained by taking the square norm of the pointwise Higgs vector. -/ @[simp] -def normSq (φ : HiggsField) : SpaceTime → ℝ := fun x => ( ‖φ x‖ ^ 2) +def normSq (φ : HiggsField) : SpaceTime → ℝ := fun x => ‖φ x‖ ^ 2 /-- Notation for the norm squared of a Higgs field. -/ scoped[StandardModel.HiggsField] notation "‖" φ1 "‖_H ^ 2" => normSq φ1 diff --git a/HepLean/StandardModel/HiggsBoson/Potential.lean b/HepLean/StandardModel/HiggsBoson/Potential.lean index 4f9b4e7..aab848b 100644 --- a/HepLean/StandardModel/HiggsBoson/Potential.lean +++ b/HepLean/StandardModel/HiggsBoson/Potential.lean @@ -34,7 +34,7 @@ open SpaceTime /-- The Higgs potential of the form `- μ² * |φ|² + 𝓵 * |φ|⁴`. -/ @[simp] -def potential (μ2 𝓵 : ℝ ) (φ : HiggsField) (x : SpaceTime) : ℝ := +def potential (μ2 𝓵 : ℝ) (φ : HiggsField) (x : SpaceTime) : ℝ := - μ2 * ‖φ‖_H ^ 2 x + 𝓵 * ‖φ‖_H ^ 2 x * ‖φ‖_H ^ 2 x /-! @@ -94,7 +94,7 @@ lemma snd_term_nonneg (φ : HiggsField) (x : SpaceTime) : and_self] lemma as_quad (μ2 𝓵 : ℝ) (φ : HiggsField) (x : SpaceTime) : - 𝓵 * ‖φ‖_H ^ 2 x * ‖φ‖_H ^ 2 x + (- μ2 ) * ‖φ‖_H ^ 2 x + (- potential μ2 𝓵 φ x) = 0 := by + 𝓵 * ‖φ‖_H ^ 2 x * ‖φ‖_H ^ 2 x + (- μ2) * ‖φ‖_H ^ 2 x + (- potential μ2 𝓵 φ x) = 0 := by simp only [normSq, neg_mul, potential, neg_add_rev, neg_neg] ring @@ -237,7 +237,7 @@ lemma IsMinOn_iff_of_μSq_nonpos {μ2 : ℝ} (hμ2 : μ2 ≤ 0) : have h0 := isMinOn_univ_iff.mp h 0 have h1 := bounded_below_of_μSq_nonpos h𝓵 hμ2 φ x simp only at h0 - rw [(eq_bound_iff_of_μSq_nonpos h𝓵 hμ2 0 0 ).mpr (by rfl)] at h0 + rw [(eq_bound_iff_of_μSq_nonpos h𝓵 hμ2 0 0).mpr (by rfl)] at h0 exact (Real.partialOrder.le_antisymm _ _ h1 h0).symm · exact eq_bound_IsMinOn_of_μSq_nonpos h𝓵 hμ2 φ x diff --git a/scripts/hepLean_style_lint.lean b/scripts/hepLean_style_lint.lean index cf7b683..254ddd0 100644 --- a/scripts/hepLean_style_lint.lean +++ b/scripts/hepLean_style_lint.lean @@ -46,6 +46,19 @@ def doubleSpaceLinter : HepLeanTextLinter := fun lines ↦ Id.run do else none) errors.toArray +/-- Substring linter. -/ +def substringLinter (s : String) : HepLeanTextLinter := fun lines ↦ Id.run do + let enumLines := (lines.toList.enumFrom 1) + let errors := enumLines.filterMap (fun (lno, l) ↦ + if String.containsSubstr l s then + let k := (Substring.findAllSubstr l s).toList.getLast? + let col := match k with + | none => 1 + | some k => String.offsetOfPos l k.stopPos + some (s!" Found instance of substring {s}.", lno, col) + else none) + errors.toArray + structure HepLeanErrorContext where /-- The underlying `message`. -/ error : String @@ -64,7 +77,8 @@ def hepLeanLintFile (path : FilePath) : IO Bool := do let lines ← IO.FS.lines path let allOutput := (Array.map (fun lint ↦ (Array.map (fun (e, n, c) ↦ HepLeanErrorContext.mk e n c path)) (lint lines))) - #[doubleEmptyLineLinter, doubleSpaceLinter] + #[doubleEmptyLineLinter, doubleSpaceLinter, substringLinter ".-/", substringLinter " )", + substringLinter "( ", substringLinter "=by", substringLinter " def "] let errors := allOutput.flatten printErrors errors return errors.size > 0 @@ -72,7 +86,7 @@ def hepLeanLintFile (path : FilePath) : IO Bool := do def main (_ : List String) : IO UInt32 := do initSearchPath (← findSysroot) let mods : Name := `HepLean - let imp : Import := {module := mods} + let imp : Import := {module := mods} let mFile ← findOLean imp.module unless (← mFile.pathExists) do throw <| IO.userError s!"object file '{mFile}' of module {imp.module} does not exist" @@ -85,4 +99,6 @@ def main (_ : List String) : IO UInt32 := do warned := true if warned then throw <| IO.userError s!"Errors found." + else + IO.println "No linting issues found." return 0