diff --git a/Physlib/ClassicalMechanics/DampedHarmonicOscillator/Basic.lean b/Physlib/ClassicalMechanics/DampedHarmonicOscillator/Basic.lean index 897b98f92..ab3513da1 100644 --- a/Physlib/ClassicalMechanics/DampedHarmonicOscillator/Basic.lean +++ b/Physlib/ClassicalMechanics/DampedHarmonicOscillator/Basic.lean @@ -166,9 +166,8 @@ decreasing at that time. -/ lemma energy_not_conserved (xₜ : Time → EuclideanSpace ℝ (Fin 1)) (t : Time) (h1 : S.EquationOfMotion xₜ) (hx : ContDiff ℝ ∞ xₜ) (hdx : ∂ₜ xₜ t ≠ 0) (hγ : 0 < S.γ) : ∂ₜ (S.energy xₜ) t < 0 := by - rw [energy_dissipation_rate S xₜ t h1 hx] - rw [neg_mul] - exact neg_neg_of_pos (mul_pos hγ (real_inner_self_pos.mpr hdx)) + simpa [energy_dissipation_rate S xₜ t h1 hx, neg_mul] using + neg_neg_of_pos (mul_pos hγ (real_inner_self_pos.mpr hdx)) /-! ## C. Newton's second law @@ -206,8 +205,7 @@ lemma equationOfMotion_iff_newtons_2nd_law (xₜ : Time → EuclideanSpace ℝ ( constructor · intro h t have h' : - S.m • ∂ₜ (∂ₜ xₜ) t + (S.γ • ∂ₜ xₜ t + S.k • xₜ t) = 0 := by - simpa [add_assoc] using h t + S.m • ∂ₜ (∂ₜ xₜ) t + (S.γ • ∂ₜ xₜ t + S.k • xₜ t) = 0 := by simpa [add_assoc] using h t have ha : S.m • ∂ₜ (∂ₜ xₜ) t = -(S.γ • ∂ₜ xₜ t + S.k • xₜ t) := eq_neg_of_add_eq_zero_left h' @@ -267,39 +265,33 @@ lemma discriminant_eq_four_mul_m_sq_mul_decayRate_sq_sub_ω_sq : /-- The decay rate is nonnegative. -/ lemma decayRate_nonneg : 0 ≤ S.decayRate := by - rw [decayRate] - exact div_nonneg S.γ_nonneg (by nlinarith [S.m_pos]) + simpa [decayRate] using div_nonneg S.γ_nonneg (by nlinarith [S.m_pos]) /-- An undamped oscillator lies in the underdamped regime. -/ lemma isUnderdamped_of_gamma_eq_zero (hγ : S.γ = 0) : S.IsUnderdamped := by - rw [IsUnderdamped, discriminant_eq_four_mul_m_sq_mul_decayRate_sq_sub_ω_sq S, decayRate] - rw [hγ] + rw [IsUnderdamped, discriminant_eq_four_mul_m_sq_mul_decayRate_sq_sub_ω_sq S, decayRate, hγ] ring_nf nlinarith [sq_pos_of_pos S.m_pos, sq_pos_of_pos S.ω_pos] /-- An underdamped system has decay rate less than the natural frequency. -/ lemma isUnderdamped_decayRate (hS : S.IsUnderdamped) : S.decayRate < S.ω := by - rw [IsUnderdamped] at hS - rw [discriminant_eq_four_mul_m_sq_mul_decayRate_sq_sub_ω_sq] at hS + rw [IsUnderdamped, discriminant_eq_four_mul_m_sq_mul_decayRate_sq_sub_ω_sq] at hS have hm_sq_pos : 0 < 4 * S.m^2 := by have hsq : 0 < S.m^2 := sq_pos_of_pos S.m_pos nlinarith - have hsq : S.decayRate^2 < S.ω^2 := by - nlinarith + have hsq : S.decayRate^2 < S.ω^2 := by nlinarith nlinarith [S.decayRate_nonneg, S.ω_pos] /-- A critically damped system has decay rate equal to the natural frequency. -/ lemma isCriticallyDamped_decayRate (hS : S.IsCriticallyDamped) : S.ω = S.decayRate := by - rw [IsCriticallyDamped] at hS - rw [discriminant_eq_four_mul_m_sq_mul_decayRate_sq_sub_ω_sq] at hS + rw [IsCriticallyDamped, discriminant_eq_four_mul_m_sq_mul_decayRate_sq_sub_ω_sq] at hS have hm_sq_ne_zero : 4 * S.m^2 ≠ 0 := by have hm_sq_pos : 0 < 4 * S.m^2 := by have hsq : 0 < S.m^2 := sq_pos_of_pos S.m_pos nlinarith exact ne_of_gt hm_sq_pos have hsq : S.decayRate^2 = S.ω^2 := by - have hsub : S.decayRate^2 - S.ω^2 = 0 := by - exact (mul_eq_zero.mp hS).resolve_left hm_sq_ne_zero + have hsub : S.decayRate^2 - S.ω^2 = 0 := (mul_eq_zero.mp hS).resolve_left hm_sq_ne_zero linarith nlinarith [S.decayRate_nonneg, S.ω_pos] @@ -317,20 +309,17 @@ lemma k_eq_m_mul_ω_sq : S.k = S.m * S.ω^2 := by lemma k_eq_m_mul_decayRate_sq_of_criticallyDamped (hS : S.IsCriticallyDamped) : S.k = S.m * S.decayRate^2 := by have hωa : S.ω = S.decayRate := S.isCriticallyDamped_decayRate hS - have hωsq : S.decayRate ^ 2 = S.k / S.m := by - simpa [hωa] using S.ω_sq + have hωsq : S.decayRate ^ 2 = S.k / S.m := by simpa [hωa] using S.ω_sq field_simp [S.m_ne_zero] at hωsq nlinarith /-- An overdamped system has decay rate greater than the natural frequency. -/ lemma isOverdamped_decayRate (hS : S.IsOverdamped) : S.ω < S.decayRate := by - rw [IsOverdamped] at hS - rw [discriminant_eq_four_mul_m_sq_mul_decayRate_sq_sub_ω_sq] at hS + rw [IsOverdamped, discriminant_eq_four_mul_m_sq_mul_decayRate_sq_sub_ω_sq] at hS have hm_sq_pos : 0 < 4 * S.m^2 := by have hsq : 0 < S.m^2 := sq_pos_of_pos S.m_pos nlinarith - have hsq : S.ω^2 < S.decayRate^2 := by - nlinarith + have hsq : S.ω^2 < S.decayRate^2 := by nlinarith nlinarith [S.decayRate_nonneg, S.ω_pos] /-- In the underdamped regime, the selected frequency uses the oscillation frequency. -/ @@ -439,8 +428,7 @@ for the corresponding undamped harmonic oscillator. -/ lemma toUndamped_equationOfMotion (S : DampedHarmonicOscillator) (hS : S.IsUndamped) (xₜ : Time → EuclideanSpace ℝ (Fin 1)) (hx : ContDiff ℝ ∞ xₜ) : S.EquationOfMotion xₜ ↔ (S.toUndamped hS).EquationOfMotion xₜ := by - have hγ : S.γ = 0 := by - simpa [IsUndamped] using hS + have hγ : S.γ = 0 := by simpa [IsUndamped] using hS rw [S.equationOfMotion_iff_newtons_2nd_law xₜ, (S.toUndamped hS).equationOfMotion_iff_newtons_2nd_law xₜ hx] constructor @@ -454,8 +442,7 @@ lemma toUndamped_equationOfMotion (S : DampedHarmonicOscillator) (hS : S.IsUndam calc S.m • ∂ₜ (∂ₜ xₜ) t = (S.toUndamped hS).m • ∂ₜ (∂ₜ xₜ) t := rfl _ = HarmonicOscillator.force (S.toUndamped hS) (xₜ t) := h t - _ = force S xₜ t := by - simp [force, HarmonicOscillator.force_eq_linear, toUndamped, hγ] + _ = force S xₜ t := by simp [force, HarmonicOscillator.force_eq_linear, toUndamped, hγ] end DampedHarmonicOscillator diff --git a/Physlib/ClassicalMechanics/DampedHarmonicOscillator/Solution.lean b/Physlib/ClassicalMechanics/DampedHarmonicOscillator/Solution.lean index 96fbaccb1..31581a804 100644 --- a/Physlib/ClassicalMechanics/DampedHarmonicOscillator/Solution.lean +++ b/Physlib/ClassicalMechanics/DampedHarmonicOscillator/Solution.lean @@ -178,8 +178,7 @@ private lemma exp_decay_smul_velocity ∂ₜ (fun t : Time => exp (-a * t.val) • y t) = fun t : Time => exp (-a * t.val) • (∂ₜ y t - a • y t) := by funext t - rw [Time.deriv] - rw [fderiv_fun_smul (by fun_prop) (hy t)] + rw [Time.deriv, fderiv_fun_smul (by fun_prop) (hy t)] rw [fderiv_exp (by fun_prop), fderiv_fun_mul (by fun_prop) (by fun_prop)] simp only [add_apply, ContinuousLinearMap.smulRight_apply, fderiv_fun_neg, fderiv_fun_const, Pi.zero_apply, Time.fderiv_val, @@ -197,11 +196,9 @@ private lemma exp_decay_smul_acceleration (μ • y t - (2 * a) • ∂ₜ y t + a^2 • y t) := by rw [exp_decay_smul_velocity a y hy] funext t - rw [Time.deriv] - rw [fderiv_fun_smul (by fun_prop) (by fun_prop)] + rw [Time.deriv, fderiv_fun_smul (by fun_prop) (by fun_prop)] rw [fderiv_exp (by fun_prop), fderiv_fun_mul (by fun_prop) (by fun_prop)] - rw [fderiv_fun_sub (hdy t) (by fun_prop)] - rw [fderiv_fun_const_smul (hy t)] + rw [fderiv_fun_sub (hdy t) (by fun_prop), fderiv_fun_const_smul (hy t)] have hy''_t := congrFun hy'' t rw [Time.deriv] at hy''_t simp only [add_apply, _root_.sub_apply, @@ -219,9 +216,7 @@ private lemma exp_decay_smul_equationOfMotion (hγ : S.γ = 2 * S.m * a) (hk : S.k = S.m * (a^2 - μ)) : S.EquationOfMotion (fun t : Time => exp (-a * t.val) • y t) := by intro t - rw [exp_decay_smul_acceleration a μ y hy hdy hy''] - rw [exp_decay_smul_velocity a y hy] - rw [hγ, hk] + rw [exp_decay_smul_acceleration a μ y hy hdy hy'', exp_decay_smul_velocity a y hy, hγ, hk] simp [smul_add, smul_sub, smul_smul] module diff --git a/Physlib/ClassicalMechanics/EulerLagrange.lean b/Physlib/ClassicalMechanics/EulerLagrange.lean index fe0086452..2340d6825 100644 --- a/Physlib/ClassicalMechanics/EulerLagrange.lean +++ b/Physlib/ClassicalMechanics/EulerLagrange.lean @@ -36,8 +36,7 @@ lemma eulerLagrangeOp_eq (L : Time → X → X → ℝ) (q : Time → X) : - ∂ₜ (fun t' => gradient (L t' (q t') ·) (∂ₜ q t')) t := by rfl lemma eulerLagrangeOp_zero (q : Time → X) : - eulerLagrangeOp (fun _ _ _ => 0) q = fun _ => 0 := by - simp [eulerLagrangeOp_eq, Time.deriv_eq] + eulerLagrangeOp (fun _ _ _ => 0) q = fun _ => 0 := by simp [eulerLagrangeOp_eq, Time.deriv_eq] /- The variational derivative of `L t (q' t) (deriv q' t))` for a lagrangian `L` is equal to the `eulerLagrangeOp`. -/ diff --git a/Physlib/ClassicalMechanics/HamiltonsEquations.lean b/Physlib/ClassicalMechanics/HamiltonsEquations.lean index 71d0ed6d0..f9309e0a9 100644 --- a/Physlib/ClassicalMechanics/HamiltonsEquations.lean +++ b/Physlib/ClassicalMechanics/HamiltonsEquations.lean @@ -43,8 +43,7 @@ noncomputable def hamiltonEqOp (H : Time → X → X → ℝ) (p : Time → X) ( lemma hamiltonEqOp_eq (H : Time → X → X → ℝ) (p : Time → X) (q : Time → X) : hamiltonEqOp H p q = fun t => (∂ₜ q t + -gradient (fun x => H t x (q t)) (p t), - - ∂ₜ p t + -gradient (fun x => H t (p t) x) (q t)) := by - rfl + - ∂ₜ p t + -gradient (fun x => H t (p t) x) (q t)) := rfl lemma hamiltonEqOp_eq_zero_iff_hamiltons_equations (H : Time → X → X → ℝ) (p : Time → X) (q : Time → X) : diff --git a/Physlib/ClassicalMechanics/HarmonicOscillator/Basic.lean b/Physlib/ClassicalMechanics/HarmonicOscillator/Basic.lean index 347e2bc7e..b4dc0d179 100644 --- a/Physlib/ClassicalMechanics/HarmonicOscillator/Basic.lean +++ b/Physlib/ClassicalMechanics/HarmonicOscillator/Basic.lean @@ -155,8 +155,7 @@ lemma ω_pos : 0 < S.ω := sqrt_pos.mpr (div_pos S.k_pos S.m_pos) /-- The square of the angular frequency of the classical harmonic oscillator is equal to `k/m`. -/ lemma ω_sq : S.ω^2 = S.k / S.m := by - rw [ω, sq_sqrt] - exact div_nonneg (le_of_lt S.k_pos) (le_of_lt S.m_pos) + simpa only [ω] using sq_sqrt (div_nonneg (le_of_lt S.k_pos) (le_of_lt S.m_pos)) /-- The angular frequency of the classical harmonic oscillator is not equal to zero. -/ lemma ω_ne_zero : S.ω ≠ 0 := Ne.symm (ne_of_lt S.ω_pos) @@ -263,8 +262,7 @@ lemma kineticEnergy_deriv (xₜ : Time → EuclideanSpace ℝ (Fin 1)) (hx : Con unfold kineticEnergy conv_lhs => simp only [Time.deriv, one_div, ringHom_apply] change (fderiv ℝ ((fun x => 2⁻¹ * S.m * ⟪x, x⟫_ℝ) ∘ (fun t => ∂ₜ xₜ t)) t) 1 = _ - rw [fderiv_comp] - rw [fderiv_const_mul (by fun_prop)] + rw [fderiv_comp, fderiv_const_mul (by fun_prop)] simp only [ContinuousLinearMap.smul_comp, FunLike.coe_smul, ContinuousLinearMap.coe_comp, Pi.smul_apply, Function.comp_apply, smul_eq_mul] rw [fderiv_inner_apply] @@ -281,8 +279,7 @@ lemma potentialEnergy_deriv (xₜ : Time → EuclideanSpace ℝ (Fin 1)) (hx : C unfold potentialEnergy conv_lhs => simp only [Time.deriv, one_div, smul_eq_mul] change (fderiv ℝ ((fun x => 2⁻¹ * (S.k * ⟪x, x⟫_ℝ)) ∘ (fun t => xₜ t)) t) 1 = _ - rw [fderiv_comp] - rw [fderiv_const_mul (by fun_prop), fderiv_const_mul (by fun_prop)] + rw [fderiv_comp, fderiv_const_mul (by fun_prop), fderiv_const_mul (by fun_prop)] simp only [ContinuousLinearMap.smul_comp, FunLike.coe_smul, ContinuousLinearMap.coe_comp, Pi.smul_apply, Function.comp_apply, smul_eq_mul] rw [fderiv_inner_apply] @@ -302,11 +299,9 @@ lemma energy_deriv (xₜ : Time → EuclideanSpace ℝ (Fin 1)) (hx : ContDiff ∂ₜ (energy S xₜ) = fun t => ⟪∂ₜ xₜ t, S.m • ∂ₜ (∂ₜ xₜ) t + S.k • xₜ t⟫_ℝ := by unfold energy funext t - rw [Time.deriv_eq] - rw [fderiv_fun_add (by fun_prop) (by apply S.potentialEnergy_differentiable xₜ hx)] + rw [Time.deriv_eq, fderiv_fun_add (by fun_prop) (by apply S.potentialEnergy_differentiable xₜ hx)] simp only [_root_.add_apply] - rw [← Time.deriv_eq, ← Time.deriv_eq] - rw [potentialEnergy_deriv, kineticEnergy_deriv] + rw [← Time.deriv_eq, ← Time.deriv_eq, potentialEnergy_deriv, kineticEnergy_deriv] simp only rw [← inner_add_right] fun_prop @@ -418,10 +413,8 @@ lemma gradient_const_mul_inner_self (c : ℝ) (x : EuclideanSpace ℝ (Fin 1)) : rw [fderiv_const_mul]; fun_prop _ = c • gradient (fun y : EuclideanSpace ℝ (Fin 1) => ⟪y, y⟫_ℝ) x := by simp only [gradient, map_smul] - _ = c • ((2 : ℝ) • x) := by - rw [gradient_inner_self] - _ = (2 * c) • x := by - rw [smul_smul, mul_comm] + _ = c • ((2 : ℝ) • x) := by rw [gradient_inner_self] + _ = (2 * c) • x := by rw [smul_smul, mul_comm] /-! @@ -689,12 +682,9 @@ noncomputable def toCanonicalMomentum (t : Time) (x : EuclideanSpace ℝ (Fin 1) EuclideanSpace ℝ (Fin 1) ≃ₗ[ℝ] EuclideanSpace ℝ (Fin 1) where toFun v := gradient (S.lagrangian t x ·) v invFun p := (1 / S.m) • p - left_inv v := by - simp [gradient_lagrangian_velocity_eq] - right_inv p := by - simp [gradient_lagrangian_velocity_eq] - map_add' v1 v2 := by - simp [gradient_lagrangian_velocity_eq] + left_inv v := by simp [gradient_lagrangian_velocity_eq] + right_inv p := by simp [gradient_lagrangian_velocity_eq] + map_add' v1 v2 := by simp [gradient_lagrangian_velocity_eq] map_smul' c v := by simp [gradient_lagrangian_velocity_eq] module diff --git a/Physlib/ClassicalMechanics/HarmonicOscillator/Geometric/Basic.lean b/Physlib/ClassicalMechanics/HarmonicOscillator/Geometric/Basic.lean index 58b56268b..3313f7d12 100644 --- a/Physlib/ClassicalMechanics/HarmonicOscillator/Geometric/Basic.lean +++ b/Physlib/ClassicalMechanics/HarmonicOscillator/Geometric/Basic.lean @@ -122,9 +122,7 @@ homeomorphism underlies the single global chart used for the smooth-manifold str def valHomeomorphism : ConfigurationSpace ≃ₜ EuclideanSpace ℝ (Fin 1) where toEquiv := valEquiv continuous_toFun := continuous_induced_dom - continuous_invFun := by - apply continuous_induced_rng.mpr - exact continuous_id + continuous_invFun := continuous_induced_rng.mpr continuous_id /-- Configuration space is Hausdorff, transported from `EuclideanSpace ℝ (Fin 1)` across the coordinate homeomorphism. -/ @@ -148,8 +146,7 @@ chart's self-transition, which is analytic, so chart compatibility is immediate. instance : ChartedSpace (EuclideanSpace ℝ (Fin 1)) ConfigurationSpace where atlas := { valHomeomorphism.toOpenPartialHomeomorph } chartAt _ := valHomeomorphism.toOpenPartialHomeomorph - mem_chart_source := by - simp + mem_chart_source := by simp chart_mem_atlas := by intro x simp diff --git a/Physlib/ClassicalMechanics/HarmonicOscillator/Solution.lean b/Physlib/ClassicalMechanics/HarmonicOscillator/Solution.lean index 459ab748c..ceded4b46 100644 --- a/Physlib/ClassicalMechanics/HarmonicOscillator/Solution.lean +++ b/Physlib/ClassicalMechanics/HarmonicOscillator/Solution.lean @@ -386,8 +386,7 @@ The trajectory for zero initial conditions is the zero function. /-- For zero initial conditions, the trajectory is zero. -/ @[simp] -lemma trajectory_zero : trajectory S 0 = fun _ => 0 := by - simp [trajectory_eq] +lemma trajectory_zero : trajectory S 0 = fun _ => 0 := by simp [trajectory_eq] /-! @@ -549,8 +548,7 @@ lemma trajectories_unique (IC : InitialConditions) (x : Time → EuclideanSpace have hy_deriv : ∂ₜ y = fun t => ∂ₜ x t - ∂ₜ (IC.trajectory S) t := dsub x _ (hx.differentiable (by simp)) (hTraj.differentiable (by simp)) have hy_deriv2 : ∂ₜ (∂ₜ y) = fun t => ∂ₜ (∂ₜ x) t - ∂ₜ (∂ₜ (IC.trajectory S)) t := by - rw [hy_deriv] - exact dsub _ _ (deriv_differentiable_of_contDiff _ hx) + simpa [hy_deriv] using dsub _ _ (deriv_differentiable_of_contDiff _ hx) (deriv_differentiable_of_contDiff _ hTraj) have hNewt_x := (S.equationOfMotion_iff_newtons_2nd_law x hx).1 hEOM have hNewt_traj := (S.equationOfMotion_iff_newtons_2nd_law (IC.trajectory S) hTraj).1 @@ -1000,8 +998,7 @@ lemma trajectory_velocity_eq_zero_iff_exists_int (IC : InitialConditions) linarith calc (t : ℝ) = (S.ω * t) / S.ω := by field_simp [hω] - _ = ((AmplitudePhase.fromInitialConditions S IC).φ + n * π) / S.ω := by - rw [ht] + _ = ((AmplitudePhase.fromInitialConditions S IC).φ + n * π) / S.ω := by rw [ht] · intro h obtain ⟨n, hn⟩ := h rw [Real.sin_eq_zero_iff] @@ -1039,8 +1036,7 @@ lemma trajectory_velocity_eq_zero_iff_norm_eq_amplitude (IC : InitialConditions) ext i fin_cases i simp [hA] - rw [trajectory_velocity_eq_zero_iff_sin_eq_zero S IC hA t] - rw [trajectory_eq_cos] + rw [trajectory_velocity_eq_zero_iff_sin_eq_zero S IC hA t, trajectory_eq_cos] set A := (AmplitudePhase.fromInitialConditions S IC).A set θ := S.ω * t.val - (AmplitudePhase.fromInitialConditions S IC).φ show sin θ = 0 ↔ ‖EuclideanSpace.single 0 (A * cos θ)‖ = A @@ -1055,8 +1051,7 @@ lemma trajectory_velocity_eq_zero_iff_norm_eq_amplitude (IC : InitialConditions) · simp [hcos, abs_of_pos hA_pos] · simp [hcos, abs_of_pos hA_pos] · intro hnorm - have hnorm' : |A * cos θ| = A := by - simpa using hnorm + have hnorm' : |A * cos θ| = A := by simpa using hnorm have hcos_abs : |cos θ| = 1 := by calc |cos θ| = |A * cos θ| / A := by @@ -1118,8 +1113,7 @@ lemma trajectory_eq_zero_iff_exists_int (IC : InitialConditions) linarith calc (t : ℝ) = (S.ω * t) / S.ω := by field_simp [hω] - _ = ((AmplitudePhase.fromInitialConditions S IC).φ + (2 * n + 1) * π / 2) / S.ω := by - rw [ht] + _ = ((AmplitudePhase.fromInitialConditions S IC).φ + (2 * n + 1) * π / 2) / S.ω := by rw [ht] · intro h obtain ⟨n, hn⟩ := h rw [Real.cos_eq_zero_iff] @@ -1182,8 +1176,7 @@ lemma trajectory_periodic (IC : InitialConditions) : have h : S.ω * (t.val + 2 * π / S.ω) = S.ω * t.val + 2 * π := by have := S.ω_ne_zero ring_nf; field_simp - rw [InitialConditions.trajectory, add_val, period_eq, h, cos_add_two_pi, sin_add_two_pi] - rfl + simp [InitialConditions.trajectory, add_val, period_eq, h, cos_add_two_pi, sin_add_two_pi] /-! @@ -1217,18 +1210,14 @@ lemma return_time (IC : InitialConditions) (non_trivial : IC.x₀ ≠ 0 ∨ IC.v have zero_lt_det : 0 < det := by cases non_trivial with | inl hx => - have xx_gt_zero : 0 < xx := by - apply real_inner_self_pos.mpr - exact hx + have xx_gt_zero : 0 < xx := real_inner_self_pos.mpr hx calc 0 < xx * S.ω^2 := by bound _ ≤ ‖IC.v₀‖^2 + xx * S.ω^2 := by bound _ = vv + xx * S.ω^2 := by rw [← real_inner_self_eq_norm_sq IC.v₀] _ = det := by rfl | inr hv => - have vv_gt_zero : 0 < vv := by - apply real_inner_self_pos.mpr - exact hv + have vv_gt_zero : 0 < vv := real_inner_self_pos.mpr hv calc 0 < vv := vv_gt_zero _ ≤ vv + ‖IC.x₀‖^2 * S.ω^2 := by bound diff --git a/Physlib/ClassicalMechanics/Lagrangian/TotalDerivativeEquivalence.lean b/Physlib/ClassicalMechanics/Lagrangian/TotalDerivativeEquivalence.lean index 2c74e1d5b..718aa4fbe 100644 --- a/Physlib/ClassicalMechanics/Lagrangian/TotalDerivativeEquivalence.lean +++ b/Physlib/ClassicalMechanics/Lagrangian/TotalDerivativeEquivalence.lean @@ -97,8 +97,7 @@ lemma isTotalTimeDerivative_explicit {δL : Time → X → X → ℝ} : ∀ t q v, δL t q v = fderiv ℝ ↿F (t, q) ((1 : Time), v)) := by -- Preliminary construction: properties of the function t => (t, q t) let tq := fun (q : Time → X) t => (t, q t) - have h_tq_contDiff : ∀ (q : Time → X), ContDiff ℝ ∞ q -> ContDiff ℝ ∞ (tq q) := by - fun_prop + have h_tq_contDiff : ∀ (q : Time → X), ContDiff ℝ ∞ q -> ContDiff ℝ ∞ (tq q) := by fun_prop have h_tq_der : ∀ (q : Time → X) t, ContDiff ℝ ∞ q -> ∂ₜ (tq q) t = (1, ∂ₜ q t) := by intro q t h_ContDiff_q ext @@ -114,8 +113,7 @@ lemma isTotalTimeDerivative_explicit {δL : Time → X → X → ℝ} : · simp rfl · apply ContDiffAt.differentiableAt - · apply ContDiff.contDiffAt - exact h_tq_contDiff q h_ContDiff_q + · exact (h_tq_contDiff q h_ContDiff_q).contDiffAt · by_contra rcases this apply Eq.symm @@ -123,11 +121,9 @@ lemma isTotalTimeDerivative_explicit {δL : Time → X → X → ℝ} : (1, ∂ₜ q t).2 = fderiv ℝ (fun t' => (tq q t').2) t 1 := by rfl _ = (∂ₜ (tq q) t).2 := by rw [fderiv.snd] - · simp only [ContinuousLinearMap.comp_apply, ContinuousLinearMap.coe_snd'] - rfl + · rfl · apply ContDiffAt.differentiableAt - · apply ContDiff.contDiffAt - exact h_tq_contDiff q h_ContDiff_q + · exact (h_tq_contDiff q h_ContDiff_q).contDiffAt · by_contra rcases this have h_F_tq_der : ∀ (q : Time → X) (F : Time → X → ℝ) t, (ContDiff ℝ ∞ ↿F) → (ContDiff ℝ ∞ q) → @@ -139,13 +135,11 @@ lemma isTotalTimeDerivative_explicit {δL : Time → X → X → ℝ} : rw [← Time.deriv_eq,h_tq_der] exact hq · apply ContDiffAt.differentiableAt - · apply ContDiff.contDiffAt - exact hF + · exact hF.contDiffAt · by_contra rcases this · apply ContDiffAt.differentiableAt - · apply ContDiff.contDiffAt - exact h_tq_contDiff q hq + · exact (h_tq_contDiff q hq).contDiffAt · by_contra rcases this -- beginning of the proof @@ -338,12 +332,10 @@ lemma isTotalTimeDerivativeVelocity [CompleteSpace X] have h0 : δL (0 : X) = fderiv ℝ ↿F ((0 : Time), (0 : X)) - ((1 : Time), (0 : X)) := by - simpa using (hEq (0 : Time) (0 : X) + ((1 : Time), (0 : X)) := by simpa using (hEq (0 : Time) (0 : X) (0 : X)) have : dF ((1 : Time), (0 : X)) = - δL (0 : X) := by - simpa [dF] using h0.symm + δL (0 : X) := by simpa [dF] using h0.symm simpa [hδL0] using this -- Induced continuous linear functional on velocity: v ↦ dF (0,v). @@ -356,10 +348,8 @@ lemma isTotalTimeDerivativeVelocity [CompleteSpace X] have hv : δL v = fderiv ℝ ↿F ((0 : Time), (0 : X)) - ((1 : Time), v) := by - simpa using (hEq (0 : Time) (0 : X) v) - have hv' : δL v = dF ((1 : Time), v) := by - simpa [dF] using hv + ((1 : Time), v) := by simpa using (hEq (0 : Time) (0 : X) v) + have hv' : δL v = dF ((1 : Time), v) := by simpa [dF] using hv calc δL v = dF ((1 : Time), v) := hv' _ = dF (((0 : Time), v) + ((1 : Time), (0 : X))) := by simp only [Prod.mk_add_mk, zero_add, @@ -367,10 +357,8 @@ lemma isTotalTimeDerivativeVelocity [CompleteSpace X] _ = dF ((0 : Time), v) + dF ((1 : Time), (0 : X)) := by simpa using (dF.map_add ((0 : Time), v) ((1 : Time), (0 : X))) - _ = dF ((0 : Time), v) := by - simp [h_time] - _ = φ v := by - simp [φ] + _ = dF ((0 : Time), v) := by simp [h_time] + _ = φ v := by simp [φ] -- Frechet–Riesz: represent φ as inner product with some g. refine ⟨(InnerProductSpace.toDual ℝ (X)).symm φ, ?_⟩ @@ -381,8 +369,7 @@ lemma isTotalTimeDerivativeVelocity [CompleteSpace X] (E := X) (x := v) (y := φ)] calc δL v = φ v := hφ v - _ = ⟪(InnerProductSpace.toDual ℝ (X)).symm φ, v⟫_ℝ := by - rw [hinner.symm] + _ = ⟪(InnerProductSpace.toDual ℝ (X)).symm φ, v⟫_ℝ := by rw [hinner.symm] end Lagrangian diff --git a/Physlib/ClassicalMechanics/Mass/MassUnit.lean b/Physlib/ClassicalMechanics/Mass/MassUnit.lean index 2c0599458..71b46fece 100644 --- a/Physlib/ClassicalMechanics/Mass/MassUnit.lean +++ b/Physlib/ClassicalMechanics/Mass/MassUnit.lean @@ -39,8 +39,7 @@ structure MassUnit where namespace MassUnit @[simp] -lemma val_ne_zero (x : MassUnit) : x.val ≠ 0 := by - exact Ne.symm (ne_of_lt x.property) +lemma val_ne_zero (x : MassUnit) : x.val ≠ 0 := Ne.symm (ne_of_lt x.property) lemma val_pos (x : MassUnit) : 0 < x.val := x.property @@ -73,9 +72,7 @@ lemma div_pos (x y : MassUnit) : (0 : ℝ≥0) < x/ y := by @[simp] lemma div_self (x : MassUnit) : - x / x = (1 : ℝ≥0) := by - simp [div_eq_val, x.val_ne_zero] - rfl + x / x = (1 : ℝ≥0) := NNReal.eq (_root_.div_self x.val_ne_zero) lemma div_symm (x y : MassUnit) : x / y = (y / x)⁻¹ := NNReal.eq <| by @@ -101,8 +98,7 @@ def scale (r : ℝ) (x : MassUnit) (hr : 0 < r := by norm_num) : MassUnit := @[simp] lemma scale_div_self (x : MassUnit) (r : ℝ) (hr : 0 < r) : - scale r x hr / x = (⟨r, le_of_lt hr⟩ : ℝ≥0) := by - simp [scale, div_eq_val] + scale r x hr / x = (⟨r, le_of_lt hr⟩ : ℝ≥0) := by simp [scale, div_eq_val] @[simp] lemma self_div_scale (x : MassUnit) (r : ℝ) (hr : 0 < r) : @@ -111,8 +107,7 @@ lemma self_div_scale (x : MassUnit) (r : ℝ) (hr : 0 < r) : field_simp @[simp] -lemma scale_one (x : MassUnit) : scale 1 x = x := by - simp [scale] +lemma scale_one (x : MassUnit) : scale 1 x = x := by simp [scale] @[simp] lemma scale_div_scale (x1 x2 : MassUnit) {r1 r2 : ℝ} (hr1 : 0 < r1) (hr2 : 0 < r2) : @@ -125,8 +120,7 @@ lemma scale_div_scale (x1 x2 : MassUnit) {r1 r2 : ℝ} (hr1 : 0 < r1) (hr2 : 0 < @[simp] lemma scale_scale (x : MassUnit) (r1 r2 : ℝ) (hr1 : 0 < r1) (hr2 : 0 < r2) : scale r1 (scale r2 x hr2) hr1 = scale (r1 * r2) x (mul_pos hr1 hr2) := by - simp [scale] - ring + simp [scale, mul_assoc] /-! diff --git a/Physlib/ClassicalMechanics/WaveEquation/Basic.lean b/Physlib/ClassicalMechanics/WaveEquation/Basic.lean index 8b85f180a..e58867685 100644 --- a/Physlib/ClassicalMechanics/WaveEquation/Basic.lean +++ b/Physlib/ClassicalMechanics/WaveEquation/Basic.lean @@ -78,8 +78,7 @@ noncomputable def planeWave (f₀ : ℝ → EuclideanSpace ℝ (Fin d)) fun t x => f₀ (⟪x, s.unit⟫_ℝ - c * t) lemma planeWave_eq {d f₀ c x} {s : Direction d} : - planeWave f₀ c s t x = f₀ (⟪x, s.unit⟫_ℝ - c * t) := - rfl + planeWave f₀ c s t x = f₀ (⟪x, s.unit⟫_ℝ - c * t) := rfl /-! @@ -138,8 +137,7 @@ lemma planeWave_time_deriv {d f₀ c x} {s : Direction d} FunLike.coe_smul, Pi.smul_apply, PiLp.neg_apply, PiLp.smul_apply, smul_eq_mul, neg_mul, neg_inj, mul_eq_mul_left_iff] left - simp - rfl + simp [planeWave] repeat fun_prop lemma planeWave_time_deriv_time_deriv {d f₀ c x} {s : Direction d} @@ -181,8 +179,7 @@ lemma planeWave_space_deriv {d f₀ c} {s : Direction d} rw [fderiv_comp] simp only [ContinuousLinearMap.coe_comp, Function.comp_apply, fderiv_eq_smul_deriv, PiLp.smul_apply, smul_eq_mul, one_smul, Pi.smul_apply] - rw [fderiv_sub_const] - rw [fderiv_inner_apply] + rw [fderiv_sub_const, fderiv_inner_apply] simp only [fderiv_fun_const, Pi.zero_apply, _root_.zero_apply, inner_zero_right, fderiv_fun_id, ContinuousLinearMap.coe_id', id_eq, basis_inner, zero_add, mul_eq_mul_left_iff] left @@ -199,9 +196,7 @@ lemma planeWave_apply_space_deriv {d f₀ c} {s : Direction d} rw [fderiv_comp] simp only [ContinuousLinearMap.fderiv, ContinuousLinearMap.coe_comp, Function.comp_apply, PiLp.proj_apply, fderiv_eq_smul_deriv, one_smul, Pi.smul_apply, smul_eq_mul] - rw [← Space.deriv_eq_fderiv_basis, planeWave_space_deriv] - rfl - · fun_prop + exact congrArg (fun y => y.ofLp j) (congrFun (planeWave_space_deriv h' i) x) · fun_prop · fun_prop diff --git a/Physlib/ClassicalMechanics/WaveEquation/HarmonicWave.lean b/Physlib/ClassicalMechanics/WaveEquation/HarmonicWave.lean index 96b9f2719..faaa61b72 100644 --- a/Physlib/ClassicalMechanics/WaveEquation/HarmonicWave.lean +++ b/Physlib/ClassicalMechanics/WaveEquation/HarmonicWave.lean @@ -69,8 +69,7 @@ lemma transverseHarmonicPlaneWave_eq_planeWave {c : ℝ} {k : WaveVector} {f₀x have normk: ‖k‖ = ω/c := by rw [hk] simp [← abs_div, hc_ge_zero, hω_ge_zero, le_of_lt] - rw [normk] - rw [mul_sub, inner_smul_right, real_inner_comm, ← mul_assoc] + rw [normk, mul_sub, inner_smul_right, real_inner_comm, ← mul_assoc] ring_nf simp [ne_of_gt, hc_ge_zero, hω_ge_zero, mul_comm ω, mul_assoc, basis_repr_inner_eq] diff --git a/Physlib/CondensedMatter/TightBindingChain/Basic.lean b/Physlib/CondensedMatter/TightBindingChain/Basic.lean index 60bd6a73d..df9bee055 100644 --- a/Physlib/CondensedMatter/TightBindingChain/Basic.lean +++ b/Physlib/CondensedMatter/TightBindingChain/Basic.lean @@ -386,8 +386,7 @@ lemma quantaWaveNumber_exp_N (n : ℕ) (k : T.QuantaWaveNumber) : field_simp ring_nf congr 1 - rw [mul_comm] - rfl + exact mul_comm _ _ lemma quantaWaveNumber_exp_sub_one (n : Fin T.N) (k : T.QuantaWaveNumber) : Complex.exp (Complex.I * k * (n - 1).val * T.a) = diff --git a/Physlib/Electromagnetism/Charge/ChargeUnit.lean b/Physlib/Electromagnetism/Charge/ChargeUnit.lean index 805677145..a6e0b7d98 100644 --- a/Physlib/Electromagnetism/Charge/ChargeUnit.lean +++ b/Physlib/Electromagnetism/Charge/ChargeUnit.lean @@ -44,8 +44,7 @@ structure ChargeUnit where namespace ChargeUnit @[simp] -lemma val_ne_zero (x : ChargeUnit) : x.val ≠ 0 := by - exact Ne.symm (ne_of_lt x.property) +lemma val_ne_zero (x : ChargeUnit) : x.val ≠ 0 := Ne.symm (ne_of_lt x.property) lemma val_pos (x : ChargeUnit) : 0 < x.val := x.property @@ -78,9 +77,7 @@ lemma div_pos (x y : ChargeUnit) : (0 : ℝ≥0) < x/ y := by @[simp] lemma div_self (x : ChargeUnit) : - x / x = (1 : ℝ≥0) := by - simp [div_eq_val, x.val_ne_zero] - rfl + x / x = (1 : ℝ≥0) := NNReal.eq (_root_.div_self x.val_ne_zero) lemma div_symm (x y : ChargeUnit) : x / y = (y / x)⁻¹ := NNReal.eq <| by @@ -106,8 +103,7 @@ def scale (r : ℝ) (x : ChargeUnit) (hr : 0 < r := by norm_num) : ChargeUnit := @[simp] lemma scale_div_self (x : ChargeUnit) (r : ℝ) (hr : 0 < r) : - scale r x hr / x = (⟨r, le_of_lt hr⟩ : ℝ≥0) := by - simp [scale, div_eq_val] + scale r x hr / x = (⟨r, le_of_lt hr⟩ : ℝ≥0) := by simp [scale, div_eq_val] @[simp] lemma self_div_scale (x : ChargeUnit) (r : ℝ) (hr : 0 < r) : @@ -116,8 +112,7 @@ lemma self_div_scale (x : ChargeUnit) (r : ℝ) (hr : 0 < r) : field_simp @[simp] -lemma scale_one (x : ChargeUnit) : scale 1 x = x := by - simp [scale] +lemma scale_one (x : ChargeUnit) : scale 1 x = x := by simp [scale] @[simp] lemma scale_div_scale (x1 x2 : ChargeUnit) {r1 r2 : ℝ} (hr1 : 0 < r1) (hr2 : 0 < r2) : @@ -130,8 +125,7 @@ lemma scale_div_scale (x1 x2 : ChargeUnit) {r1 r2 : ℝ} (hr1 : 0 < r1) (hr2 : 0 @[simp] lemma scale_scale (x : ChargeUnit) (r1 r2 : ℝ) (hr1 : 0 < r1) (hr2 : 0 < r2) : scale r1 (scale r2 x hr2) hr1 = scale (r1 * r2) x (mul_pos hr1 hr2) := by - simp [scale] - ring + simp [scale, mul_assoc] /-! diff --git a/Physlib/Electromagnetism/Distributional/Basic.lean b/Physlib/Electromagnetism/Distributional/Basic.lean index 2c3004bf6..49c214689 100644 --- a/Physlib/Electromagnetism/Distributional/Basic.lean +++ b/Physlib/Electromagnetism/Distributional/Basic.lean @@ -188,8 +188,7 @@ lemma toTensor_distTensorDeriv_basis_repr_apply {d} (A : DistElectromagneticPote (Fin.append ![Color.down] ![Color.up])) : (Tensor.basis _).repr (Tensorial.toTensor (distTensorDeriv A ε)) b = distDeriv (b 0) A ε (b 1) := by - rw [Tensorial.basis_toTensor_apply] - rw [Tensorial.basis_map_prod] + rw [Tensorial.basis_toTensor_apply, Tensorial.basis_map_prod] simp only [Nat.reduceSucc, Nat.reduceAdd, Basis.repr_reindex, Finsupp.mapDomain_equiv_apply, Equiv.symm_symm, Fin.isValue] rw [Lorentz.Vector.tensor_basis_map_eq_basis_reindex, diff --git a/Physlib/Electromagnetism/Distributional/Dynamics/CurrentDensity.lean b/Physlib/Electromagnetism/Distributional/Dynamics/CurrentDensity.lean index 38e1ce7e7..182f1fd8b 100644 --- a/Physlib/Electromagnetism/Distributional/Dynamics/CurrentDensity.lean +++ b/Physlib/Electromagnetism/Distributional/Dynamics/CurrentDensity.lean @@ -66,8 +66,7 @@ namespace DistLorentzCurrentDensity noncomputable def chargeDensity {d : ℕ} (c : SpeedOfLight) : (DistLorentzCurrentDensity d) →ₗ[ℝ] (Time × Space d) →d[ℝ] ℝ where toFun J := (1 / (c : ℝ)) • (Lorentz.Vector.temporalCLM d ∘L distTimeSlice c J) - map_add' J1 J2 := by - simp + map_add' J1 J2 := by simp map_smul' r J := by simp only [one_div, map_smul, ContinuousLinearMap.comp_smulₛₗ, RingHom.id_apply] rw [smul_comm] @@ -83,10 +82,8 @@ noncomputable def chargeDensity {d : ℕ} (c : SpeedOfLight) : noncomputable def currentDensity (c : SpeedOfLight) : DistLorentzCurrentDensity d →ₗ[ℝ] (Time × Space d) →d[ℝ] EuclideanSpace ℝ (Fin d) where toFun J := Lorentz.Vector.spatialCLM d ∘L distTimeSlice c J - map_add' J1 J2 := by - simp - map_smul' r J := by - simp + map_add' _ _ := rfl + map_smul' _ _ := rfl end DistLorentzCurrentDensity end Electromagnetism diff --git a/Physlib/Electromagnetism/Distributional/Dynamics/Lagrangian.lean b/Physlib/Electromagnetism/Distributional/Dynamics/Lagrangian.lean index e77b0b035..458cf24bd 100644 --- a/Physlib/Electromagnetism/Distributional/Dynamics/Lagrangian.lean +++ b/Physlib/Electromagnetism/Distributional/Dynamics/Lagrangian.lean @@ -78,8 +78,7 @@ noncomputable def gradFreeCurrentPotential {d} : DistLorentzCurrentDensity d →ₗ[ℝ] ((SpaceTime d) →d[ℝ] Lorentz.Vector d) where toFun J := { toFun ε := ∑ μ, (η μ μ • (J ε μ) • Lorentz.Vector.basis μ) - map_add' ε₁ ε₂ := by - simp [Finset.sum_add_distrib, add_smul] + map_add' ε₁ ε₂ := by simp [Finset.sum_add_distrib, add_smul] map_smul' r ε := by simp only [map_smul, apply_smul, smul_smul, Real.ringHom_apply, Finset.smul_sum] congr diff --git a/Physlib/Electromagnetism/Distributional/FieldStrength.lean b/Physlib/Electromagnetism/Distributional/FieldStrength.lean index 4ec6cdb0a..3fbcda8fe 100644 --- a/Physlib/Electromagnetism/Distributional/FieldStrength.lean +++ b/Physlib/Electromagnetism/Distributional/FieldStrength.lean @@ -128,8 +128,7 @@ lemma fieldStrengthAux_tensor_basis_eq_basis {d} (A : DistElectromagneticPotenti (Tensor.basis _).repr (Tensorial.toTensor (A.fieldStrengthAux ε)) b = (Lorentz.Vector.basis.tensorProduct Lorentz.Vector.basis).repr (A.fieldStrengthAux ε) (b 0, b 1) := by - rw [Tensorial.basis_toTensor_apply] - rw [Tensorial.basis_map_prod] + rw [Tensorial.basis_toTensor_apply, Tensorial.basis_map_prod] simp only [Nat.reduceSucc, Nat.reduceAdd, Basis.repr_reindex, Finsupp.mapDomain_equiv_apply, Equiv.symm_symm, Fin.isValue] rw [Lorentz.Vector.tensor_basis_map_eq_basis_reindex] @@ -243,9 +242,8 @@ lemma fieldStrength_eq_basis {d} (A : DistElectromagneticPotential d) (ε : 𝓢(SpaceTime d, ℝ)) : A.fieldStrength ε = ∑ μ, ∑ ν, ((η μ μ * distDeriv μ A ε ν) - η ν ν * distDeriv ν A ε μ) - • Lorentz.Vector.basis μ ⊗ₜ[ℝ] Lorentz.Vector.basis ν := by - rw [fieldStrength] - exact fieldStrengthAux_eq_basis A ε + • Lorentz.Vector.basis μ ⊗ₜ[ℝ] Lorentz.Vector.basis ν := + (fieldStrength_eq_fieldStrengthAux A ε).trans (fieldStrengthAux_eq_basis A ε) lemma fieldStrength_basis_repr_eq_single {d} {μν : (Fin 1 ⊕ Fin d) × (Fin 1 ⊕ Fin d)} (A : DistElectromagneticPotential d) (ε : 𝓢(SpaceTime d, ℝ)) : diff --git a/Physlib/Electromagnetism/Dynamics/Basic.lean b/Physlib/Electromagnetism/Dynamics/Basic.lean index 513934f8d..056ddb8b1 100644 --- a/Physlib/Electromagnetism/Dynamics/Basic.lean +++ b/Physlib/Electromagnetism/Dynamics/Basic.lean @@ -102,8 +102,7 @@ lemma c_sq : (𝓕.c : ℝ) ^ 2 = 1 / (𝓕.ε₀ * 𝓕.μ₀) := by · positivity @[simp] -lemma c_abs : abs (𝓕.c : ℝ) = 𝓕.c := by - rw [abs_of_pos (SpeedOfLight.val_pos 𝓕.c)] +lemma c_abs : abs (𝓕.c : ℝ) = 𝓕.c := by rw [abs_of_pos (SpeedOfLight.val_pos 𝓕.c)] end FreeSpace diff --git a/Physlib/Electromagnetism/Dynamics/CurrentDensity.lean b/Physlib/Electromagnetism/Dynamics/CurrentDensity.lean index 3869cfc86..616e8187c 100644 --- a/Physlib/Electromagnetism/Dynamics/CurrentDensity.lean +++ b/Physlib/Electromagnetism/Dynamics/CurrentDensity.lean @@ -102,20 +102,13 @@ lemma chargeDensity_zero {d : ℕ} {c : SpeedOfLight}: lemma chargeDensity_differentiable {d : ℕ} {c : SpeedOfLight} {J : LorentzCurrentDensity d} (hJ : Differentiable ℝ J) : Differentiable ℝ ↿(J.chargeDensity c) := by rw [chargeDensity_eq_timeSlice] - apply timeSlice_differentiable - have h1 : ∀ i, Differentiable ℝ (fun x => J x i) := by - rw [SpaceTime.differentiable_vector] - exact hJ - apply Differentiable.fun_const_smul - exact h1 (Sum.inl 0) + exact timeSlice_differentiable c _ + (Differentiable.fun_const_smul ((SpaceTime.differentiable_vector J).mpr hJ (Sum.inl 0)) _) lemma chargeDensity_differentiable_space {d : ℕ} {c : SpeedOfLight} {J : LorentzCurrentDensity d} (hJ : Differentiable ℝ J) (t : Time) : - Differentiable ℝ (fun x => J.chargeDensity c t x) := by - change Differentiable ℝ (↿(J.chargeDensity c) ∘ fun x => (t, x)) - refine Differentiable.comp ?_ ?_ - · exact chargeDensity_differentiable hJ - · fun_prop + Differentiable ℝ (fun x => J.chargeDensity c t x) := + (chargeDensity_differentiable hJ).comp (f := fun x => (t, x)) (by fun_prop) /-! @@ -126,12 +119,8 @@ lemma chargeDensity_differentiable_space {d : ℕ} {c : SpeedOfLight} {J : Loren lemma chargeDensity_contDiff {d : ℕ} {c : SpeedOfLight} {J : LorentzCurrentDensity d} (hJ : ContDiff ℝ n J) : ContDiff ℝ n ↿(J.chargeDensity c) := by rw [chargeDensity_eq_timeSlice] - apply timeSlice_contDiff - have h1 : ∀ i, ContDiff ℝ n (fun x => J x i) := by - rw [SpaceTime.contDiff_vector] - exact hJ - apply ContDiff.const_smul - exact h1 (Sum.inl 0) + exact timeSlice_contDiff c _ + (ContDiff.const_smul _ ((SpaceTime.contDiff_vector J).mpr hJ (Sum.inl 0))) /-! @@ -156,9 +145,7 @@ lemma currentDensity_eq_timeSlice {d : ℕ} {J : LorentzCurrentDensity d} : @[simp] lemma currentDensity_zero {d : ℕ} {c : SpeedOfLight}: - currentDensity c (0 : LorentzCurrentDensity d) = 0 := by - simp [currentDensity_eq_timeSlice, timeSlice] - rfl + currentDensity c (0 : LorentzCurrentDensity d) = 0 := rfl /-! ### C.2. Differentiability of the current density @@ -168,57 +155,38 @@ lemma currentDensity_zero {d : ℕ} {c : SpeedOfLight}: lemma currentDensity_differentiable {d : ℕ} {c : SpeedOfLight} {J : LorentzCurrentDensity d} (hJ : Differentiable ℝ J) : Differentiable ℝ ↿(J.currentDensity c) := by rw [currentDensity_eq_timeSlice] - apply timeSlice_differentiable - have h1 : ∀ i, Differentiable ℝ (fun x => J x i) := by - rw [SpaceTime.differentiable_vector] - exact hJ - exact differentiable_euclidean.mpr fun i => h1 (Sum.inr i) + exact timeSlice_differentiable c _ + (differentiable_euclidean.mpr fun i => (SpaceTime.differentiable_vector J).mpr hJ (Sum.inr i)) lemma currentDensity_apply_differentiable {d : ℕ} {c : SpeedOfLight} {J : LorentzCurrentDensity d} (hJ : Differentiable ℝ J) (i : Fin d) : - Differentiable ℝ ↿(fun t x => J.currentDensity c t x i) := by - change Differentiable ℝ (EuclideanSpace.proj i ∘ ↿(J.currentDensity c)) - refine Differentiable.comp ?_ ?_ - · exact ContinuousLinearMap.differentiable (𝕜 := ℝ) (EuclideanSpace.proj i) - · exact currentDensity_differentiable hJ + Differentiable ℝ ↿(fun t x => J.currentDensity c t x i) := + (ContinuousLinearMap.differentiable (𝕜 := ℝ) (EuclideanSpace.proj i)).comp + (currentDensity_differentiable hJ) lemma currentDensity_differentiable_space {d : ℕ} {c : SpeedOfLight} {J : LorentzCurrentDensity d} (hJ : Differentiable ℝ J) (t : Time) : - Differentiable ℝ (fun x => J.currentDensity c t x) := by - change Differentiable ℝ (↿(J.currentDensity c) ∘ fun x => (t, x)) - refine Differentiable.comp ?_ ?_ - · exact currentDensity_differentiable hJ - · fun_prop + Differentiable ℝ (fun x => J.currentDensity c t x) := + (currentDensity_differentiable hJ).comp (f := fun x => (t, x)) (by fun_prop) lemma currentDensity_apply_differentiable_space {d : ℕ} {c : SpeedOfLight} {J : LorentzCurrentDensity d} (hJ : Differentiable ℝ J) (t : Time) (i : Fin d) : - Differentiable ℝ (fun x => J.currentDensity c t x i) := by - change Differentiable ℝ (EuclideanSpace.proj i ∘ (↿(J.currentDensity c) ∘ fun x => (t, x))) - refine Differentiable.comp ?_ ?_ - · exact ContinuousLinearMap.differentiable (𝕜 := ℝ) _ - · apply Differentiable.comp ?_ ?_ - · exact currentDensity_differentiable hJ - · fun_prop + Differentiable ℝ (fun x => J.currentDensity c t x i) := + (ContinuousLinearMap.differentiable (𝕜 := ℝ) (EuclideanSpace.proj i)).comp + (currentDensity_differentiable_space hJ t) lemma currentDensity_differentiable_time {d : ℕ} {c : SpeedOfLight} {J : LorentzCurrentDensity d} (hJ : Differentiable ℝ J) (x : Space d) : - Differentiable ℝ (fun t => J.currentDensity c t x) := by - change Differentiable ℝ (↿(J.currentDensity c) ∘ fun t => (t, x)) - refine Differentiable.comp ?_ ?_ - · exact currentDensity_differentiable hJ - · fun_prop + Differentiable ℝ (fun t => J.currentDensity c t x) := + (currentDensity_differentiable hJ).comp (f := fun t => (t, x)) (by fun_prop) lemma currentDensity_apply_differentiable_time {d : ℕ} {c : SpeedOfLight} {J : LorentzCurrentDensity d} (hJ : Differentiable ℝ J) (x : Space d) (i : Fin d) : - Differentiable ℝ (fun t => J.currentDensity c t x i) := by - change Differentiable ℝ (EuclideanSpace.proj i ∘ (↿(J.currentDensity c) ∘ fun t => (t, x))) - refine Differentiable.comp ?_ ?_ - · exact ContinuousLinearMap.differentiable (𝕜 := ℝ) _ - · apply Differentiable.comp ?_ ?_ - · exact currentDensity_differentiable hJ - · fun_prop + Differentiable ℝ (fun t => J.currentDensity c t x i) := + (ContinuousLinearMap.differentiable (𝕜 := ℝ) (EuclideanSpace.proj i)).comp + (currentDensity_differentiable_time hJ x) /-! @@ -229,11 +197,8 @@ lemma currentDensity_apply_differentiable_time {d : ℕ} {c : SpeedOfLight} lemma currentDensity_ContDiff {d : ℕ} {c : SpeedOfLight} {J : LorentzCurrentDensity d} (hJ : ContDiff ℝ n J) : ContDiff ℝ n ↿(J.currentDensity c) := by rw [currentDensity_eq_timeSlice] - apply timeSlice_contDiff - have h1 : ∀ i, ContDiff ℝ n (fun x => J x i) := by - rw [SpaceTime.contDiff_vector] - exact hJ - exact contDiff_euclidean.mpr fun i => h1 (Sum.inr i) + exact timeSlice_contDiff c _ + (contDiff_euclidean.mpr fun i => (SpaceTime.contDiff_vector J).mpr hJ (Sum.inr i)) end LorentzCurrentDensity diff --git a/Physlib/Electromagnetism/Dynamics/IsExtrema.lean b/Physlib/Electromagnetism/Dynamics/IsExtrema.lean index 5c5cee879..dff99ce3f 100644 --- a/Physlib/Electromagnetism/Dynamics/IsExtrema.lean +++ b/Physlib/Electromagnetism/Dynamics/IsExtrema.lean @@ -233,8 +233,7 @@ lemma isExtrema_iff_gauss_ampere_magneticFieldMatrix {d} {𝓕 : FreeSpace} IsExtrema 𝓕 A J ↔ ∀ t, ∀ x, (∇ ⬝ (A.electricField 𝓕.c t)) x = J.chargeDensity 𝓕.c t x / 𝓕.ε₀ ∧ ∀ i, 𝓕.μ₀ * 𝓕.ε₀ * ∂ₜ (fun t => A.electricField 𝓕.c t x) t i = ∑ j, ∂[j] (A.magneticFieldMatrix 𝓕.c t · (j, i)) x - 𝓕.μ₀ * J.currentDensity 𝓕.c t x i := by - rw [isExtrema_iff_gradLagrangian] - rw [funext_iff] + rw [isExtrema_iff_gradLagrangian, funext_iff] conv_lhs => enter [x] rw [gradLagrangian_eq_electricField_magneticField (𝓕 := 𝓕) A hA J hJ] @@ -469,8 +468,7 @@ lemma time_deriv_time_deriv_electricField_of_isExtrema {A : ElectromagneticPoten exact (hEd j j).differentiableAt _ = 1 / (𝓕.μ₀ * 𝓕.ε₀) * ∑ j, (∂[j] (fun x => ∂[j] (A.electricField 𝓕.c t · i) x) x) - 1 / (𝓕.μ₀ * 𝓕.ε₀) * (∂[i] (fun x => (∇ ⬝ (A.electricField 𝓕.c t)) x) x) - - 1 / 𝓕.ε₀ * ∂ₜ (J.currentDensity 𝓕.c · x i) t := by - rfl + 1 / 𝓕.ε₀ * ∂ₜ (J.currentDensity 𝓕.c · x i) t := by rfl _ = 1 / (𝓕.μ₀ * 𝓕.ε₀) * ∑ j, (∂[j] (∂[j] (A.electricField 𝓕.c t · i)) x) - 1 / (𝓕.μ₀ * 𝓕.ε₀ ^ 2) * ∂[i] (J.chargeDensity 𝓕.c t ·) x - 1 / 𝓕.ε₀ * ∂ₜ (J.currentDensity 𝓕.c · x i) t := by @@ -489,9 +487,8 @@ lemma time_deriv_time_deriv_electricField_of_isExtrema {A : ElectromagneticPoten rw [fderiv_const_mul] simp [← Space.deriv_eq_fderiv_basis] field_simp - apply Differentiable.differentiableAt - apply LorentzCurrentDensity.chargeDensity_differentiable_space - exact hJ.differentiable (by simp) + exact (LorentzCurrentDensity.chargeDensity_differentiable_space + (hJ.differentiable (by simp)) _).differentiableAt · exact hA · exact hJ _ = 𝓕.c ^ 2 * ∑ j, (∂[j] (∂[j] (A.electricField 𝓕.c t · i)) x) - diff --git a/Physlib/Electromagnetism/Dynamics/KineticTerm.lean b/Physlib/Electromagnetism/Dynamics/KineticTerm.lean index b9a583038..ab5d6c2ee 100644 --- a/Physlib/Electromagnetism/Dynamics/KineticTerm.lean +++ b/Physlib/Electromagnetism/Dynamics/KineticTerm.lean @@ -121,8 +121,7 @@ lemma kineticTerm_eq_sum {d} {𝓕 : FreeSpace} (A : ElectromagneticPotential d) (Lorentz.CoVector.basis.tensorProduct Lorentz.Vector.basis).repr (A.toFieldStrength x) (μ, ν) * (Lorentz.CoVector.basis.tensorProduct Lorentz.Vector.basis).repr (A.toFieldStrength x) (μ', ν') := by - rw [kineticTerm] - rw [toField_eq_repr] + rw [kineticTerm, toField_eq_repr] rw [contrT_basis_repr_apply_eq_fin] conv_lhs => enter [2, 2, μ] @@ -480,8 +479,7 @@ lemma kineticTerm_add_time_mul_const {d} {𝓕 : FreeSpace} (A : Electromagnetic _ = -1 / (2 * 𝓕.μ₀) * ∑ μ, ∑ ν, (η μ μ * η ν ν * (∂_ μ A x + if μ = Sum.inl 0 then c else 0) ν ^ 2 - (∂_ μ A x + if μ = Sum.inl 0 then c else 0) ν * - (∂_ ν A x + if ν = Sum.inl 0 then c else 0) μ) := by - simp only [hdiff] + (∂_ ν A x + if ν = Sum.inl 0 then c else 0) μ) := by simp only [hdiff] _ = -1 / (2 * 𝓕.μ₀) * ∑ μ, ∑ ν, (η μ μ * η ν ν * (∂_ μ A x ν + if μ = Sum.inl 0 then c ν else 0) ^ 2 - (∂_ μ A x ν + if μ = Sum.inl 0 then c ν else 0) * diff --git a/Physlib/Electromagnetism/Kinematics/EMPotential.lean b/Physlib/Electromagnetism/Kinematics/EMPotential.lean index f15200014..522271a1a 100644 --- a/Physlib/Electromagnetism/Kinematics/EMPotential.lean +++ b/Physlib/Electromagnetism/Kinematics/EMPotential.lean @@ -231,9 +231,8 @@ noncomputable def ofStaticPotentials {d} (c : SpeedOfLight) (ϕ : Space d → lemma ofStaticPotentials_eq_ofPotentials {d} (c : SpeedOfLight) (ϕ : Space d → ℝ) (A : Space d → EuclideanSpace ℝ (Fin d)) : - ofStaticPotentials c ϕ A = ofPotentials c (fun _ => ϕ) (fun _ => A) := by - rw [ofPotentials_eq_add] - rfl + ofStaticPotentials c ϕ A = ofPotentials c (fun _ => ϕ) (fun _ => A) := + (ofPotentials_eq_add c (fun _ => ϕ) (fun _ => A)).symm open MeasureTheory Matrix Space InnerProductSpace Time in /-- The electromagnetic potential from an electric and a magnetic field. @@ -281,7 +280,7 @@ noncomputable instance {d} : simp smul_add Λ A B := by ext x μ - simp [Lorentz.Vector.smul_add] + simp /-! @@ -295,38 +294,27 @@ open ContDiff @[fun_prop] lemma differentiable_component {d : ℕ} (A : ElectromagneticPotential d) (hA : Differentiable ℝ A) (μ : Fin 1 ⊕ Fin d) : - Differentiable ℝ (fun x => A x μ) := by - revert μ - rw [SpaceTime.differentiable_vector] - exact hA + Differentiable ℝ (fun x => A x μ) := + (SpaceTime.differentiable_vector A).mpr hA μ @[fun_prop] lemma differentiable_action {d} (Λ : LorentzGroup d) (A : ElectromagneticPotential d) - (hA : Differentiable ℝ A) : Differentiable ℝ (fun x => Λ • A (Λ⁻¹ • x)) := by - apply Differentiable.comp - · exact ContinuousLinearMap.differentiable (Lorentz.Vector.actionCLM Λ) - · apply Differentiable.comp - · exact hA - · exact ContinuousLinearMap.differentiable (Lorentz.Vector.actionCLM Λ⁻¹) + (hA : Differentiable ℝ A) : Differentiable ℝ (fun x => Λ • A (Λ⁻¹ • x)) := + (ContinuousLinearMap.differentiable (Lorentz.Vector.actionCLM Λ)).comp + (hA.comp (ContinuousLinearMap.differentiable (Lorentz.Vector.actionCLM Λ⁻¹))) @[fun_prop] lemma contDiff_action {d} (Λ : LorentzGroup d) (A : ElectromagneticPotential d) - (hA : ContDiff ℝ n A) : ContDiff ℝ n (fun x => Λ • A (Λ⁻¹ • x)) := by - apply ContDiff.comp - · exact ContinuousLinearMap.contDiff (Lorentz.Vector.actionCLM Λ) - · apply ContDiff.comp - · exact hA - · exact ContinuousLinearMap.contDiff (Lorentz.Vector.actionCLM Λ⁻¹) + (hA : ContDiff ℝ n A) : ContDiff ℝ n (fun x => Λ • A (Λ⁻¹ • x)) := + (ContinuousLinearMap.contDiff (Lorentz.Vector.actionCLM Λ)).comp + (hA.comp (ContinuousLinearMap.contDiff (Lorentz.Vector.actionCLM Λ⁻¹))) @[fun_prop] lemma differentiable_deriv {d} {A : ElectromagneticPotential d} (hA : ContDiff ℝ 2 A) (μ ν : Fin 1 ⊕ Fin d) : - Differentiable ℝ (fun x => ∂_ μ A x ν) := by - have diff_partial (μ) : - ∀ ν, Differentiable ℝ fun x => (fderiv ℝ A x) (Lorentz.Vector.basis μ) ν := by - rw [SpaceTime.differentiable_vector] - fun_prop - exact diff_partial μ ν + Differentiable ℝ (fun x => ∂_ μ A x ν) := + (SpaceTime.differentiable_vector (fun x => (fderiv ℝ A x) (Lorentz.Vector.basis μ))).mpr + (by fun_prop) ν @[fun_prop] lemma differentiable_deriv_of_smooth {d} {A : ElectromagneticPotential d} @@ -337,12 +325,9 @@ lemma differentiable_deriv_of_smooth {d} {A : ElectromagneticPotential d} @[fun_prop] lemma contDiff_deriv {n} {d} {A : ElectromagneticPotential d} (hA : ContDiff ℝ (n + 1) A) (μ ν : Fin 1 ⊕ Fin d) : - ContDiff ℝ n (fun x => ∂_ μ A x ν) := by - have diff_partial (μ) : - ∀ ν, ContDiff ℝ n fun x => (fderiv ℝ A x) (Lorentz.Vector.basis μ) ν := by - rw [SpaceTime.contDiff_vector] - fun_prop - exact diff_partial μ ν + ContDiff ℝ n (fun x => ∂_ μ A x ν) := + (SpaceTime.contDiff_vector (fun x => (fderiv ℝ A x) (Lorentz.Vector.basis μ))).mpr + (by fun_prop) ν TODO "Add results related to the differentiability of the derivative of the Electromagnetic potential." @@ -576,8 +561,7 @@ as taking the derivative and then applying the Lorentz transformation to the res lemma deriv_equivariant {d} {x : SpaceTime d} (A : ElectromagneticPotential d) (Λ : LorentzGroup d) (hf : Differentiable ℝ A) : deriv (Λ • A) x = Λ • (deriv A (Λ⁻¹ • x)) := by - rw [deriv_eq_tensorDeriv, deriv_eq_tensorDeriv] - rw [action_val, tensorDeriv_equivariant] + rw [deriv_eq_tensorDeriv, deriv_eq_tensorDeriv, action_val, tensorDeriv_equivariant] all_goals fun_prop /-! @@ -634,8 +618,7 @@ lemma toTensor_deriv_basis_repr_apply {d} (A : ElectromagneticPotential d) (Fin.append ![Color.down] ![Color.up])) : (Tensor.basis _).repr (Tensorial.toTensor (deriv A x)) b = ∂_ (b 0) A x (b 1) := by - rw [Tensorial.basis_toTensor_apply] - rw [Tensorial.basis_map_prod] + rw [Tensorial.basis_toTensor_apply, Tensorial.basis_map_prod] simp only [Nat.reduceSucc, Nat.reduceAdd, Basis.repr_reindex, Finsupp.mapDomain_equiv_apply, Equiv.symm_symm, Fin.isValue] rw [Lorentz.Vector.tensor_basis_map_eq_basis_reindex, diff --git a/Physlib/Electromagnetism/Kinematics/FieldStrength.lean b/Physlib/Electromagnetism/Kinematics/FieldStrength.lean index 5b53bb856..d6c84b18d 100644 --- a/Physlib/Electromagnetism/Kinematics/FieldStrength.lean +++ b/Physlib/Electromagnetism/Kinematics/FieldStrength.lean @@ -151,10 +151,9 @@ tensor in. the components extracted via `toField`. -/ lemma toFieldStrength_eq_sum_basis_eval {d} {A : ElectromagneticPotential d} : A.toFieldStrength = fun x => ∑ μ, ∑ ν, toField {A.toFieldStrength x| [μ] [ν]}ᵀ • - Vector.basis μ ⊗ₜ[ℝ] Vector.basis ν := by - ext x - exact prod_eq_sum_eval Vector.basis_eq_map_tensor_basis - Vector.basis_eq_map_tensor_basis (A.toFieldStrength x) + Vector.basis μ ⊗ₜ[ℝ] Vector.basis ν := + funext fun x => prod_eq_sum_eval Vector.basis_eq_map_tensor_basis + Vector.basis_eq_map_tensor_basis (A.toFieldStrength x) /-- The statement that `F = F^{μν} eᵤ ⊗ eᵥ` written explicitly, with the components given by `∑ κ, (η μ κ * ∂_ κ A x ν - η ν κ * ∂_ κ A x μ)`. -/ @@ -317,8 +316,7 @@ lemma toFieldStrength_tensor_basis_eq_basis {d} (A : ElectromagneticPotential d) (Tensor.basis _).repr (Tensorial.toTensor (toFieldStrength A x)) b = (Lorentz.Vector.basis.tensorProduct Lorentz.Vector.basis).repr (toFieldStrength A x) (b 0, b 1) := by - rw [Tensorial.basis_toTensor_apply] - rw [Tensorial.basis_map_prod] + rw [Tensorial.basis_toTensor_apply, Tensorial.basis_map_prod] simp only [Nat.reduceSucc, Nat.reduceAdd, Basis.repr_reindex, Finsupp.mapDomain_equiv_apply, Equiv.symm_symm, Fin.isValue] rw [Lorentz.Vector.tensor_basis_map_eq_basis_reindex] @@ -477,19 +475,15 @@ lemma fieldStrengthMatrix_differentiable {d} {A : ElectromagneticPotential d} lemma fieldStrengthMatrix_differentiable_space {d} {A : ElectromagneticPotential d} {μν} (hA : ContDiff ℝ 2 A) (t : Time) {c : SpeedOfLight} : - Differentiable ℝ (fun x => A.fieldStrengthMatrix ((toTimeAndSpace c).symm (t, x)) μν) := by - change Differentiable ℝ ((A.fieldStrengthMatrix · μν) ∘ fun x => (toTimeAndSpace c).symm (t, x)) - refine Differentiable.comp ?_ ?_ - · exact fieldStrengthMatrix_differentiable hA - · fun_prop + Differentiable ℝ (fun x => A.fieldStrengthMatrix ((toTimeAndSpace c).symm (t, x)) μν) := + (fieldStrengthMatrix_differentiable hA).comp (f := fun x => (toTimeAndSpace c).symm (t, x)) + (by fun_prop) lemma fieldStrengthMatrix_differentiable_time {d} {A : ElectromagneticPotential d} {μν} (hA : ContDiff ℝ 2 A) (x : Space d) {c : SpeedOfLight} : - Differentiable ℝ (fun t => A.fieldStrengthMatrix ((toTimeAndSpace c).symm (t, x)) μν) := by - change Differentiable ℝ ((A.fieldStrengthMatrix · μν) ∘ fun t => (toTimeAndSpace c).symm (t, x)) - refine Differentiable.comp ?_ ?_ - · exact fieldStrengthMatrix_differentiable hA - · fun_prop + Differentiable ℝ (fun t => A.fieldStrengthMatrix ((toTimeAndSpace c).symm (t, x)) μν) := + (fieldStrengthMatrix_differentiable hA).comp (f := fun t => (toTimeAndSpace c).symm (t, x)) + (by fun_prop) lemma fieldStrengthMatrix_contDiff {d} {n : WithTop ℕ∞} {A : ElectromagneticPotential d} {μν} (hA : ContDiff ℝ (n + 1) A) : @@ -520,9 +514,8 @@ lemma fieldStrengthMatrix_contDiff {d} {n : WithTop ℕ∞} {A : Electromagnetic lemma fieldStrengthMatrix_smooth {d} {A : ElectromagneticPotential d} (hA : ContDiff ℝ ∞ A) (μν) : - ContDiff ℝ ∞ (A.fieldStrengthMatrix · μν) := by - apply fieldStrengthMatrix_contDiff - simpa using hA + ContDiff ℝ ∞ (A.fieldStrengthMatrix · μν) := + fieldStrengthMatrix_contDiff (μν := μν) (by simpa using hA) /-! diff --git a/Physlib/Electromagnetism/Kinematics/GaugeTransformation.lean b/Physlib/Electromagnetism/Kinematics/GaugeTransformation.lean index c3c1cc631..bd75d39ed 100644 --- a/Physlib/Electromagnetism/Kinematics/GaugeTransformation.lean +++ b/Physlib/Electromagnetism/Kinematics/GaugeTransformation.lean @@ -104,8 +104,7 @@ lemma ofGradient_apply_sum {d} (χ : SpaceTime d → ℝ) (x : SpaceTime d) (μ only the `κ = μ` term survives. -/ lemma ofGradient_apply {d} (χ : SpaceTime d → ℝ) (x : SpaceTime d) (μ : Fin 1 ⊕ Fin d) : ofGradient χ x μ = η μ μ * ∂_ μ χ x := by - rw [ofGradient_apply_sum] - rw [Finset.sum_eq_single μ] + rw [ofGradient_apply_sum, Finset.sum_eq_single μ] · intro κ _ hκ rw [minkowskiMatrix.off_diag_zero (Ne.symm hκ)] simp diff --git a/Physlib/Electromagnetism/Kinematics/MagneticField.lean b/Physlib/Electromagnetism/Kinematics/MagneticField.lean index 1d88db0dd..dfeeb0f5f 100644 --- a/Physlib/Electromagnetism/Kinematics/MagneticField.lean +++ b/Physlib/Electromagnetism/Kinematics/MagneticField.lean @@ -239,8 +239,7 @@ lemma fieldStrengthMatrix_inr_inr_eq_magneticFieldMatrix {c : SpeedOfLight} (A : ElectromagneticPotential d) (x : SpaceTime d) (i j : Fin d) : A.fieldStrengthMatrix x (Sum.inr i, Sum.inr j) = - A.magneticFieldMatrix c (x.time c) x.space (i, j) := by - simp [magneticFieldMatrix_eq] + A.magneticFieldMatrix c (x.time c) x.space (i, j) := by simp [magneticFieldMatrix_eq] /-! diff --git a/Physlib/Electromagnetism/Kinematics/ScalarPotential.lean b/Physlib/Electromagnetism/Kinematics/ScalarPotential.lean index ba274ba3d..945a1f6c6 100644 --- a/Physlib/Electromagnetism/Kinematics/ScalarPotential.lean +++ b/Physlib/Electromagnetism/Kinematics/ScalarPotential.lean @@ -92,8 +92,7 @@ lemma ofVectorPotential_scalarPotential {d} (c : SpeedOfLight) @[simp] lemma ofStaticVectorPotential_scalarPotential {d} (c : SpeedOfLight) (A : Space d → EuclideanSpace ℝ (Fin d)) : - (ofStaticVectorPotential c A).scalarPotential = 0 := by - simp [ofStaticVectorPotential] + (ofStaticVectorPotential c A).scalarPotential = 0 := by simp [ofStaticVectorPotential] @[simp] lemma ofPotentials_scalarPotential {d} (c : SpeedOfLight) (φ : Time → Space d → ℝ) @@ -114,8 +113,7 @@ lemma ofElectromagneticField_scalarPotential (c : SpeedOfLight) (E : Time → Space → EuclideanSpace ℝ (Fin 3)) (B : Time → Space → EuclideanSpace ℝ (Fin 3)) : (ofElectromagneticField c E B).scalarPotential c = fun t x => - - ∫ u in (0 : ℝ)..1, ⟪E t (u • x), basis.repr x⟫_ℝ ∂(volume) := by - simp [ofElectromagneticField] + - ∫ u in (0 : ℝ)..1, ⟪E t (u • x), basis.repr x⟫_ℝ ∂(volume) := by simp [ofElectromagneticField] open MeasureTheory Matrix Space InnerProductSpace Time in lemma ofElectromagneticField_scalarPotential_eq_add_vectorPotential (c : SpeedOfLight) @@ -154,27 +152,20 @@ lemma scalarPotential_contDiff {n} {d} (c : SpeedOfLight) (A : ElectromagneticPo @[fun_prop] lemma scalarPotential_contDiff_space {n} {d} (c : SpeedOfLight) (A : ElectromagneticPotential d) - (hA : ContDiff ℝ n A) (t : Time) : ContDiff ℝ n (A.scalarPotential c t) := by - change ContDiff ℝ n (↿(A.scalarPotential c) ∘ fun x => (t, x)) - refine ContDiff.comp ?_ ?_ - · exact scalarPotential_contDiff c A hA - · fun_prop + (hA : ContDiff ℝ n A) (t : Time) : ContDiff ℝ n (A.scalarPotential c t) := + (scalarPotential_contDiff c A hA).comp (f := fun x => (t, x)) (by fun_prop) open ContDiff @[fun_prop] lemma scalarPotential_contDiff_space_of_smooth {n : ℕ} {d} (c : SpeedOfLight) (A : ElectromagneticPotential d) - (hA : ContDiff ℝ ∞ A) (t : Time) : ContDiff ℝ n (A.scalarPotential c t) := by - apply scalarPotential_contDiff_space - exact hA.of_le (ENat.LEInfty.out) + (hA : ContDiff ℝ ∞ A) (t : Time) : ContDiff ℝ n (A.scalarPotential c t) := + scalarPotential_contDiff_space c A (hA.of_le (ENat.LEInfty.out)) t lemma scalarPotential_contDiff_time {n} {d} (c : SpeedOfLight) (A : ElectromagneticPotential d) - (hA : ContDiff ℝ n A) (x : Space d) : ContDiff ℝ n (A.scalarPotential c · x) := by - change ContDiff ℝ n (↿(A.scalarPotential c) ∘ fun t => (t, x)) - refine ContDiff.comp ?_ ?_ - · exact scalarPotential_contDiff c A hA - · fun_prop + (hA : ContDiff ℝ n A) (x : Space d) : ContDiff ℝ n (A.scalarPotential c · x) := + (scalarPotential_contDiff c A hA).comp (f := fun t => (t, x)) (by fun_prop) /-! @@ -196,18 +187,12 @@ lemma scalarPotential_differentiable {d} (c : SpeedOfLight) (A : Electromagnetic exact h1 (Sum.inl 0) lemma scalarPotential_differentiable_space {d} (c : SpeedOfLight) (A : ElectromagneticPotential d) - (hA : Differentiable ℝ A) (t : Time) : Differentiable ℝ (A.scalarPotential c t) := by - change Differentiable ℝ (↿(A.scalarPotential c) ∘ fun x => (t, x)) - refine Differentiable.comp ?_ ?_ - · exact scalarPotential_differentiable c A hA - · fun_prop + (hA : Differentiable ℝ A) (t : Time) : Differentiable ℝ (A.scalarPotential c t) := + (scalarPotential_differentiable c A hA).comp (f := fun x => (t, x)) (by fun_prop) lemma scalarPotential_differentiable_time {d} (c : SpeedOfLight) (A : ElectromagneticPotential d) - (hA : Differentiable ℝ A) (x : Space d) : Differentiable ℝ (A.scalarPotential c · x) := by - change Differentiable ℝ (↿(A.scalarPotential c) ∘ fun t => (t, x)) - refine Differentiable.comp ?_ ?_ - · exact scalarPotential_differentiable c A hA - · fun_prop + (hA : Differentiable ℝ A) (x : Space d) : Differentiable ℝ (A.scalarPotential c · x) := + (scalarPotential_differentiable c A hA).comp (f := fun t => (t, x)) (by fun_prop) end ElectromagneticPotential diff --git a/Physlib/Electromagnetism/Kinematics/VectorPotential.lean b/Physlib/Electromagnetism/Kinematics/VectorPotential.lean index b5edd33d0..a909c266a 100644 --- a/Physlib/Electromagnetism/Kinematics/VectorPotential.lean +++ b/Physlib/Electromagnetism/Kinematics/VectorPotential.lean @@ -73,9 +73,7 @@ noncomputable def vectorPotential {d} (c : SpeedOfLight := 1) (A : Electromagnet @[simp] lemma ofScalarPotential_vectorPotential {d} (c : SpeedOfLight) - (φ : Time → Space d → ℝ) : (ofScalarPotential c φ).vectorPotential c = 0 := by - simp only [vectorPotential, ofScalarPotential] - rfl + (φ : Time → Space d → ℝ) : (ofScalarPotential c φ).vectorPotential c = 0 := rfl @[simp] lemma ofStaticScalarPotential_vectorPotential {d} (c : SpeedOfLight) @@ -197,9 +195,8 @@ lemma vectorPotential_inner_radial_eq_zero_ofElectromagneticField {c : SpeedOfLight} {E B : Time → Space 3 → EuclideanSpace ℝ (Fin 3)} {t : Time} {x : Space 3} {a : ℝ} (hB : Continuous ↿B) : ⟪(ofElectromagneticField c E B).vectorPotential c t (a • x), Space.basis.repr x⟫_ℝ = 0 := by - rw [real_inner_comm] - rw [PiLp.inner_apply] - have h1 (a b : ℝ) : ⟪a, b⟫_ℝ = b * a:= by rfl + rw [real_inner_comm, PiLp.inner_apply] + have h1 (a b : ℝ) : ⟪a, b⟫_ℝ = b * a := rfl simp only [Space.basis_repr_apply, ofElectromagneticField_vectorPotential_apply_eq_expand hB, Fin.isValue, Space.smul_apply, h1, Fin.sum_univ_three, zero_add, Fin.reduceAdd] ring @@ -238,57 +235,40 @@ the smoothness of the electromagnetic potential. lemma vectorPotential_contDiff {n} {d} {c : SpeedOfLight} (A : ElectromagneticPotential d) (hA : ContDiff ℝ n A) : ContDiff ℝ n ↿(A.vectorPotential c) := by simp [vectorPotential] - apply timeSlice_contDiff - refine contDiff_euclidean.mpr ?_ - have h1 : ∀ i, ContDiff ℝ n (fun x => A x i) := by - rw [SpaceTime.contDiff_vector] - exact hA - exact fun i => h1 (Sum.inr i) + exact timeSlice_contDiff c _ (contDiff_euclidean.mpr fun i => + (SpaceTime.contDiff_vector A).mpr hA (Sum.inr i)) open ContDiff @[fun_prop] lemma vectorPotential_contDiff_of_smooth {n : ℕ} {d} {c : SpeedOfLight} (A : ElectromagneticPotential d) (hA : ContDiff ℝ ∞ A) : - ContDiff ℝ n ↿(A.vectorPotential c) := by - apply vectorPotential_contDiff - exact hA.of_le (ENat.LEInfty.out) + ContDiff ℝ n ↿(A.vectorPotential c) := + vectorPotential_contDiff A (hA.of_le (ENat.LEInfty.out)) lemma vectorPotential_apply_contDiff {n} {d} {c : SpeedOfLight} (A : ElectromagneticPotential d) - (hA : ContDiff ℝ n A) (i : Fin d) : ContDiff ℝ n ↿(fun t x => A.vectorPotential c t x i) := by - change ContDiff ℝ n (EuclideanSpace.proj i ∘ ↿(A.vectorPotential c)) - refine ContDiff.comp ?_ ?_ - · exact ContinuousLinearMap.contDiff (𝕜 := ℝ) (n := n) (EuclideanSpace.proj i) - · exact vectorPotential_contDiff A hA + (hA : ContDiff ℝ n A) (i : Fin d) : ContDiff ℝ n ↿(fun t x => A.vectorPotential c t x i) := + (ContinuousLinearMap.contDiff (𝕜 := ℝ) (n := n) (EuclideanSpace.proj i)).comp + (vectorPotential_contDiff A hA) lemma vectorPotential_comp_contDiff {n} {d} {c : SpeedOfLight} (A : ElectromagneticPotential d) - (hA : ContDiff ℝ n A) (i : Fin d) : ContDiff ℝ n ↿(fun t x => A.vectorPotential c t x i) := by - change ContDiff ℝ n (EuclideanSpace.proj i ∘ ↿(A.vectorPotential c)) - refine ContDiff.comp ?_ ?_ - · exact ContinuousLinearMap.contDiff (𝕜 := ℝ) (n := n) (EuclideanSpace.proj i) - · exact vectorPotential_contDiff A hA + (hA : ContDiff ℝ n A) (i : Fin d) : ContDiff ℝ n ↿(fun t x => A.vectorPotential c t x i) := + (ContinuousLinearMap.contDiff (𝕜 := ℝ) (n := n) (EuclideanSpace.proj i)).comp + (vectorPotential_contDiff A hA) lemma vectorPotential_contDiff_space {n} {d} {c : SpeedOfLight} (A : ElectromagneticPotential d) - (hA : ContDiff ℝ n A) (t : Time) : ContDiff ℝ n (A.vectorPotential c t) := by - change ContDiff ℝ n (↿(A.vectorPotential c) ∘ fun x => (t, x)) - refine ContDiff.comp ?_ ?_ - · exact vectorPotential_contDiff A hA - · fun_prop + (hA : ContDiff ℝ n A) (t : Time) : ContDiff ℝ n (A.vectorPotential c t) := + (vectorPotential_contDiff A hA).comp (f := fun x => (t, x)) (by fun_prop) lemma vectorPotential_apply_contDiff_space {n} {d} {c : SpeedOfLight} (A : ElectromagneticPotential d) (hA : ContDiff ℝ n A) (t : Time) (i : Fin d) : - ContDiff ℝ n (fun x => A.vectorPotential c t x i) := by - change ContDiff ℝ n (EuclideanSpace.proj i ∘ (↿(A.vectorPotential c) ∘ fun x => (t, x))) - refine ContDiff.comp ?_ ?_ - · exact ContinuousLinearMap.contDiff (𝕜 := ℝ) (n := n) (EuclideanSpace.proj i) - · exact vectorPotential_contDiff_space A hA t + ContDiff ℝ n (fun x => A.vectorPotential c t x i) := + (ContinuousLinearMap.contDiff (𝕜 := ℝ) (n := n) (EuclideanSpace.proj i)).comp + (vectorPotential_contDiff_space A hA t) lemma vectorPotential_contDiff_time {n} {d} {c : SpeedOfLight} (A : ElectromagneticPotential d) - (hA : ContDiff ℝ n A) (x : Space d) : ContDiff ℝ n (A.vectorPotential c · x) := by - change ContDiff ℝ n (↿(A.vectorPotential c) ∘ fun t => (t, x)) - refine ContDiff.comp ?_ ?_ - · exact vectorPotential_contDiff A hA - · fun_prop + (hA : ContDiff ℝ n A) (x : Space d) : ContDiff ℝ n (A.vectorPotential c · x) := + (vectorPotential_contDiff A hA).comp (f := fun t => (t, x)) (by fun_prop) /-! @@ -302,19 +282,12 @@ the differentiablity of the electromagnetic potential. lemma vectorPotential_differentiable {d} {c : SpeedOfLight} (A : ElectromagneticPotential d) (hA : Differentiable ℝ A) : Differentiable ℝ ↿(A.vectorPotential c) := by simp [vectorPotential] - apply timeSlice_differentiable - refine differentiable_euclidean.mpr ?_ - have h1 : ∀ i, Differentiable ℝ (fun x => A x i) := by - rw [SpaceTime.differentiable_vector] - exact hA - exact fun i => h1 (Sum.inr i) + exact timeSlice_differentiable c _ (differentiable_euclidean.mpr fun i => + (SpaceTime.differentiable_vector A).mpr hA (Sum.inr i)) lemma vectorPotential_differentiable_time {d} {c : SpeedOfLight} (A : ElectromagneticPotential d) - (hA : Differentiable ℝ A) (x : Space d) : Differentiable ℝ (A.vectorPotential c · x) := by - change Differentiable ℝ (↿(A.vectorPotential c) ∘ fun t => (t, x)) - refine Differentiable.comp ?_ ?_ - · exact vectorPotential_differentiable A hA - · fun_prop + (hA : Differentiable ℝ A) (x : Space d) : Differentiable ℝ (A.vectorPotential c · x) := + (vectorPotential_differentiable A hA).comp (f := fun t => (t, x)) (by fun_prop) end ElectromagneticPotential diff --git a/Physlib/Electromagnetism/PointParticle/OneDimension.lean b/Physlib/Electromagnetism/PointParticle/OneDimension.lean index 127faf8de..c03c213b7 100644 --- a/Physlib/Electromagnetism/PointParticle/OneDimension.lean +++ b/Physlib/Electromagnetism/PointParticle/OneDimension.lean @@ -201,8 +201,7 @@ lemma oneDimPointParticle_electricField_timeDeriv (𝓕 : FreeSpace) (q : ℝ) ( -/ lemma oneDimPointParticle_magneticFieldMatrix (q : ℝ) (r₀ : Space 1) : - (oneDimPointParticle 𝓕 q r₀).magneticFieldMatrix 𝓕.c = 0 := by - simp + (oneDimPointParticle 𝓕 q r₀).magneticFieldMatrix 𝓕.c = 0 := by simp /-! diff --git a/Physlib/Electromagnetism/Vacuum/Constant.lean b/Physlib/Electromagnetism/Vacuum/Constant.lean index 4bbfd58b1..1f4dc9cdd 100644 --- a/Physlib/Electromagnetism/Vacuum/Constant.lean +++ b/Physlib/Electromagnetism/Vacuum/Constant.lean @@ -167,8 +167,7 @@ lemma constantEB_vectorPotential_space_deriv {c : SpeedOfLight} {B₀_antisymm : ∀ i j, B₀ (i, j) = - B₀ (j, i)} (t : Time) (x : Space d) (i j : Fin d) : Space.deriv i ((constantEB c E₀ B₀ B₀_antisymm).vectorPotential c t · j) x = (1 / 2) * B₀ (j, i) := by - rw [constantEB_vectorPotential] - rw [Space.deriv_eq] + rw [constantEB_vectorPotential, Space.deriv_eq] rw [fderiv_const_mul (by fun_prop)] rw [fderiv_fun_sum (by fun_prop)] simp only [one_div, FunLike.coe_smul, FunLike.coe_sum, Pi.smul_apply, diff --git a/Physlib/Electromagnetism/Vacuum/HarmonicWave.lean b/Physlib/Electromagnetism/Vacuum/HarmonicWave.lean index bc4fbe15d..255a29080 100644 --- a/Physlib/Electromagnetism/Vacuum/HarmonicWave.lean +++ b/Physlib/Electromagnetism/Vacuum/HarmonicWave.lean @@ -86,15 +86,12 @@ noncomputable def harmonicWaveX (𝓕 : FreeSpace) (k : ℝ) (E₀ : Fin d → @[simp] lemma harmonicWaveX_inl_zero {d} (𝓕 : FreeSpace) (k : ℝ) (E₀ : Fin d → ℝ) (φ : Fin d → ℝ) (x : SpaceTime d.succ) : - harmonicWaveX 𝓕 k E₀ φ x (Sum.inl 0) = 0 := by - simp [harmonicWaveX] + harmonicWaveX 𝓕 k E₀ φ x (Sum.inl 0) = 0 := by simp [harmonicWaveX] @[simp] lemma harmonicWaveX_inr_zero {d} (𝓕 : FreeSpace) (k : ℝ) (E₀ : Fin d → ℝ) (φ : Fin d → ℝ) (x : SpaceTime d.succ) : - harmonicWaveX 𝓕 k E₀ φ x (Sum.inr 0) = 0 := by - simp [harmonicWaveX] - rfl + harmonicWaveX 𝓕 k E₀ φ x (Sum.inr 0) = 0 := rfl /-! @@ -104,9 +101,8 @@ lemma harmonicWaveX_inr_zero {d} (𝓕 : FreeSpace) (k : ℝ) (E₀ : Fin d → lemma harmonicWaveX_differentiable {d} (𝓕 : FreeSpace) (k : ℝ) (E₀ : Fin d → ℝ) (φ : Fin d → ℝ) : - Differentiable ℝ (harmonicWaveX 𝓕 k E₀ φ) := by - rw [← Lorentz.Vector.differentiable_apply] - intro μ + Differentiable ℝ (harmonicWaveX 𝓕 k E₀ φ) := + (Lorentz.Vector.differentiable_apply _).mp fun μ => by match μ with | Sum.inl 0 => simp | Sum.inr ⟨0, h⟩ => simp @@ -123,9 +119,8 @@ lemma harmonicWaveX_differentiable {d} (𝓕 : FreeSpace) (k : ℝ) lemma harmonicWaveX_contDiff {d} (n : WithTop ℕ∞) (𝓕 : FreeSpace) (k : ℝ) (E₀ : Fin d → ℝ) (φ : Fin d → ℝ) : - ContDiff ℝ n (harmonicWaveX 𝓕 k E₀ φ) := by - rw [← Lorentz.Vector.contDiff_apply] - intro μ + ContDiff ℝ n (harmonicWaveX 𝓕 k E₀ φ) := + (Lorentz.Vector.contDiff_apply _).mp fun μ => by match μ with | Sum.inl 0 => simp [harmonicWaveX]; fun_prop | Sum.inr ⟨0, h⟩ => simp [harmonicWaveX]; fun_prop @@ -166,9 +161,7 @@ lemma harmonicWaveX_scalarPotential_eq_zero {d} (𝓕 : FreeSpace) (k : ℝ) @[simp] lemma harmonicWaveX_vectorPotential_zero_eq_zero {d} (𝓕 : FreeSpace) (k : ℝ) (E₀ : Fin d → ℝ) (φ : Fin d → ℝ) (t : Time) (x : Space d.succ) : - (harmonicWaveX 𝓕 k E₀ φ).vectorPotential 𝓕.c t x 0 = 0 := by - simp [harmonicWaveX, vectorPotential, SpaceTime.timeSlice] - rfl + (harmonicWaveX 𝓕 k E₀ φ).vectorPotential 𝓕.c t x 0 = 0 := rfl lemma harmonicWaveX_vectorPotential_succ {d} (𝓕 : FreeSpace) (k : ℝ) (E₀ : Fin d → ℝ) (φ : Fin d → ℝ) (t : Time) (x : Space d.succ) (i : Fin d) : @@ -604,8 +597,7 @@ lemma harmonicWaveX_polarization_ellipse {d} (𝓕 : FreeSpace) (k : ℝ) (hk : symm calc _ _ = ∑ (i : Fin d), ∑ (j : Fin d), (cos (τ + φ i) ^ 2 + cos (τ + φ j) ^ 2 - - 2 * cos (τ + φ i) * cos (τ + φ j) * cos (φ j - φ i)) := by - simp [← hij] + - 2 * cos (τ + φ i) * cos (τ + φ j) * cos (φ j - φ i)) := by simp [← hij] _ = 2 * ∑ (i : Fin d), ∑ (j : Fin d), cos (τ + φ j) ^ 2 - 2 * ∑ (i : Fin d), ∑ (j : Fin d), cos (τ + φ i) * cos (τ + φ j) * cos (φ j - φ i) := by rw [two_mul] diff --git a/Physlib/Electromagnetism/Vacuum/IsPlaneWave.lean b/Physlib/Electromagnetism/Vacuum/IsPlaneWave.lean index eb0811902..761811058 100644 --- a/Physlib/Electromagnetism/Vacuum/IsPlaneWave.lean +++ b/Physlib/Electromagnetism/Vacuum/IsPlaneWave.lean @@ -93,9 +93,8 @@ lemma electricField_eq_electricFunction {d : ℕ} {𝓕 : FreeSpace} {A : ElectromagneticPotential d} {s : Direction d} (P : IsPlaneWave 𝓕 A s) (t : Time) (x : Space d) : A.electricField 𝓕.c t x = - P.electricFunction (⟪x, s.unit⟫_ℝ - 𝓕.c * t) := by - rw [Classical.choose_spec P.1] - rfl + P.electricFunction (⟪x, s.unit⟫_ℝ - 𝓕.c * t) := + congrFun (congrFun (Classical.choose_spec P.1) t) x /-- The corresponding magnetic field function from `ℝ` to `Fin d × Fin d → ℝ` of a plane wave. -/ @@ -108,9 +107,8 @@ lemma magneticFieldMatrix_eq_magneticFunction {d : ℕ} {𝓕 : FreeSpace} {A : ElectromagneticPotential d} {s : Direction d} (P : IsPlaneWave 𝓕 A s) (t : Time) (x : Space d) : A.magneticFieldMatrix 𝓕.c t x = - P.magneticFunction (⟪x, s.unit⟫_ℝ - 𝓕.c * t) := by - rw [Classical.choose_spec P.2 t x] - rfl + P.magneticFunction (⟪x, s.unit⟫_ℝ - 𝓕.c * t) := + Classical.choose_spec P.2 t x /-! @@ -379,19 +377,11 @@ lemma time_deriv_magneticFieldMatrix_eq_electricField_mul_propogator {d : ℕ} rw [P.electricField_space_deriv_eq_time_deriv, P.electricField_space_deriv_eq_time_deriv] conv_rhs => rw [Time.deriv_eq] - rw [fderiv_fun_sub (by - apply Differentiable.differentiableAt - apply Differentiable.const_mul - exact electricField_apply_differentiable_time hA _ _) (by - apply Differentiable.differentiableAt - apply Differentiable.const_mul - exact electricField_apply_differentiable_time hA _ _)] - rw [fderiv_const_mul (by - apply Differentiable.differentiableAt - exact electricField_apply_differentiable_time hA _ _)] - rw [fderiv_const_mul (by - apply Differentiable.differentiableAt - exact electricField_apply_differentiable_time hA _ _)] + rw [fderiv_fun_sub + ((electricField_apply_differentiable_time hA _ _).const_mul _).differentiableAt + ((electricField_apply_differentiable_time hA _ _).const_mul _).differentiableAt] + rw [fderiv_const_mul (electricField_apply_differentiable_time hA _ _).differentiableAt] + rw [fderiv_const_mul (electricField_apply_differentiable_time hA _ _).differentiableAt] simp [← Time.deriv_eq] field_simp ring @@ -446,12 +436,8 @@ lemma magneticFieldMatrix_eq_propogator_cross_electricField {d : ℕ} s.unit i * A.electricField 𝓕.c t x j) + C := by apply Space.equal_up_to_const_of_deriv_eq · exact magneticFieldMatrix_differentiable A hA (i, j) - · apply Differentiable.const_mul - apply Differentiable.sub - · apply Differentiable.const_mul - exact electricField_apply_differentiable hA - · apply Differentiable.const_mul - exact electricField_apply_differentiable hA + · exact (Differentiable.sub ((electricField_apply_differentiable hA).const_mul _) + ((electricField_apply_differentiable hA).const_mul _)).const_mul _ · intro t x rw [P.time_deriv_magneticFieldMatrix_eq_electricField_mul_propogator hA t x i j] congr @@ -506,8 +492,7 @@ lemma time_deriv_electricField_eq_magneticFieldMatrix {d : ℕ} ring_nf rfl · intro k _ - apply DifferentiableAt.mul_const - exact (hBd k).differentiableAt + exact (hBd k).differentiableAt.mul_const _ rw [h1, Finset.mul_sum, Finset.mul_sum,← Finset.sum_neg_distrib] field_simp @@ -523,8 +508,7 @@ lemma time_deriv_electricField_eq_magneticFieldMatrix {d : ℕ} simp [← Time.deriv_eq] · refine DifferentiableAt.fun_sum ?_ intro k _ - apply DifferentiableAt.mul_const - exact (hBd k).differentiableAt + exact (hBd k).differentiableAt.mul_const _ · change ContDiff ℝ ∞ (fun _ => 0) fun_prop · exact electricField_differentiable_time (hA.of_le (ENat.LEInfty.out)) x @@ -562,22 +546,16 @@ lemma space_deriv_electricField_eq_magneticFieldMatrix {d : ℕ} field_simp any_goals apply Differentiable.differentiableAt · exact fieldStrengthMatrix_differentiable_space hA2 t - · apply Differentiable.mul_const - exact fieldStrengthMatrix_differentiable_space hA2 t + · exact (fieldStrengthMatrix_differentiable_space hA2 t).mul_const _ · exact fieldStrengthMatrix_differentiable_time hA2 x · intro i _ - apply Differentiable.differentiableAt - apply Differentiable.const_mul - apply Differentiable.mul_const - exact fieldStrengthMatrix_differentiable_space hA2 t + exact + (((fieldStrengthMatrix_differentiable_space hA2 t).mul_const _).const_mul _).differentiableAt · intro i _ - apply Differentiable.differentiableAt - apply Differentiable.mul_const - exact fieldStrengthMatrix_differentiable_time hA2 x + exact ((fieldStrengthMatrix_differentiable_time hA2 x).mul_const _).differentiableAt · apply Differentiable.fun_sum intro i _ - apply Differentiable.mul_const - exact fieldStrengthMatrix_differentiable_time hA2 x + exact (fieldStrengthMatrix_differentiable_time hA2 x).mul_const _ /-! @@ -594,11 +572,8 @@ lemma electricField_eq_propogator_cross_magneticFieldMatrix {d : ℕ} have hA2 : ContDiff ℝ 2 A := hA.of_le ENat.LEInfty.out apply Space.equal_up_to_const_of_deriv_eq · exact electricField_apply_differentiable hA2 - · apply Differentiable.const_mul - apply Differentiable.fun_sum - intro j _ - apply Differentiable.mul_const - exact magneticFieldMatrix_differentiable A hA2 (i, j) + · exact ((Differentiable.fun_sum fun j _ => + (magneticFieldMatrix_differentiable A hA2 (i, j)).mul_const _).const_mul _) · intro t x rw [P.time_deriv_electricField_eq_magneticFieldMatrix hA _ t x i] congr diff --git a/Physlib/FluidDynamics/NavierStokes/Momentum.lean b/Physlib/FluidDynamics/NavierStokes/Momentum.lean index 40928d4fd..32b0baa9d 100644 --- a/Physlib/FluidDynamics/NavierStokes/Momentum.lean +++ b/Physlib/FluidDynamics/NavierStokes/Momentum.lean @@ -135,8 +135,7 @@ lemma timeDeriv_smul_velocity (d : ℕ) (rhoAtPosition : Time → ℝ) change (fderiv ℝ (rhoAtPosition • velocityAtPosition) t) 1 = rhoAtPosition t • (fderiv ℝ velocityAtPosition t) 1 + (fderiv ℝ rhoAtPosition t) 1 • velocityAtPosition t - rw [fderiv_smul hRho hVelocity] - rfl + exact congrArg (fun L => L 1) (fderiv_smul hRho hVelocity) /-- Product rule for the time derivative of the momentum density `rho u`. -/ lemma timeDeriv_momentumDensity (d : ℕ) (fluid : FluidState d) @@ -200,8 +199,7 @@ lemma matrixDiv_momentumFlux (d : ℕ) (fluid : FluidState d) hVelocity x] simp [momentumDensity, mul_comm, mul_assoc] _ = (∑ j, ∂[j] (fun x' => momentumDensity d fluid t x' j) x) * fluid.velocity t x i + - fluid.rho t x * (∑ j, fluid.velocity t x j * ∂[j] (fluid.velocity t) x i) := by - ring + fluid.rho t x * (∑ j, fluid.velocity t x j * ∂[j] (fluid.velocity t) x i) := by ring /-- The algebraic bridge between conservative and convective momentum. diff --git a/Physlib/Mathematics/Calculus/AdjFDeriv.lean b/Physlib/Mathematics/Calculus/AdjFDeriv.lean index 16130eb11..622fc1936 100644 --- a/Physlib/Mathematics/Calculus/AdjFDeriv.lean +++ b/Physlib/Mathematics/Calculus/AdjFDeriv.lean @@ -130,28 +130,24 @@ lemma gradient_eq_adjFDeriv {f : U → 𝕜} {x : U} (hf : DifferentiableAt 𝕜 f x) : gradient f x = adjFDeriv 𝕜 f x 1 := by apply ext_inner_right 𝕜 - unfold gradient - simp [hf.hasAdjFDerivAt.hasAdjoint_fderiv.adjoint_inner_left] + simp [gradient, hf.hasAdjFDerivAt.hasAdjoint_fderiv.adjoint_inner_left] attribute [fun_prop] HasAdjFDerivAt.differentiableAt lemma hasAdjFDerivAt_id (x : E) : HasAdjFDerivAt 𝕜 (fun x : E => x) (fun dx => dx) x where differentiableAt := by fun_prop - hasAdjoint_fderiv := by - simp; apply hasAdjoint_id + hasAdjoint_fderiv := by simp; apply hasAdjoint_id lemma adjFDeriv_id : adjFDeriv 𝕜 (fun x : E => x) = fun _ dx => dx := by funext x rw[HasAdjFDerivAt.adjFDeriv (hasAdjFDerivAt_id x)] -lemma adjFDeriv_id' : adjFDeriv 𝕜 (id : E → E) = fun _ dx => dx := by - exact adjFDeriv_id +lemma adjFDeriv_id' : adjFDeriv 𝕜 (id : E → E) = fun _ dx => dx := adjFDeriv_id lemma hasAdjFDerivAt_const (x : E) (y : F) : HasAdjFDerivAt 𝕜 (fun _ : E => y) (fun _ => 0) x where differentiableAt := by fun_prop - hasAdjoint_fderiv := by - simp; apply hasAdjoint_zero + hasAdjoint_fderiv := by simp; apply hasAdjoint_zero lemma adjFDeriv_const (y : F) : adjFDeriv 𝕜 (fun _ : E => y) = fun _ _ => 0 := by funext x @@ -160,8 +156,7 @@ lemma adjFDeriv_const (y : F) : adjFDeriv 𝕜 (fun _ : E => y) = fun _ _ => 0 : lemma HasAdjFDerivAt.comp {f : F → G} {g : E → F} {f' g'} {x : E} (hf : HasAdjFDerivAt 𝕜 f f' (g x)) (hg : HasAdjFDerivAt 𝕜 g g' x) : HasAdjFDerivAt 𝕜 (fun x => f (g x)) (fun dz => g' (f' dz)) x where - differentiableAt := by - fun_prop + differentiableAt := by fun_prop hasAdjoint_fderiv := by simp (disch:=fun_prop) [fderiv_fun_comp] exact hf.hasAdjoint_fderiv.comp hg.hasAdjoint_fderiv @@ -169,11 +164,8 @@ lemma HasAdjFDerivAt.comp {f : F → G} {g : E → F} {f' g'} {x : E} lemma adjFDeriv_comp [CompleteSpace E] [CompleteSpace F] [CompleteSpace G] {f : F → G} {g : E → F} {x : E} (hf : DifferentiableAt 𝕜 f (g x)) (hg : DifferentiableAt 𝕜 g x) : - adjFDeriv 𝕜 (fun x => f (g x)) x = fun dy => adjFDeriv 𝕜 g x (adjFDeriv 𝕜 f (g x) dy) := by - apply HasAdjFDerivAt.adjFDeriv - apply HasAdjFDerivAt.comp - apply hf.hasAdjFDerivAt - apply hg.hasAdjFDerivAt + adjFDeriv 𝕜 (fun x => f (g x)) x = fun dy => adjFDeriv 𝕜 g x (adjFDeriv 𝕜 f (g x) dy) := + (HasAdjFDerivAt.comp hf.hasAdjFDerivAt hg.hasAdjFDerivAt).adjFDeriv lemma HasAdjFDerivAt.prodMk {f : E → F} {g : E → G} {f' g'} {x : E} (hf : HasAdjFDerivAt 𝕜 f f' x) (hg : HasAdjFDerivAt 𝕜 g g' x) : @@ -194,9 +186,8 @@ lemma HasAjdFDerivAt.fst {f : E → F×G} {f'} {x : E} (hf : HasAdjFDerivAt 𝕜 lemma adjFDeriv_fst [CompleteSpace E] [CompleteSpace F] [CompleteSpace G] {f : E → F×G} {x : E} (hf : DifferentiableAt 𝕜 f x) : - adjFDeriv 𝕜 (fun x => (f x).fst) x = fun dy => adjFDeriv 𝕜 f x (dy, 0) := by - apply HasAdjFDerivAt.adjFDeriv - apply HasAjdFDerivAt.fst hf.hasAdjFDerivAt + adjFDeriv 𝕜 (fun x => (f x).fst) x = fun dy => adjFDeriv 𝕜 f x (dy, 0) := + (HasAjdFDerivAt.fst hf.hasAdjFDerivAt).adjFDeriv @[simp] lemma adjFDeriv_prod_fst [CompleteSpace E] [CompleteSpace F] {x : F × E} : @@ -216,9 +207,8 @@ lemma HasAjdFDerivAt.snd {f : E → F×G} {f'} {x : E} (hf : HasAdjFDerivAt 𝕜 lemma adjFDeriv_snd [CompleteSpace E] [CompleteSpace F] [CompleteSpace G] {f : E → F×G} {x : E} (hf : DifferentiableAt 𝕜 f x) : - adjFDeriv 𝕜 (fun x => (f x).snd) x = fun dy => adjFDeriv 𝕜 f x (0, dy) := by - apply HasAdjFDerivAt.adjFDeriv - apply HasAjdFDerivAt.snd hf.hasAdjFDerivAt + adjFDeriv 𝕜 (fun x => (f x).snd) x = fun dy => adjFDeriv 𝕜 f x (0, dy) := + (HasAjdFDerivAt.snd hf.hasAdjFDerivAt).adjFDeriv @[simp] lemma adjFDeriv_prod_snd [CompleteSpace E] [CompleteSpace F] {x : F × E} : @@ -262,9 +252,8 @@ lemma HasAdjFDerivAt.neg {f : E → F} {f'} {x : E} (hf : HasAdjFDerivAt 𝕜 f lemma adjFDeriv_neg [CompleteSpace E] [CompleteSpace F] {f : E → F} {x : E} (hf : DifferentiableAt 𝕜 f x) : - adjFDeriv 𝕜 (fun x => - f x) x = fun dy => - adjFDeriv 𝕜 f x dy := by - apply HasAdjFDerivAt.adjFDeriv - apply HasAdjFDerivAt.neg hf.hasAdjFDerivAt + adjFDeriv 𝕜 (fun x => - f x) x = fun dy => - adjFDeriv 𝕜 f x dy := + (HasAdjFDerivAt.neg hf.hasAdjFDerivAt).adjFDeriv lemma HasAjdFDerivAt.add {f g : E → F} {f' g'} {x : E} (hf : HasAdjFDerivAt 𝕜 f f' x) (hg : HasAdjFDerivAt 𝕜 g g' x) : @@ -277,11 +266,8 @@ lemma HasAjdFDerivAt.add {f g : E → F} {f' g'} {x : E} lemma adjFDeriv_add [CompleteSpace E] [CompleteSpace F] {f g : E → F} {x : E} (hf : DifferentiableAt 𝕜 f x) (hg : DifferentiableAt 𝕜 g x) : - adjFDeriv 𝕜 (fun x => f x + g x) x = fun dy => adjFDeriv 𝕜 f x dy + adjFDeriv 𝕜 g x dy := by - apply HasAdjFDerivAt.adjFDeriv - apply HasAjdFDerivAt.add - apply hf.hasAdjFDerivAt - apply hg.hasAdjFDerivAt + adjFDeriv 𝕜 (fun x => f x + g x) x = fun dy => adjFDeriv 𝕜 f x dy + adjFDeriv 𝕜 g x dy := + (HasAjdFDerivAt.add hf.hasAdjFDerivAt hg.hasAdjFDerivAt).adjFDeriv lemma HasAdjFDerivAt.sub {f g : E → F} {f' g'} {x : E} @@ -294,11 +280,8 @@ lemma HasAdjFDerivAt.sub lemma adjFDeriv_sub [CompleteSpace E] [CompleteSpace F] {f g : E → F} {x : E} (hf : DifferentiableAt 𝕜 f x) (hg : DifferentiableAt 𝕜 g x) : - adjFDeriv 𝕜 (fun x => f x - g x) x = fun dy => adjFDeriv 𝕜 f x dy - adjFDeriv 𝕜 g x dy := by - apply HasAdjFDerivAt.adjFDeriv - apply HasAdjFDerivAt.sub - apply hf.hasAdjFDerivAt - apply hg.hasAdjFDerivAt + adjFDeriv 𝕜 (fun x => f x - g x) x = fun dy => adjFDeriv 𝕜 f x dy - adjFDeriv 𝕜 g x dy := + (HasAdjFDerivAt.sub hf.hasAdjFDerivAt hg.hasAdjFDerivAt).adjFDeriv open ComplexConjugate in lemma HasAdjFDerivAt.smul {f : E → F} {g : E → 𝕜} {f' g'} @@ -317,11 +300,8 @@ lemma adjFDeriv_smul [CompleteSpace E] [CompleteSpace F] {f : E → F} {g : E → 𝕜} {x : E} (hf : DifferentiableAt 𝕜 f x) (hg : DifferentiableAt 𝕜 g x) : adjFDeriv 𝕜 (fun x => g x • f x) x = fun dy => conj (g x) • adjFDeriv 𝕜 f x dy + - adjFDeriv 𝕜 g x (conj (inner 𝕜 dy (f x))) := by - apply HasAdjFDerivAt.adjFDeriv - apply HasAdjFDerivAt.smul - apply hf.hasAdjFDerivAt - apply hg.hasAdjFDerivAt + adjFDeriv 𝕜 g x (conj (inner 𝕜 dy (f x))) := + (HasAdjFDerivAt.smul hf.hasAdjFDerivAt hg.hasAdjFDerivAt).adjFDeriv set_option backward.isDefEq.respectTransparency false in open InnerProductSpace in @@ -348,6 +328,5 @@ open InnerProductSpace in lemma adjFDeriv_inner {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [InnerProductSpace' ℝ E] (x : E × E) : adjFDeriv ℝ (fun (x : E × E) => ⟪x.1, x.2⟫_ℝ) x = - fun y => y • (x.2, x.1) := by - apply HasAdjFDerivAt.adjFDeriv - apply HasAdjFDerivAt.inner + fun y => y • (x.2, x.1) := + (HasAdjFDerivAt.inner x).adjFDeriv diff --git a/Physlib/Mathematics/Calculus/Divergence.lean b/Physlib/Mathematics/Calculus/Divergence.lean index a538a0e6b..9c18cf0ee 100644 --- a/Physlib/Mathematics/Calculus/Divergence.lean +++ b/Physlib/Mathematics/Calculus/Divergence.lean @@ -39,10 +39,8 @@ lemma divergence_zero : divergence 𝕜 (fun _ : E => 0) = fun _ => 0 := by lemma divergence_eq_sum_fderiv {s : Finset E} (b : Basis s 𝕜 E) {f : E → E} : divergence 𝕜 f = fun x => ∑ i : s, b.repr (fderiv 𝕜 f x (b i)) i := by funext x - unfold divergence - rw[LinearMap.trace_eq_matrix_trace_of_finset (s:=s) _ b] - simp only [Matrix.trace, Matrix.diag, LinearMap.toMatrix_apply] - rfl + rw [divergence, LinearMap.trace_eq_matrix_trace_of_finset (s := s) _ b] + simp [Matrix.trace, Matrix.diag, LinearMap.toMatrix_apply] lemma divergence_eq_sum_fderiv' {ι} [Fintype ι] (b : Basis ι 𝕜 E) {f : E → E} : divergence 𝕜 f = fun x => ∑ i, b.repr (fderiv 𝕜 f x (b i)) i := by @@ -79,8 +77,7 @@ lemma divergence_eq_space_div {d} (f : Space d → Space d) ext j simp only [Function.comp_apply] rw [Space.coordCLM_apply, Space.coord_apply] - rw [h1] - rw [fderiv_comp] + rw [h1, fderiv_comp] simp [Space.coordCLM_apply, Space.coord_apply] · fun_prop · exact h x @@ -107,30 +104,22 @@ lemma divergence_add {f g : E → E} {x : E} (hf : DifferentiableAt 𝕜 f x) (hg : DifferentiableAt 𝕜 g x) : divergence 𝕜 (fun x => f x + g x) x = - divergence 𝕜 f x + divergence 𝕜 g x := by - unfold divergence - simp [fderiv_fun_add hf hg] + divergence 𝕜 f x + divergence 𝕜 g x := by simp [divergence, fderiv_fun_add hf hg] lemma divergence_neg {f : E → E} {x : E} : - divergence 𝕜 (fun x => -f x) x = -divergence 𝕜 f x := by - unfold divergence - simp + divergence 𝕜 (fun x => -f x) x = -divergence 𝕜 f x := by simp [divergence] lemma divergence_sub {f g : E → E} {x : E} (hf : DifferentiableAt 𝕜 f x) (hg : DifferentiableAt 𝕜 g x) : divergence 𝕜 (fun x => f x - g x) x = - divergence 𝕜 f x - divergence 𝕜 g x := by - unfold divergence - simp [fderiv_fun_sub hf hg] + divergence 𝕜 f x - divergence 𝕜 g x := by simp [divergence, fderiv_fun_sub hf hg] lemma divergence_const_smul {f : E → E} {x : E} {c : 𝕜} (hf : DifferentiableAt 𝕜 f x) : divergence 𝕜 (fun x => c • f x) x = - c * divergence 𝕜 f x := by - unfold divergence - simp [fderiv_fun_const_smul hf] + c * divergence 𝕜 f x := by simp [divergence, fderiv_fun_const_smul hf] open InnerProductSpace' in lemma divergence_smul [InnerProductSpace' 𝕜 E] {f : E → 𝕜} {g : E → E} {x : E} diff --git a/Physlib/Mathematics/Calculus/ParametricIntegration.lean b/Physlib/Mathematics/Calculus/ParametricIntegration.lean index 60dd12ddd..ab16da442 100644 --- a/Physlib/Mathematics/Calculus/ParametricIntegration.lean +++ b/Physlib/Mathematics/Calculus/ParametricIntegration.lean @@ -48,8 +48,7 @@ lemma hasFDerivAt_parametric_intervalIntegral_of_contDiff fun_prop · apply Continuous.intervalIntegrable fun_prop - · apply Continuous.aestronglyMeasurable - exact Continuous.uncurry_left x₀ (by fun_prop) + · exact (Continuous.uncurry_left x₀ (by fun_prop)).aestronglyMeasurable · filter_upwards with t h x hx exact ha.2 (Set.mk_mem_prod hx (Set.Ioc_subset_Icc_self (by simpa using h))) · exact intervalIntegrable_const diff --git a/Physlib/Mathematics/Calculus/Wirtinger/Basic.lean b/Physlib/Mathematics/Calculus/Wirtinger/Basic.lean index 62e780ebe..5ba498cf9 100644 --- a/Physlib/Mathematics/Calculus/Wirtinger/Basic.lean +++ b/Physlib/Mathematics/Calculus/Wirtinger/Basic.lean @@ -215,8 +215,7 @@ rule. /-- Constants have zero holomorphic directional Wirtinger derivative, `∂_v c = 0`. -/ @[simp] lemma dWirtingerDir_const (c : ℂ) (v u : V) : - dWirtingerDir (fun _ : V => c) v u = 0 := by - simp [dWirtingerDir_apply, fderiv_const_apply] + dWirtingerDir (fun _ : V => c) v u = 0 := by simp [dWirtingerDir_apply, fderiv_const_apply] /-- Constants have zero anti-holomorphic directional Wirtinger derivative, `∂̄_v c = 0`. -/ @[simp] lemma dWirtingerAntiDir_const (c : ℂ) (v u : V) : @@ -395,8 +394,7 @@ lemma realLinear_apply_eq_wirtinger (L : ℂ →L[ℝ] ℂ) (w : ℂ) : calc L w = L ((w.re : ℝ) • (1 : ℂ) + (w.im : ℝ) • Complex.I) := by congr 1; apply Complex.ext <;> simp - _ = (w.re : ℝ) • L 1 + (w.im : ℝ) • L Complex.I := by - rw [map_add, map_smul, map_smul] + _ = (w.re : ℝ) • L 1 + (w.im : ℝ) • L Complex.I := by rw [map_add, map_smul, map_smul] _ = ((1 / 2 : ℂ) * (L 1 - Complex.I * L Complex.I)) * w + ((1 / 2 : ℂ) * (L 1 + Complex.I * L Complex.I)) * star w := by apply Complex.ext <;> @@ -664,13 +662,11 @@ private lemma fderiv_weightedDirDeriv (hf' : DifferentiableAt ℝ (fderiv ℝ f) /-- A directional derivative is a `weightedDirDeriv`: anti-holomorphic with `c = i`. -/ private lemma dWirtingerAntiDir_eq_weightedDirDeriv (w : V) : - (fun p => dWirtingerAntiDir f w p) = weightedDirDeriv f Complex.I w (Complex.I • w) := - rfl + (fun p => dWirtingerAntiDir f w p) = weightedDirDeriv f Complex.I w (Complex.I • w) := rfl /-- A directional derivative is a `weightedDirDeriv`: holomorphic with `c = -i`. -/ private lemma dWirtingerDir_eq_weightedDirDeriv (v : V) : - (fun p => dWirtingerDir f v p) = weightedDirDeriv f (-Complex.I) v (Complex.I • v) := - rfl + (fun p => dWirtingerDir f v p) = weightedDirDeriv f (-Complex.I) v (Complex.I • v) := rfl /-- Differentiating the anti-holomorphic directional derivative lands on the second real Fréchet derivative in the two slots. -/ @@ -740,8 +736,7 @@ lemma differentiableAt_dWirtingerAntiDir (hf2 : ContDiffAt ℝ 2 f u) (w : V) : fields agreeing on a neighbourhood have equal derivative. -/ lemma dWirtingerDir_congr_of_eventuallyEq {f₁ f₂ : V → ℂ} {u : V} (h : f₁ =ᶠ[nhds u] f₂) (v : V) : - dWirtingerDir f₁ v u = dWirtingerDir f₂ v u := by - simp only [dWirtingerDir_apply, h.fderiv_eq] + dWirtingerDir f₁ v u = dWirtingerDir f₂ v u := by simp only [dWirtingerDir_apply, h.fderiv_eq] /-- The anti-holomorphic directional derivative depends only on the field near the point; dual of `dWirtingerDir_congr_of_eventuallyEq`. -/ diff --git a/Physlib/Mathematics/DataStructures/Matrix/LieTrace.lean b/Physlib/Mathematics/DataStructures/Matrix/LieTrace.lean index 5abed796b..9c8362545 100644 --- a/Physlib/Mathematics/DataStructures/Matrix/LieTrace.lean +++ b/Physlib/Mathematics/DataStructures/Matrix/LieTrace.lean @@ -38,8 +38,7 @@ instance [UniformSpace 𝕂] : UniformSpace (Matrix m n 𝕂) := by unfold Matri lemma tsum_eq_zero {β : Type*} [TopologicalSpace β] [AddCommMonoid β] {f : ℕ → β} (h : ∀ n, f n = 0) : - (∑' n, f n) = 0 := by - simp_all only [tsum_zero] + (∑' n, f n) = 0 := by simp_all only [tsum_zero] /-! ### The determinant of the matrix exponential @@ -59,10 +58,9 @@ lemma matrix_tsum_apply have h_row_summable : Summable (fun n ↦ (f n) i) := by have h := Pi.summable.1 hf exact h i - have h₁ : ((∑' n, f n) : Matrix m m 𝕂) i = (∑' n, (f n) i) := by - exact tsum_apply hf - have h₂ : ((∑' n, (f n) i) : m → 𝕂) j = (∑' n, (f n) i j) := by - exact tsum_apply h_row_summable + have h₁ : ((∑' n, f n) : Matrix m m 𝕂) i = (∑' n, (f n) i) := tsum_apply hf + have h₂ : ((∑' n, (f n) i) : m → 𝕂) j = (∑' n, (f n) i j) := + tsum_apply h_row_summable rw [h₁, h₂] variable [Fintype m] [LinearOrder m] @@ -145,8 +143,7 @@ theorem diag_exp_of_blockTriangular_id funext i rw [NormedSpace.exp_eq_tsum 𝕂, diag_apply] simp_rw [matrix_tsum_apply (NormedSpace.expSeries_summable' A) i i] - rw [matrix_exp_series_diag_eq_scalar_series hA i] - rw [NormedSpace.exp_eq_tsum 𝕂] + rw [matrix_exp_series_diag_eq_scalar_series hA i, NormedSpace.exp_eq_tsum 𝕂] /-- Lie's trace formula for upper triangular matrices. -/ lemma det_exp_of_blockTriangular_id {A : Matrix m m 𝕂} (hA : BlockTriangular A id) : @@ -189,8 +186,7 @@ lemma exp_unitary_conj (A : Matrix m m 𝕂) (U : unitaryGroup m 𝕂) : lemma det_exp_unitary_conj (A : Matrix m m 𝕂) (U : unitaryGroup m 𝕂) : (NormedSpace.exp ((U : Matrix m m 𝕂) * A * star (U : Matrix m m 𝕂))).det = - (NormedSpace.exp A).det := by - rw [exp_unitary_conj, det_unitary_conj] + (NormedSpace.exp A).det := by rw [exp_unitary_conj, det_unitary_conj] /-- The determinant of the exponential of a matrix is the exponential of its trace. This is also known as **Lie's trace formula**. -/ @@ -242,8 +238,7 @@ lemma exp_map_algebraMap {n : Type*} [Fintype n] [DecidableEq n] letI : NormedAlgebra ℂ (Matrix n n ℂ) := Matrix.linftyOpNormedAlgebra letI : CompleteSpace (Matrix n n ℂ) := inferInstance simp only [exp_eq_tsum ℝ] - have hs : Summable (fun k => (k.factorial : ℝ)⁻¹ • A ^ k) := by - exact NormedSpace.expSeries_summable' A + have hs : Summable (fun k => (k.factorial : ℝ)⁻¹ • A ^ k) := NormedSpace.expSeries_summable' A erw [Matrix.map_tsum (algebraMap ℝ ℂ).toAddMonoidHom RCLike.continuous_ofReal hs] apply tsum_congr intro k @@ -269,8 +264,7 @@ theorem det_exp_real {n : Type*} [Fintype n] [LinearOrder n] have h_det_comm : (algebraMap ℝ ℂ) ((NormedSpace.exp A).det) = (NormedSpace.exp A_ℂ).det := by rw [@RingHom.map_det] rw [← NormedSpace.exp_map_algebraMap]; rfl - rw [← h_det_comm] at h_complex - rw [h_trace_comm] at h_complex + rw [← h_det_comm, h_trace_comm] at h_complex have h_exp_comm : Complex.exp ((algebraMap ℝ ℂ) A.trace) = (algebraMap ℝ ℂ) (Real.exp A.trace) := by rw [Complex.coe_algebraMap, ← Complex.ofReal_exp] diff --git a/Physlib/Mathematics/Distribution/Basic.lean b/Physlib/Mathematics/Distribution/Basic.lean index 20029cc6c..31e927c95 100644 --- a/Physlib/Mathematics/Distribution/Basic.lean +++ b/Physlib/Mathematics/Distribution/Basic.lean @@ -148,11 +148,10 @@ def ofLinear (s : Finset (ℕ × ℕ)) (u : 𝓢(E, 𝕜) →ₗ[𝕜] F) (f := fun kn : ℕ × ℕ ↦ (⟨SchwartzMap.seminorm 𝕜 kn.1 kn.2 η, apply_nonneg _ _⟩ : ℝ≥0)) @[simp] lemma ofLinear_apply (s : Finset (ℕ × ℕ)) (u : 𝓢(E, 𝕜) →ₗ[𝕜] F) - (hu : ∃ C : ℝ, 0 ≤ C ∧ ∀ η : 𝓢(E, 𝕜), ∃ (k : ℕ) (n : ℕ) (x : E), (k, n) ∈ s ∧ - ‖u η‖ ≤ C * (‖x‖ ^ k * ‖iteratedFDeriv ℝ n η x‖)) - (η : 𝓢(E, 𝕜)) : - ofLinear 𝕜 s u hu η = u η := - rfl + (hu : ∃ C : ℝ, 0 ≤ C ∧ ∀ η : 𝓢(E, 𝕜), ∃ (k : ℕ) (n : ℕ) (x : E), (k, n) ∈ s ∧ + ‖u η‖ ≤ C * (‖x‖ ^ k * ‖iteratedFDeriv ℝ n η x‖)) + (η : 𝓢(E, 𝕜)) : + ofLinear 𝕜 s u hu η = u η := rfl end NormedSpace @@ -275,8 +274,7 @@ def fourierTransform : (E →d[ℂ] F) →ₗ[ℂ] (E →d[ℂ] F) where map_smul' c u := by simp @[simp] lemma fourierTransform_apply (u : E →d[ℂ] F) (η : 𝓢(E, ℂ)) : - u.fourierTransform E F η = u (fourierTransformCLM ℂ η) := - rfl + u.fourierTransform E F η = u (fourierTransformCLM ℂ η) := rfl end Complex @@ -356,10 +354,8 @@ def const [hμ : Measure.HasTemperateGrowth (volume (α := E))] (c : F) : E →d · subst hc simp rw [MeasureTheory.integral_add] - · refine (integrable_smul_const hc).mpr ?_ - exact integrable η1 - · refine (integrable_smul_const hc).mpr ?_ - exact integrable η2 + · exact (integrable_smul_const hc).mpr (integrable η1) + · exact (integrable_smul_const hc).mpr (integrable η2) · intro a η simp only [smul_apply, RingHom.id_apply, smul_assoc] rw [MeasureTheory.integral_smul] @@ -414,8 +410,7 @@ lemma fderivD_const [hμ : Measure.IsAddHaarMeasure (volume (α := E))] change Integrable (SchwartzMap.evalCLM (𝕜 := ℝ) E ℝ v (SchwartzMap.fderivCLM ℝ E ℝ η)) volume exact integrable ((SchwartzMap.evalCLM ℝ E ℝ v) ((fderivCLM ℝ) E ℝ η)) · simp - · apply MeasureTheory.Integrable.smul_const - exact integrable η + · exact (integrable η).smul_const _ · fun_prop · simp @@ -478,8 +473,7 @@ def diracDelta (a : E) : E →d[𝕜] 𝕜 := (BoundedContinuousFunction.evalCLM 𝕜 a).comp (toBoundedContinuousFunctionCLM 𝕜 E 𝕜) @[simp] lemma diracDelta_apply (a : E) (η : 𝓢(E, 𝕜)) : - diracDelta 𝕜 a η = η a := - rfl + diracDelta 𝕜 a η = η a := rfl /-- Dirac delta in a given direction `v : F`. `diracDelta' 𝕜 a v` takes in a test function `η : 𝓢(E, 𝕜)` and outputs `η a • v`. Intuitively this is an infinitely intense vector field @@ -488,8 +482,7 @@ def diracDelta' (a : E) (v : F) : E →d[𝕜] F := ContinuousLinearMap.smulRight (diracDelta 𝕜 a) v @[simp] lemma diracDelta'_apply (a : E) (v : F) (η : 𝓢(E, 𝕜)) : - diracDelta' 𝕜 a v η = η a • v := - rfl + diracDelta' 𝕜 a v η = η a • v := rfl end DiracDelta /-! @@ -513,10 +506,8 @@ def heavisideStep (d : ℕ) : (EuclideanSpace ℝ (Fin d.succ)) →d[ℝ] ℝ := · intro η1 η2 simp only [Nat.succ_eq_add_one, add_apply] rw [MeasureTheory.integral_add] - · apply MeasureTheory.Integrable.restrict - exact integrable η1 - · apply MeasureTheory.Integrable.restrict - exact integrable η2 + · exact (integrable η1).restrict + · exact (integrable η2).restrict · intro a η simp only [smul_apply, RingHom.id_apply] rw [MeasureTheory.integral_smul] @@ -546,8 +537,7 @@ def heavisideStep (d : ℕ) : (EuclideanSpace ℝ (Fin d.succ)) →d[ℝ] ℝ := lemma heavisideStep_apply (d : ℕ) (η : 𝓢(EuclideanSpace ℝ (Fin d.succ), ℝ)) : heavisideStep d η = ∫ x in {x : EuclideanSpace ℝ (Fin d.succ) | 0 < x (Fin.last d)}, - η x ∂MeasureTheory.volume := by - rfl + η x ∂MeasureTheory.volume := rfl end Distribution end Physlib diff --git a/Physlib/Mathematics/Distribution/PowMul.lean b/Physlib/Mathematics/Distribution/PowMul.lean index 2feed10a9..3a93cd17c 100644 --- a/Physlib/Mathematics/Distribution/PowMul.lean +++ b/Physlib/Mathematics/Distribution/PowMul.lean @@ -76,8 +76,7 @@ def powOneMul : 𝓢(ℝ, 𝕜) →L[𝕜] 𝓢(ℝ, 𝕜) := by · exact SchwartzMap.smooth (ψ) ⊤ · exact right_eq_inf.mp rfl · exact ContinuousMultilinearMap.opNorm_nonneg _ - · refine pow_nonneg ?_ k - exact norm_nonneg x + · exact pow_nonneg (norm_nonneg x) k conv_lhs => enter [2, 2, i, 1, 2] change ‖iteratedFDeriv ℝ i RCLike.ofRealCLM x‖ diff --git a/Physlib/Mathematics/FDerivCurry.lean b/Physlib/Mathematics/FDerivCurry.lean index 3dd64883e..8c1c15735 100644 --- a/Physlib/Mathematics/FDerivCurry.lean +++ b/Physlib/Mathematics/FDerivCurry.lean @@ -37,9 +37,7 @@ lemma fderiv_uncurry (f : X → Y → Z) (xy dxy : X × Y) lemma fderiv_curry_fst (f : X × Y → Z) (x : X) (y : Y) (h : DifferentiableAt 𝕜 f (x,y)) (dx : X) : fderiv 𝕜 (fun x' => Function.curry f x' y) x dx = fderiv 𝕜 f (x,y) (dx, 0) := by - have h1 : f = ↿(Function.curry f) := by - ext x - rfl + have h1 : f = ↿(Function.curry f) := rfl conv_rhs => rw [h1] rw [fderiv_uncurry] @@ -49,9 +47,7 @@ lemma fderiv_curry_fst (f : X × Y → Z) (x : X) (y : Y) lemma fderiv_curry_snd (f : X × Y → Z) (x : X) (y : Y) (h : DifferentiableAt 𝕜 f (x,y)) (dy : Y) : fderiv 𝕜 (Function.curry f x) y dy = fderiv 𝕜 (f) (x,y) (0, dy) := by - have h1 : f = ↿(Function.curry f) := by - ext x - rfl + have h1 : f = ↿(Function.curry f) := rfl conv_rhs => rw [h1] rw [fderiv_uncurry] @@ -95,16 +91,14 @@ lemma fderiv_wrt_prod_clm_comp (f : X × Y → Z) (hf : Differentiable 𝕜 f) : lemma fderiv_curry_clm_apply (f : X → Y →L[𝕜] Z) (y : Y) (x dx : X) (h : Differentiable 𝕜 f) : fderiv 𝕜 f x dx y = - fderiv 𝕜 (f · y) x dx := by - rw [fderiv_clm_apply] <;> first | simp | fun_prop + fderiv 𝕜 (f · y) x dx := by rw [fderiv_clm_apply] <;> first | simp | fun_prop /- Helper rw lemmas for proving differentiability conditions. -/ lemma fderiv_uncurry_comp_fst (f : X → Y → Z) (y : Y) (hf : Differentiable 𝕜 (↿f)) : fderiv 𝕜 (fun x' => (↿f) (x', y)) = fun x => (fderiv 𝕜 (↿f) ((·, y) x)).comp (fderiv 𝕜 (·, y) x) := by - have hl (y : Y) : (fun x' => (↿f) (x', y)) = ↿f ∘ (·, y) := by - rfl + have hl (y : Y) : (fun x' => (↿f) (x', y)) = ↿f ∘ (·, y) := rfl rw [hl] funext x rw [fderiv_comp] @@ -115,8 +109,7 @@ lemma fderiv_uncurry_comp_snd (f : X → Y → Z) (x : X) (hf : Differentiable fderiv 𝕜 (fun y' => (↿f) (x, y')) = fun y => (fderiv 𝕜 (↿f) ((x, ·) y)).comp (fderiv 𝕜 (x, ·) y) := by - have hl (x : X) : (fun y' => (↿f) (x, y')) = ↿f ∘ (x, ·) := by - rfl + have hl (x : X) : (fun y' => (↿f) (x, y')) = ↿f ∘ (x, ·) := rfl rw [hl] funext y rw [fderiv_comp] @@ -128,10 +121,8 @@ lemma fderiv_curry_comp_fst (f : X → Y → Z) (x dx : X) (y : Y) (fderiv 𝕜 (fun x' => f x' y) x) dx = (fderiv 𝕜 (↿f) ((·, y) x)) ((fderiv 𝕜 (·, y) x) dx) := by - have hl (y : Y) : (fun x' => f x' y) = ↿f ∘ (·, y) := by - rfl - rw [hl] - rw [fderiv_comp] + have hl (y : Y) : (fun x' => f x' y) = ↿f ∘ (·, y) := rfl + rw [hl, fderiv_comp] simp only [ContinuousLinearMap.coe_comp, Function.comp_apply] · fun_prop · fun_prop @@ -141,10 +132,8 @@ lemma fderiv_curry_comp_snd (f : X → Y → Z) (x : X) (y dy : Y) (fderiv 𝕜 (fun y' => f x y') y) dy = (fderiv 𝕜 (↿f) ((x, ·) y)) ((fderiv 𝕜 (x, ·) y) dy) := by - have hl (x : X) : (fun y' => f x y') = ↿f ∘ (x, ·) := by - rfl - rw [hl] - rw [fderiv_comp] + have hl (x : X) : (fun y' => f x y') = ↿f ∘ (x, ·) := rfl + rw [hl, fderiv_comp] simp only [ContinuousLinearMap.coe_comp, Function.comp_apply] · fun_prop · fun_prop @@ -161,53 +150,41 @@ lemma fderiv_inl_snd_clm (x : X) (y : Y) : lemma function_differentiableAt_fst (f : X → Y → Z) (x : X) (y : Y) (hf : Differentiable 𝕜 (↿f)) : DifferentiableAt 𝕜 (fun x' => f x' y) x := by - have hl : (fun x' => f x' y) = ↿f ∘ (·, y) := by - funext x' - rfl + have hl : (fun x' => f x' y) = ↿f ∘ (·, y) := rfl rw [hl] - apply Differentiable.differentiableAt - apply Differentiable.comp <;> fun_prop + exact (Differentiable.comp (by fun_prop) (by fun_prop)).differentiableAt lemma function_differentiableAt_snd (f : X → Y → Z) (x : X) (y : Y) (hf : Differentiable 𝕜 (↿f)) : DifferentiableAt 𝕜 (fun y' => f x y') y := by - have hl : (fun y' => f x y') = ↿f ∘ (x, ·) := by - funext y' - rfl + have hl : (fun y' => f x y') = ↿f ∘ (x, ·) := rfl rw [hl] - apply Differentiable.differentiableAt - apply Differentiable.comp <;> fun_prop + exact (Differentiable.comp (by fun_prop) (by fun_prop)).differentiableAt @[fun_prop] lemma fderiv_uncurry_differentiable_fst (f : X → Y → Z) (y : Y) (hf : ContDiff 𝕜 2 ↿f) : - Differentiable 𝕜 (fderiv 𝕜 fun x' => (↿f) (x', y)) := by - fun_prop + Differentiable 𝕜 (fderiv 𝕜 fun x' => (↿f) (x', y)) := by fun_prop @[fun_prop] lemma fderiv_uncurry_differentiable_snd (f : X → Y → Z) (x : X) (hf : ContDiff 𝕜 2 ↿f) : - Differentiable 𝕜 (fderiv 𝕜 fun y' => (↿f) (x, y')) := by - fun_prop + Differentiable 𝕜 (fderiv 𝕜 fun y' => (↿f) (x, y')) := by fun_prop @[fun_prop] lemma fderiv_uncurry_differentiable_fst_comp_snd (f : X → Y → Z) (x : X) (hf : ContDiff 𝕜 2 ↿f) : - Differentiable 𝕜 (fun y' => fderiv 𝕜 (fun x' => (↿f) (x', y')) x) := by - fun_prop + Differentiable 𝕜 (fun y' => fderiv 𝕜 (fun x' => (↿f) (x', y')) x) := by fun_prop @[fun_prop] lemma fderiv_uncurry_differentiable_fst_comp_snd_apply (f : X → Y → Z) (x δx : X) (hf : ContDiff 𝕜 2 ↿f) : - Differentiable 𝕜 (fun y' => fderiv 𝕜 (fun x' => (↿f) (x', y')) x δx) := by - fun_prop + Differentiable 𝕜 (fun y' => fderiv 𝕜 (fun x' => (↿f) (x', y')) x δx) := by fun_prop @[fun_prop] lemma fderiv_uncurry_differentiable_snd_comp_fst (f : X → Y → Z) (y : Y) (hf : ContDiff 𝕜 2 ↿f) : - Differentiable 𝕜 (fun x' => fderiv 𝕜 (fun y' => (↿f) (x', y')) y) := by - fun_prop + Differentiable 𝕜 (fun x' => fderiv 𝕜 (fun y' => (↿f) (x', y')) y) := by fun_prop @[fun_prop] lemma fderiv_uncurry_differentiable_snd_comp_fst_apply (f : X → Y → Z) (y δy : Y) (hf : ContDiff 𝕜 2 ↿f) : - Differentiable 𝕜 (fun x' => fderiv 𝕜 (fun y' => (↿f) (x', y')) y δy) := by - fun_prop + Differentiable 𝕜 (fun x' => fderiv 𝕜 (fun y' => (↿f) (x', y')) y δy) := by fun_prop @[fun_prop] lemma fderiv_curry_differentiableAt_fst_comp_snd (f : X → Y → Z) (x dx : X) (y : Y) diff --git a/Physlib/Mathematics/Fin.lean b/Physlib/Mathematics/Fin.lean index e89b8d3a5..4404545d2 100644 --- a/Physlib/Mathematics/Fin.lean +++ b/Physlib/Mathematics/Fin.lean @@ -58,8 +58,7 @@ lemma predAboveI_eq_iff {i x : Fin n.succ.succ} (h : i ≠ x) (y : Fin n.succ) : · simp [← h] lemma predAboveI_lt {i x : Fin n.succ.succ} (h : x.val < i.val) : - predAboveI i x = ⟨x.val, by omega⟩ := by - simp [predAboveI, h] + predAboveI i x = ⟨x.val, by omega⟩ := by simp [predAboveI, h] lemma predAboveI_ge {i x : Fin n.succ.succ} (h : i.val < x.val) : predAboveI i x = ⟨x.val - 1, by omega⟩ := by @@ -85,9 +84,8 @@ def finExtractOne {n : ℕ} (i : Fin (n + 1)) : Fin (n + 1) ≃ Fin 1 ⊕ Fin n @[simp] lemma finExtractOne_apply_eq {n : ℕ} (i : Fin n.succ) : - finExtractOne i i = Sum.inl 0 := by - rw [Equiv.apply_eq_iff_eq_symm_apply] - rfl + finExtractOne i i = Sum.inl 0 := + (Equiv.apply_eq_iff_eq_symm_apply (finExtractOne i)).2 rfl lemma finExtractOne_symm_inr {n : ℕ} (i : Fin n.succ) : (finExtractOne i).symm ∘ Sum.inr = i.succAbove := by @@ -102,9 +100,7 @@ lemma finExtractOne_symm_inr {n : ℕ} (i : Fin n.succ) : by_cases hi : x.1 < i.1 · generalize_proofs hp have h1 : (finSumFinEquiv.symm (Fin.cast hp x)) = - Sum.inl ⟨x, hi⟩ := by - rw [← finSumFinEquiv_symm_apply_castAdd] - rfl + Sum.inl ⟨x, hi⟩ := finSumFinEquiv_symm_apply_castAdd (n := n - i.1) (⟨x, hi⟩ : Fin i.1) rw [h1] simp only [Nat.succ_eq_add_one, Equiv.sumAssoc_symm_apply_inr_inl, Sum.map_inl, Equiv.symm_trans_apply, Equiv.symm_symm, Equiv.sumComm_symm, Equiv.sumComm_apply, @@ -140,15 +136,13 @@ lemma finExtractOne_symm_inr_apply {n : ℕ} (i : Fin n.succ) (x : Fin n) : @[simp] lemma finExtractOne_symm_inl_apply {n : ℕ} (i : Fin n.succ) : - (finExtractOne i).symm (Sum.inl 0) = i := by - rfl + (finExtractOne i).symm (Sum.inl 0) = i := rfl lemma finExtractOne_apply_neq {n : ℕ} (i j : Fin (n + 1 + 1)) (hij : i ≠ j) : finExtractOne i j = Sum.inr (predAboveI i j) := by symm apply (Equiv.symm_apply_eq _).mp ?_ - simp only [Nat.succ_eq_add_one, finExtractOne_symm_inr_apply] - exact succsAbove_predAboveI hij + simpa only [Nat.succ_eq_add_one, finExtractOne_symm_inr_apply] using succsAbove_predAboveI hij /-- Given an equivalence `Fin n.succ.succ ≃ Fin n.succ.succ`, and an `i : Fin n.succ.succ`, the map `Fin n.succ → Fin n.succ` obtained by dropping `i` and it's image. -/ @@ -200,8 +194,7 @@ def finExtractTwo {n : ℕ} (i : Fin n.succ.succ) (j : Fin n.succ) : @[simp] lemma finExtractTwo_apply_fst {n : ℕ} (i : Fin n.succ.succ) (j : Fin n.succ) : - finExtractTwo i j i = Sum.inl (Sum.inl 0) := by - simp [finExtractTwo] + finExtractTwo i j i = Sum.inl (Sum.inl 0) := by simp [finExtractTwo] lemma finExtractTwo_symm_inr {n : ℕ} (i : Fin n.succ.succ) (j : Fin n.succ) : (finExtractTwo i j).symm ∘ Sum.inr = i.succAbove ∘ j.succAbove := by @@ -210,13 +203,11 @@ lemma finExtractTwo_symm_inr {n : ℕ} (i : Fin n.succ.succ) (j : Fin n.succ) : @[simp] lemma finExtractTwo_symm_inr_apply {n : ℕ} (i : Fin n.succ.succ) (j : Fin n.succ) (x : Fin n) : - (finExtractTwo i j).symm (Sum.inr x) = i.succAbove (j.succAbove x) := by - simp [finExtractTwo] + (finExtractTwo i j).symm (Sum.inr x) = i.succAbove (j.succAbove x) := by simp [finExtractTwo] @[simp] lemma finExtractTwo_symm_inl_inr_apply {n : ℕ} (i : Fin n.succ.succ) (j : Fin n.succ) : - (finExtractTwo i j).symm (Sum.inl (Sum.inr 0)) = i.succAbove j := by - simp [finExtractTwo] + (finExtractTwo i j).symm (Sum.inl (Sum.inr 0)) = i.succAbove j := by simp [finExtractTwo] @[simp] lemma finExtractTwo_symm_inl_inl_apply {n : ℕ} (i : Fin n.succ.succ) (j : Fin n.succ) : @@ -224,8 +215,7 @@ lemma finExtractTwo_symm_inl_inl_apply {n : ℕ} (i : Fin n.succ.succ) (j : Fin @[simp] lemma finExtractTwo_apply_snd {n : ℕ} (i : Fin n.succ.succ) (j : Fin n.succ) : - finExtractTwo i j (i.succAbove j) = Sum.inl (Sum.inr 0) := by - simp [← Equiv.eq_symm_apply] + finExtractTwo i j (i.succAbove j) = Sum.inl (Sum.inr 0) := by simp [← Equiv.eq_symm_apply] /-- Takes two maps `Fin n → Fin n` and returns the equivalence they form. -/ def finMapToEquiv (f1 : Fin n → Fin m) (f2 : Fin m → Fin n) diff --git a/Physlib/Mathematics/Fin/Involutions.lean b/Physlib/Mathematics/Fin/Involutions.lean index c65067e45..cd47697fb 100644 --- a/Physlib/Mathematics/Fin/Involutions.lean +++ b/Physlib/Mathematics/Fin/Involutions.lean @@ -155,7 +155,6 @@ lemma involutionCons_ext {n : ℕ} {f1 f2 : (f : {f : Fin n → Fin n // Functio obtain ⟨val, property⟩ := fst obtain ⟨val_1, property_1⟩ := snd obtain ⟨val_2, property_2⟩ := snd_1 - simp_all only rfl /-- Given an involution of `Fin n`, the optional choice of an element in `Fin n` which @@ -201,8 +200,7 @@ lemma involutionAddEquiv_cast {n : ℕ} {f1 f2 : {f : Fin n → Fin n // Functio involutionAddEquiv f1 = (Equiv.subtypeEquivRight (by rw [hf]; simp)).trans ((involutionAddEquiv f2).trans (Equiv.optionCongr (finCongr (by rw [hf])))) := by subst hf - rw [finCongr_refl, Equiv.optionCongr_refl] - rfl + simp [Equiv.subtypeEquivRight] lemma involutionAddEquiv_cast' {m : ℕ} {f1 f2 : {f : Fin m → Fin m // Function.Involutive f}} {N : ℕ} (hf : f1 = f2) (n : Option (Fin N)) @@ -341,8 +339,7 @@ def involutionNoFixedSetOne {n : ℕ} : simp [f.2.1 i.succ.succ] · intro i simp only [succ_eq_add_one, ne_eq, Function.comp_apply, f''', f'', f'] - rw [Fin.pred_eq_iff_eq_succ, Fin.pred_eq_iff_eq_succ] - exact f.2.2.1 i.succ.succ + simpa [Fin.pred_eq_iff_eq_succ, Fin.pred_eq_iff_eq_succ] using f.2.2.1 i.succ.succ invFun f := by let f' := fun (i : Fin n.succ.succ)=> match i with diff --git a/Physlib/Mathematics/Geometry/Metric/PseudoRiemannian/Defs.lean b/Physlib/Mathematics/Geometry/Metric/PseudoRiemannian/Defs.lean index a6bf51cf6..0d88c7f14 100644 --- a/Physlib/Mathematics/Geometry/Metric/PseudoRiemannian/Defs.lean +++ b/Physlib/Mathematics/Geometry/Metric/PseudoRiemannian/Defs.lean @@ -120,9 +120,7 @@ lemma neg_weight_implies_neg_value {E : Type*} [AddCommGroup E] [Module ℝ E] intro h have : f v = f 0 := by rw [h] have : f (f.symm v_std) = f 0 := by rw [← this] - have : v_std = 0 := by - rw [← f.apply_symm_apply v_std] - exact Eq.trans this (map_zero f) + have : v_std = 0 := by simpa using this have : v_std i = 0 := by rw [this]; rfl simp only [↓reduceIte, one_ne_zero, v_std] at this have hq_neg : q v < 0 := by @@ -195,8 +193,7 @@ def pseudoRiemannianMetricValToQuadraticForm (symm : ∀ (x : M) (v w : TangentSpace I x), (val x v) w = (val x w) v) (x : M) : QuadraticForm ℝ (TangentSpace I x) where toFun v := val x v v - toFun_smul a v := by - simp only [ContinuousLinearMap.map_smul, _root_.smul_apply, smul_smul] + toFun_smul a v := by simp only [ContinuousLinearMap.map_smul, _root_.smul_apply, smul_smul] exists_companion' := ⟨LinearMap.mk₂ ℝ (fun v y => val x v y + val x y v) (fun v₁ v₂ y => by simp only [map_add, add_apply]; ring) @@ -486,16 +483,14 @@ lemma sharp_flat_apply lemma apply_sharp_sharp (g : PseudoRiemannianMetric E H M n I) (x : M) (ω₁ ω₂ : TangentSpace I x →L[ℝ] ℝ) : g.val x (g.sharpL x ω₁) (g.sharpL x ω₂) = ω₁ (g.sharpL x ω₂) := by - rw [← flatL_apply g x (g.sharpL x ω₁)] - rw [flatL_apply_sharpL g x ω₁] + rw [← flatL_apply g x (g.sharpL x ω₁), flatL_apply_sharpL g x ω₁] /-- The metric evaluated at `v` and `sharp ω`. -/ lemma apply_vec_sharp (g : PseudoRiemannianMetric E H M n I) (x : M) (v : TangentSpace I x) (ω : TangentSpace I x →L[ℝ] ℝ) : g.val x v (g.sharpL x ω) = ω v := by - rw [g.symm x v (g.sharpL x ω)] - rw [← flatL_apply g x (g.sharpL x ω)] + rw [g.symm x v (g.sharpL x ω), ← flatL_apply g x (g.sharpL x ω)] rw [flatL_apply_sharpL g x ω] end Sharp @@ -518,8 +513,7 @@ noncomputable def cotangentMetricVal (g : PseudoRiemannianMetric E H M n I) (x : @[simp] lemma cotangentMetricVal_eq_apply_sharp (g : PseudoRiemannianMetric E H M n I) (x : M) (ω₁ ω₂ : TangentSpace I x →L[ℝ] ℝ) : - cotangentMetricVal g x ω₁ ω₂ = ω₁ (g.sharpL x ω₂) := by - rw [cotangentMetricVal, apply_sharp_sharp] + cotangentMetricVal g x ω₁ ω₂ = ω₁ (g.sharpL x ω₂) := by rw [cotangentMetricVal, apply_sharp_sharp] lemma cotangentMetricVal_symm (g : PseudoRiemannianMetric E H M n I) (x : M) (ω₁ ω₂ : TangentSpace I x →L[ℝ] ℝ) : @@ -606,8 +600,7 @@ lemma cotangentMetricVal_nondegenerate (g : PseudoRiemannianMetric E H M n I) (x have h_forall : ∀ w : TangentSpace I x, ω w = 0 := by intro w let ω' : TangentSpace I x →L[ℝ] ℝ := g.flatL x w - have this : g.sharpL x ω' = w := by - simp only [ω', sharpL_apply_flatL] + have this : g.sharpL x ω' = w := by simp only [ω', sharpL_apply_flatL] have h_apply : cotangentMetricVal g x ω ω' = 0 := h ω' simp only [cotangentMetricVal_eq_apply_sharp] at h_apply rw [this] at h_apply diff --git a/Physlib/Mathematics/Geometry/Metric/Riemannian/Defs.lean b/Physlib/Mathematics/Geometry/Metric/Riemannian/Defs.lean index 0e46651d2..dec2bae22 100644 --- a/Physlib/Mathematics/Geometry/Metric/Riemannian/Defs.lean +++ b/Physlib/Mathematics/Geometry/Metric/Riemannian/Defs.lean @@ -92,9 +92,8 @@ lemma toQuadraticForm_posDef (g : RiemannianMetric I n M) (x : M) : λ v hv => g.pos_def x v hv lemma riemannian_metric_negDim_zero (g : RiemannianMetric I n M) (x : M) : - (g.toQuadraticForm x).negDim = 0 := by - apply QuadraticForm.rankNeg_eq_zero - exact g.toQuadraticForm_posDef x + (g.toQuadraticForm x).negDim = 0 := + QuadraticForm.rankNeg_eq_zero (g.toQuadraticForm_posDef x) /-! ## InnerProductSpace structure from RiemannianMetric -/ @@ -111,8 +110,7 @@ noncomputable def tangentInnerCore (g : RiemannianMetric I n M) (x : M) : InnerProductSpace.Core ℝ (TangentSpace I x) where inner := λ v w => g.inner x v w conj_inner_symm := λ v w => by - simp only [inner_apply, conj_trivial] - exact g.toPseudoRiemannianMetric.symm x w v + simpa only [inner_apply, conj_trivial] using g.toPseudoRiemannianMetric.symm x w v re_inner_nonneg := λ v => by simp only [inner_apply, RCLike.re_to_real] by_cases hv : v = 0 @@ -121,8 +119,7 @@ noncomputable def tangentInnerCore (g : RiemannianMetric I n M) (x : M) : add_left := λ u v w => by simp only [inner_apply, map_add, add_apply] smul_left := λ r u v => by - simp only [inner_apply, map_smul, conj_trivial] - rfl + simp [inner_apply] definite := fun v (h_inner_zero : g.inner x v v = 0) => by by_contra h_v_ne_zero have h_pos : g.inner x v v > 0 := g.pos_def x v h_v_ne_zero @@ -170,9 +167,7 @@ example (g : RiemannianMetric I n M) (x : M) (v : TangentSpace I x) : -- Example showing how to use the metric inner product space example (g : RiemannianMetric I n M) (x : M) (v w : TangentSpace I x) : - (TangentSpace.metricInnerProductSpace g x).inner v w = g.inner x v w := by - letI := TangentSpace.metricInnerProductSpace g x - rfl + (TangentSpace.metricInnerProductSpace g x).inner v w = g.inner x v w := rfl /-- Helper function to compute the norm on a tangent space from a Riemannian metric, using the underlying `NormedAddCommGroup` structure. -/ @@ -196,12 +191,7 @@ example (g : RiemannianMetric I n M) (x : M) (v : TangentSpace I x) : ℝ := lemma norm_eq_norm_of_metricNormedAddCommGroup (g : RiemannianMetric I n M) (x : M) (v : TangentSpace I x) : norm g x v = @Norm.norm (TangentSpace I x) - (@NormedAddCommGroup.toNorm _ (TangentSpace.metricNormedAddCommGroup g x)) v := by - unfold norm - let normed_group := TangentSpace.metricNormedAddCommGroup g x - unfold TangentSpace.metricNormedAddCommGroup - simp only [inner_apply] - rfl + (@NormedAddCommGroup.toNorm _ (TangentSpace.metricNormedAddCommGroup g x)) v := rfl end InnerProductSpace diff --git a/Physlib/Mathematics/InnerProductSpace/Adjoint.lean b/Physlib/Mathematics/InnerProductSpace/Adjoint.lean index 9161b1fb2..ddfdfd957 100644 --- a/Physlib/Mathematics/InnerProductSpace/Adjoint.lean +++ b/Physlib/Mathematics/InnerProductSpace/Adjoint.lean @@ -49,8 +49,7 @@ def adjoint (f : E → F) := lemma HasAdjoint.adjoint_inner_right {f : E → F} (hf : HasAdjoint 𝕜 f f') : ⟪x, f' y⟫ = ⟪f x, y⟫ := by - rw [← inner_conj_symm'] - rw [hf.adjoint_inner_left] + rw [← inner_conj_symm', hf.adjoint_inner_left] rw [inner_conj_symm'] open InnerProductSpace' in @@ -67,8 +66,7 @@ lemma adjoint_eq_clm_adjoint [CompleteSpace E] [CompleteSpace F] (f : E →L[ simp[_root_.adjoint,h,h.choose_spec.adjoint_inner_left] lemma HasAdjoint.adjoint_apply_zero {f : E → F} {f' : F → E} - (hf : HasAdjoint 𝕜 f f') : f' 0 = 0 := by - simpa using hf.adjoint_inner_left (f' 0) 0 + (hf : HasAdjoint 𝕜 f f') : f' 0 = 0 := by simpa using hf.adjoint_inner_left (f' 0) 0 lemma HasAdjoint.adjoint {f : E → F} {f' : F → E} diff --git a/Physlib/Mathematics/InnerProductSpace/Basic.lean b/Physlib/Mathematics/InnerProductSpace/Basic.lean index f6d0b35ec..034bbfbc6 100644 --- a/Physlib/Mathematics/InnerProductSpace/Basic.lean +++ b/Physlib/Mathematics/InnerProductSpace/Basic.lean @@ -512,9 +512,7 @@ instance {ι : Type*} [Fintype ι] : InnerProductSpace' 𝕜 (ι → E) where rw [hi] use i simp - have hj : ∀ j, ‖x j‖ ≤ ‖x i‖ := by - rw [← hi] - exact fun j => norm_le_pi_norm x j + have hj : ∀ j, ‖x j‖ ≤ ‖x i‖ := by simpa [← hi] using fun j => norm_le_pi_norm x j rw [hi] constructor · apply le_trans (h (x i)).1 @@ -576,10 +574,8 @@ lemma _root_.isBoundedBilinearMap_inner' : apply h1.trans apply le_of_eq congr - · rw [norm_withLp2_eq_norm2] - rfl - · rw [norm_withLp2_eq_norm2] - rfl + · exact norm_withLp2_eq_norm2 _ + · exact norm_withLp2_eq_norm2 _ · have key (z : E) : |‖z‖₂| ≤ √ d * ‖z‖ := by apply le_of_sq_le_sq · simp [@mul_pow] diff --git a/Physlib/Mathematics/InnerProductSpace/Calculus.lean b/Physlib/Mathematics/InnerProductSpace/Calculus.lean index e5b79dc10..2b3b92ff0 100644 --- a/Physlib/Mathematics/InnerProductSpace/Calculus.lean +++ b/Physlib/Mathematics/InnerProductSpace/Calculus.lean @@ -35,8 +35,7 @@ lemma fderiv_inner_apply' {f g : E → F} {x : E} (hf : DifferentiableAt ℝ f x) (hg : DifferentiableAt ℝ g x) (y : E) : fderiv ℝ (fun t => ⟪f t, g t⟫) x y = ⟪f x, fderiv ℝ g x y⟫ + ⟪fderiv ℝ f x y, g x⟫ := by - rw [(hf.hasFDerivAt.inner' hg.hasFDerivAt).fderiv] - rfl + simpa [fderivInnerCLM'] using DFunLike.congr_fun (hf.hasFDerivAt.inner' hg.hasFDerivAt).fderiv y -- todo: move this lemma deriv_inner_apply' @@ -49,6 +48,5 @@ lemma deriv_inner_apply' @[fun_prop] lemma DifferentiableAt.inner' {f g : E → F} {x} (hf : DifferentiableAt ℝ f x) (hg : DifferentiableAt ℝ g x) : - DifferentiableAt ℝ (fun x => ⟪f x, g x⟫) x := by - apply HasFDerivAt.differentiableAt - exact hf.hasFDerivAt.inner' hg.hasFDerivAt + DifferentiableAt ℝ (fun x => ⟪f x, g x⟫) x := + (hf.hasFDerivAt.inner' hg.hasFDerivAt).differentiableAt diff --git a/Physlib/Mathematics/InnerProductSpace/Submodule.lean b/Physlib/Mathematics/InnerProductSpace/Submodule.lean index afeb98227..d0189e440 100644 --- a/Physlib/Mathematics/InnerProductSpace/Submodule.lean +++ b/Physlib/Mathematics/InnerProductSpace/Submodule.lean @@ -32,13 +32,9 @@ variable /-- The submodule of `WithLp 2 (E × F)` defined by `M`. -/ def submoduleToLp : Submodule ℂ (WithLp 2 (E × F)) where carrier := {x | x.ofLp ∈ M} - add_mem' := by - intro a b ha hb - exact Submodule.add_mem M ha hb + add_mem' := fun {_ _} ha hb => Submodule.add_mem M ha hb zero_mem' := Submodule.zero_mem M - smul_mem' := by - intro c x hx - exact Submodule.smul_mem M c hx + smul_mem' := fun c {_} hx => Submodule.smul_mem M c hx lemma mem_submodule_iff_mem_submoduleToLp : f ∈ M ↔ (WithLp.toLp 2 f) ∈ submoduleToLp M := Eq.to_iff rfl @@ -75,8 +71,7 @@ lemma submoduleToLp_closure : lemma mem_submodule_closure_iff_mem_submoduleToLp_closure : f ∈ M.topologicalClosure ↔ (WithLp.toLp 2 f) ∈ (submoduleToLp M).topologicalClosure := by - rw [← submoduleToLp_closure] - rfl + simpa [submoduleToLp_closure] using mem_submodule_iff_mem_submoduleToLp M.topologicalClosure f lemma mem_submodule_adjoint_iff_mem_submoduleToLp_orthogonal : g ∈ M.adjoint ↔ WithLp.toLp 2 (g.2, -g.1) ∈ (submoduleToLp M)ᗮ := by @@ -84,9 +79,7 @@ lemma mem_submodule_adjoint_iff_mem_submoduleToLp_orthogonal : · rw [mem_orthogonal] intro u hu rw [mem_adjoint_iff] at h - have h' : inner ℂ u.snd g.1 = inner ℂ u.fst g.2 := by - rw [← sub_eq_zero] - exact h u.fst u.snd hu + have h' : inner ℂ u.snd g.1 = inner ℂ u.fst g.2 := by simpa [sub_eq_zero] using h u.fst u.snd hu simp [h'] · rw [mem_adjoint_iff] intro a b hab diff --git a/Physlib/Mathematics/KroneckerDelta.lean b/Physlib/Mathematics/KroneckerDelta.lean index 36d2933db..2ddde0146 100644 --- a/Physlib/Mathematics/KroneckerDelta.lean +++ b/Physlib/Mathematics/KroneckerDelta.lean @@ -109,20 +109,17 @@ open Finset variable [AddCommMonoid M] @[simp] -lemma sum_mul [Fintype α] (i j : α) : ∑ k : α, δ[i,k] * δ[k,j] = δ[i,j] := by - simp [kroneckerDelta] +lemma sum_mul [Fintype α] (i j : α) : ∑ k : α, δ[i,k] * δ[k,j] = δ[i,j] := by simp [kroneckerDelta] @[simp] lemma sum_smul [Fintype α] (i : α) (f : α → M) : ∑ j : α, δ[i,j] • f j = f i := by simp [kroneckerDelta] lemma sum_sum_smul_eq_zero [Fintype α] {f : α → α → M} (hf : ∀ i : α, f i i = 0) : - ∑ i : α, ∑ j : α, δ[i,j] • f i j = 0 := by - simp [sum_smul, hf, sum_const_zero] + ∑ i : α, ∑ j : α, δ[i,j] • f i j = 0 := by simp [sum_smul, hf, sum_const_zero] lemma finset_sum_smul (s : Finset α) (i : α) (f : α → M) : - ∑ j ∈ s, δ[i,j] • f j = if i ∈ s then f i else 0 := by - simp [kroneckerDelta] + ∑ j ∈ s, δ[i,j] • f j = if i ∈ s then f i else 0 := by simp [kroneckerDelta] lemma finset_sum_sum_smul_eq_zero {s s' : Finset α} {f : α → α → M} (hf : ∀ i ∈ s ∩ s', f i i = 0) : ∑ i ∈ s, ∑ j ∈ s', δ[i,j] • f i j = 0 := by diff --git a/Physlib/Mathematics/LinearMaps.lean b/Physlib/Mathematics/LinearMaps.lean index 35fbdd5b8..879a5489d 100644 --- a/Physlib/Mathematics/LinearMaps.lean +++ b/Physlib/Mathematics/LinearMaps.lean @@ -87,24 +87,19 @@ def mk₂ (f : V × V → ℚ) (map_smul : ∀ a S T, f (a • S, T) = a * f (S, map_add' := fun S1 S2 => LinearMap.ext fun T => map_add S1 S2 T swap' := swap -lemma map_smul₁ (f : BiLinearSymm V) (a : ℚ) (S T : V) : f (a • S) T = a * f S T := by - have h : f (a • S) = a • (f S) := by - exact f.map_smul a S - simp [h] +lemma map_smul₁ (f : BiLinearSymm V) (a : ℚ) (S T : V) : f (a • S) T = a * f S T := + (congrArg (fun g : V →ₗ[ℚ] ℚ => g T) (f.map_smul a S)).trans (by rfl) lemma swap (f : BiLinearSymm V) (S T : V) : f S T = f T S := f.swap' S T lemma map_smul₂ (f : BiLinearSymm V) (a : ℚ) (S : V) (T : V) : f S (a • T) = a * f S T := by rw [f.swap, f.map_smul₁, f.swap] -lemma map_add₁ (f : BiLinearSymm V) (S1 S2 T : V) : f (S1 + S2) T = f S1 T + f S2 T := by - have h : f (S1 + S2) = f S1 + f S2 := by - exact f.map_add S1 S2 - simp [h] +lemma map_add₁ (f : BiLinearSymm V) (S1 S2 T : V) : f (S1 + S2) T = f S1 T + f S2 T := + (congrArg (fun g : V →ₗ[ℚ] ℚ => g T) (f.map_add S1 S2)).trans (by rfl) lemma map_add₂ (f : BiLinearSymm V) (S : V) (T1 T2 : V) : - f S (T1 + T2) = f S T1 + f S T2 := by - rw [f.swap, f.map_add₁, f.swap T1 S, f.swap T2 S] + f S (T1 + T2) = f S T1 + f S T2 := by rw [f.swap, f.map_add₁, f.swap T1 S, f.swap T2 S] /-- Fixing the second input vectors, the resulting linear map. -/ def toLinear₁ (f : BiLinearSymm V) (T : V) : V →ₗ[ℚ] ℚ where @@ -115,8 +110,7 @@ def toLinear₁ (f : BiLinearSymm V) (T : V) : V →ₗ[ℚ] ℚ where lemma toLinear₁_apply (f : BiLinearSymm V) (S T : V) : f S T = f.toLinear₁ T S := rfl lemma map_sum₁ {n : ℕ} (f : BiLinearSymm V) (S : Fin n → V) (T : V) : - f (∑ i, S i) T = ∑ i, f (S i) T := by - simp [f.toLinear₁_apply, map_sum] + f (∑ i, S i) T = ∑ i, f (S i) T := by simp [f.toLinear₁_apply, map_sum] lemma map_sum₂ {n : ℕ} (f : BiLinearSymm V) (S : Fin n → V) (T : V) : f T (∑ i, S i) = ∑ i, f T (S i) := map_sum (f T) S Finset.univ @@ -211,47 +205,35 @@ lemma swap₃ (f : TriLinearSymm V) (S T L : V) : f S T L = f L T S := by rw [f.swap₁, f.swap₂, f.swap₁] lemma map_smul₁ (f : TriLinearSymm V) (a : ℚ) (S T L : V) : - f (a • S) T L = a * f S T L := by - have h : f (a • S) = a • (f S) := by - exact f.map_smul a S - simp [h] + f (a • S) T L = a * f S T L := + (congrArg (fun g : V →ₗ[ℚ] V →ₗ[ℚ] ℚ => g T L) (f.map_smul a S)).trans rfl lemma map_smul₂ (f : TriLinearSymm V) (S : V) (a : ℚ) (T L : V) : - f S (a • T) L = a * f S T L := by - rw [f.swap₁, f.map_smul₁, f.swap₁] + f S (a • T) L = a * f S T L := by rw [f.swap₁, f.map_smul₁, f.swap₁] lemma map_smul₃ (f : TriLinearSymm V) (S T : V) (a : ℚ) (L : V) : - f S T (a • L) = a * f S T L := by - rw [f.swap₃, f.map_smul₁, f.swap₃] + f S T (a • L) = a * f S T L := by rw [f.swap₃, f.map_smul₁, f.swap₃] lemma map_add₁ (f : TriLinearSymm V) (S1 S2 T L : V) : - f (S1 + S2) T L = f S1 T L + f S2 T L := by - have h : f (S1 + S2) = f S1 + f S2 := by - exact f.map_add S1 S2 - simp [h] + f (S1 + S2) T L = f S1 T L + f S2 T L := + (congrArg (fun g : V →ₗ[ℚ] V →ₗ[ℚ] ℚ => g T L) (f.map_add S1 S2)).trans rfl lemma map_add₂ (f : TriLinearSymm V) (S T1 T2 L : V) : - f S (T1 + T2) L = f S T1 L + f S T2 L := by - rw [f.swap₁, f.map_add₁, f.swap₁ S T1, f.swap₁ S T2] + f S (T1 + T2) L = f S T1 L + f S T2 L := by rw [f.swap₁, f.map_add₁, f.swap₁ S T1, f.swap₁ S T2] lemma map_add₃ (f : TriLinearSymm V) (S T L1 L2 : V) : - f S T (L1 + L2) = f S T L1 + f S T L2 := by - rw [f.swap₃, f.map_add₁, f.swap₃, f.swap₃ L2 T S] + f S T (L1 + L2) = f S T L1 + f S T L2 := by rw [f.swap₃, f.map_add₁, f.swap₃, f.swap₃ L2 T S] /-- Fixing the second and third input vectors, the resulting linear map. -/ def toLinear₁ (f : TriLinearSymm V) (T L : V) : V →ₗ[ℚ] ℚ where toFun S := f S T L map_add' S1 S2 := map_add₁ f S1 S2 T L - map_smul' a S := by - simp only [f.map_smul₁] - rfl + map_smul' a S := by simp [f.map_smul₁] lemma toLinear₁_apply (f : TriLinearSymm V) (S T L : V) : f S T L = f.toLinear₁ T L S := rfl lemma map_sum₁ {n : ℕ} (f : TriLinearSymm V) (S : Fin n → V) (T : V) (L : V) : - f (∑ i, S i) T L = ∑ i, f (S i) T L := by - rw [f.toLinear₁_apply, map_sum] - rfl + f (∑ i, S i) T L = ∑ i, f (S i) T L := by simp [toLinear₁_apply, map_sum] lemma map_sum₂ {n : ℕ} (f : TriLinearSymm V) (S : Fin n → V) (T : V) (L : V) : f T (∑ i, S i) L = ∑ i, f T (S i) L := by diff --git a/Physlib/Mathematics/LinearPMap.lean b/Physlib/Mathematics/LinearPMap.lean index 5c7bf3ee0..bc4879fd7 100644 --- a/Physlib/Mathematics/LinearPMap.lean +++ b/Physlib/Mathematics/LinearPMap.lean @@ -198,8 +198,7 @@ lemma compRestricted_domain : (g ∘ᵣ f).domain = (g.domain.comap f.toFun).map exact h.choose lemma mem_compRestricted_domain_iff {x : E} : - x ∈ (v ∘ᵣ u).domain ↔ ∃ h : x ∈ u.domain, u ⟨x, h⟩ ∈ v.domain := by - simp [compRestricted_domain] + x ∈ (v ∘ᵣ u).domain ↔ ∃ h : x ∈ u.domain, u ⟨x, h⟩ ∈ v.domain := by simp [compRestricted_domain] lemma mem_compRestricted_domain_iff' {x : E} : x ∈ (v ∘ᵣ u).domain ↔ ∃ y : u.domain, x = y ∧ ∃ y' : v.domain, u y = y' := by diff --git a/Physlib/Mathematics/List.lean b/Physlib/Mathematics/List.lean index d2c0fa4e4..f257eb8a7 100644 --- a/Physlib/Mathematics/List.lean +++ b/Physlib/Mathematics/List.lean @@ -23,8 +23,7 @@ variable {n : Nat} lemma takeWile_eraseIdx {I : Type} (P : I → Prop) [DecidablePred P] : (l : List I) → (i : ℕ) → (hi : ∀ (i j : Fin l.length), i < j → P (l.get j) → P (l.get i)) → List.takeWhile P (List.eraseIdx l i) = (List.takeWhile P l).eraseIdx i - | [], _, h => by - rfl + | [], _, h => rfl | a :: [], 0, h => by simp only [List.takeWhile, List.eraseIdx_zero] split <;> rfl @@ -34,8 +33,7 @@ lemma takeWile_eraseIdx {I : Type} (P : I → Prop) [DecidablePred P] : | a :: b :: l, 0, h => by simp only [List.takeWhile, List.eraseIdx_zero] by_cases hPb : P b - · have hPa : P a := by - simpa using h ⟨0, by simp⟩ ⟨1, by simp⟩ (by simp) (by simpa using hPb) + · have hPa : P a := by simpa using h ⟨0, by simp⟩ ⟨1, by simp⟩ (by simp) (by simpa using hPb) simp [hPb, hPa] · simp [hPb] split <;> rfl @@ -62,15 +60,13 @@ lemma dropWile_eraseIdx {I : Type} (P : I → Prop) [DecidablePred P] : by_cases hPa : P a <;> simp [hPa, List.eraseIdx_of_length_le] | a :: b :: l, 0, h => by by_cases hPb : P b - · have hPa : P a := by - simpa using h ⟨0, by simp⟩ ⟨1, by simp⟩ (by simp) (by simpa using hPb) + · have hPa : P a := by simpa using h ⟨0, by simp⟩ ⟨1, by simp⟩ (by simp) (by simpa using hPb) simp [hPb, hPa] · by_cases hPa : P a <;> simp [hPa, hPb] | a :: b :: l, Nat.succ n, h => by simp only [Nat.succ_eq_add_one, List.eraseIdx_cons_succ] by_cases hPb : P b - · have hPa : P a := by - simpa using h ⟨0, by simp⟩ ⟨1, by simp⟩ (by simp) (by simpa using hPb) + · have hPa : P a := by simpa using h ⟨0, by simp⟩ ⟨1, by simp⟩ (by simp) (by simpa using hPb) simp only [List.dropWhile, hPa, decide_true, List.takeWhile, hPb, List.length_cons, add_le_add_iff_right, Nat.reduceSubDiff] rw [dropWile_eraseIdx P (b :: l) n (fun i j hij hP => by @@ -176,10 +172,9 @@ lemma orderedInsertPos_take_eq_orderedInsert {I : Type} (le1 : I → I → Prop) exact Nat.le_of_lt_succ (orderedInsertPos_lt_length le1 r r0) · intro n h1 h2 simp only [List.get_eq_getElem, List.getElem_take] - rw [orderedInsert_get_lt le1 r r0 n] - rfl - simp only [List.length_take, lt_inf_iff] at h1 - exact h1.1 + exact (orderedInsert_get_lt le1 r r0 n (by + simp only [List.length_take, lt_inf_iff] at h1 + exact h1.1)).symm lemma orderedInsertPos_drop_eq_orderedInsert {I : Type} (le1 : I → I → Prop) [DecidableRel le1] (r : List I) (r0 : I) : @@ -187,8 +182,7 @@ lemma orderedInsertPos_drop_eq_orderedInsert {I : Type} (le1 : I → I → Prop) List.drop (orderedInsertPos le1 r r0).succ (List.orderedInsert le1 r0 r) := by conv_rhs => simp [orderedInsertPos, List.orderedInsert_eq_take_drop] have hr : r = List.takeWhile (fun b => !decide (le1 r0 b)) r ++ - List.dropWhile (fun b => !decide (le1 r0 b)) r := by - exact Eq.symm (List.takeWhile_append_dropWhile) + List.dropWhile (fun b => !decide (le1 r0 b)) r := Eq.symm (List.takeWhile_append_dropWhile) conv_lhs => rhs rw [hr] @@ -446,9 +440,7 @@ lemma orderedInsert_eraseIdx_orderedInsertEquiv_fin_succ (hr : ∀ (i j : Fin r.length), i < j → ¬le1 r0 (r.get j) → ¬le1 r0 (r.get i)) : (List.orderedInsert le1 r0 r).eraseIdx (orderedInsertEquiv le1 r r0 n.succ) = (List.orderedInsert le1 r0 (r.eraseIdx n)) := by - have hn : n.succ = ⟨n.val + 1, by omega⟩ := by - rw [Fin.ext_iff] - rfl + have hn : n.succ = ⟨n.val + 1, by omega⟩ := Fin.ext rfl rw [hn] exact orderedInsert_eraseIdx_orderedInsertEquiv_succ le1 r r0 n.val _ hr @@ -608,8 +600,7 @@ lemma insertionSortEquiv_order {α : Type} {r : α → α → Prop} [DecidableRe | some i => List.eraseIdx l i lemma eraseIdx_length' {I : Type} (l : List I) (i : Fin l.length) : - (List.eraseIdx l i).length = l.length - 1 := by - simp [List.length_eraseIdx] + (List.eraseIdx l i).length = l.length - 1 := by simp [List.length_eraseIdx] lemma eraseIdx_length {I : Type} (l : List I) (i : Fin l.length) : (List.eraseIdx l i).length + 1 = l.length := by @@ -624,8 +615,7 @@ lemma eraseIdx_length_succ {I : Type} (l : List I) (i : Fin l.length) : omega lemma eraseIdx_cons_length {I : Type} (a : I) (l : List I) (i : Fin (a :: l).length) : - (List.eraseIdx (a :: l) i).length= l.length := by - simp [List.length_eraseIdx] + (List.eraseIdx (a :: l) i).length= l.length := by simp [List.length_eraseIdx] lemma eraseIdx_get {I : Type} (l : List I) (i : Fin l.length) : (List.eraseIdx l i).get = l.get ∘ (Fin.cast (eraseIdx_length l i)) ∘ diff --git a/Physlib/Mathematics/List/InsertIdx.lean b/Physlib/Mathematics/List/InsertIdx.lean index b9f4ae4fc..044eb9302 100644 --- a/Physlib/Mathematics/List/InsertIdx.lean +++ b/Physlib/Mathematics/List/InsertIdx.lean @@ -42,8 +42,7 @@ lemma eraseIdx_sorted {I : Type} (le : I → I → Prop) : simp only [List.pairwise_cons] at h refine And.intro ?_ (eraseIdx_sorted le as n h.2) intro b hb - refine h.1 _ ?_ - exact List.mem_of_mem_eraseIdx hb + exact h.1 _ (List.mem_of_mem_eraseIdx hb) lemma mem_eraseIdx_nodup {I : Type} (i : I) : (l : List I) → (n : ℕ) → (hn : n < l.length) → (h : List.Nodup l) → diff --git a/Physlib/Mathematics/List/InsertionSort.lean b/Physlib/Mathematics/List/InsertionSort.lean index 7d2b893f7..85485eebd 100644 --- a/Physlib/Mathematics/List/InsertionSort.lean +++ b/Physlib/Mathematics/List/InsertionSort.lean @@ -73,9 +73,7 @@ lemma insertionSortMin_lt_mem_insertionSortDropMinPos_of_lt {α : Type} (r : α trans (insertionSortDropMinPos r a l).get i simp only [Fin.getElem_fin, List.get_eq_getElem] simp only [insertionSortDropMinPos, List.length_cons, Nat.succ_eq_add_one, finCongr_apply] - rw [eraseIdx_get] - simp only [List.length_cons, Function.comp_apply, List.get_eq_getElem, Fin.val_cast] - rfl + exact congr_fun (eraseIdx_get (a :: l) (insertionSortMinPos r a l)) i erw [h1] simp only [List.length_cons, Nat.succ_eq_add_one, List.get_eq_getElem] apply insertionSortEquiv_order @@ -84,16 +82,14 @@ lemma insertionSortMin_lt_mem_insertionSortDropMinPos_of_lt {α : Type} (r : α apply lt_of_eq_of_lt (insertionSortMinPos_insertionSortEquiv r a l) apply insertionSortEquiv_gt_zero_of_ne_insertionSortMinPos r a l simp only [List.length_cons, ne_eq, Fin.ext_iff, Fin.val_cast] - have hl : (insertionSortMinPos r a l).val = (insertionSortMinPosFin r a l).val := by - rfl + have hl : (insertionSortMinPos r a l).val = (insertionSortMinPosFin r a l).val := rfl simp only [hl, Nat.succ_eq_add_one, Fin.val_eq_val, ne_eq] exact Fin.succAbove_ne (insertionSortMinPosFin r a l) i lemma insertionSort_insertionSort {α : Type} (r : α → α → Prop) [DecidableRel r] [Std.Total r] [IsTrans α r] (l1 : List α) : - List.insertionSort r (List.insertionSort r l1) = List.insertionSort r l1 := by - apply List.Pairwise.insertionSort_eq - exact List.pairwise_insertionSort r l1 + List.insertionSort r (List.insertionSort r l1) = List.insertionSort r l1 := + List.Pairwise.insertionSort_eq (List.pairwise_insertionSort r l1) lemma orderedInsert_commute {α : Type} (r : α → α → Prop) [DecidableRel r] [Std.Total r] [IsTrans α r] (a b : α) (hr : ¬ r a b) : (l : List α) → @@ -154,9 +150,8 @@ lemma insertionSort_append_insertionSort_append {α : Type} (r : α → α → P @[simp] lemma orderedInsert_length {α : Type} (r : α → α → Prop) [DecidableRel r] (a : α) (l : List α) : - (List.orderedInsert r a l).length = (a :: l).length := by - apply List.Perm.length_eq - exact List.perm_orderedInsert r a l + (List.orderedInsert r a l).length = (a :: l).length := + List.Perm.length_eq (List.perm_orderedInsert r a l) lemma takeWhile_orderedInsert {α : Type} (r : α → α → Prop) [DecidableRel r] [Std.Total r] [IsTrans α r] @@ -242,8 +237,7 @@ lemma insertionSortEquiv_commute {α : Type} (r : α → α → Prop) [Decidable funext c simp only [Bool.eq_self_and, Bool.not_eq_eq_eq_not, Bool.not_true, decide_eq_false_iff_not] intro hbc hac - refine hbc ?_ - exact IsTrans.trans _ _ _ hrba hac + exact hbc (IsTrans.trans _ _ _ hrba hac) have ha1 : b1.1 ≤ a2.1 := by simp only [orderedInsertPos, decide_not, b1] rw [ht] @@ -289,8 +283,7 @@ lemma insertionSortEquiv_orderedInsert_append {α : Type} (r : α → α → Pro rw [insertionSortEquiv_congr _ _ h1] simp · have h1 : (List.orderedInsert r a (b :: l1) ++ a2 :: l2) = - (b :: List.orderedInsert r a (l1) ++ a2 :: l2) := by - simp [h] + (b :: List.orderedInsert r a (l1) ++ a2 :: l2) := by simp [h] rw [insertionSortEquiv_congr _ _ h1] simp only [List.cons_append, List.length_cons, Equiv.trans_apply, RelIso.coe_fn_toEquiv, Fin.castOrderIso_apply, Fin.cast_mk, @@ -313,7 +306,6 @@ lemma insertionSortEquiv_orderedInsert_append {α : Type} (r : α → α → Pro simp only [List.insertionSort, List.length_cons, hl] conv_rhs => erw [insertionSortEquiv_commute _ _ _ h _ _] - simp rfl set_option backward.isDefEq.respectTransparency false in @@ -335,10 +327,8 @@ lemma insertionSortEquiv_insertionSort_append {α : Type} (r : α → α → Pro equivCons_succ] erw [ih] have hl : (List.insertionSort r (List.insertionSort r l1 ++ a :: l2)) = - (List.insertionSort r (l1 ++ a :: l2)) := by - exact insertionSort_insertionSort_append r l1 (a :: l2) + (List.insertionSort r (l1 ++ a :: l2)) := insertionSort_insertionSort_append r l1 (a :: l2) erw [orderedInsertEquiv_congr _ _ _ hl] - simp only [List.foldr_cons, finCongr_apply] rfl /-! @@ -360,11 +350,9 @@ lemma orderedInsert_filter_of_pos {α : Type} (r : α → α → Prop) [Decidabl by_cases hpb : p b <;> by_cases hab : r a b · simp only [hab, ↓reduceIte, hpb, decide_true, List.filter_cons_of_pos, List.orderedInsert.eq_2] - rw [List.filter_cons_of_pos (by simp [h])] - rw [List.filter_cons_of_pos (by simp [hpb])] + rw [List.filter_cons_of_pos (by simp [h]), List.filter_cons_of_pos (by simp [hpb])] · simp only [hab, ↓reduceIte] - rw [List.filter_cons_of_pos (by simp [hpb])] - rw [List.filter_cons_of_pos (by simp [hpb])] + rw [List.filter_cons_of_pos (by simp [hpb]), List.filter_cons_of_pos (by simp [hpb])] simp only [List.orderedInsert, hab, ↓reduceIte, List.cons.injEq, true_and] simp only [List.pairwise_cons] at hl exact orderedInsert_filter_of_pos r a p h l hl.2 @@ -383,8 +371,7 @@ lemma orderedInsert_filter_of_pos {α : Type} (r : α → α → Prop) [Decidabl simp only [List.pairwise_cons] at hl apply hl.1 have hlf : (List.filter (fun b => decide (p b)) l)[0] ∈ - (List.filter (fun b => decide (p b)) l) := by - exact List.getElem_mem c + (List.filter (fun b => decide (p b)) l) := List.getElem_mem c simp only [List.mem_filter, decide_eq_true_eq] at hlf exact hlf.1 rw [hl] @@ -394,8 +381,7 @@ lemma orderedInsert_filter_of_pos {α : Type} (r : α → α → Prop) [Decidabl rw [hl] simp · simp only [hab, ↓reduceIte] - rw [List.filter_cons_of_neg (by simp [hpb])] - rw [List.filter_cons_of_neg (by simp [hpb])] + rw [List.filter_cons_of_neg (by simp [hpb]), List.filter_cons_of_neg (by simp [hpb])] simp only [List.pairwise_cons] at hl exact orderedInsert_filter_of_pos r a p h l hl.2 @@ -404,8 +390,7 @@ lemma orderedInsert_filter_of_neg {α : Type} (r : α → α → Prop) [Decidabl List.filter p (List.orderedInsert r a l) = (List.filter p l) := by rw [List.orderedInsert_eq_take_drop] simp only [decide_not, List.filter_append] - rw [List.filter_cons_of_neg] - rw [← List.filter_append] + rw [List.filter_cons_of_neg, ← List.filter_append] congr exact List.takeWhile_append_dropWhile simp [h] @@ -423,8 +408,7 @@ lemma insertionSort_filter {α : Type} (r : α → α → Prop) [DecidableRel r] simp only [List.insertionSort_cons] rw [insertionSort_filter] · rw [orderedInsert_filter_of_neg r a p h] - rw [List.filter_cons_of_neg (by simpa using h)] - rw [insertionSort_filter] + rw [List.filter_cons_of_neg (by simpa using h), insertionSort_filter] lemma takeWhile_sorted_eq_filter {α : Type} (r : α → α → Prop) [DecidableRel r] [IsTrans α r] (a : α) : (l : List α) → (hl : l.Pairwise r) → @@ -440,8 +424,7 @@ lemma takeWhile_sorted_eq_filter {α : Type} (r : α → α → Prop) [Decidable not_false_eq_true, List.takeWhile_cons_of_neg, List.filter_cons_of_neg, List.nil_eq, List.filter_eq_nil_iff, Bool.not_eq_eq_eq_not, decide_eq_false_iff_not] intro c hc - apply IsTrans.trans a b c hb - exact hl.1 c hc + exact IsTrans.trans a b c hb (hl.1 c hc) lemma dropWhile_sorted_eq_filter {α : Type} (r : α → α → Prop) [DecidableRel r] [IsTrans α r] (a : α) : (l : List α) → (hl : l.Pairwise r) → @@ -460,8 +443,7 @@ lemma dropWhile_sorted_eq_filter {α : Type} (r : α → α → Prop) [Decidable rw [List.filter_eq_self] intro c hc simp only [decide_eq_true_eq] - apply IsTrans.trans a b c hb - exact hl.1 c hc + exact IsTrans.trans a b c hb (hl.1 c hc) lemma dropWhile_sorted_eq_filter_filter {α : Type} (r : α → α → Prop) [DecidableRel r] [IsTrans α r] (a : α) :(l : List α) → (hl : l.Pairwise r) → @@ -493,8 +475,7 @@ lemma dropWhile_sorted_eq_filter_filter {α : Type} (r : α → α → Prop) [De simp only [Bool.and_eq_true, decide_eq_true_eq, not_and] intro hac hca apply hba - apply IsTrans.trans b c a _ hca - exact hl.1 c hc + exact IsTrans.trans b c a (hl.1 c hc) hca rw [h1] rw [dropWhile_sorted_eq_filter_filter] simp only [Bool.decide_and, h1, decide_not, List.nil_append] diff --git a/Physlib/Mathematics/PiTensorProduct.lean b/Physlib/Mathematics/PiTensorProduct.lean index a8bcc6cae..26cddfebc 100644 --- a/Physlib/Mathematics/PiTensorProduct.lean +++ b/Physlib/Mathematics/PiTensorProduct.lean @@ -199,8 +199,7 @@ lemma elimPureTensor_update_right (p : (i : ι1) → s1 i) (q : (i : ι2) → s2 Function.update (elimPureTensor p q) (Sum.inr y) r := by funext x match x with - | Sum.inl x => - rfl + | Sum.inl x => rfl | Sum.inr x => change Function.update q y r x = _ simp only [Function.update, Sum.inr.injEq, Sum.elim_inr] @@ -224,8 +223,7 @@ lemma elimPureTensor_update_left (p : (i : ι1) → s1 i) (q : (i : ι2) → s2 subst h rfl · rfl - | Sum.inr y => - rfl + | Sum.inr y => rfl end diff --git a/Physlib/Mathematics/RatComplexNum.lean b/Physlib/Mathematics/RatComplexNum.lean index 49c19f846..d1f489885 100644 --- a/Physlib/Mathematics/RatComplexNum.lean +++ b/Physlib/Mathematics/RatComplexNum.lean @@ -36,14 +36,8 @@ lemma ext {x y : RatComplexNum} (h1 : x.1 = y.1) (h2 : x.2 = y.2) : x = y := by def equivToProd : RatComplexNum ≃ ℚ × ℚ where toFun := fun x => (x.1, x.2) invFun := fun x => ⟨x.1, x.2⟩ - left_inv := by - intro x - cases x - rfl - right_inv := by - intro x - cases x - rfl + left_inv := fun ⟨_, _⟩ => rfl + right_inv := fun ⟨_, _⟩ => rfl instance : DecidableEq RatComplexNum := Equiv.decidableEq equivToProd @@ -242,8 +236,7 @@ open Complex /-- The inclusion of `RatComplexNum` into the complex numbers. -/ noncomputable def toComplexNum : RatComplexNum →+* ℂ where toFun := fun x => x.fst + x.snd * I - map_one' := by - simp + map_one' := by simp map_add' a b := by simp only [add_fst, Rat.cast_add, add_snd] ring @@ -252,8 +245,7 @@ noncomputable def toComplexNum : RatComplexNum →+* ℂ where ring_nf simp only [I_sq, mul_neg, mul_one] ring - map_zero' := by - simp + map_zero' := by simp @[simp] lemma I_mul_toComplexNum (a : RatComplexNum) : I * toComplexNum a = toComplexNum (⟨0, 1⟩ * a) := by @@ -264,8 +256,7 @@ lemma I_mul_toComplexNum (a : RatComplexNum) : I * toComplexNum a = toComplexNum ring lemma ofNat_mul_toComplexNum (n : ℕ) (a : RatComplexNum) : - n * toComplexNum a = toComplexNum (n * a) := by - simp only [map_mul, map_natCast] + n * toComplexNum a = toComplexNum (n * a) := by simp only [map_mul, map_natCast] lemma toComplexNum_injective : Function.Injective toComplexNum := by intro a b ha diff --git a/Physlib/Mathematics/SO3/Basic.lean b/Physlib/Mathematics/SO3/Basic.lean index 69b497e9c..4f74e3d7b 100644 --- a/Physlib/Mathematics/SO3/Basic.lean +++ b/Physlib/Mathematics/SO3/Basic.lean @@ -57,8 +57,7 @@ def toGL : SO(3) →* GL (Fin 3) ℝ where map_mul' _ _ := (GeneralLinearGroup.ext_iff _ _).mpr fun _ => congrFun rfl lemma subtype_val_eq_toGL : (Subtype.val : SO3 → Matrix (Fin 3) (Fin 3) ℝ) = - Units.val ∘ toGL.toFun := - rfl + Units.val ∘ toGL.toFun := rfl /-- The inclusion of `SO(3)` into `GL(3,ℝ)` is an injection. -/ lemma toGL_injective : Function.Injective toGL := by diff --git a/Physlib/Mathematics/SchurTriangulation.lean b/Physlib/Mathematics/SchurTriangulation.lean index 0ec7fb8e3..fec1510ec 100644 --- a/Physlib/Mathematics/SchurTriangulation.lean +++ b/Physlib/Mathematics/SchurTriangulation.lean @@ -180,8 +180,7 @@ protected noncomputable def SchurTriangulationAux.of have hf {bi i' bj j'} (hi : e i = ⟨bi, i'⟩) (hj : e j = ⟨bj, j'⟩) := calc toMatrixOrthonormal basis f i j _ = toMatrixOrthonormal bE f (e i) (e j) := by - rw [f.toMatrixOrthonormal_reindex] - rfl + exact congr_fun (congr_fun (f.toMatrixOrthonormal_reindex bE e.symm) i) j _ = ⟪bE (e i), f (bE (e j))⟫_𝕜 := f.toMatrixOrthonormal_apply_apply .. _ = ⟪(B bi i' : E), f (B bj j')⟫_𝕜 := by rw [hB, hB, hi, hj] @@ -252,8 +251,7 @@ noncomputable def schurTriangulationAux : fun i j (hji : j < i) => calc LinearMap.toMatrixOrthonormal b' f i j _ = LinearMap.toMatrixOrthonormal b f (e.symm i) (e.symm j) := by - rw [f.toMatrixOrthonormal_reindex] - rfl + exact congrFun (congrFun (f.toMatrixOrthonormal_reindex b e.toEquiv) i) j _ = 0 := hut (e.symm.lt_iff_lt.mpr hji) /-- The change of basis that induces the upper triangular form `A.schurTriangulation` of a matrix diff --git a/Physlib/Mathematics/SpecialFunctions/PhysHermite.lean b/Physlib/Mathematics/SpecialFunctions/PhysHermite.lean index 68d76cc46..e7104beed 100644 --- a/Physlib/Mathematics/SpecialFunctions/PhysHermite.lean +++ b/Physlib/Mathematics/SpecialFunctions/PhysHermite.lean @@ -211,9 +211,8 @@ lemma deriv_physHermite' (x : ℝ) (f : ℝ → ℝ) (hf : DifferentiableAt ℝ f x) (n : ℕ) : deriv (fun x => physHermite n (f x)) x = (2 * n * physHermite (n - 1) (f x)) * deriv f x := by - unfold deriv - rw [fderiv_physHermite (hf := by fun_prop)] - rfl + simpa only [deriv, FunLike.coe_smul, Pi.smul_apply, smul_eq_mul] using + congrArg (fun g : ℝ →L[ℝ] ℝ => g 1) (fderiv_physHermite x f hf n) lemma physHermite_parity: (n : ℕ) → (x : ℝ) → physHermite n (-x) = (-1)^n * physHermite n x @@ -325,8 +324,7 @@ lemma integral_physHermite_mul_physHermite_eq_integral_deriv_inductive (n m : ∫ x : ℝ, (physHermite n x * physHermite m x) * Real.exp (- x ^ 2) = (-1 : ℝ) ^ (m - p) * ∫ x : ℝ, (deriv^[p] (physHermite n) x * (deriv^[m - p] fun x => Real.exp (-x ^ 2)) x) - | 0, h => by - exact integral_physHermite_mul_physHermite_eq_integral_deriv_exp n m + | 0, h => integral_physHermite_mul_physHermite_eq_integral_deriv_exp n m | p + 1, h => by rw [integral_physHermite_mul_physHermite_eq_integral_deriv_inductive n m p (by omega)] have h1 : m - p = m - (p + 1) + 1 := by omega @@ -401,8 +399,7 @@ theorem physHermite_norm (n : ℕ) : rw [aeval_C] simp rw [MeasureTheory.integral_const_mul] - have h1 : ∫ (x : ℝ), Real.exp (- x^2) = Real.sqrt (Real.pi) := by - simpa using integral_gaussian 1 + have h1 : ∫ (x : ℝ), Real.exp (- x^2) = Real.sqrt (Real.pi) := by simpa using integral_gaussian 1 rw [h1] lemma physHermite_norm_cons (n : ℕ) (c : ℝ) : @@ -482,8 +479,7 @@ lemma cos_mem_physHermite_span_topologicalClosure (c : ℝ) : simp only [HasSum] at h1 have h1 : Filter.Tendsto (fun s => fun y => ∑ x ∈ s, (-1) ^ x * (c * y) ^ (2 * x) / ((2 * x)! : ℝ)) - Filter.atTop (nhds (fun x => Real.cos (c * x))) := by - exact tendsto_pi_nhds.mpr fun x => h1 (c * x) + Filter.atTop (nhds (fun x => Real.cos (c * x))) := tendsto_pi_nhds.mpr fun x => h1 (c * x) have h2 (z : Finset ℕ) : (fun y => ∑ x ∈ z, (-1) ^ x * (c * y) ^ (2 * x) / ↑(2 * x)!) ∈ ↑(Submodule.span ℝ (Set.range (fun n => (physHermite n : ℝ → ℝ)))) := by have h0 : (fun y => ∑ x ∈ z, (-1) ^ x * (c * y) ^ (2 * x) / ↑(2 * x)!) = diff --git a/Physlib/Mathematics/Trigonometry/Tanh.lean b/Physlib/Mathematics/Trigonometry/Tanh.lean index 9f17baa83..377484ac2 100644 --- a/Physlib/Mathematics/Trigonometry/Tanh.lean +++ b/Physlib/Mathematics/Trigonometry/Tanh.lean @@ -110,11 +110,8 @@ lemma polynomial_tanh_bounded (P : Polynomial ℝ) : ∃ C : ℝ, ∀ x : ℝ, |P.eval (Real.tanh x)| ≤ C := by -- Since tanh maps to (-1, 1), it maps to [-1+ε, 1-ε] for any ε > 0 -- But more directly, tanh maps to (-1, 1) ⊆ [-1, 1] - have h_range : ∀ x : ℝ, Real.tanh x ∈ Set.Icc (-1) 1 := by - intro x - constructor - · exact le_of_lt (neg_one_lt_tanh x) - · exact le_of_lt (tanh_lt_one x) + have h_range : ∀ x : ℝ, Real.tanh x ∈ Set.Icc (-1) 1 := + fun x => ⟨le_of_lt (neg_one_lt_tanh x), le_of_lt (tanh_lt_one x)⟩ -- Apply polynomial boundedness on [-1, 1] obtain ⟨M, hM⟩ := polynomial_bounded_on_interval P (-1) 1 use M @@ -146,10 +143,8 @@ lemma tanh_hasTemperateGrowth : Function.HasTemperateGrowth Real.tanh := by use C intro x have h_equiv : ‖iteratedFDeriv ℝ n Real.tanh x‖ = |iteratedDeriv n Real.tanh x| := by - rw [← iteratedFDerivWithin_univ] - rw [← iteratedDerivWithin_univ] - rw [← norm_eq_abs] - rw [norm_iteratedFDerivWithin_eq_norm_iteratedDerivWithin] + rw [← iteratedFDerivWithin_univ, ← iteratedDerivWithin_univ] + rw [← norm_eq_abs, norm_iteratedFDerivWithin_eq_norm_iteratedDerivWithin] rw [h_equiv] simp only [pow_zero, mul_one] exact hC x @@ -209,8 +204,7 @@ lemma iteratedDeriv_tanh_const_mul (n : ℕ) (κ : ℝ) : ∀ x : ℝ, lemma tanh_const_mul_hasTemperateGrowth (κ : ℝ) : Function.HasTemperateGrowth (fun x => Real.tanh (κ * x)) := by constructor - · have h : (fun x => Real.tanh (κ * x)) = (Real.tanh ∘ (fun x => κ * x)) := - rfl + · have h : (fun x => Real.tanh (κ * x)) = (Real.tanh ∘ (fun x => κ * x)) := rfl have h' : ContDiff ℝ ∞ (fun x => κ * x) := by have h'': (fun x : ℝ => κ * x) = fun x => κ • x := rfl rw [contDiff_infty, h''] diff --git a/Physlib/Mathematics/VariationalCalculus/Basic.lean b/Physlib/Mathematics/VariationalCalculus/Basic.lean index 7244f8f22..98846c383 100644 --- a/Physlib/Mathematics/VariationalCalculus/Basic.lean +++ b/Physlib/Mathematics/VariationalCalculus/Basic.lean @@ -245,5 +245,4 @@ lemma fundamental_theorem_of_variational_calculus {f : X → V} · intro x simp only [Pi.zero_apply] apply real_inner_self_nonneg' - · apply IsTestFunction.integrable - exact IsTestFunction.inner hf hf + · exact (IsTestFunction.inner hf hf).integrable μ diff --git a/Physlib/Mathematics/VariationalCalculus/HasVarAdjDeriv.lean b/Physlib/Mathematics/VariationalCalculus/HasVarAdjDeriv.lean index 0bcaef70b..9671fdf30 100644 --- a/Physlib/Mathematics/VariationalCalculus/HasVarAdjDeriv.lean +++ b/Physlib/Mathematics/VariationalCalculus/HasVarAdjDeriv.lean @@ -66,8 +66,7 @@ lemma apply_smooth_of_smooth {F : (X → U) → (X → V)} {F' : (X → V) → ( fun_prop lemma apply_smooth_self {F : (X → U) → (X → V)} {F' : (X → V) → (X → U)} {u : X → U} - (h : HasVarAdjDerivAt F F' u) : ContDiff ℝ ∞ (F u) := by - exact h.apply_smooth_of_smooth (h.smooth_at) + (h : HasVarAdjDerivAt F F' u) : ContDiff ℝ ∞ (F u) := h.apply_smooth_of_smooth (h.smooth_at) lemma smooth_R {F : (X → U) → (X → V)} {F' : (X → V) → (X → U)} {u : X → U} (h : HasVarAdjDerivAt F F' u) {φ : ℝ → X → U} (hφ : ContDiff ℝ ∞ ↿φ) (x : X) : @@ -190,10 +189,8 @@ lemma comp {F : (Y → V) → (Z → W)} {G : (X → U) → (Y → V)} {u : X {F' G'} (hF : HasVarAdjDerivAt F F' (G u)) (hG : HasVarAdjDerivAt G G' u) : HasVarAdjDerivAt (fun u => F (G u)) (fun ψ => G' (F' ψ)) u where smooth_at := hG.smooth_at - diff := by - intro φ hφ - apply hF.diff (φ := fun t x => G (φ t) x) - exact hG.diff φ hφ + diff := fun φ hφ => + hF.diff (φ := fun t x => G (φ t) x) (hG.diff φ hφ) linearize := by intro φ hφ x rw[hF.linearize (fun t x => G (φ t) x) (hG.diff φ hφ)] @@ -408,8 +405,7 @@ lemma deriv' (u : ℝ → U) (hu : ContDiff ℝ ∞ u) : rw [← fderiv_apply_one_eq_deriv] rw [fderiv_swap] simp only [fderiv_eq_smul_deriv, one_smul] - · apply ContDiff.of_le hφ - exact ENat.LEInfty.out + · exact hφ.of_le ENat.LEInfty.out · exact differentiableAt_id adjoint := by apply HasVarAdjoint.congr_fun (G := (fun δu x => deriv (fun x' => δu x') x)) @@ -605,8 +601,7 @@ lemma mul · apply hG.diff; assumption linearize := by intro φ hφ x - rw [deriv_fun_mul, deriv_fun_mul] - rw [hF.linearize _ hφ, hG.linearize _ hφ] + rw [deriv_fun_mul, deriv_fun_mul, hF.linearize _ hφ, hG.linearize _ hφ] · simp · exact hF.differentiable_linear hφ x 0 · exact hG.differentiable_linear hφ x 0 @@ -683,11 +678,9 @@ protected lemma fderiv (u : X → U) (dx : X) (hu : ContDiff ℝ ∞ u) simp only [FunLike.coe_smul, Pi.smul_apply] exact (hφ.differentiable (by simp)).differentiableAt · intro φ hφ x - rw [← fderiv_apply_one_eq_deriv] - rw [fderiv_swap] + rw [← fderiv_apply_one_eq_deriv, fderiv_swap] simp only [fderiv_eq_smul_deriv, one_smul] - · apply ContDiff.of_le hφ - exact ENat.LEInfty.out + · exact hφ.of_le ENat.LEInfty.out · exact hu · exact HasVarAdjoint.fderiv_apply @@ -712,16 +705,12 @@ protected lemma gradient {d} (u : Space d → ℝ) (hu : ContDiff ℝ ∞ u) : simp only [Space.deriv] fun_prop · intro φ1 φ2 h1 h2 - rw [Space.gradient_eq_grad] - rw [Space.grad_add, Space.grad_eq_gradient, Space.grad_eq_gradient] - simp + rw [Space.gradient_eq_grad, Space.grad_add, Space.grad_eq_gradient, Space.grad_eq_gradient] rfl · exact h1.differentiable (by simp) · exact h2.differentiable (by simp) · intro c φ hφ - rw [Space.gradient_eq_grad] - rw [Space.grad_smul, Space.grad_eq_gradient] - simp + rw [Space.gradient_eq_grad, Space.grad_smul, Space.grad_eq_gradient] rfl exact hφ.differentiable (by simp) · intro φ hφ x @@ -733,11 +722,9 @@ protected lemma gradient {d} (u : Space d → ℝ) (hu : ContDiff ℝ ∞ u) : rw [deriv_smul_const] congr simp [Space.deriv] - rw [← fderiv_apply_one_eq_deriv] - rw [fderiv_swap] + rw [← fderiv_apply_one_eq_deriv, fderiv_swap] simp only [fderiv_eq_smul_deriv, smul_eq_mul, one_mul] - · apply ContDiff.of_le hφ - exact ENat.LEInfty.out + · exact hφ.of_le ENat.LEInfty.out · simp [Space.deriv] apply Differentiable.differentiableAt apply fderiv_uncurry_differentiable_snd_comp_fst_apply @@ -781,8 +768,7 @@ protected lemma grad {d} (u : Space d → ℝ) (hu : ContDiff ℝ ∞ u) : rw [← fderiv_apply_one_eq_deriv] rw [fderiv_swap] simp only [fderiv_eq_smul_deriv, smul_eq_mul, one_mul] - · apply ContDiff.of_le hφ - exact ENat.LEInfty.out + · exact hφ.of_le ENat.LEInfty.out · simp [Space.deriv] apply Differentiable.differentiableAt apply fderiv_uncurry_differentiable_snd_comp_fst_apply @@ -835,8 +821,7 @@ lemma div {d} (u : Space d → EuclideanSpace ℝ (Fin d)) (hu : ContDiff ℝ exact hφ.differentiable (by simp) · apply ContDiff.comp (g := EuclideanSpace.proj i) · fun_prop - · apply ContDiff.of_le hφ - exact ENat.LEInfty.out + · exact hφ.of_le ENat.LEInfty.out · intro i _ apply Differentiable.differentiableAt simp [Space.deriv] diff --git a/Physlib/Mathematics/VariationalCalculus/HasVarAdjoint.lean b/Physlib/Mathematics/VariationalCalculus/HasVarAdjoint.lean index dabe8bf76..ab984557b 100644 --- a/Physlib/Mathematics/VariationalCalculus/HasVarAdjoint.lean +++ b/Physlib/Mathematics/VariationalCalculus/HasVarAdjoint.lean @@ -99,13 +99,9 @@ lemma comp {F : (Y → V) → (Z → W)} {G : (X → U) → (Y → V)} {F' G'} lemma congr_fun {F G : (X → U) → (Y → V)} {F' : (Y → V) → (X → U)} (h : HasVarAdjoint G F') (h' : ∀ φ, IsTestFunction φ → F φ = G φ) : HasVarAdjoint F F' where - test_fun_preserving φ hφ := by - rw[h' _ hφ] - exact h.test_fun_preserving φ hφ + test_fun_preserving φ hφ := by simpa [h' φ hφ] using h.test_fun_preserving φ hφ test_fun_preserving' φ hφ := h.test_fun_preserving' φ hφ - adjoint φ ψ hφ hψ := by - rw [h' φ hφ] - exact h.adjoint φ ψ hφ hψ + adjoint φ ψ hφ hψ := by simpa [h' φ hφ] using h.adjoint φ ψ hφ hψ ext' := h.ext' lemma of_eq {F : (X → U) → (Y → V)} {F' G' : (Y → V) → (X → U)} @@ -113,12 +109,8 @@ lemma of_eq {F : (X → U) → (Y → V)} {F' G' : (Y → V) → (X → U)} (hlin : IsLocalizedFunctionTransform G') : HasVarAdjoint F G' where test_fun_preserving φ hφ := hF'.test_fun_preserving φ hφ - test_fun_preserving' φ hφ := by - rw [← h φ hφ] - exact hF'.test_fun_preserving' φ hφ - adjoint φ ψ hφ hψ := by - rw [← h ψ hψ] - exact hF'.adjoint φ ψ hφ hψ + test_fun_preserving' φ hφ := by simpa [← h φ hφ] using hF'.test_fun_preserving' φ hφ + adjoint φ ψ hφ hψ := by simpa [← h ψ hψ] using hF'.adjoint φ ψ hφ hψ ext' := hlin /-- Variational adjoint is unique only when applied to test functions. -/ @@ -129,8 +121,7 @@ lemma unique_on_test_functions {F : (X → U) → (Y → V)} {F' G' : (Y → V) obtain ⟨F_preserve_test, F'_preserve_test, F'_adjoint⟩ := hF' obtain ⟨F_preserve_test, G'_preserve_test, G'_adjoint⟩ := hG' intro φ hφ - rw [← zero_add (G' φ)] - rw [← sub_eq_iff_eq_add] + rw [← zero_add (G' φ), ← sub_eq_iff_eq_add] change (F' - G') φ = 0 apply fundamental_theorem_of_variational_calculus (@volume X _) · simp @@ -405,9 +396,7 @@ lemma clm_apply apply HasAdjoint.congr_adj apply ContinuousLinearMap.hasAdjoint funext y; simp[adjoint_eq_clm_adjoint] - ext' := by - intro K cK - exact ⟨K, cK, by intro _ _ hφ _ _; simp_all⟩ + ext' := fun K cK => ⟨K, cK, by intro _ _ hφ _ _; simp_all⟩ -- ext := IsLocalizedFunctionTransform.clm_apply _ protected lemma deriv : @@ -454,14 +443,12 @@ lemma fderiv_apply {dx} apply IsLocalizedFunctionTransform.neg apply IsLocalizedFunctionTransform.fderiv adjoint φ ψ hφ hψ := by - rw [← sub_eq_zero] - rw [← integral_sub] + rw [← sub_eq_zero, ← integral_sub] · trans ∫ (a : X), fderiv ℝ (fun a => ⟪φ a, ψ a⟫_ℝ) a dx · congr funext a simp only [inner_neg_right', sub_neg_eq_add] - rw [fderiv_inner_apply'] - rw [add_comm] + rw [fderiv_inner_apply', add_comm] · exact hφ.differentiable a · exact hψ.differentiable a · have h1 := integral_mul_fderiv_eq_neg_fderiv_mul_of_integrable (f := fun a => 1) @@ -695,9 +682,7 @@ lemma fst {F'} {F : (X → U) → (X → W×V)} HasVarAdjoint (fun φ x => (F φ x).1) (fun φ x => F' (fun x' => (φ x', 0)) x) where - test_fun_preserving _ hφ := by - apply IsTestFunction.prod_fst - exact hF.test_fun_preserving _ hφ + test_fun_preserving _ hφ := IsTestFunction.prod_fst (hF.test_fun_preserving _ hφ) test_fun_preserving' y hφ := by apply hF.test_fun_preserving' fun_prop @@ -721,9 +706,7 @@ lemma snd {F'} {F : (X → U) → (X → W×V)} HasVarAdjoint (fun φ x => (F φ x).2) (fun φ x => F' (fun x' => (0, φ x')) x) where - test_fun_preserving _ hφ := by - apply IsTestFunction.prod_snd - exact hF.test_fun_preserving _ hφ + test_fun_preserving _ hφ := IsTestFunction.prod_snd (hF.test_fun_preserving _ hφ) test_fun_preserving' y hφ := by apply hF.test_fun_preserving' _ fun_prop diff --git a/Physlib/Mathematics/VariationalCalculus/HasVarGradient.lean b/Physlib/Mathematics/VariationalCalculus/HasVarGradient.lean index 4698332a5..170644aae 100644 --- a/Physlib/Mathematics/VariationalCalculus/HasVarGradient.lean +++ b/Physlib/Mathematics/VariationalCalculus/HasVarGradient.lean @@ -72,8 +72,7 @@ lemma HasVarGradientAt.add (F F' : (X → U) → (X → ℝ)) obtain ⟨F1,hF1,eq1⟩ := h obtain ⟨F2,hF2,eq2⟩ := h' apply HasVarGradientAt.intro (F1 + F2) - · apply hF1.add (V := ℝ) - exact hF2 + · exact HasVarAdjDerivAt.add (V := ℝ) F F' F1 F2 u hF1 hF2 · simp rw [eq1, eq2] diff --git a/Physlib/Mathematics/VariationalCalculus/IsTestFunction.lean b/Physlib/Mathematics/VariationalCalculus/IsTestFunction.lean index dd3e9fbcb..748b65919 100644 --- a/Physlib/Mathematics/VariationalCalculus/IsTestFunction.lean +++ b/Physlib/Mathematics/VariationalCalculus/IsTestFunction.lean @@ -85,10 +85,9 @@ lemma IsTestFunction.pi {ι} [Fintype ι] {φ : X → ι → U} (hφ : ∀ i, Is refine exists_compact_iff_hasCompactSupport.mp ⟨⋃ i, K i, isCompact_iUnion (fun i => (hK i).1), fun x hx => ?_⟩ simp at hx - conv_lhs => - enter [i] - rw [(hK i).2 x (hx i)] - rfl + apply funext + intro i + exact (hK i).2 x (hx i) lemma IsTestFunction.space_component {φ : X → Space d} (hφ : IsTestFunction φ) : IsTestFunction (fun x => φ x i) where @@ -208,8 +207,7 @@ lemma IsTestFunction.linearMap_comp {f : X → V} (hf : IsTestFunction f) lemma IsTestFunction.family_linearMap_comp {f : X → V} (hf : IsTestFunction f) {g : X → V →L[ℝ] U} (hg : ContDiff ℝ ∞ g) : IsTestFunction (fun x => g x (f x)) where - smooth := by - fun_prop + smooth := by fun_prop supp := by have hf' := hf.supp rw [← exists_compact_iff_hasCompactSupport] at hf' ⊢ @@ -232,9 +230,7 @@ lemma IsTestFunction.of_fderiv {f : X → U} (hf : IsTestFunction f) : · fun_prop · fun_prop · exact Preorder.le_refl (∞ + 1) - supp := by - apply HasCompactSupport.fderiv - exact hf.supp + supp := HasCompactSupport.fderiv ℝ hf.supp @[fun_prop] lemma IsTestFunction.fderiv_apply {f : X → U} (hf : IsTestFunction f) (δx : X) : @@ -245,9 +241,7 @@ lemma IsTestFunction.fderiv_apply {f : X → U} (hf : IsTestFunction f) (δx : X · fun_prop · fun_prop · exact Preorder.le_refl (∞ + 1) - supp := by - apply HasCompactSupport.fderiv_apply - exact hf.supp + supp := HasCompactSupport.fderiv_apply ℝ hf.supp δx open InnerProductSpace' in @[fun_prop] diff --git a/Physlib/Particles/BeyondTheStandardModel/RHN/AnomalyCancellation/Basic.lean b/Physlib/Particles/BeyondTheStandardModel/RHN/AnomalyCancellation/Basic.lean index e7c308607..ebaea736e 100644 --- a/Physlib/Particles/BeyondTheStandardModel/RHN/AnomalyCancellation/Basic.lean +++ b/Physlib/Particles/BeyondTheStandardModel/RHN/AnomalyCancellation/Basic.lean @@ -33,10 +33,7 @@ namespace SMνCharges variable {n : ℕ} lemma sum_one [AddCommMonoid M] (f : Fin (SMνSpecies 1).numberCharges → M) : - ∑ i, f i = f ⟨0, by simp⟩ := by - change ∑ (i : Fin 1), f i = _ - simp only [Finset.univ_unique, Fin.default_eq_zero, Fin.isValue, Finset.sum_singleton] - rfl + ∑ i, f i = f ⟨0, by simp⟩ := Fin.sum_univ_one f /-- An equivalence between `(SMνCharges n).charges` and `(Fin 6 → Fin n → ℚ)` splitting the charges into species. -/ @@ -55,8 +52,7 @@ lemma charges_eq_toSpecies_eq (S T : (SMνCharges n).Charges) : S = T ↔ ∀ i, toSpecies i S = toSpecies i T := by refine Iff.intro (fun h => ?_) (fun h => ?_) · exact fun i => congrArg (⇑(toSpecies i)) h - · apply toSpeciesEquiv.injective - exact funext (fun i => h i) + · exact toSpeciesEquiv.injective (funext (fun i => h i)) lemma toSMSpecies_toSpecies_inv (i : Fin 6) (f : Fin 6 → Fin n → ℚ) : (toSpecies i) (toSpeciesEquiv.symm f) = f i := by @@ -258,8 +254,7 @@ def quadBiLin : BiLinearSymm (SMνCharges n).Charges := BiLinearSymm.mk₂ lemma quadBiLin_decomp (S T : (SMνCharges n).Charges) : quadBiLin S T = ∑ i, Q S i * Q T i - 2 * ∑ i, U S i * U T i + ∑ i, D S i * D T i - ∑ i, L S i * L T i + ∑ i, E S i * E T i := by - rw [quadBiLin] - rw [BiLinearSymm.mk₂_toFun_apply] + rw [quadBiLin, BiLinearSymm.mk₂_toFun_apply] repeat rw [Finset.sum_add_distrib] repeat rw [← Finset.mul_sum] simp only [toSpecies_apply, Fin.isValue, neg_mul, one_mul, add_left_inj] @@ -325,8 +320,7 @@ lemma cubeTriLin_decomp (S T R : (SMνCharges n).Charges) : cubeTriLin S T R = 6 * ∑ i, (Q S i * Q T i * Q R i) + 3 * ∑ i, (U S i * U T i * U R i) + 3 * ∑ i, (D S i * D T i * D R i) + 2 * ∑ i, (L S i * L T i * L R i) + ∑ i, (E S i * E T i * E R i) + ∑ i, (N S i * N T i * N R i) := by - rw [cubeTriLin] - rw [TriLinearSymm.mk₃_toFun_apply_apply] + rw [cubeTriLin, TriLinearSymm.mk₃_toFun_apply_apply] repeat rw [Finset.sum_add_distrib] repeat rw [← Finset.mul_sum] diff --git a/Physlib/Particles/BeyondTheStandardModel/RHN/AnomalyCancellation/FamilyMaps.lean b/Physlib/Particles/BeyondTheStandardModel/RHN/AnomalyCancellation/FamilyMaps.lean index a9725b545..40d49aed1 100644 --- a/Physlib/Particles/BeyondTheStandardModel/RHN/AnomalyCancellation/FamilyMaps.lean +++ b/Physlib/Particles/BeyondTheStandardModel/RHN/AnomalyCancellation/FamilyMaps.lean @@ -32,8 +32,7 @@ def chargesMapOfSpeciesMap {n m : ℕ} (f : (SMνSpecies n).Charges →ₗ[ℚ] map_smul' a S := by rw [charges_eq_toSpecies_eq] intro i - rw [map_smul, toSMSpecies_toSpecies_inv, toSMSpecies_toSpecies_inv, map_smul] - rfl + simp [toSMSpecies_toSpecies_inv] lemma chargesMapOfSpeciesMap_toSpecies {n m : ℕ} (f : (SMνSpecies n).Charges →ₗ[ℚ] (SMνSpecies m).Charges) @@ -76,8 +75,7 @@ def speciesEmbed (m n : ℕ) : eq_ratCast, Rat.cast_eq_id, id_eq] by_cases hi : i.val < m · rw [dif_pos hi, dif_pos hi] - · rw [dif_neg hi, dif_neg hi] - exact Eq.symm (Rat.mul_zero a) + · simp [dif_neg hi] /-- The embedding of the `m`-family charges onto the `n`-family charges, with all other charges zero. -/ @@ -100,8 +98,7 @@ def familyUniversal (n : ℕ) : (SMνCharges 1).Charges →ₗ[ℚ] (SMνCharges lemma toSpecies_familyUniversal {n : ℕ} (j : Fin 6) (S : (SMνCharges 1).Charges) (i : Fin n) : toSpecies j (familyUniversal n S) i = toSpecies j S ⟨0, by simp⟩ := by - rw [familyUniversal, chargesMapOfSpeciesMap_toSpecies] - rfl + exact congrFun (chargesMapOfSpeciesMap_toSpecies (speciesFamilyUniversial n) S j) i set_option backward.isDefEq.respectTransparency false in lemma sum_familyUniversal {n : ℕ} (m : ℕ) (S : (SMνCharges 1).Charges) (j : Fin 6) : @@ -130,8 +127,7 @@ lemma sum_familyUniversal_two {n : ℕ} (S : (SMνCharges 1).Charges) Fin.isValue, Nat.reduceMul] rw [Finset.mul_sum] refine Finset.sum_congr rfl (fun i _ => ?_) - erw [toSpecies_familyUniversal] - rfl + exact congrArg (fun x => x * T (finProdFinEquiv (j, i))) (toSpecies_familyUniversal j S i) set_option backward.isDefEq.respectTransparency false in lemma sum_familyUniversal_three {n : ℕ} (S : (SMνCharges 1).Charges) diff --git a/Physlib/Particles/BeyondTheStandardModel/RHN/AnomalyCancellation/PlusU1/BMinusL.lean b/Physlib/Particles/BeyondTheStandardModel/RHN/AnomalyCancellation/PlusU1/BMinusL.lean index a3f4f6a30..5bbf06c83 100644 --- a/Physlib/Particles/BeyondTheStandardModel/RHN/AnomalyCancellation/PlusU1/BMinusL.lean +++ b/Physlib/Particles/BeyondTheStandardModel/RHN/AnomalyCancellation/PlusU1/BMinusL.lean @@ -79,8 +79,7 @@ lemma add_AFL_quad (S : (PlusU1 n).LinSols) (a b : ℚ) : lemma add_quad (S : (PlusU1 n).QuadSols) (a b : ℚ) : accQuad (a • S.val + b • (BL n).val) = 0 := by - rw [add_AFL_quad, quadSol S] - exact Rat.mul_zero (a ^ 2) + exact (add_AFL_quad S.1 a b).trans (mul_eq_zero_of_right (a ^ 2) (quadSol S)) /-- The `QuadSol` obtained by adding $B-L$ to a `QuadSol`. -/ def addQuad (S : (PlusU1 n).QuadSols) (a b : ℚ) : (PlusU1 n).QuadSols := diff --git a/Physlib/Particles/BeyondTheStandardModel/RHN/AnomalyCancellation/PlusU1/Basic.lean b/Physlib/Particles/BeyondTheStandardModel/RHN/AnomalyCancellation/PlusU1/Basic.lean index 8fb0b8bcd..e55585d60 100644 --- a/Physlib/Particles/BeyondTheStandardModel/RHN/AnomalyCancellation/PlusU1/Basic.lean +++ b/Physlib/Particles/BeyondTheStandardModel/RHN/AnomalyCancellation/PlusU1/Basic.lean @@ -66,8 +66,7 @@ lemma quadSol (S : (PlusU1 n).QuadSols) : accQuad S.val = 0 := by simp only [PlusU1_quadraticACCs] at hS exact hS ⟨0, by simp⟩ -lemma cubeSol (S : (PlusU1 n).Sols) : accCube S.val = 0 := by - exact S.cubicSol +lemma cubeSol (S : (PlusU1 n).Sols) : accCube S.val = 0 := S.cubicSol /-- An element of `charges` which satisfies the linear ACCs gives us a element of `LinSols`. -/ diff --git a/Physlib/Particles/BeyondTheStandardModel/RHN/AnomalyCancellation/PlusU1/HyperCharge.lean b/Physlib/Particles/BeyondTheStandardModel/RHN/AnomalyCancellation/PlusU1/HyperCharge.lean index a7be87e52..3e250acee 100644 --- a/Physlib/Particles/BeyondTheStandardModel/RHN/AnomalyCancellation/PlusU1/HyperCharge.lean +++ b/Physlib/Particles/BeyondTheStandardModel/RHN/AnomalyCancellation/PlusU1/HyperCharge.lean @@ -76,8 +76,7 @@ lemma add_AFL_quad (S : (PlusU1 n).LinSols) (a b : ℚ) : simp lemma add_quad (S : (PlusU1 n).QuadSols) (a b : ℚ) : - accQuad (a • S.val + b • (Y n).val) = 0 := by - rw [add_AFL_quad, quadSol S]; simp + accQuad (a • S.val + b • (Y n).val) = 0 := by rw [add_AFL_quad, quadSol S]; simp /-- The `QuadSol` obtained by adding hypercharge to a `QuadSol`. -/ def addQuad (S : (PlusU1 n).QuadSols) (a b : ℚ) : (PlusU1 n).QuadSols := diff --git a/Physlib/Particles/BeyondTheStandardModel/RHN/AnomalyCancellation/PlusU1/PlaneNonSols.lean b/Physlib/Particles/BeyondTheStandardModel/RHN/AnomalyCancellation/PlusU1/PlaneNonSols.lean index 519735102..a286cc98e 100644 --- a/Physlib/Particles/BeyondTheStandardModel/RHN/AnomalyCancellation/PlusU1/PlaneNonSols.lean +++ b/Physlib/Particles/BeyondTheStandardModel/RHN/AnomalyCancellation/PlusU1/PlaneNonSols.lean @@ -87,8 +87,7 @@ lemma Bi_sum_quad (i : Fin 11) (f : Fin 11 → ℚ) : rw [quadBiLin.map_sum₂, Fintype.sum_eq_single i] · rw [quadBiLin.map_smul₂] · intro k hij - rw [quadBiLin.map_smul₂, Bi_Bj_quad hij.symm] - exact Rat.mul_zero (f k) + simpa [quadBiLin.map_smul₂] using mul_eq_zero_of_right (f k) (Bi_Bj_quad hij.symm) /-- The coefficients of the quadratic equation in our basis. -/ @[simp] diff --git a/Physlib/Particles/BeyondTheStandardModel/RHN/AnomalyCancellation/PlusU1/QuadSolToSol.lean b/Physlib/Particles/BeyondTheStandardModel/RHN/AnomalyCancellation/PlusU1/QuadSolToSol.lean index 594c080ce..cf52cc138 100644 --- a/Physlib/Particles/BeyondTheStandardModel/RHN/AnomalyCancellation/PlusU1/QuadSolToSol.lean +++ b/Physlib/Particles/BeyondTheStandardModel/RHN/AnomalyCancellation/PlusU1/QuadSolToSol.lean @@ -51,8 +51,7 @@ lemma BL_add_α₁_α₂_cube (S : (PlusU1 n).QuadSols) : ring lemma BL_add_α₁_α₂_AF (S : (PlusU1 n).Sols) : - BL.addQuad S.1 (α₁ S.1) (α₂ S.1) = (α₁ S.1) • S.1 := by - rw [α₂_AF, BL.addQuad_zero] + BL.addQuad S.1 (α₁ S.1) (α₂ S.1) = (α₁ S.1) • S.1 := by rw [α₂_AF, BL.addQuad_zero] /-- The construction of a `Sol` from a `QuadSol` in the generic case. -/ def generic (S : (PlusU1 n).QuadSols) : (PlusU1 n).Sols := @@ -60,13 +59,10 @@ def generic (S : (PlusU1 n).QuadSols) : (PlusU1 n).Sols := lemma generic_on_AF (S : (PlusU1 n).Sols) : generic S.1 = (α₁ S.1) • S := by apply ACCSystem.Sols.ext - change (BL.addQuad S.1 (α₁ S.1) (α₂ S.1)).val = _ - rw [BL_add_α₁_α₂_AF] - rfl + exact congrArg (fun Q : (PlusU1 n).QuadSols => Q.val) (BL_add_α₁_α₂_AF S) lemma generic_on_AF_α₁_ne_zero (S : (PlusU1 n).Sols) (h : α₁ S.1 ≠ 0) : - (α₁ S.1)⁻¹ • generic S.1 = S := by - rw [generic_on_AF, smul_smul, inv_mul_cancel₀ h, one_smul] + (α₁ S.1)⁻¹ • generic S.1 = S := by rw [generic_on_AF, smul_smul, inv_mul_cancel₀ h, one_smul] /-- The construction of a `Sol` from a `QuadSol` in the case when `α₁ S = 0` and `α₂ S = 0`. -/ def special (S : (PlusU1 n).QuadSols) (a b : ℚ) (h1 : α₁ S = 0) (h2 : α₂ S = 0) : diff --git a/Physlib/Particles/BeyondTheStandardModel/TwoHDM/GramMatrix.lean b/Physlib/Particles/BeyondTheStandardModel/TwoHDM/GramMatrix.lean index e6e319dba..6623c009b 100644 --- a/Physlib/Particles/BeyondTheStandardModel/TwoHDM/GramMatrix.lean +++ b/Physlib/Particles/BeyondTheStandardModel/TwoHDM/GramMatrix.lean @@ -99,18 +99,15 @@ lemma gaugeGroupI_exists_fst_eq {H : TwoHiggsDoublet} (h1 : H.Φ1 ≠ 0) : simp at h simp [h] have h_fst : (g • H.Φ2).ofLp 0 = ⟪H.Φ1, H.Φ2⟫_ℂ / ‖H.Φ1‖ := by - have h2 : ⟪H.Φ1, H.Φ2⟫_ℂ = ⟪g • H.Φ1, g • H.Φ2⟫_ℂ := by - simp + have h2 : ⟪H.Φ1, H.Φ2⟫_ℂ = ⟪g • H.Φ1, g • H.Φ2⟫_ℂ := by simp rw [h] at h2 conv_rhs at h2 => simp [PiLp.inner_apply] rw [h2] - have hx : (‖H.Φ1‖ : ℂ) ≠ 0 := by - simp_all + have hx : (‖H.Φ1‖ : ℂ) ≠ 0 := by simp_all field_simp apply And.intro h_fst - have hx : ‖g • H.Φ2‖ ^ 2 = ‖H.Φ2‖ ^ 2 := by - simp + have hx : ‖g • H.Φ2‖ ^ 2 = ‖H.Φ2‖ ^ 2 := by simp rw [PiLp.norm_sq_eq_of_L2] at hx simp at hx have hx0 : ‖(g • H.Φ2).ofLp 1‖ ^ 2 = ‖H.Φ2‖ ^ 2 - ‖(g • H.Φ2).ofLp 0‖ ^ 2 := by @@ -184,8 +181,7 @@ lemma mem_orbit_gaugeGroupI_iff_gramMatrix (H1 H2 : TwoHiggsDoublet) : obtain ⟨g1, H1_Φ1, H1_Φ2⟩ := gaugeGroupI_exists_fst_eq_snd_eq (H := H1) Φ1_zero have Φ2_nezero : H2.Φ1 ≠ 0 := by intro hzero - have hnorm : ‖H1.Φ1‖ = ‖H2.Φ1‖ := by - rw [← eq_fst_norm_of_eq_gramMatrix h] + have hnorm : ‖H1.Φ1‖ = ‖H2.Φ1‖ := by rw [← eq_fst_norm_of_eq_gramMatrix h] simp [hzero] at hnorm simp [hnorm] at Φ1_zero obtain ⟨g2, H2_Φ1, H2_Φ2⟩ := gaugeGroupI_exists_fst_eq_snd_eq (H := H2) Φ2_nezero @@ -236,8 +232,7 @@ lemma gramMatrix_surjective_det_tr (K : Matrix (Fin 2) (Fin 2) ℂ) have det_eq_abc : K.det = a * b - ‖c‖ ^ 2 := by simp [hK_explicit2] rw [Complex.mul_conj'] - have tra_eq_abc : K.trace.re = a + b := by - simp [hK_explicit2] + have tra_eq_abc : K.trace.re = a + b := by simp [hK_explicit2] simp [det_eq_abc, ← Complex.ofReal_pow] at hKdet rw [tra_eq_abc] at hKtr rw [hK_explicit2] @@ -255,8 +250,7 @@ lemma gramMatrix_surjective_det_tr (K : Matrix (Fin 2) (Fin 2) ℂ) simp [PiLp.norm_eq_of_L2, ← Complex.ofReal_pow] exact Real.sq_sqrt hb_nonneg /- The case when a ≠ 0. -/ - have h1 : (√a : ℂ) ≠ 0 := by - simp_all + have h1 : (√a : ℂ) ≠ 0 := by simp_all use ⟨(!₂[√a, 0] : HiggsVec), !₂[conj c/ √a, √(a * b - ‖c‖ ^ 2) / √a]⟩ ext i j fin_cases i <;> fin_cases j <;> simp [gramMatrix, PiLp.norm_eq_of_L2, ← Complex.ofReal_pow] diff --git a/Physlib/Particles/FlavorPhysics/CKMMatrix/PhaseFreedom.lean b/Physlib/Particles/FlavorPhysics/CKMMatrix/PhaseFreedom.lean index 36dba588d..a454c85b4 100644 --- a/Physlib/Particles/FlavorPhysics/CKMMatrix/PhaseFreedom.lean +++ b/Physlib/Particles/FlavorPhysics/CKMMatrix/PhaseFreedom.lean @@ -97,8 +97,7 @@ lemma shift_tb_phase_zero {V : CKMMatrix} (h1 : t + b = - arg [V]tb) : lemma shift_cd_phase_pi {V : CKMMatrix} (h1 : c + d = Real.pi - arg [V]cd) : [phaseShiftApply V u c t d s b]cd = - VcdAbs ⟦V⟧ := by - rw [phaseShiftApply.cd] - rw [← norm_mul_exp_arg_mul_I [V]cd] + rw [phaseShiftApply.cd, ← norm_mul_exp_arg_mul_I [V]cd] rw [mul_comm, mul_assoc, ← exp_add] have h2 : ↑(arg [V]cd) * I + (↑c * I + ↑d * I) = ↑(arg [V]cd + (c + d)) * I := by simp only [Fin.isValue, ofReal_add] diff --git a/Physlib/Particles/FlavorPhysics/CKMMatrix/Relations.lean b/Physlib/Particles/FlavorPhysics/CKMMatrix/Relations.lean index 18358a9bc..f16cc2013 100644 --- a/Physlib/Particles/FlavorPhysics/CKMMatrix/Relations.lean +++ b/Physlib/Particles/FlavorPhysics/CKMMatrix/Relations.lean @@ -221,8 +221,7 @@ lemma conj_Vtb_mul_Vud {V : CKMMatrix} {τ : ℝ} simp only [neg_mul, exp_neg, Fin.isValue, ne_eq, exp_ne_zero, not_false_eq_true, mul_inv_cancel_left₀] have h2 : ([V]cs * [V]ud - [V]us * [V]cd) * conj [V]ud = [V]cs - * [V]ud * conj [V]ud - [V]us * ([V]cd * conj [V]ud) := by - ring + * [V]ud * conj [V]ud - [V]us * ([V]cd * conj [V]ud) := by ring rw [h2, V.Vcd_mul_conj_Vud] rw [normSq_eq_conj_mul_self, normSq_eq_conj_mul_self] simp only [Fin.isValue, neg_mul] @@ -236,8 +235,7 @@ lemma conj_Vtb_mul_Vus {V : CKMMatrix} {τ : ℝ} simp only [neg_mul, exp_neg, Fin.isValue, ne_eq, exp_ne_zero, not_false_eq_true, mul_inv_cancel_left₀, neg_add_rev] have h2 : ([V]cs * [V]ud - [V]us * [V]cd) * conj [V]us = ([V]cs - * conj [V]us) * [V]ud - [V]us * [V]cd * conj [V]us := by - ring + * conj [V]us) * [V]ud - [V]us * [V]cd * conj [V]us := by ring rw [h2, V.Vcs_mul_conj_Vus] rw [normSq_eq_conj_mul_self, normSq_eq_conj_mul_self] simp only [Fin.isValue, neg_mul] diff --git a/Physlib/Particles/FlavorPhysics/CKMMatrix/Rows.lean b/Physlib/Particles/FlavorPhysics/CKMMatrix/Rows.lean index 8c8998beb..db248587e 100644 --- a/Physlib/Particles/FlavorPhysics/CKMMatrix/Rows.lean +++ b/Physlib/Particles/FlavorPhysics/CKMMatrix/Rows.lean @@ -207,8 +207,7 @@ lemma cRow_cross_tRow_eq_uRow (V : CKMMatrix) : rw [← hg, smul_smul, inv_mul_cancel₀, one_smul] by_contra hn simp [hn] at h2 - have hg2 : norm (g 0)⁻¹ = 1 := by - simp [h2] + have hg2 : norm (g 0)⁻¹ = 1 := by simp [h2] have hg22 : ∃ (τ : ℝ), (g 0)⁻¹ = Complex.exp (τ * I) := by rw [← norm_mul_exp_arg_mul_I (g 0)⁻¹, hg2] use arg (g 0)⁻¹ @@ -216,8 +215,7 @@ lemma cRow_cross_tRow_eq_uRow (V : CKMMatrix) : obtain ⟨τ, hτ⟩ := hg22 use τ rw [hx, hτ] - · have hx : norm (g 0) = -1 := by - simp [← ofReal_inj, Fin.isValue, ofReal_neg, ofReal_one, h2] + · have hx : norm (g 0) = -1 := by simp [← ofReal_inj, Fin.isValue, ofReal_neg, ofReal_one, h2] have h3 := norm_nonneg (g 0) simp_all only [ofReal_neg, ofReal_one, Left.nonneg_neg_iff] have h4 : (0 : ℝ) < 1 := by norm_num @@ -247,8 +245,7 @@ lemma uRow_cross_cRow_eq_tRow (V : CKMMatrix) : ofReal_eq_one] at h2 cases' h2 with h2 h2 swap - · have hx : norm (g 2) = -1 := by - simp [h2, ← ofReal_inj, Fin.isValue, ofReal_neg, ofReal_one] + · have hx : norm (g 2) = -1 := by simp [h2, ← ofReal_inj, Fin.isValue, ofReal_neg, ofReal_one] have h3 := norm_nonneg (g 2) simp_all only [ofReal_neg, ofReal_one, Left.nonneg_neg_iff] have h4 : (0 : ℝ) < 1 := by norm_num @@ -257,8 +254,7 @@ lemma uRow_cross_cRow_eq_tRow (V : CKMMatrix) : rw [← hg, @smul_smul, inv_mul_cancel₀, one_smul] by_contra hn simp [hn] at h2 - have hg2 : norm (g 2)⁻¹ = 1 := by - simp [h2] + have hg2 : norm (g 2)⁻¹ = 1 := by simp [h2] have hg22 : ∃ (τ : ℝ), (g 2)⁻¹ = Complex.exp (τ * I) := by rw [← norm_mul_exp_arg_mul_I (g 2)⁻¹] use arg (g 2)⁻¹ diff --git a/Physlib/Particles/FlavorPhysics/CKMMatrix/StandardParameterization/StandardParameters.lean b/Physlib/Particles/FlavorPhysics/CKMMatrix/StandardParameterization/StandardParameters.lean index 63a9f9b0e..6f7d04085 100644 --- a/Physlib/Particles/FlavorPhysics/CKMMatrix/StandardParameterization/StandardParameters.lean +++ b/Physlib/Particles/FlavorPhysics/CKMMatrix/StandardParameterization/StandardParameters.lean @@ -155,21 +155,17 @@ lemma S₂₃_of_Vub_eq_one {V : Quotient CKMMatrixSetoid} (ha : VubAbs V = 1) : rw [S₂₃, if_pos ha] lemma S₂₃_of_Vub_ne_one {V : Quotient CKMMatrixSetoid} (ha : VubAbs V ≠ 1) : - S₂₃ V = VcbAbs V / √ (VudAbs V ^ 2 + VusAbs V ^ 2) := by - rw [S₂₃, if_neg ha] + S₂₃ V = VcbAbs V / √ (VudAbs V ^ 2 + VusAbs V ^ 2) := by rw [S₂₃, if_neg ha] end sines section cosines -lemma C₁₂_eq_ℂcos_θ₁₂ (V : Quotient CKMMatrixSetoid) : Complex.cos (θ₁₂ V) = C₁₂ V := by - simp [C₁₂] +lemma C₁₂_eq_ℂcos_θ₁₂ (V : Quotient CKMMatrixSetoid) : Complex.cos (θ₁₂ V) = C₁₂ V := by simp [C₁₂] -lemma C₁₃_eq_ℂcos_θ₁₃ (V : Quotient CKMMatrixSetoid) : Complex.cos (θ₁₃ V) = C₁₃ V := by - simp [C₁₃] +lemma C₁₃_eq_ℂcos_θ₁₃ (V : Quotient CKMMatrixSetoid) : Complex.cos (θ₁₃ V) = C₁₃ V := by simp [C₁₃] -lemma C₂₃_eq_ℂcos_θ₂₃ (V : Quotient CKMMatrixSetoid) : Complex.cos (θ₂₃ V) = C₂₃ V := by - simp [C₂₃] +lemma C₂₃_eq_ℂcos_θ₂₃ (V : Quotient CKMMatrixSetoid) : Complex.cos (θ₂₃ V) = C₂₃ V := by simp [C₂₃] lemma complexAbs_cos_θ₁₂ (V : Quotient CKMMatrixSetoid) : norm (Complex.cos (θ₁₂ V)) = cos (θ₁₂ V) := by @@ -541,8 +537,7 @@ lemma eq_standParam_of_ubOnePhaseCond {V : CKMMatrix} (hV : ubOnePhaseCond V) : rw [C₁₂_eq_ℂcos_θ₁₂ ⟦V⟧, C₁₂_of_Vub_one h1] rw [S₁₃_eq_ℂsin_θ₁₃ ⟦V⟧, S₁₃_of_Vub_one h1] simp only [Fin.isValue, ofReal_one, one_mul, ofReal_zero, mul_one, VcdAbs, zero_mul, sub_zero] - have h3 : (Real.cos (θ₂₃ ⟦V⟧) : ℂ) = √(1 - S₂₃ ⟦V⟧ ^ 2) := by - rw [θ₂₃, Real.cos_arcsin] + have h3 : (Real.cos (θ₂₃ ⟦V⟧) : ℂ) = √(1 - S₂₃ ⟦V⟧ ^ 2) := by rw [θ₂₃, Real.cos_arcsin] simp only [ofReal_cos] at h3 rw [h3, S₂₃_of_Vub_eq_one h1, hV.2.2.2.2.2.2] · simp only [cRow, Fin.isValue, Fin.reduceFinMk, cons_val_two, Nat.succ_eq_add_one, diff --git a/Physlib/Particles/StandardModel/AnomalyCancellation/Basic.lean b/Physlib/Particles/StandardModel/AnomalyCancellation/Basic.lean index bfddec06f..56b4baa1d 100644 --- a/Physlib/Particles/StandardModel/AnomalyCancellation/Basic.lean +++ b/Physlib/Particles/StandardModel/AnomalyCancellation/Basic.lean @@ -33,10 +33,7 @@ variable {n : ℕ} lemma sum_SMSpecies_numberCharges_one {M} [AddCommMonoid M] (f : Fin (SMSpecies 1).numberCharges → M) : - ∑ i, f i = f ⟨0, by simp⟩ := by - change ∑ (i : Fin 1), f i = _ - simp only [Finset.univ_unique, Fin.default_eq_zero, Fin.isValue, Finset.sum_singleton] - rfl + ∑ i, f i = f ⟨0, by simp⟩ := Fin.sum_univ_one f /-- An equivalence between the set `(SMCharges n).charges` and the set `(Fin 5 → Fin n → ℚ)`. -/ diff --git a/Physlib/Particles/StandardModel/AnomalyCancellation/FamilyMaps.lean b/Physlib/Particles/StandardModel/AnomalyCancellation/FamilyMaps.lean index a0730be03..62a33bcfa 100644 --- a/Physlib/Particles/StandardModel/AnomalyCancellation/FamilyMaps.lean +++ b/Physlib/Particles/StandardModel/AnomalyCancellation/FamilyMaps.lean @@ -36,8 +36,7 @@ def chargesMapOfSpeciesMap {n m : ℕ} (f : (SMSpecies n).Charges →ₗ[ℚ] (S intro i rw [map_smul] rw [toSMSpecies_toSpecies_inv, toSMSpecies_toSpecies_inv] - rw [map_smul] - rfl + exact (f.comp (toSpecies i)).map_smul a S /-- The projection of the `m`-family charges onto the first `n`-family charges for species. -/ @[simps!] @@ -73,8 +72,7 @@ def speciesEmbed (m n : ℕ) : simp only [HSMul.hSMul, ACCSystemCharges.chargesModule_smul, eq_ratCast, Rat.cast_eq_id, id_eq] by_cases hi : i.val < m · rw [dif_pos hi, dif_pos hi] - · rw [dif_neg hi, dif_neg hi] - exact Eq.symm (Rat.mul_zero a) + · simp [dif_neg hi] /-- The embedding of the `m`-family charges onto the `n`-family charges, with all other charges zero. -/ diff --git a/Physlib/Particles/StandardModel/AnomalyCancellation/NoGrav/Basic.lean b/Physlib/Particles/StandardModel/AnomalyCancellation/NoGrav/Basic.lean index d7da16d48..f26e674d9 100644 --- a/Physlib/Particles/StandardModel/AnomalyCancellation/NoGrav/Basic.lean +++ b/Physlib/Particles/StandardModel/AnomalyCancellation/NoGrav/Basic.lean @@ -31,9 +31,7 @@ def SMNoGrav (n : ℕ) : ACCSystem where | 0 => @accSU2 n | 1 => accSU3 numberQuadratic := 0 - quadraticACCs := by - intro i - exact Fin.elim0 i + quadraticACCs := fun i => Fin.elim0 i cubicACC := accCube namespace SMNoGrav diff --git a/Physlib/Particles/StandardModel/AnomalyCancellation/NoGrav/One/LinearParameterization.lean b/Physlib/Particles/StandardModel/AnomalyCancellation/NoGrav/One/LinearParameterization.lean index efb447d2f..aad78b182 100644 --- a/Physlib/Particles/StandardModel/AnomalyCancellation/NoGrav/One/LinearParameterization.lean +++ b/Physlib/Particles/StandardModel/AnomalyCancellation/NoGrav/One/LinearParameterization.lean @@ -82,8 +82,7 @@ def asLinear (S : linearParameters) : (SMNoGrav 1).LinSols := LinearMap.coe_mk, AddHom.coe_mk, speciesVal, asCharges, neg_add_rev] ring) -lemma asLinear_val (S : linearParameters) : S.asLinear.val = S.asCharges := by - rfl +lemma asLinear_val (S : linearParameters) : S.asLinear.val = S.asCharges := rfl set_option backward.isDefEq.respectTransparency false in lemma cubic (S : linearParameters) : @@ -295,8 +294,7 @@ lemma cubic (S : linearParametersQENeqZero) : field_simp simp [hQ] ring_nf - have h1 : -216 - S.v ^ 3 * 216 - S.w ^ 3 * 216 = - 216 *(S.v ^3 + S.w ^3 +1) := by - ring + have h1 : -216 - S.v ^ 3 * 216 - S.w ^ 3 * 216 = - 216 *(S.v ^3 + S.w ^3 +1) := by ring rw [h1] simp_all exact add_eq_zero_iff_eq_neg diff --git a/Physlib/Particles/StandardModel/Basic.lean b/Physlib/Particles/StandardModel/Basic.lean index 18c72a2fe..42bbacfc6 100644 --- a/Physlib/Particles/StandardModel/Basic.lean +++ b/Physlib/Particles/StandardModel/Basic.lean @@ -141,8 +141,7 @@ noncomputable def gaugeGroupℤ₆SU3OfRoot (α : rootsOfUnity 6 ℂ) : let z : ℂ := ((α : ℂˣ) : ℂ) ⟨scalar (Fin 3) (z ^ 2), by rw [mem_specialUnitaryGroup_iff] - have hz : ‖z‖ = 1 := by - simpa [z] using Complex.norm_eq_one_of_mem_rootsOfUnity α.prop + have hz : ‖z‖ = 1 := by simpa [z] using Complex.norm_eq_one_of_mem_rootsOfUnity α.prop have hz2 : star (z ^ 2) * z ^ 2 = 1 := by rw [RCLike.star_def, Complex.conj_mul', Complex.norm_pow, hz] norm_num @@ -152,8 +151,7 @@ noncomputable def gaugeGroupℤ₆SU3OfRoot (α : rootsOfUnity 6 ℂ) : Matrix.diagonal_mul_diagonal, Matrix.diagonal_eq_one] funext i simpa [Pi.star_def] using hz2 - · have hα : z ^ 6 = 1 := by - simpa [z] using (mem_rootsOfUnity' 6 (α : ℂˣ)).mp α.prop + · have hα : z ^ 6 = 1 := by simpa [z] using (mem_rootsOfUnity' 6 (α : ℂˣ)).mp α.prop rw [Matrix.scalar_apply, Matrix.det_diagonal, Fin.prod_univ_three] calc z ^ 2 * z ^ 2 * z ^ 2 = z ^ 6 := by ring @@ -172,8 +170,7 @@ noncomputable def gaugeGroupℤ₆SU2OfRoot (α : rootsOfUnity 6 ℂ) : star ((u ^ 3 : unitary ℂ) : ℂ) = 1 rw [star_star] exact (u ^ 3 : unitary ℂ).prop.2 - have hα : z ^ 6 = 1 := by - simpa [z] using (mem_rootsOfUnity' 6 (α : ℂˣ)).mp α.prop + have hα : z ^ 6 = 1 := by simpa [z] using (mem_rootsOfUnity' 6 (α : ℂˣ)).mp α.prop have hw2 : w ^ 2 = 1 := by calc w ^ 2 = star (z ^ 6) := by diff --git a/Physlib/Particles/StandardModel/HiggsBoson/Basic.lean b/Physlib/Particles/StandardModel/HiggsBoson/Basic.lean index 5a647eab3..47bdbd260 100644 --- a/Physlib/Particles/StandardModel/HiggsBoson/Basic.lean +++ b/Physlib/Particles/StandardModel/HiggsBoson/Basic.lean @@ -176,8 +176,7 @@ lemma gaugeGroupI_smul_eq_U1_mul_SU2 (g : StandardModel.GaugeGroupI) (φ : Higgs lemma gaugeGroupI_smul_eq_U1_smul_SU2 (g : StandardModel.GaugeGroupI) (φ : HiggsVec) : g • φ = (WithLp.toLp 2 <| (g.toU1 ^ 3 • g.toSU2.1) *ᵥ φ.ofLp) := by - rw [gaugeGroupI_smul_eq] - rw [Matrix.smul_mulVec] + rw [gaugeGroupI_smul_eq, Matrix.smul_mulVec] instance : MulAction StandardModel.GaugeGroupI HiggsVec where one_smul φ := by simp [gaugeGroupI_smul_eq] @@ -224,8 +223,7 @@ lemma gaugeGroupI_smul_inner (g : StandardModel.GaugeGroupI) (φ ψ : HiggsVec) _ = (g.toSU2.1 *ᵥ (g.toU1 ^ 3 • ψ)) ⬝ᵥ star (g.toSU2.1 *ᵥ (g.toU1 ^ 3 • φ)) := by rw [gaugeGroupI_smul_eq_U1_mul_SU2, gaugeGroupI_smul_eq_U1_mul_SU2] _ = (g.toSU2.1 *ᵥ (g.toU1 ^ 3 • ψ)) ⬝ᵥ (star ((g.toU1 ^ 3 • φ)) ᵥ* star (g.toSU2.1)) := by - rw [star_mulVec] - rfl + exact congrArg (fun v => _ ⬝ᵥ v) (star_mulVec (g.toSU2.1) (g.toU1 ^ 3 • φ)) _ = ((star (g.toSU2.1) * g.toSU2.1) *ᵥ (g.toU1 ^ 3 • ψ)) ⬝ᵥ star ((g.toU1 ^ 3 • φ)) := by rw [dotProduct_comm, ← Matrix.dotProduct_mulVec, dotProduct_comm, mulVec_mulVec] rfl @@ -450,8 +448,7 @@ def toRealScalars : HiggsVec →ₗ[ℝ] (Fin 4 → ℝ) where fin_cases i <;> simp lemma toRealScalars_smul_real (a : ℝ) (φ : HiggsVec) : - toRealScalars (a • φ) = a • toRealScalars φ := by - simp [toRealScalars] + toRealScalars (a • φ) = a • toRealScalars φ := by simp [toRealScalars] lemma ofReal_toRealScalars (a : ℝ) : toRealScalars (ofReal a) = !₄[Real.sqrt a, 0, 0, 0] := by @@ -778,8 +775,7 @@ lemma normSq_expand (φ : HiggsField) : -/ -lemma normSq_nonneg (φ : HiggsField) (x : SpaceTime) : 0 ≤ ‖φ‖_H^2 x := by - simp [normSq] +lemma normSq_nonneg (φ : HiggsField) (x : SpaceTime) : 0 ≤ ‖φ‖_H^2 x := by simp [normSq] /-! @@ -817,8 +813,7 @@ lemma normSq_smooth (φ : HiggsField) : ContMDiff 𝓘(ℝ, SpaceTime) 𝓘(ℝ, @[simp] lemma const_normSq (φ : HiggsVec) (x : SpaceTime) : - ‖const φ‖_H^2 x = ‖φ‖ ^ 2 := by - simp [normSq, const_apply] + ‖const φ‖_H^2 x = ‖φ‖ ^ 2 := by simp [normSq, const_apply] /-! diff --git a/Physlib/Particles/StandardModel/HiggsBoson/Potential.lean b/Physlib/Particles/StandardModel/HiggsBoson/Potential.lean index d0dc88789..8da1593e5 100644 --- a/Physlib/Particles/StandardModel/HiggsBoson/Potential.lean +++ b/Physlib/Particles/StandardModel/HiggsBoson/Potential.lean @@ -89,8 +89,7 @@ lemma 𝓵_neg : P.neg.𝓵 = - P.𝓵 := by rfl -/ @[simp] -lemma toFun_zero (x : SpaceTime) : P.toFun 0 x = 0 := by - simp [toFun] +lemma toFun_zero (x : SpaceTime) : P.toFun 0 x = 0 := by simp [toFun] lemma complete_square (h : P.𝓵 ≠ 0) (φ : HiggsField) (x : SpaceTime) : P.toFun φ x = P.𝓵 * (‖φ‖_H^2 x - P.μ2 / (2 * P.𝓵)) ^ 2 - P.μ2 ^ 2 / (4 * P.𝓵) := by diff --git a/Physlib/Particles/StandardModel/Representations.lean b/Physlib/Particles/StandardModel/Representations.lean index 90b7fd5d5..5b81c6cec 100644 --- a/Physlib/Particles/StandardModel/Representations.lean +++ b/Physlib/Particles/StandardModel/Representations.lean @@ -41,8 +41,7 @@ noncomputable def repU1 : unitary ℂ →* unitaryGroup (Fin 2) ℂ where toFun g := repU1Map g map_mul' g h := by simp only [repU1Map, Submonoid.mk_mul_mk, mul_smul_one, smul_smul, mul_comm, ← mul_pow] - map_one' := by - simp only [repU1Map, one_pow, one_smul, Submonoid.mk_eq_one] + map_one' := by simp only [repU1Map, one_pow, one_smul, Submonoid.mk_eq_one] /-- The fundamental representation of SU(2) as a homomorphism to `unitaryGroup (Fin 2) ℂ`. -/ @[simps!] diff --git a/Physlib/Particles/SuperSymmetry/MSSMNu/AnomalyCancellation/B3.lean b/Physlib/Particles/SuperSymmetry/MSSMNu/AnomalyCancellation/B3.lean index 2cba2d097..407e88b8e 100644 --- a/Physlib/Particles/SuperSymmetry/MSSMNu/AnomalyCancellation/B3.lean +++ b/Physlib/Particles/SuperSymmetry/MSSMNu/AnomalyCancellation/B3.lean @@ -61,8 +61,7 @@ def B₃ : MSSMACC.Sols := (by with_unfolding_all rfl) (by with_unfolding_all rfl) (by with_unfolding_all rfl) (by with_unfolding_all rfl) (by with_unfolding_all rfl) -lemma B₃_val : B₃.val = B₃AsCharge := by - rfl +lemma B₃_val : B₃.val = B₃AsCharge := rfl set_option backward.isDefEq.respectTransparency false in lemma doublePoint_B₃_B₃ (R : MSSMACC.LinSols) : cubeTriLin B₃.val B₃.val R.val = 0 := by diff --git a/Physlib/Particles/SuperSymmetry/MSSMNu/AnomalyCancellation/Basic.lean b/Physlib/Particles/SuperSymmetry/MSSMNu/AnomalyCancellation/Basic.lean index 340c8f26d..ce7c618a1 100644 --- a/Physlib/Particles/SuperSymmetry/MSSMNu/AnomalyCancellation/Basic.lean +++ b/Physlib/Particles/SuperSymmetry/MSSMNu/AnomalyCancellation/Basic.lean @@ -31,10 +31,7 @@ namespace MSSMCharges lemma sum_MSSMSpecies_numberCharges_eq_expand [AddCommMonoid M] (f : Fin MSSMSpecies.numberCharges → M) : - ∑ i, f i = f ⟨0, by simp⟩ + f ⟨1, by simp⟩ + f ⟨2, by simp⟩ := by - change ∑ (i : Fin 3), f i = f ⟨0, by simp⟩ + f ⟨1, by simp⟩ + f ⟨2, by simp⟩ - simp only [Fin.sum_univ_three] - rfl + ∑ i, f i = f ⟨0, by simp⟩ + f ⟨1, by simp⟩ + f ⟨2, by simp⟩ := Fin.sum_univ_three f /-- An equivalence between `MSSMCharges.charges` and the space of maps `(Fin 18 ⊕ Fin 2 → ℚ)`. The first 18 factors corresponds to the SM fermions, while the last two @@ -125,12 +122,10 @@ lemma charges_eq_toSpecies_eq (S T : MSSMCharges.Charges) : | 1 => exact h.2.2 lemma Hd_toSpecies_inv (f : (Fin 6 → Fin 3 → ℚ) × (Fin 2 → ℚ)) : - Hd (toSpecies.symm f) = f.2 0 := by - rfl + Hd (toSpecies.symm f) = f.2 0 := rfl lemma Hu_toSpecies_inv (f : (Fin 6 → Fin 3 → ℚ) × (Fin 2 → ℚ)) : - Hu (toSpecies.symm f) = f.2 1 := by - rfl + Hu (toSpecies.symm f) = f.2 1 := rfl end MSSMCharges @@ -455,8 +450,7 @@ def AnomalyFreeMk (S : MSSMACC.Charges) (hg : accGrav S = 0) lemma AnomalyFreeMk_val (S : MSSMACC.Charges) (hg : accGrav S = 0) (hsu2 : accSU2 S = 0) (hsu3 : accSU3 S = 0) (hyy : accYY S = 0) (hquad : accQuad S = 0) (hcube : accCube S = 0) : - (AnomalyFreeMk S hg hsu2 hsu3 hyy hquad hcube).val = S := by - rfl + (AnomalyFreeMk S hg hsu2 hsu3 hyy hquad hcube).val = S := rfl /-- A `QuadSol` from a `LinSol` satisfying the quadratic ACC. -/ @[simp] @@ -483,8 +477,7 @@ def AnomalyFreeMk'' (S : MSSMACC.QuadSols) (hcube : accCube S.val = 0) : MSSMACC lemma AnomalyFreeMk''_val (S : MSSMACC.QuadSols) (hcube : accCube S.val = 0) : - (AnomalyFreeMk'' S hcube).val = S.val := by - rfl + (AnomalyFreeMk'' S hcube).val = S.val := rfl set_option backward.isDefEq.respectTransparency false in /-- The dot product on the vector space of charges. -/ diff --git a/Physlib/Particles/SuperSymmetry/MSSMNu/AnomalyCancellation/OrthogY3B3/Basic.lean b/Physlib/Particles/SuperSymmetry/MSSMNu/AnomalyCancellation/OrthogY3B3/Basic.lean index 2c038fff9..475c8ce0b 100644 --- a/Physlib/Particles/SuperSymmetry/MSSMNu/AnomalyCancellation/OrthogY3B3/Basic.lean +++ b/Physlib/Particles/SuperSymmetry/MSSMNu/AnomalyCancellation/OrthogY3B3/Basic.lean @@ -58,23 +58,20 @@ 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 B₃.val • T.val := by - rfl + dot Y₃.val B₃.val • T.val := rfl lemma Y₃_plus_B₃_plus_proj (T : MSSMACC.LinSols) (a b c : ℚ) : a • Y₃.val + b • B₃.val + c • (proj T).val = (a + c * (dot B₃.val T.val - dot Y₃.val T.val)) • Y₃.val + (b + c * (dot Y₃.val T.val - 2 * dot B₃.val T.val)) • B₃.val + (dot Y₃.val B₃.val * c) • T.val:= by - rw [proj_val] - rw [DistribMulAction.smul_add, DistribMulAction.smul_add] + rw [proj_val, DistribMulAction.smul_add, DistribMulAction.smul_add] module set_option backward.isDefEq.respectTransparency false in lemma quad_Y₃_proj (T : MSSMACC.LinSols) : quadBiLin Y₃.val (proj T).val = dot Y₃.val B₃.val * quadBiLin Y₃.val T.val := by - rw [proj_val] - rw [quadBiLin.map_add₂, quadBiLin.map_add₂] + rw [proj_val, quadBiLin.map_add₂, quadBiLin.map_add₂] rw [quadBiLin.map_smul₂, quadBiLin.map_smul₂, quadBiLin.map_smul₂] rw [show quadBiLin Y₃.val B₃.val = 0 by with_unfolding_all rfl] rw [show quadBiLin Y₃.val Y₃.val = 0 by with_unfolding_all rfl] @@ -83,8 +80,7 @@ lemma quad_Y₃_proj (T : MSSMACC.LinSols) : set_option backward.isDefEq.respectTransparency false in lemma quad_B₃_proj (T : MSSMACC.LinSols) : quadBiLin B₃.val (proj T).val = dot Y₃.val B₃.val * quadBiLin B₃.val T.val := by - rw [proj_val] - rw [quadBiLin.map_add₂, quadBiLin.map_add₂] + rw [proj_val, quadBiLin.map_add₂, quadBiLin.map_add₂] rw [quadBiLin.map_smul₂, quadBiLin.map_smul₂, quadBiLin.map_smul₂] rw [show quadBiLin B₃.val Y₃.val = 0 by with_unfolding_all rfl] rw [show quadBiLin B₃.val B₃.val = 0 by with_unfolding_all rfl] @@ -95,8 +91,7 @@ lemma quad_self_proj (T : MSSMACC.Sols) : quadBiLin T.val (proj T.1.1).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 - rw [proj_val] - rw [quadBiLin.map_add₂, quadBiLin.map_add₂] + rw [proj_val, quadBiLin.map_add₂, quadBiLin.map_add₂] rw [quadBiLin.map_smul₂, quadBiLin.map_smul₂, quadBiLin.map_smul₂] rw [← quadBiLin.toHomogeneousQuad_apply] rw [← accQuad] @@ -119,8 +114,7 @@ set_option backward.isDefEq.respectTransparency false in lemma cube_proj_proj_Y₃ (T : MSSMACC.LinSols) : cubeTriLin (proj T).val (proj T).val Y₃.val = (dot Y₃.val B₃.val)^2 * cubeTriLin T.val T.val Y₃.val := by - rw [proj_val] - rw [cubeTriLin.map_add₁, cubeTriLin.map_add₂] + rw [proj_val, cubeTriLin.map_add₁, cubeTriLin.map_add₂] conv_lhs => enter [1, 1] change ((cubeTriLin (lineY₃B₃ _ _).val) (lineY₃B₃ _ _).val) _ @@ -145,8 +139,7 @@ set_option backward.isDefEq.respectTransparency false in lemma cube_proj_proj_B₃ (T : MSSMACC.LinSols) : cubeTriLin (proj T).val (proj T).val B₃.val = (dot Y₃.val B₃.val)^2 * cubeTriLin T.val T.val B₃.val := by - rw [proj_val] - rw [cubeTriLin.map_add₁, cubeTriLin.map_add₂] + rw [proj_val, cubeTriLin.map_add₁, cubeTriLin.map_add₂] rw [← lineY₃B₃_val, lineY₃B₃_doublePoint, lineY₃B₃_val] rw [cubeTriLin.map_add₂, cubeTriLin.swap₂, cubeTriLin.map_add₁, cubeTriLin.map_smul₁, cubeTriLin.map_smul₃, doublePoint_Y₃_B₃] @@ -164,8 +157,7 @@ lemma cube_proj_proj_self (T : MSSMACC.Sols) : 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 - rw [proj_val] - rw [cubeTriLin.map_add₁, cubeTriLin.map_add₂] + rw [proj_val, cubeTriLin.map_add₁, cubeTriLin.map_add₂] rw [← lineY₃B₃_val, lineY₃B₃_doublePoint, lineY₃B₃_val] repeat rw [cubeTriLin.map_add₁] repeat rw [cubeTriLin.map_smul₁] diff --git a/Physlib/Particles/SuperSymmetry/MSSMNu/AnomalyCancellation/OrthogY3B3/PlaneWithY3B3.lean b/Physlib/Particles/SuperSymmetry/MSSMNu/AnomalyCancellation/OrthogY3B3/PlaneWithY3B3.lean index dae9178f8..9d36dbf14 100644 --- a/Physlib/Particles/SuperSymmetry/MSSMNu/AnomalyCancellation/OrthogY3B3/PlaneWithY3B3.lean +++ b/Physlib/Particles/SuperSymmetry/MSSMNu/AnomalyCancellation/OrthogY3B3/PlaneWithY3B3.lean @@ -30,8 +30,7 @@ def planeY₃B₃ (R : MSSMACC.AnomalyFreePerp) (a b c : ℚ) : MSSMACC.LinSols a • Y₃.1.1 + b • B₃.1.1 + c • R.1 lemma planeY₃B₃_val (R : MSSMACC.AnomalyFreePerp) (a b c : ℚ) : - (planeY₃B₃ R a b c).val = a • Y₃.val + b • B₃.val + c • R.val := by - rfl + (planeY₃B₃ R a b c).val = a • Y₃.val + b • B₃.val + c • R.val := rfl lemma planeY₃B₃_smul (R : MSSMACC.AnomalyFreePerp) (a b c d : ℚ) : planeY₃B₃ R (d * a) (d * b) (d * c) = d • planeY₃B₃ R a b c := by @@ -42,8 +41,7 @@ lemma planeY₃B₃_smul (R : MSSMACC.AnomalyFreePerp) (a b c d : ℚ) : rw [smul_smul, smul_smul, smul_smul] lemma planeY₃B₃_eq (R : MSSMACC.AnomalyFreePerp) (a b c : ℚ) (h : a = a' ∧ b = b' ∧ c = c') : - (planeY₃B₃ R a b c) = (planeY₃B₃ R a' b' c') := by - rw [h.1, h.2.1, h.2.2] + (planeY₃B₃ R a b c) = (planeY₃B₃ R a' b' c') := by rw [h.1, h.2.1, h.2.2] set_option backward.isDefEq.respectTransparency false in lemma planeY₃B₃_val_eq' (R : MSSMACC.AnomalyFreePerp) (a b c : ℚ) (hR' : R.val ≠ 0) @@ -67,8 +65,7 @@ set_option backward.isDefEq.respectTransparency false in lemma planeY₃B₃_quad (R : MSSMACC.AnomalyFreePerp) (a b c : ℚ) : accQuad (planeY₃B₃ R a b c).val = c * (2 * a * quadBiLin Y₃.val R.val + 2 * b * quadBiLin B₃.val R.val + c * quadBiLin R.val R.val) := by - rw [planeY₃B₃_val] - rw [accQuad, BiLinearSymm.toHomogeneousQuad_add] + rw [planeY₃B₃_val, accQuad, BiLinearSymm.toHomogeneousQuad_add] rw [← lineY₃B₃Charges_val, ← accQuad] rw [lineY₃B₃Charges_quad] rw [lineY₃B₃Charges_val, accQuad] @@ -83,8 +80,7 @@ lemma planeY₃B₃_cubic (R : MSSMACC.AnomalyFreePerp) (a b c : ℚ) : accCube (planeY₃B₃ R a b c).val = c ^ 2 * (3 * a * cubeTriLin R.val R.val Y₃.val + 3 * b * cubeTriLin R.val R.val B₃.val + c * cubeTriLin R.val R.val R.val) := by - rw [planeY₃B₃_val] - rw [accCube, TriLinearSymm.toCubic_add, ← accCube] + rw [planeY₃B₃_val, accCube, TriLinearSymm.toCubic_add, ← accCube] rw [← lineY₃B₃Charges_val] rw [lineY₃B₃Charges_cubic] rw [TriLinearSymm.map_smul₃, lineY₃B₃Charges_val, ← lineY₃B₃_val] @@ -105,8 +101,7 @@ def lineQuadAFL (R : MSSMACC.AnomalyFreePerp) (c1 c2 c3 : ℚ) : MSSMACC.LinSols lemma lineQuadAFL_quad (R : MSSMACC.AnomalyFreePerp) (c1 c2 c3 : ℚ) : accQuad (lineQuadAFL R c1 c2 c3).val = 0 := by - rw [lineQuadAFL, planeY₃B₃_quad] - rw [mul_eq_zero] + rw [lineQuadAFL, planeY₃B₃_quad, mul_eq_zero] apply Or.inr ring @@ -118,8 +113,7 @@ lemma lineQuad_val (R : MSSMACC.AnomalyFreePerp) (c1 c2 c3 : ℚ) : (lineQuad R c1 c2 c3).val = (planeY₃B₃ R (c2 * quadBiLin R.val R.val - 2 * c3 * quadBiLin B₃.val R.val) (2 * c3 * quadBiLin Y₃.val R.val - c1 * quadBiLin R.val R.val) - (2 * c1 * quadBiLin B₃.val R.val - 2 * c2 * quadBiLin Y₃.val R.val)).val := by - rfl + (2 * c1 * quadBiLin B₃.val R.val - 2 * c2 * quadBiLin Y₃.val R.val)).val := rfl lemma lineQuad_smul (R : MSSMACC.AnomalyFreePerp) (a b c d : ℚ) : lineQuad R (d * a) (d * b) (d * c) = d • lineQuad R a b c := by @@ -148,8 +142,7 @@ 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, α₁, α₂, α₃] + rw [lineQuad_val, planeY₃B₃_cubic, α₁, α₂, α₃] ring /-- The line in the plane spanned by `Y₃`, `B₃` and `R` which is in the cubic. -/ @@ -196,19 +189,14 @@ lemma α₂_proj (T : MSSMACC.Sols) : α₂ (proj T.1.1) = lemma α₁_proj (T : MSSMACC.Sols) : α₁ (proj T.1.1) = - α₃ (proj T.1.1) * (dot B₃.val T.val - dot Y₃.val T.val) := by - rw [α₃_proj, α₁] - rw [cube_proj_proj_B₃, quad_B₃_proj, quad_proj, cube_proj] + rw [α₃_proj, α₁, cube_proj_proj_B₃, quad_B₃_proj, quad_proj, cube_proj] ring lemma α₁_proj_zero (T : MSSMACC.Sols) (h1 : α₃ (proj T.1.1) = 0) : - α₁ (proj T.1.1) = 0 := by - rw [α₁_proj, h1] - exact mul_eq_zero_of_left rfl ((dot B₃.val) T.val - (dot Y₃.val) T.val) + α₁ (proj T.1.1) = 0 := by simp [α₁_proj, h1] lemma α₂_proj_zero (T : MSSMACC.Sols) (h1 : α₃ (proj T.1.1) = 0) : - α₂ (proj T.1.1) = 0 := by - rw [α₂_proj, h1] - exact mul_eq_zero_of_left rfl ((dot Y₃.val) T.val - 2 * (dot B₃.val) T.val) + α₂ (proj T.1.1) = 0 := by simp [α₂_proj, h1] end proj diff --git a/Physlib/Particles/SuperSymmetry/MSSMNu/AnomalyCancellation/OrthogY3B3/ToSols.lean b/Physlib/Particles/SuperSymmetry/MSSMNu/AnomalyCancellation/OrthogY3B3/ToSols.lean index f1d2b3469..be63be629 100644 --- a/Physlib/Particles/SuperSymmetry/MSSMNu/AnomalyCancellation/OrthogY3B3/ToSols.lean +++ b/Physlib/Particles/SuperSymmetry/MSSMNu/AnomalyCancellation/OrthogY3B3/ToSols.lean @@ -70,8 +70,7 @@ lemma linEqPropSol_iff_proj_linEqProp (R : MSSMACC.Sols) : simp only [mul_eq_zero, OfNat.ofNat_ne_zero, false_or] at h rw [α₁_proj, α₂_proj, h] simp only [neg_zero, zero_mul, and_self] - · rw [h.2.2] - exact Rat.mul_zero ((dot Y₃.val) B₃.val) + · simp [h.2.2] /-- A condition which is satisfied if the plane spanned by `R`, `Y₃` and `B₃` lies entirely in the quadratic surface. -/ @@ -152,8 +151,7 @@ lemma inCubeSolProp_iff_cubicCoeff_zero (T : MSSMACC.Sols) : lemma inCubeSolProp_iff_proj_inCubeProp (R : MSSMACC.Sols) : InCubeSolProp R ↔ InCubeProp (proj R.1.1) := by - rw [InCubeSolProp, InCubeProp] - rw [cube_proj, cube_proj_proj_Y₃, cube_proj_proj_B₃] + rw [InCubeSolProp, InCubeProp, cube_proj, cube_proj_proj_Y₃, cube_proj_proj_B₃] refine Iff.intro (fun h => ?_) (fun h => ?_) · rw [h.1, h.2] simp only [mul_zero, add_zero, and_self] @@ -199,8 +197,7 @@ def toSolNSQuad (R : MSSMACC.AnomalyFreePerp) : MSSMACC.QuadSols := lemma toSolNSQuad_cube (R : MSSMACC.AnomalyFreePerp) : accCube (toSolNSQuad R).val = 0 := by - rw [toSolNSQuad] - rw [lineQuad_val] + rw [toSolNSQuad, lineQuad_val] rw [planeY₃B₃_cubic] ring @@ -260,9 +257,7 @@ def inLineEqProj (T : InLineEqSol) : InLineEq × ℚ × ℚ × ℚ := lemma inLineEqTo_smul (R : InLineEq) (c₁ c₂ c₃ d : ℚ) : inLineEqToSol (R, (d * c₁), (d * c₂), (d * c₃)) = d • inLineEqToSol (R, c₁, c₂, c₃) := by apply ACCSystem.Sols.ext - change (lineQuad _ _ _ _).val = _ - rw [lineQuad_smul] - rfl + exact congrArg (fun x => x.val) (lineQuad_smul R.val c₁ c₂ c₃ d) lemma inLineEqToSol_proj (T : InLineEqSol) : inLineEqToSol (inLineEqProj T) = T.val := by rw [inLineEqProj, inLineEqTo_smul] @@ -292,9 +287,7 @@ def inQuadToSol : InQuad × ℚ × ℚ × ℚ → MSSMACC.Sols := fun (R, a₁, lemma inQuadToSol_smul (R : InQuad) (c₁ c₂ c₃ d : ℚ) : inQuadToSol (R, (d * c₁), (d * c₂), (d * c₃)) = d • inQuadToSol (R, c₁, c₂, c₃) := by apply ACCSystem.Sols.ext - change (lineCube _ _ _ _).val = _ - rw [lineCube_smul] - rfl + exact congrArg (fun x => x.val) (lineCube_smul R.val.val c₁ c₂ c₃ d) /-- On elements of `inQuadSol` a right-inverse to `inQuadToSol`. -/ def inQuadProj (T : InQuadSol) : InQuad × ℚ × ℚ × ℚ := @@ -332,9 +325,7 @@ def inQuadCubeToSol : InQuadCube × ℚ × ℚ × ℚ → MSSMACC.Sols := fun (R lemma inQuadCubeToSol_smul (R : InQuadCube) (c₁ c₂ c₃ d : ℚ) : inQuadCubeToSol (R, (d * c₁), (d * c₂), (d * c₃)) = d • inQuadCubeToSol (R, c₁, c₂, c₃) := by apply ACCSystem.Sols.ext - change (planeY₃B₃ _ _ _ _).val = _ - rw [planeY₃B₃_smul] - rfl + exact congrArg (fun x => x.val) (planeY₃B₃_smul R.val.val.val c₁ c₂ c₃ d) /-- On elements of `inQuadCubeSol` a right-inverse to `inQuadCubeToSol`. -/ def inQuadCubeProj (T : InQuadCubeSol) : InQuadCube × ℚ × ℚ × ℚ := @@ -355,8 +346,7 @@ lemma inQuadCubeToSol_proj (T : InQuadCubeSol) : simp only [zero_smul, add_zero, zero_add] rw [← SemigroupAction.mul_smul, mul_comm, mul_inv_cancel₀] · exact MulAction.one_smul (T.1).val - · rw [show dot Y₃.val B₃.val = 108 by with_unfolding_all rfl] - exact Ne.symm (OfNat.zero_ne_ofNat 108) + · simp [show dot Y₃.val B₃.val = 108 by with_unfolding_all rfl] /-- A solution from an element of `MSSMACC.AnomalyFreePerp × ℚ × ℚ × ℚ`. We will show that this map is a surjection. -/ diff --git a/Physlib/Particles/SuperSymmetry/MSSMNu/AnomalyCancellation/Y3.lean b/Physlib/Particles/SuperSymmetry/MSSMNu/AnomalyCancellation/Y3.lean index 87a0f57c4..b3b6b522e 100644 --- a/Physlib/Particles/SuperSymmetry/MSSMNu/AnomalyCancellation/Y3.lean +++ b/Physlib/Particles/SuperSymmetry/MSSMNu/AnomalyCancellation/Y3.lean @@ -61,8 +61,7 @@ def Y₃ : MSSMACC.Sols := (by with_unfolding_all rfl) (by with_unfolding_all rfl) (by with_unfolding_all rfl) (by with_unfolding_all rfl) (by with_unfolding_all rfl) (by with_unfolding_all rfl) -lemma Y₃_val : Y₃.val = Y₃AsCharge := by - rfl +lemma Y₃_val : Y₃.val = Y₃AsCharge := rfl set_option backward.isDefEq.respectTransparency false in lemma doublePoint_Y₃_Y₃ (R : MSSMACC.LinSols) : diff --git a/Physlib/Particles/SuperSymmetry/N1/Basic.lean b/Physlib/Particles/SuperSymmetry/N1/Basic.lean index 30c27e517..a27b42f1f 100644 --- a/Physlib/Particles/SuperSymmetry/N1/Basic.lean +++ b/Physlib/Particles/SuperSymmetry/N1/Basic.lean @@ -413,13 +413,11 @@ def conjChiralCovector `toField`. -/ lemma toField_conjScalar (t : (chiralTensor (ι := ι)).Tensor ![]) : (conjScalar t).toField = star t.toField := by - rw [conjScalar, toField_permT] - rw [toField_eq_repr, toField_eq_repr] + rw [conjScalar, toField_permT, toField_eq_repr, toField_eq_repr] change componentMap (S := (chiralTensor (ι := ι)).toTensorSpecies) ((chiralTensor (ι := ι)).bar ∘ ![]) ((chiralTensor (ι := ι)).conjT t) (fun j => Fin.elim0 j) = star ((basis (S := (chiralTensor (ι := ι)).toTensorSpecies) ![]).repr t (fun j => Fin.elim0 j)) - rw [ConjTensorSpecies.componentMap_conjT (S := chiralTensor (ι := ι))] - rfl + exact ConjTensorSpecies.componentMap_conjT (S := chiralTensor (ι := ι)) t (fun j => Fin.elim0 j) /-- Component formula for the holomorphic covector conjugate: the `![I]` basis component of `conjChiralCovector t` is the complex conjugate of the `![I]` component of `t`. -/ diff --git a/Physlib/Particles/SuperSymmetry/SU5/ChargeSpectrum/Basic.lean b/Physlib/Particles/SuperSymmetry/SU5/ChargeSpectrum/Basic.lean index 7241858a8..56408a140 100644 --- a/Physlib/Particles/SuperSymmetry/SU5/ChargeSpectrum/Basic.lean +++ b/Physlib/Particles/SuperSymmetry/SU5/ChargeSpectrum/Basic.lean @@ -176,8 +176,7 @@ instance subsetDecidable [DecidableEq 𝓩] (x y : ChargeSpectrum 𝓩) : Decida instDecidableAnd lemma subset_def {x y : ChargeSpectrum 𝓩} : x ⊆ y ↔ x.qHd.toFinset ⊆ y.qHd.toFinset ∧ - x.qHu.toFinset ⊆ y.qHu.toFinset ∧ x.Q5 ⊆ y.Q5 ∧ x.Q10 ⊆ y.Q10 := by - rfl + x.qHu.toFinset ⊆ y.qHu.toFinset ∧ x.Q5 ⊆ y.Q5 ∧ x.Q10 ⊆ y.Q10 := Iff.rfl @[simp, refl] lemma subset_refl (x : ChargeSpectrum 𝓩) : x ⊆ x := ⟨by rfl, by rfl, by rfl, by rfl⟩ @@ -208,8 +207,7 @@ instance emptyInst : EmptyCollection (ChargeSpectrum 𝓩) where lemma empty_eq : (∅ : ChargeSpectrum 𝓩) = ⟨none, none, {}, {}⟩ := rfl @[simp] -lemma empty_subset (x : ChargeSpectrum 𝓩) : ∅ ⊆ x := by - simp [Subset, empty_eq] +lemma empty_subset (x : ChargeSpectrum 𝓩) : ∅ ⊆ x := by simp [Subset, empty_eq] @[simp] lemma subset_of_empty_iff_empty {x : ChargeSpectrum 𝓩} : @@ -219,20 +217,16 @@ lemma subset_of_empty_iff_empty {x : ChargeSpectrum 𝓩} : simp @[simp] -lemma empty_qHd : (∅ : ChargeSpectrum 𝓩).qHd = none := by - simp [empty_eq] +lemma empty_qHd : (∅ : ChargeSpectrum 𝓩).qHd = none := by simp [empty_eq] @[simp] -lemma empty_qHu : (∅ : ChargeSpectrum 𝓩).qHu = none := by - simp [empty_eq] +lemma empty_qHu : (∅ : ChargeSpectrum 𝓩).qHu = none := by simp [empty_eq] @[simp] -lemma empty_Q5 : (∅ : ChargeSpectrum 𝓩).Q5 = ∅ := by - simp [empty_eq] +lemma empty_Q5 : (∅ : ChargeSpectrum 𝓩).Q5 = ∅ := by simp [empty_eq] @[simp] -lemma empty_Q10 : (∅ : ChargeSpectrum 𝓩).Q10 = ∅ := by - simp [empty_eq] +lemma empty_Q10 : (∅ : ChargeSpectrum 𝓩).Q10 = ∅ := by simp [empty_eq] /-! @@ -246,8 +240,7 @@ def card (x : ChargeSpectrum 𝓩) : Nat := x.qHu.toFinset.card + x.qHd.toFinset.card + x.Q5.card + x.Q10.card @[simp] -lemma card_empty : card (∅ : ChargeSpectrum 𝓩) = 0 := by - simp [card, empty_eq] +lemma card_empty : card (∅ : ChargeSpectrum 𝓩) = 0 := by simp [card, empty_eq] lemma card_mono {x y : ChargeSpectrum 𝓩} (h : x ⊆ y) : card x ≤ card y := by have h1 := Finset.card_le_card h.1 @@ -300,13 +293,11 @@ lemma mem_powerset_iff {x y : ChargeSpectrum 𝓩} : x.qHd ∈ y.qHd.powerset ∧ x.qHu ∈ y.qHu.powerset ∧ x.Q5 ∈ y.Q5.powerset ∧ - x.Q10 ∈ y.Q10.powerset := by - simp [powerset, Finset.mem_product, toProd] + x.Q10 ∈ y.Q10.powerset := by simp [powerset, Finset.mem_product, toProd] @[simp] lemma mem_powerset_iff_subset {x y : ChargeSpectrum 𝓩} : - x ∈ powerset y ↔ x ⊆ y := by - simp [mem_powerset_iff, subset_def] + x ∈ powerset y ↔ x ⊆ y := by simp [mem_powerset_iff, subset_def] lemma self_mem_powerset (x : ChargeSpectrum 𝓩) : x ∈ powerset x := by simp @@ -321,12 +312,9 @@ lemma powerset_of_empty : simp lemma powerset_mono {x y : ChargeSpectrum 𝓩} : - powerset x ⊆ powerset y ↔ x ⊆ y := by - constructor - · intro h - exact mem_powerset_iff_subset.mp (h (self_mem_powerset x)) - · intro h z hz - exact mem_powerset_iff_subset.mpr (subset_trans (mem_powerset_iff_subset.mp hz) h) + powerset x ⊆ powerset y ↔ x ⊆ y := + ⟨fun h => mem_powerset_iff_subset.mp (h (self_mem_powerset x)), + fun h _ hz => mem_powerset_iff_subset.mpr (subset_trans (mem_powerset_iff_subset.mp hz) h)⟩ lemma min_exists_inductive (S : Finset (ChargeSpectrum 𝓩)) (hS : S ≠ ∅) : (n : ℕ) → (hn : S.card = n) → diff --git a/Physlib/Particles/SuperSymmetry/SU5/ChargeSpectrum/Completions.lean b/Physlib/Particles/SuperSymmetry/SU5/ChargeSpectrum/Completions.lean index 20a2b9332..ec1e993d8 100644 --- a/Physlib/Particles/SuperSymmetry/SU5/ChargeSpectrum/Completions.lean +++ b/Physlib/Particles/SuperSymmetry/SU5/ChargeSpectrum/Completions.lean @@ -87,8 +87,7 @@ The empty charge spectrum is not complete, since it has no charges present. -/ @[simp] -lemma not_isComplete_empty : ¬ IsComplete (∅ : ChargeSpectrum 𝓩) := by - simp [IsComplete] +lemma not_isComplete_empty : ¬ IsComplete (∅ : ChargeSpectrum 𝓩) := by simp [IsComplete] /-! @@ -210,8 +209,7 @@ lemma completions_eq_singleton_of_complete {S5 S10 : Finset 𝓩} (x : ChargeSpe case' neg => simp_all by_cases h4 : x.Q10 ≠ ∅ case' neg => simp_all - simp_all - rfl + simp_all [toProd] /-! @@ -294,7 +292,6 @@ lemma self_subset_mem_completions (S5 S10 : Finset 𝓩) (x y : ChargeSpectrum (hy : y ∈ completions S5 S10 x) : x ⊆ y := by simp [mem_completions_iff] at hy rw [Subset] - dsimp [hasSubset] refine ⟨?_, ?_, ?_, ?_⟩ · by_cases h : x.qHd.isSome · simp_all @@ -353,7 +350,6 @@ lemma exist_completions_subset_of_complete (S5 S10 : Finset 𝓩) (x y : ChargeS · split_ifs with h3 <;> simp_all · split_ifs with h4 <;> simp_all · rw [Subset] - dsimp [hasSubset] refine ⟨by simp_all, by simp_all, ?_, ?_⟩ · split_ifs with h3 <;> simp_all [Finset.singleton_subset_iff] · split_ifs with h4 <;> simp_all [Finset.singleton_subset_iff] diff --git a/Physlib/Particles/SuperSymmetry/SU5/ChargeSpectrum/Map.lean b/Physlib/Particles/SuperSymmetry/SU5/ChargeSpectrum/Map.lean index f2270bc7a..e6c6a8aff 100644 --- a/Physlib/Particles/SuperSymmetry/SU5/ChargeSpectrum/Map.lean +++ b/Physlib/Particles/SuperSymmetry/SU5/ChargeSpectrum/Map.lean @@ -113,8 +113,7 @@ lemma map_empty (f : 𝓩 →+ 𝓩1) : map f (∅ : ChargeSpectrum 𝓩) = ∅ -/ lemma map_map (f : 𝓩 →+ 𝓩1) (g : 𝓩1 →+ 𝓩2) (x : ChargeSpectrum 𝓩) : - map g (map f x) = map (g.comp f) x := by - simp [map, Option.map_map, Finset.image_image] + map g (map f x) = map (g.comp f) x := by simp [map, Option.map_map, Finset.image_image] /-! @@ -222,16 +221,13 @@ lemma mem_map_ofPotentialTerm_iff [DecidableEq 𝓩] lemma mem_map_ofPotentialTerm'_iff[DecidableEq 𝓩] (f : 𝓩 →+ 𝓩1) (x : ChargeSpectrum 𝓩) (T : PotentialTerm) : i ∈ (ofPotentialTerm' (map f x) T) ↔ i ∈ (ofPotentialTerm' x T).map f := by - rw [← mem_ofPotentialTerm_iff_mem_ofPotentialTerm] - rw [mem_map_ofPotentialTerm_iff] + rw [← mem_ofPotentialTerm_iff_mem_ofPotentialTerm, mem_map_ofPotentialTerm_iff] simp only [Multiset.mem_map] constructor · intro ⟨a, h, h1⟩ - refine ⟨a, ?_, h1⟩ - exact mem_ofPotentialTerm_iff_mem_ofPotentialTerm.mp h + exact ⟨a, mem_ofPotentialTerm_iff_mem_ofPotentialTerm.mp h, h1⟩ · intro ⟨a, h, h1⟩ - refine ⟨a, ?_, h1⟩ - exact mem_ofPotentialTerm_iff_mem_ofPotentialTerm.mpr h + exact ⟨a, mem_ofPotentialTerm_iff_mem_ofPotentialTerm.mpr h, h1⟩ lemma map_ofPotentialTerm'_toFinset [DecidableEq 𝓩] (f : 𝓩 →+ 𝓩1) (x : ChargeSpectrum 𝓩) (T : PotentialTerm) : @@ -298,8 +294,7 @@ lemma not_isPhenoConstrained_of_map {f : 𝓩 →+ 𝓩1} {x : ChargeSpectrum omit [DecidableEq 𝓩] in lemma map_isComplete_iff {f : 𝓩 →+ 𝓩1} {x : ChargeSpectrum 𝓩} : - (map f x).IsComplete ↔ x.IsComplete := by - simp [IsComplete, map] + (map f x).IsComplete ↔ x.IsComplete := by simp [IsComplete, map] /-! diff --git a/Physlib/Particles/SuperSymmetry/SU5/ChargeSpectrum/MinimalSuperSet.lean b/Physlib/Particles/SuperSymmetry/SU5/ChargeSpectrum/MinimalSuperSet.lean index 15604132a..7ecd6a333 100644 --- a/Physlib/Particles/SuperSymmetry/SU5/ChargeSpectrum/MinimalSuperSet.lean +++ b/Physlib/Particles/SuperSymmetry/SU5/ChargeSpectrum/MinimalSuperSet.lean @@ -126,8 +126,7 @@ two different forms of this result. @[simp] lemma self_not_mem_minimalSuperSet (S5 S10 : Finset 𝓩) (x : ChargeSpectrum 𝓩) : - x ∉ minimalSuperSet S5 S10 x := by - simp [minimalSuperSet] + x ∉ minimalSuperSet S5 S10 x := by simp [minimalSuperSet] lemma self_ne_mem_minimalSuperSet (S5 S10 : Finset 𝓩) (x y : ChargeSpectrum 𝓩) (hy : y ∈ minimalSuperSet S5 S10 x) : x ≠ y := by diff --git a/Physlib/Particles/SuperSymmetry/SU5/ChargeSpectrum/MinimallyAllowsTerm/Basic.lean b/Physlib/Particles/SuperSymmetry/SU5/ChargeSpectrum/MinimallyAllowsTerm/Basic.lean index b615cfc72..49484a2a5 100644 --- a/Physlib/Particles/SuperSymmetry/SU5/ChargeSpectrum/MinimallyAllowsTerm/Basic.lean +++ b/Physlib/Particles/SuperSymmetry/SU5/ChargeSpectrum/MinimallyAllowsTerm/Basic.lean @@ -114,8 +114,7 @@ lemma allowsTerm_of_has_minimallyAllowsTerm_subset (hx : ∃ y ∈ powerset x, y.MinimallyAllowsTerm T) : x.AllowsTerm T := by obtain ⟨y, hy⟩ := hx simp only [mem_powerset_iff_subset] at hy - apply allowsTerm_mono hy.1 - exact allowsTerm_of_minimallyAllowsTerm hy.2 + exact allowsTerm_mono hy.1 (allowsTerm_of_minimallyAllowsTerm hy.2) /-! @@ -178,8 +177,7 @@ lemma minimallyAllowsTerm_iff_powerset_countP_eq_one : exact Eq.symm (Multiset.countP_eq_card_filter (fun y => y.AllowsTerm T) x.powerset.val) rw [Multiset.card_eq_one] at h1 obtain ⟨a, ha⟩ := h1 - have haMem : a ∈ Multiset.filter (fun y => y.AllowsTerm T) x.powerset.val := by - simp [ha] + have haMem : a ∈ Multiset.filter (fun y => y.AllowsTerm T) x.powerset.val := by simp [ha] simp at haMem have hxMem : x ∈ Multiset.filter (fun y => y.AllowsTerm T) x.powerset.val := by simpa using allowsTerm_mono haMem.1 haMem.2 @@ -241,8 +239,7 @@ lemma card_le_degree_of_minimallyAllowsTerm (h : x.MinimallyAllowsTerm T) : x.card ≤ T.degree := by obtain ⟨y, y_mem_power, y_card,y_present⟩ := subset_card_le_degree_allowsTerm_of_allowsTerm (allowsTerm_of_minimallyAllowsTerm h) - have hy : y ∈ x.powerset.filter (fun y => y.AllowsTerm T) := by - simp_all + have hy : y ∈ x.powerset.filter (fun y => y.AllowsTerm T) := by simp_all rw [minimallyAllowsTerm_iff_powerset_filter_eq] at h rw [h] at hy simp at hy @@ -272,8 +269,7 @@ lemma eq_allowsTermForm_of_minimallyAllowsTerm (h1 : x.MinimallyAllowsTerm T) : obtain ⟨a, b, c, h2, h3⟩ := allowsTermForm_subset_allowsTerm_of_allowsTerm (allowsTerm_of_minimallyAllowsTerm h1) use a, b, c - have hy : allowsTermForm a b c T ∈ x.powerset.filter (fun y => y.AllowsTerm T) := by - simp_all + have hy : allowsTermForm a b c T ∈ x.powerset.filter (fun y => y.AllowsTerm T) := by simp_all rw [minimallyAllowsTerm_iff_powerset_filter_eq] at h1 rw [h1] at hy simp at hy diff --git a/Physlib/Particles/SuperSymmetry/SU5/ChargeSpectrum/OfPotentialTerm.lean b/Physlib/Particles/SuperSymmetry/SU5/ChargeSpectrum/OfPotentialTerm.lean index 49658a0a8..f642ddfe9 100644 --- a/Physlib/Particles/SuperSymmetry/SU5/ChargeSpectrum/OfPotentialTerm.lean +++ b/Physlib/Particles/SuperSymmetry/SU5/ChargeSpectrum/OfPotentialTerm.lean @@ -381,10 +381,9 @@ which is not important for us. -/ lemma mem_ofPotentialTerm_iff_mem_ofPotentialTerm [DecidableEq 𝓩] {T : PotentialTerm} {n : 𝓩} {y : ChargeSpectrum 𝓩} : - n ∈ y.ofPotentialTerm T ↔ n ∈ y.ofPotentialTerm' T := by - constructor - · exact fun h => ofPotentialTerm_subset_ofPotentialTerm' T h - · exact fun h => ofPotentialTerm'_subset_ofPotentialTerm T h + n ∈ y.ofPotentialTerm T ↔ n ∈ y.ofPotentialTerm' T := + ⟨fun h => ofPotentialTerm_subset_ofPotentialTerm' T h, + fun h => ofPotentialTerm'_subset_ofPotentialTerm T h⟩ /-! @@ -399,8 +398,7 @@ lemma ofPotentialTerm'_mono [DecidableEq 𝓩] {x y : ChargeSpectrum 𝓩} (h : x ⊆ y) (T : PotentialTerm) : x.ofPotentialTerm' T ⊆ y.ofPotentialTerm' T := by intro i - rw [← mem_ofPotentialTerm_iff_mem_ofPotentialTerm, ← mem_ofPotentialTerm_iff_mem_ofPotentialTerm] - exact fun a => ofPotentialTerm_mono h T a + simpa [← mem_ofPotentialTerm_iff_mem_ofPotentialTerm] using fun a => ofPotentialTerm_mono h T a end ChargeSpectrum diff --git a/Physlib/Particles/SuperSymmetry/SU5/ChargeSpectrum/PhenoConstrained.lean b/Physlib/Particles/SuperSymmetry/SU5/ChargeSpectrum/PhenoConstrained.lean index bfd14fa6b..c8f96fb5e 100644 --- a/Physlib/Particles/SuperSymmetry/SU5/ChargeSpectrum/PhenoConstrained.lean +++ b/Physlib/Particles/SuperSymmetry/SU5/ChargeSpectrum/PhenoConstrained.lean @@ -138,8 +138,7 @@ def phenoConstrainingChargesSP (x : ChargeSpectrum 𝓩) : Multiset 𝓩 := @[simp] lemma phenoConstrainingChargesSP_empty : - phenoConstrainingChargesSP (∅ : ChargeSpectrum 𝓩) = ∅ := by - simp [phenoConstrainingChargesSP] + phenoConstrainingChargesSP (∅ : ChargeSpectrum 𝓩) = ∅ := by simp [phenoConstrainingChargesSP] /-! @@ -183,8 +182,7 @@ def IsPhenoConstrainedQ5 [DecidableEq 𝓩] (x : ChargeSpectrum 𝓩) (q5 : 𝓩 lemma isPhenoConstrainedQ5_iff [DecidableEq 𝓩] (x : ChargeSpectrum 𝓩) (q5 : 𝓩) : x.IsPhenoConstrainedQ5 q5 ↔ x.AllowsTermQ5 q5 β ∨ x.AllowsTermQ5 q5 Λ ∨ x.AllowsTermQ5 q5 W4 ∨ - x.AllowsTermQ5 q5 K1 ∨ x.AllowsTermQ5 q5 W1 := by - simp [IsPhenoConstrainedQ5, AllowsTermQ5] + x.AllowsTermQ5 q5 K1 ∨ x.AllowsTermQ5 q5 W1 := by simp [IsPhenoConstrainedQ5, AllowsTermQ5] /-! diff --git a/Physlib/Particles/SuperSymmetry/SU5/ChargeSpectrum/Yukawa.lean b/Physlib/Particles/SuperSymmetry/SU5/ChargeSpectrum/Yukawa.lean index 030ae5816..7c2b35b31 100644 --- a/Physlib/Particles/SuperSymmetry/SU5/ChargeSpectrum/Yukawa.lean +++ b/Physlib/Particles/SuperSymmetry/SU5/ChargeSpectrum/Yukawa.lean @@ -84,11 +84,9 @@ lemma ofYukawaTerms_subset_of_subset [DecidableEq 𝓩] {x y : ChargeSpectrum intro hr rcases hr with hr | hr · left - apply ofPotentialTerm'_mono h - exact hr + exact ofPotentialTerm'_mono h topYukawa hr · right - apply ofPotentialTerm'_mono h - exact hr + exact ofPotentialTerm'_mono h bottomYukawa hr /-! @@ -131,8 +129,7 @@ lemma ofYukawaTermsNSum_subset_of_subset [DecidableEq 𝓩] {x y : ChargeSpectru · exact ih hz1 use z2 simp_all only [and_true] - apply ofYukawaTerms_subset_of_subset h - exact hz2 + exact ofYukawaTerms_subset_of_subset h hz2 /-! @@ -191,8 +188,7 @@ lemma yukawaGeneratesDangerousAtLevel_iff_toFinset (x : ChargeSpectrum 𝓩) (n ext i simp only [Finset.mem_inter, Multiset.mem_toFinset, Finset.notMem_empty, iff_false, not_and] intro h1 h2 - have h3 : i ∈ (x.ofYukawaTermsNSum n) ∩ x.phenoConstrainingChargesSP := by - simpa using ⟨h1, h2⟩ + have h3 : i ∈ (x.ofYukawaTermsNSum n) ∩ x.phenoConstrainingChargesSP := by simpa using ⟨h1, h2⟩ simp_all /-! diff --git a/Physlib/QFT/AnomalyCancellation/Basic.lean b/Physlib/QFT/AnomalyCancellation/Basic.lean index d9b158e81..98957f780 100644 --- a/Physlib/QFT/AnomalyCancellation/Basic.lean +++ b/Physlib/QFT/AnomalyCancellation/Basic.lean @@ -383,9 +383,8 @@ def quadSolsIncl (χ : ACCSystemQuad) : χ.QuadSols →[ℚ] χ.Charges := lemma quadSolsIncl_injective (χ : ACCSystemQuad) : Function.Injective χ.quadSolsIncl := by intro S T h - have h' : χ.quadSolsInclLinSols S = χ.quadSolsInclLinSols T := by - apply ACCSystemLinear.linSolsIncl_injective (χ := χ.toACCSystemLinear) - exact h + have h' : χ.quadSolsInclLinSols S = χ.quadSolsInclLinSols T := + ACCSystemLinear.linSolsIncl_injective (χ := χ.toACCSystemLinear) h exact quadSolsInclLinSols_injective χ h' end ACCSystemQuad diff --git a/Physlib/QFT/AnomalyCancellation/GroupActions.lean b/Physlib/QFT/AnomalyCancellation/GroupActions.lean index 09f91bde5..fb85e12a6 100644 --- a/Physlib/QFT/AnomalyCancellation/GroupActions.lean +++ b/Physlib/QFT/AnomalyCancellation/GroupActions.lean @@ -60,14 +60,10 @@ def linSolRep {χ : ACCSystem} (G : ACCSystemGroupAction χ) : toFun := G.linSolMap map_mul' g1 g2 := by refine LinearMap.ext fun S ↦ ACCSystemLinear.LinSols.ext ?_ - change (G.rep (g1 * g2)) S.val = _ - rw [G.rep.map_mul] - rfl + exact LinearMap.congr_fun (G.rep.map_mul g1 g2) S.val map_one' := by refine LinearMap.ext fun S ↦ ACCSystemLinear.LinSols.ext ?_ - change (G.rep.toFun 1) S.val = _ - rw [G.rep.map_one'] - rfl + exact LinearMap.congr_fun G.rep.map_one S.val /-- The representation on the charges and anomaly free solutions commutes with the inclusion. -/ @@ -82,14 +78,10 @@ instance quadSolAction {χ : ACCSystem} (G : ACCSystemGroupAction χ) : smul f S := ⟨G.linSolRep f S.1, by simp [linSolRep_apply_apply_val, G.quadInvariant, S.quadSol]⟩ mul_smul f1 f2 S := by apply ACCSystemQuad.QuadSols.ext - change (G.rep.toFun (f1 * f2)) S.val = _ - rw [G.rep.map_mul'] - rfl + exact LinearMap.congr_fun (G.rep.map_mul' f1 f2) S.val one_smul S := by apply ACCSystemQuad.QuadSols.ext - change (G.rep.toFun 1) S.val = _ - rw [G.rep.map_one'] - rfl + exact LinearMap.congr_fun G.rep.map_one S.val lemma linSolRep_quadSolAction_commute {χ : ACCSystem} (G : ACCSystemGroupAction χ) (g : G.group) (S : χ.QuadSols) : χ.quadSolsInclLinSols (G.quadSolAction.toFun _ _ S g) = @@ -107,14 +99,10 @@ instance solAction {χ : ACCSystem} (G : ACCSystemGroupAction χ) : MulAction G. rw [G.cubicInvariant, S.cubicSol]⟩ mul_smul f1 f2 S := by apply ACCSystem.Sols.ext - change (G.rep.toFun (f1 * f2)) S.val = _ - rw [G.rep.map_mul'] - rfl + exact LinearMap.congr_fun (G.rep.map_mul' f1 f2) S.val one_smul S := by apply ACCSystem.Sols.ext - change (G.rep.toFun 1) S.val = _ - rw [G.rep.map_one'] - rfl + exact LinearMap.congr_fun G.rep.map_one S.val lemma quadSolAction_solAction_commute {χ : ACCSystem} (G : ACCSystemGroupAction χ) (g : G.group) (S : χ.Sols) : χ.solsInclQuadSols (G.solAction.toFun _ _ S g) = diff --git a/Physlib/QFT/PerturbationTheory/FieldOpFreeAlgebra/Basic.lean b/Physlib/QFT/PerturbationTheory/FieldOpFreeAlgebra/Basic.lean index 169c50c34..237a98cc2 100644 --- a/Physlib/QFT/PerturbationTheory/FieldOpFreeAlgebra/Basic.lean +++ b/Physlib/QFT/PerturbationTheory/FieldOpFreeAlgebra/Basic.lean @@ -155,19 +155,16 @@ def crPartF : 𝓕.FieldOp → 𝓕.FieldOpFreeAlgebra := fun φ => @[simp] lemma crPartF_negAsymp (φ : (Σ f, 𝓕.AsymptoticLabel f) × Momentum) : - crPartF (FieldOp.inAsymp φ) = ofCrAnOpF ⟨FieldOp.inAsymp φ, ()⟩ := by - simp [crPartF] + crPartF (FieldOp.inAsymp φ) = ofCrAnOpF ⟨FieldOp.inAsymp φ, ()⟩ := by simp [crPartF] @[simp] lemma crPartF_position (φ : (Σ f, 𝓕.PositionLabel f) × SpaceTime) : crPartF (FieldOp.position φ) = - ofCrAnOpF ⟨FieldOp.position φ, CreateAnnihilate.create⟩ := by - simp [crPartF] + ofCrAnOpF ⟨FieldOp.position φ, CreateAnnihilate.create⟩ := by simp [crPartF] @[simp] lemma crPartF_posAsymp (φ : (Σ f, 𝓕.AsymptoticLabel f) × Momentum) : - crPartF (FieldOp.outAsymp φ) = 0 := by - simp [crPartF] + crPartF (FieldOp.outAsymp φ) = 0 := by simp [crPartF] /-- The algebra map taking an element of the free-state algebra to the part of it in the creation and annihilation free algebra @@ -180,19 +177,16 @@ def anPartF : 𝓕.FieldOp → 𝓕.FieldOpFreeAlgebra := fun φ => @[simp] lemma anPartF_negAsymp (φ : (Σ f, 𝓕.AsymptoticLabel f) × Momentum) : - anPartF (FieldOp.inAsymp φ) = 0 := by - simp [anPartF] + anPartF (FieldOp.inAsymp φ) = 0 := by simp [anPartF] @[simp] lemma anPartF_position (φ : (Σ f, 𝓕.PositionLabel f) × SpaceTime) : anPartF (FieldOp.position φ) = - ofCrAnOpF ⟨FieldOp.position φ, CreateAnnihilate.annihilate⟩ := by - simp [anPartF] + ofCrAnOpF ⟨FieldOp.position φ, CreateAnnihilate.annihilate⟩ := by simp [anPartF] @[simp] lemma anPartF_posAsymp (φ : (Σ f, 𝓕.AsymptoticLabel f) × Momentum) : - anPartF (FieldOp.outAsymp φ) = ofCrAnOpF ⟨FieldOp.outAsymp φ, ()⟩ := by - simp [anPartF] + anPartF (FieldOp.outAsymp φ) = ofCrAnOpF ⟨FieldOp.outAsymp φ, ()⟩ := by simp [anPartF] lemma ofFieldOpF_eq_crPartF_add_anPartF (φ : 𝓕.FieldOp) : ofFieldOpF φ = crPartF φ + anPartF φ := by diff --git a/Physlib/QFT/PerturbationTheory/FieldOpFreeAlgebra/Grading.lean b/Physlib/QFT/PerturbationTheory/FieldOpFreeAlgebra/Grading.lean index 40f76ac7d..de54ee5f1 100644 --- a/Physlib/QFT/PerturbationTheory/FieldOpFreeAlgebra/Grading.lean +++ b/Physlib/QFT/PerturbationTheory/FieldOpFreeAlgebra/Grading.lean @@ -43,8 +43,7 @@ lemma ofCrAnListF_bosonic_or_fermionic (φs : List 𝓕.CrAnFieldOp) : lemma ofCrAnOpF_bosonic_or_fermionic (φ : 𝓕.CrAnFieldOp) : ofCrAnOpF φ ∈ statisticSubmodule bosonic ∨ ofCrAnOpF φ ∈ statisticSubmodule fermionic := by - rw [← ofCrAnListF_singleton] - exact ofCrAnListF_bosonic_or_fermionic [φ] + simpa [ofCrAnListF_singleton] using ofCrAnListF_bosonic_or_fermionic [φ] /-- The projection of an element of `FieldOpFreeAlgebra` onto it's bosonic part. -/ def bosonicProjF : 𝓕.FieldOpFreeAlgebra →ₗ[ℂ] statisticSubmodule (𝓕 := 𝓕) bosonic := @@ -104,9 +103,8 @@ lemma bosonicProjF_of_bonosic_part @[simp] lemma bosonicProjF_of_fermionic_part (a : DirectSum FieldStatistic (fun i => (statisticSubmodule (𝓕 := 𝓕) i))) : - bosonicProjF (a fermionic).1 = 0 := by - apply bosonicProjF_of_mem_fermionic - exact Submodule.coe_mem (a.toFun fermionic) + bosonicProjF (a fermionic).1 = 0 := + bosonicProjF_of_mem_fermionic (a.toFun fermionic).1 (Submodule.coe_mem (a.toFun fermionic)) /-- The projection of an element of `FieldOpFreeAlgebra` onto it's fermionic part. -/ def fermionicProjF : 𝓕.FieldOpFreeAlgebra →ₗ[ℂ] statisticSubmodule (𝓕 := 𝓕) fermionic := @@ -171,9 +169,8 @@ lemma fermionicProjF_of_mem_bosonic (a : 𝓕.FieldOpFreeAlgebra) @[simp] lemma fermionicProjF_of_bosonic_part (a : DirectSum FieldStatistic (fun i => (statisticSubmodule (𝓕 := 𝓕) i))) : - fermionicProjF (a bosonic).1 = 0 := by - apply fermionicProjF_of_mem_bosonic - exact Submodule.coe_mem (a.toFun bosonic) + fermionicProjF (a bosonic).1 = 0 := + fermionicProjF_of_mem_bosonic (a.toFun bosonic).1 (Submodule.coe_mem (a.toFun bosonic)) @[simp] lemma fermionicProjF_of_fermionic_part @@ -255,9 +252,7 @@ instance fieldOpFreeAlgebraGrade : simp only [statisticSubmodule] refine Submodule.mem_span.mpr fun p a => a ?_ simp only [Set.mem_setOf_eq] - use [] - simp only [ofCrAnListF_nil, ofList_empty, true_and] - rfl + exact ⟨[], rfl, rfl⟩ mul_mem f1 f2 a1 a2 h1 h2 := by let p (a2 : 𝓕.FieldOpFreeAlgebra) (hx : a2 ∈ statisticSubmodule f2) : Prop := a1 * a2 ∈ statisticSubmodule (f1 + f2) @@ -282,8 +277,7 @@ instance fieldOpFreeAlgebraGrade : cases f1 <;> cases f2 <;> rfl · simp [p] · intro x y hx hy hx1 hx2 - simp only [add_mul, p] - exact Submodule.add_mem _ hx1 hx2 + simpa only [add_mul, p] using Submodule.add_mem _ hx1 hx2 · intro c a hx h1 simp only [Algebra.smul_mul_assoc, p] exact Submodule.smul_mem _ _ h1 @@ -350,17 +344,13 @@ lemma bosonicProjF_mul (a b : 𝓕.FieldOpFreeAlgebra) : right rw [bosonicProjF_of_mem_bosonic _ (by - have h1 : bosonic = fermionic + fermionic := by - simp only [add_eq_mul, mul_self] - rfl + have h1 : bosonic = fermionic + fermionic := rfl conv_lhs => rw [h1] apply fieldOpFreeAlgebraGrade.mul_mem simp only [SetLike.coe_mem] simp)] simp only [ZeroMemClass.coe_zero, add_zero, zero_add] - · have h1 : bosonic = bosonic + bosonic := by - simp only [add_eq_mul, mul_self] - rfl + · have h1 : bosonic = bosonic + bosonic := rfl conv_lhs => rw [h1] apply fieldOpFreeAlgebraGrade.mul_mem simp only [SetLike.coe_mem] @@ -378,9 +368,7 @@ lemma fermionicProjF_mul (a b : 𝓕.FieldOpFreeAlgebra) : left rw [fermionicProjF_of_mem_bosonic _ (by - have h1 : bosonic = bosonic + bosonic := by - simp only [add_eq_mul, mul_self] - rfl + have h1 : bosonic = bosonic + bosonic := rfl conv_lhs => rw [h1] apply fieldOpFreeAlgebraGrade.mul_mem simp only [SetLike.coe_mem] @@ -410,9 +398,7 @@ lemma fermionicProjF_mul (a b : 𝓕.FieldOpFreeAlgebra) : right rw [fermionicProjF_of_mem_bosonic _ (by - have h1 : bosonic = fermionic + fermionic := by - simp only [add_eq_mul, mul_self] - rfl + have h1 : bosonic = fermionic + fermionic := rfl conv_lhs => rw [h1] apply fieldOpFreeAlgebraGrade.mul_mem simp only [SetLike.coe_mem] diff --git a/Physlib/QFT/PerturbationTheory/FieldOpFreeAlgebra/NormalOrder.lean b/Physlib/QFT/PerturbationTheory/FieldOpFreeAlgebra/NormalOrder.lean index 3cb794dd1..c9a25faab 100644 --- a/Physlib/QFT/PerturbationTheory/FieldOpFreeAlgebra/NormalOrder.lean +++ b/Physlib/QFT/PerturbationTheory/FieldOpFreeAlgebra/NormalOrder.lean @@ -115,17 +115,11 @@ lemma normalOrderF_normalOrderF_mid (a b c : 𝓕.FieldOpFreeAlgebra) : lemma normalOrderF_normalOrderF_right (a b : 𝓕.FieldOpFreeAlgebra) : 𝓝ᶠ(a * b) = 𝓝ᶠ(a * 𝓝ᶠ(b)) := by - trans 𝓝ᶠ(a * b * 1) - · simp - · rw [normalOrderF_normalOrderF_mid] - simp + simpa using normalOrderF_normalOrderF_mid a b (1 : 𝓕.FieldOpFreeAlgebra) lemma normalOrderF_normalOrderF_left (a b : 𝓕.FieldOpFreeAlgebra) : 𝓝ᶠ(a * b) = 𝓝ᶠ(𝓝ᶠ(a) * b) := by - trans 𝓝ᶠ(1 * a * b) - · simp - · rw [normalOrderF_normalOrderF_mid] - simp + simpa using normalOrderF_normalOrderF_mid (1 : 𝓕.FieldOpFreeAlgebra) a b /-! @@ -173,8 +167,7 @@ lemma normalOrderF_crPartF_mul (φ : 𝓕.FieldOp) (a : FieldOpFreeAlgebra 𝓕) crPartF φ * 𝓝ᶠ(a) := by match φ with | .inAsymp φ => - rw [crPartF] - exact normalOrderF_create_mul ⟨FieldOp.inAsymp φ, ()⟩ rfl a + simpa [crPartF] using normalOrderF_create_mul ⟨FieldOp.inAsymp φ, ()⟩ rfl a | .position φ => rw [crPartF] exact normalOrderF_create_mul _ rfl _ @@ -221,8 +214,7 @@ lemma normalOrderF_swap_create_annihilate_ofCrAnListF (φc φa : 𝓕.CrAnFieldO refine LinearMap.congr_fun (ofCrAnListFBasis.ext fun l ↦ ?_) a simp only [mulLinearMap, LinearMap.coe_mk, AddHom.coe_mk, ofListBasis_eq_ofList, LinearMap.coe_comp, Function.comp_apply] - rw [normalOrderF_swap_create_annihilate_ofCrAnListF_ofCrAnListF φc φa hφc hφa] - rfl + exact normalOrderF_swap_create_annihilate_ofCrAnListF_ofCrAnListF _ _ hφc hφa _ _ lemma normalOrderF_swap_create_annihilate (φc φa : 𝓕.CrAnFieldOp) (hφc : 𝓕 |>ᶜ φc = CreateAnnihilate.create) (hφa : 𝓕 |>ᶜ φa = CreateAnnihilate.annihilate) @@ -267,23 +259,19 @@ lemma normalOrderF_swap_crPartF_anPartF (φ φ' : 𝓕.FieldOp) (a b : FieldOpFr | .position φ, .position φ' => simp only [crPartF_position, anPartF_position] rw [normalOrderF_swap_create_annihilate] - simp only [crAnStatistics, Function.comp_apply, crAnFieldOpToFieldOp_prod] - rfl; rfl + all_goals rfl | .inAsymp φ, .outAsymp φ' => simp only [crPartF_negAsymp, anPartF_posAsymp] rw [normalOrderF_swap_create_annihilate] - simp only [crAnStatistics, Function.comp_apply, crAnFieldOpToFieldOp_prod] - rfl; rfl + all_goals rfl | .inAsymp φ, .position φ' => simp only [crPartF_negAsymp, anPartF_position] rw [normalOrderF_swap_create_annihilate] - simp only [crAnStatistics, Function.comp_apply, crAnFieldOpToFieldOp_prod] - rfl; rfl + all_goals rfl | .position φ, .outAsymp φ' => simp only [crPartF_position, anPartF_posAsymp] rw [normalOrderF_swap_create_annihilate] - simp only [crAnStatistics, Function.comp_apply, crAnFieldOpToFieldOp_prod] - rfl; rfl + all_goals rfl /-! @@ -296,8 +284,7 @@ Using the results from above. lemma normalOrderF_swap_anPartF_crPartF (φ φ' : 𝓕.FieldOp) (a b : FieldOpFreeAlgebra 𝓕) : 𝓝ᶠ(a * (anPartF φ) * (crPartF φ') * b) = 𝓢(𝓕 |>ₛ φ, 𝓕 |>ₛ φ') • 𝓝ᶠ(a * (crPartF φ') * - (anPartF φ) * b) := by - simp [normalOrderF_swap_crPartF_anPartF, smul_smul] + (anPartF φ) * b) := by simp [normalOrderF_swap_crPartF_anPartF, smul_smul] lemma normalOrderF_superCommuteF_crPartF_anPartF (φ φ' : 𝓕.FieldOp) (a b : FieldOpFreeAlgebra 𝓕) : 𝓝ᶠ(a * superCommuteF @@ -348,38 +335,32 @@ lemma normalOrderF_crPartF_mul_crPartF (φ φ' : 𝓕.FieldOp) : 𝓝ᶠ(crPartF φ * crPartF φ') = crPartF φ * crPartF φ' := by rw [normalOrderF_crPartF_mul] - conv_lhs => rw [← mul_one (crPartF φ')] - rw [normalOrderF_crPartF_mul, normalOrderF_one] - simp + simpa [normalOrderF_one] using congrArg (fun x => crPartF φ * x) + (normalOrderF_crPartF_mul φ' (1 : 𝓕.FieldOpFreeAlgebra)) @[simp] lemma normalOrderF_anPartF_mul_anPartF (φ φ' : 𝓕.FieldOp) : 𝓝ᶠ(anPartF φ * anPartF φ') = anPartF φ * anPartF φ' := by rw [normalOrderF_mul_anPartF] - conv_lhs => rw [← one_mul (anPartF φ)] - rw [normalOrderF_mul_anPartF, normalOrderF_one] - simp + simpa [normalOrderF_one] using congrArg (fun x => x * anPartF φ') + (normalOrderF_mul_anPartF φ (1 : 𝓕.FieldOpFreeAlgebra)) @[simp] lemma normalOrderF_crPartF_mul_anPartF (φ φ' : 𝓕.FieldOp) : 𝓝ᶠ(crPartF φ * anPartF φ') = crPartF φ * anPartF φ' := by rw [normalOrderF_crPartF_mul] - conv_lhs => rw [← one_mul (anPartF φ')] - rw [normalOrderF_mul_anPartF, normalOrderF_one] - simp + simpa [normalOrderF_one] using congrArg (fun x => crPartF φ * x) + (normalOrderF_mul_anPartF φ' (1 : 𝓕.FieldOpFreeAlgebra)) @[simp] lemma normalOrderF_anPartF_mul_crPartF (φ φ' : 𝓕.FieldOp) : 𝓝ᶠ(anPartF φ * crPartF φ') = 𝓢(𝓕 |>ₛ φ, 𝓕 |>ₛ φ') • (crPartF φ' * anPartF φ) := by - conv_lhs => rw [← one_mul (anPartF φ * crPartF φ')] - conv_lhs => rw [← mul_one (1 * (anPartF φ * - crPartF φ'))] - rw [← mul_assoc, normalOrderF_swap_anPartF_crPartF] - simp + simpa using normalOrderF_swap_anPartF_crPartF φ φ' + (1 : 𝓕.FieldOpFreeAlgebra) (1 : 𝓕.FieldOpFreeAlgebra) lemma normalOrderF_ofFieldOpF_mul_ofFieldOpF (φ φ' : 𝓕.FieldOp) : 𝓝ᶠ(ofFieldOpF φ * ofFieldOpF φ') = diff --git a/Physlib/QFT/PerturbationTheory/FieldOpFreeAlgebra/SuperCommute.lean b/Physlib/QFT/PerturbationTheory/FieldOpFreeAlgebra/SuperCommute.lean index 84da10d1b..4b2c3d9ae 100644 --- a/Physlib/QFT/PerturbationTheory/FieldOpFreeAlgebra/SuperCommute.lean +++ b/Physlib/QFT/PerturbationTheory/FieldOpFreeAlgebra/SuperCommute.lean @@ -92,16 +92,14 @@ lemma superCommuteF_ofFieldOpListF_ofFieldOpFsList (φ : List 𝓕.FieldOp) (φs lemma superCommuteF_ofFieldOpF_ofFieldOpFsList (φ : 𝓕.FieldOp) (φs : List 𝓕.FieldOp) : [ofFieldOpF φ, ofFieldOpListF φs]ₛF = ofFieldOpF φ * ofFieldOpListF φs - 𝓢(𝓕 |>ₛ φ, 𝓕 |>ₛ φs) • ofFieldOpListF φs * ofFieldOpF φ := by - rw [← ofFieldOpListF_singleton, superCommuteF_ofFieldOpListF_ofFieldOpFsList, - ofFieldOpListF_singleton] - simp + simpa [ofFieldOpListF_singleton] using + superCommuteF_ofFieldOpListF_ofFieldOpFsList [φ] φs lemma superCommuteF_ofFieldOpListF_ofFieldOpF (φs : List 𝓕.FieldOp) (φ : 𝓕.FieldOp) : [ofFieldOpListF φs, ofFieldOpF φ]ₛF = ofFieldOpListF φs * ofFieldOpF φ - 𝓢(𝓕 |>ₛ φs, 𝓕 |>ₛ φ) • ofFieldOpF φ * ofFieldOpListF φs := by - rw [← ofFieldOpListF_singleton, superCommuteF_ofFieldOpListF_ofFieldOpFsList, - ofFieldOpListF_singleton] - simp + simpa [ofFieldOpListF_singleton] using + superCommuteF_ofFieldOpListF_ofFieldOpFsList φs [φ] lemma superCommuteF_anPartF_crPartF (φ φ' : 𝓕.FieldOp) : [anPartF φ, crPartF φ']ₛF = anPartF φ * crPartF φ' - @@ -244,15 +242,13 @@ lemma superCommuteF_crPartF_ofFieldOpF (φ φ' : 𝓕.FieldOp) : [crPartF φ, ofFieldOpF φ']ₛF = crPartF φ * ofFieldOpF φ' - 𝓢(𝓕 |>ₛ φ, 𝓕 |>ₛ φ') • ofFieldOpF φ' * crPartF φ := by - rw [← ofFieldOpListF_singleton, superCommuteF_crPartF_ofFieldOpListF] - simp + simpa [ofFieldOpListF_singleton] using superCommuteF_crPartF_ofFieldOpListF φ [φ'] lemma superCommuteF_anPartF_ofFieldOpF (φ φ' : 𝓕.FieldOp) : [anPartF φ, ofFieldOpF φ']ₛF = anPartF φ * ofFieldOpF φ' - 𝓢(𝓕 |>ₛ φ, 𝓕 |>ₛ φ') • ofFieldOpF φ' * anPartF φ := by - rw [← ofFieldOpListF_singleton, superCommuteF_anPartF_ofFieldOpListF] - simp + simpa [ofFieldOpListF_singleton] using superCommuteF_anPartF_ofFieldOpListF φ [φ'] /-! @@ -265,8 +261,7 @@ multiplication with a sign plus the super commutator. lemma ofCrAnListF_mul_ofCrAnListF_eq_superCommuteF (φs φs' : List 𝓕.CrAnFieldOp) : ofCrAnListF φs * ofCrAnListF φs' = 𝓢(𝓕 |>ₛ φs, 𝓕 |>ₛ φs') • ofCrAnListF φs' * ofCrAnListF φs + [ofCrAnListF φs, ofCrAnListF φs']ₛF := by - rw [superCommuteF_ofCrAnListF_ofCrAnListF] - simp [ofCrAnListF_append] + simp [superCommuteF_ofCrAnListF_ofCrAnListF, ofCrAnListF_append] lemma ofCrAnOpF_mul_ofCrAnListF_eq_superCommuteF (φ : 𝓕.CrAnFieldOp) (φs' : List 𝓕.CrAnFieldOp) : ofCrAnOpF φ * ofCrAnListF φs' = 𝓢(𝓕 |>ₛ φ, 𝓕 |>ₛ φs') • ofCrAnListF φs' * ofCrAnOpF φ @@ -278,8 +273,7 @@ lemma ofFieldOpListF_mul_ofFieldOpListF_eq_superCommuteF (φs φs' : List 𝓕.F ofFieldOpListF φs * ofFieldOpListF φs' = 𝓢(𝓕 |>ₛ φs, 𝓕 |>ₛ φs') • ofFieldOpListF φs' * ofFieldOpListF φs + [ofFieldOpListF φs, ofFieldOpListF φs']ₛF := by - rw [superCommuteF_ofFieldOpListF_ofFieldOpFsList] - simp + simp [superCommuteF_ofFieldOpListF_ofFieldOpFsList] lemma ofFieldOpF_mul_ofFieldOpListF_eq_superCommuteF (φ : 𝓕.FieldOp) (φs' : List 𝓕.FieldOp) : ofFieldOpF φ * ofFieldOpListF φs' = 𝓢(𝓕 |>ₛ φ, 𝓕 |>ₛ φs') • ofFieldOpListF φs' * ofFieldOpF φ @@ -296,37 +290,27 @@ lemma ofFieldOpListF_mul_ofFieldOpF_eq_superCommuteF (φs : List 𝓕.FieldOp) ( lemma crPartF_mul_anPartF_eq_superCommuteF (φ φ' : 𝓕.FieldOp) : crPartF φ * anPartF φ' = 𝓢(𝓕 |>ₛ φ, 𝓕 |>ₛ φ') • anPartF φ' * crPartF φ + - [crPartF φ, anPartF φ']ₛF := by - rw [superCommuteF_crPartF_anPartF] - simp + [crPartF φ, anPartF φ']ₛF := by simp [superCommuteF_crPartF_anPartF] lemma anPartF_mul_crPartF_eq_superCommuteF (φ φ' : 𝓕.FieldOp) : anPartF φ * crPartF φ' = 𝓢(𝓕 |>ₛ φ, 𝓕 |>ₛ φ') • crPartF φ' * anPartF φ + - [anPartF φ, crPartF φ']ₛF := by - rw [superCommuteF_anPartF_crPartF] - simp + [anPartF φ, crPartF φ']ₛF := by simp [superCommuteF_anPartF_crPartF] lemma crPartF_mul_crPartF_eq_superCommuteF (φ φ' : 𝓕.FieldOp) : crPartF φ * crPartF φ' = 𝓢(𝓕 |>ₛ φ, 𝓕 |>ₛ φ') • crPartF φ' * crPartF φ + - [crPartF φ, crPartF φ']ₛF := by - rw [superCommuteF_crPartF_crPartF] - simp + [crPartF φ, crPartF φ']ₛF := by simp [superCommuteF_crPartF_crPartF] lemma anPartF_mul_anPartF_eq_superCommuteF (φ φ' : 𝓕.FieldOp) : anPartF φ * anPartF φ' = 𝓢(𝓕 |>ₛ φ, 𝓕 |>ₛ φ') • anPartF φ' * anPartF φ + - [anPartF φ, anPartF φ']ₛF := by - rw [superCommuteF_anPartF_anPartF] - simp + [anPartF φ, anPartF φ']ₛF := by simp [superCommuteF_anPartF_anPartF] lemma ofCrAnListF_mul_ofFieldOpListF_eq_superCommuteF (φs : List 𝓕.CrAnFieldOp) (φs' : List 𝓕.FieldOp) : ofCrAnListF φs * ofFieldOpListF φs' = 𝓢(𝓕 |>ₛ φs, 𝓕 |>ₛ φs') • ofFieldOpListF φs' * ofCrAnListF φs - + [ofCrAnListF φs, ofFieldOpListF φs']ₛF := by - rw [superCommuteF_ofCrAnListF_ofFieldOpFsList] - simp + + [ofCrAnListF φs, ofFieldOpListF φs']ₛF := by simp [superCommuteF_ofCrAnListF_ofFieldOpFsList] /-! @@ -531,8 +515,7 @@ lemma superCommuteF_grade {a b : 𝓕.FieldOpFreeAlgebra} {f1 f2 : FieldStatisti rw [mul_comm] · simp [p] · intro x y hx hy hp1 hp2 - simp only [add_eq_mul, map_add, LinearMap.add_apply, p] - exact Submodule.add_mem _ hp1 hp2 + simpa only [add_eq_mul, map_add, LinearMap.add_apply, p] using Submodule.add_mem _ hp1 hp2 · intro c x hx hp1 simp only [add_eq_mul, map_smul, LinearMap.smul_apply, p] exact Submodule.smul_mem _ c hp1 @@ -663,15 +646,11 @@ lemma bosonic_superCommuteF {a b : 𝓕.FieldOpFreeAlgebra} (ha : a ∈ statisti lemma superCommuteF_bonsonic_symm {a b : 𝓕.FieldOpFreeAlgebra} (hb : b ∈ statisticSubmodule bosonic) : - [a, b]ₛF = - [b, a]ₛF := by - rw [bosonic_superCommuteF hb, superCommuteF_bonsonic hb] - simp + [a, b]ₛF = - [b, a]ₛF := by simp [bosonic_superCommuteF hb, superCommuteF_bonsonic hb] lemma bonsonic_superCommuteF_symm {a b : 𝓕.FieldOpFreeAlgebra} (ha : a ∈ statisticSubmodule bosonic) : - [a, b]ₛF = - [b, a]ₛF := by - rw [bosonic_superCommuteF ha, superCommuteF_bonsonic ha] - simp + [a, b]ₛF = - [b, a]ₛF := by simp [bosonic_superCommuteF ha, superCommuteF_bonsonic ha] lemma superCommuteF_fermionic_fermionic {a b : 𝓕.FieldOpFreeAlgebra} (ha : a ∈ statisticSubmodule fermionic) (hb : b ∈ statisticSubmodule fermionic) : @@ -709,8 +688,7 @@ lemma superCommuteF_fermionic_fermionic {a b : 𝓕.FieldOpFreeAlgebra} lemma superCommuteF_fermionic_fermionic_symm {a b : 𝓕.FieldOpFreeAlgebra} (ha : a ∈ statisticSubmodule fermionic) (hb : b ∈ statisticSubmodule fermionic) : [a, b]ₛF = [b, a]ₛF := by - rw [superCommuteF_fermionic_fermionic ha hb] - rw [superCommuteF_fermionic_fermionic hb ha] + rw [superCommuteF_fermionic_fermionic ha hb, superCommuteF_fermionic_fermionic hb ha] abel lemma superCommuteF_expand_bosonicProjF_fermionicProjF (a b : 𝓕.FieldOpFreeAlgebra) : @@ -731,33 +709,25 @@ lemma superCommuteF_ofCrAnListF_ofCrAnListF_bosonic_or_fermionic (φs φs' : Lis [ofCrAnListF φs, ofCrAnListF φs']ₛF ∈ statisticSubmodule fermionic := by by_cases h1 : (𝓕 |>ₛ φs) = bosonic <;> by_cases h2 : (𝓕 |>ₛ φs') = bosonic · left - have h : bosonic = bosonic + bosonic := by - simp only [add_eq_mul, mul_self] - rfl + have h : bosonic = bosonic + bosonic := rfl rw [h] apply superCommuteF_grade apply ofCrAnListF_mem_statisticSubmodule_of _ _ h1 apply ofCrAnListF_mem_statisticSubmodule_of _ _ h2 · right - have h : fermionic = bosonic + fermionic := by - simp only [add_eq_mul] - rfl + have h : fermionic = bosonic + fermionic := rfl rw [h] apply superCommuteF_grade apply ofCrAnListF_mem_statisticSubmodule_of _ _ h1 apply ofCrAnListF_mem_statisticSubmodule_of _ _ (by simpa using h2) · right - have h : fermionic = fermionic + bosonic := by - simp only [add_eq_mul] - rfl + have h : fermionic = fermionic + bosonic := rfl rw [h] apply superCommuteF_grade apply ofCrAnListF_mem_statisticSubmodule_of _ _ (by simpa using h1) apply ofCrAnListF_mem_statisticSubmodule_of _ _ h2 · left - have h : bosonic = fermionic + fermionic := by - simp only [add_eq_mul, mul_self] - rfl + have h : bosonic = fermionic + fermionic := rfl rw [h] apply superCommuteF_grade apply ofCrAnListF_mem_statisticSubmodule_of _ _ (by simpa using h1) @@ -775,27 +745,19 @@ lemma superCommuteF_superCommuteF_ofCrAnOpF_bosonic_or_fermionic (φ1 φ2 φ3 : rcases superCommuteF_ofCrAnOpF_ofCrAnOpF_bosonic_or_fermionic φ2 φ3 with hs | hs <;> rcases ofCrAnOpF_bosonic_or_fermionic φ1 with h1 | h1 · left - have h : bosonic = bosonic + bosonic := by - simp only [add_eq_mul, mul_self] - rfl + have h : bosonic = bosonic + bosonic := rfl rw [h] apply superCommuteF_grade h1 hs · right - have h : fermionic = fermionic + bosonic := by - simp only [add_eq_mul] - rfl + have h : fermionic = fermionic + bosonic := rfl rw [h] apply superCommuteF_grade h1 hs · right - have h : fermionic = bosonic + fermionic := by - simp only [add_eq_mul] - rfl + have h : fermionic = bosonic + fermionic := rfl rw [h] apply superCommuteF_grade h1 hs · left - have h : bosonic = fermionic + fermionic := by - simp only [add_eq_mul, mul_self] - rfl + have h : bosonic = fermionic + fermionic := rfl rw [h] apply superCommuteF_grade h1 hs @@ -871,17 +833,13 @@ lemma statistic_ne_of_superCommuteF_fermionic {φs φs' : List 𝓕.CrAnFieldOp} by_contra hn refine h0 (eq_zero_of_bosonic_and_fermionic ?_ h) by_cases hc : (𝓕 |>ₛ φs) = bosonic - · have h1 : bosonic = bosonic + bosonic := by - simp only [add_eq_mul, mul_self] - rfl + · have h1 : bosonic = bosonic + bosonic := rfl rw [h1] apply superCommuteF_grade apply ofCrAnListF_mem_statisticSubmodule_of _ _ hc apply ofCrAnListF_mem_statisticSubmodule_of _ _ rw [← hn, hc] - · have h1 : bosonic = fermionic + fermionic := by - simp only [add_eq_mul, mul_self] - rfl + · have h1 : bosonic = fermionic + fermionic := rfl rw [h1] apply superCommuteF_grade apply ofCrAnListF_mem_statisticSubmodule_of _ _ diff --git a/Physlib/QFT/PerturbationTheory/FieldOpFreeAlgebra/TimeOrder.lean b/Physlib/QFT/PerturbationTheory/FieldOpFreeAlgebra/TimeOrder.lean index 8f07abd3c..0b4d44a7f 100644 --- a/Physlib/QFT/PerturbationTheory/FieldOpFreeAlgebra/TimeOrder.lean +++ b/Physlib/QFT/PerturbationTheory/FieldOpFreeAlgebra/TimeOrder.lean @@ -105,16 +105,10 @@ lemma timeOrderF_timeOrderF_mid (a b c : 𝓕.FieldOpFreeAlgebra) : simp_all [pc] lemma timeOrderF_timeOrderF_right (a b : 𝓕.FieldOpFreeAlgebra) : 𝓣ᶠ(a * b) = 𝓣ᶠ(a * 𝓣ᶠ(b)) := by - trans 𝓣ᶠ(a * b * 1) - · simp - · rw [timeOrderF_timeOrderF_mid] - simp + simpa using timeOrderF_timeOrderF_mid a b (1 : 𝓕.FieldOpFreeAlgebra) lemma timeOrderF_timeOrderF_left (a b : 𝓕.FieldOpFreeAlgebra) : 𝓣ᶠ(a * b) = 𝓣ᶠ(𝓣ᶠ(a) * b) := by - trans 𝓣ᶠ(1 * a * b) - · simp - · rw [timeOrderF_timeOrderF_mid] - simp + simpa using timeOrderF_timeOrderF_mid (1 : 𝓕.FieldOpFreeAlgebra) a b lemma timeOrderF_ofFieldOpListF (φs : List 𝓕.FieldOp) : 𝓣ᶠ(ofFieldOpListF φs) = timeOrderSign φs • ofFieldOpListF (timeOrderList φs) := by @@ -142,8 +136,7 @@ lemma timeOrderF_ofFieldOpF_ofFieldOpF_ordered {φ ψ : 𝓕.FieldOp} (h : timeO rw [← ofFieldOpListF_singleton, ← ofFieldOpListF_singleton, ← ofFieldOpListF_append, timeOrderF_ofFieldOpListF] simp only [List.singleton_append] - rw [timeOrderSign_pair_ordered h, timeOrderList_pair_ordered h] - simp + simp [timeOrderSign_pair_ordered h, timeOrderList_pair_ordered h] lemma timeOrderF_ofFieldOpF_ofFieldOpF_not_ordered {φ ψ : 𝓕.FieldOp} (h : ¬ timeOrderRel φ ψ) : 𝓣ᶠ(ofFieldOpF φ * ofFieldOpF ψ) = 𝓢(𝓕 |>ₛ φ, 𝓕 |>ₛ ψ) • ofFieldOpF ψ * ofFieldOpF φ := by @@ -156,8 +149,7 @@ lemma timeOrderF_ofFieldOpF_ofFieldOpF_not_ordered {φ ψ : 𝓕.FieldOp} (h : lemma timeOrderF_ofFieldOpF_ofFieldOpF_not_ordered_eq_timeOrderF {φ ψ : 𝓕.FieldOp} (h : ¬ timeOrderRel φ ψ) : 𝓣ᶠ(ofFieldOpF φ * ofFieldOpF ψ) = 𝓢(𝓕 |>ₛ φ, 𝓕 |>ₛ ψ) • 𝓣ᶠ(ofFieldOpF ψ * ofFieldOpF φ) := by - rw [timeOrderF_ofFieldOpF_ofFieldOpF_not_ordered h] - rw [timeOrderF_ofFieldOpF_ofFieldOpF_ordered] + rw [timeOrderF_ofFieldOpF_ofFieldOpF_not_ordered h, timeOrderF_ofFieldOpF_ofFieldOpF_ordered] simp only [Algebra.smul_mul_assoc] have hx := Std.Total.total (r := timeOrderRel) ψ φ simp_all @@ -275,24 +267,19 @@ lemma timeOrderF_superCommuteF_ofCrAnOpF_superCommuteF_all_not_crAnTimeOrderRel simp simp_all only [imp_false, Decidable.not_not] by_cases h12 : ¬ crAnTimeOrderRel φ1 φ2 - · have h13 : ¬ crAnTimeOrderRel φ1 φ3 := by - intro h13 - apply h12 - exact IsTrans.trans φ1 φ3 φ2 h13 h32 + · have h13 : ¬ crAnTimeOrderRel φ1 φ3 := + fun h13 => h12 (IsTrans.trans φ1 φ3 φ2 h13 h32) rw [timeOrderF_superCommuteF_ofCrAnOpF_superCommuteF_not_crAnTimeOrderRel h12 h13] simp_all only [Decidable.not_not, forall_const] have h13 : crAnTimeOrderRel φ1 φ3 := IsTrans.trans φ1 φ2 φ3 h12 h23 simp_all only [forall_const] by_cases h21 : ¬ crAnTimeOrderRel φ2 φ1 · simp_all only [IsEmpty.forall_iff] - have h31 : ¬ crAnTimeOrderRel φ3 φ1 := by - intro h31 - apply h21 - exact IsTrans.trans φ2 φ3 φ1 h23 h31 + have h31 : ¬ crAnTimeOrderRel φ3 φ1 := + fun h31 => h21 (IsTrans.trans φ2 φ3 φ1 h23 h31) rw [timeOrderF_superCommuteF_ofCrAnOpF_superCommuteF_not_crAnTimeOrderRel' h21 h31] simp_all only [Decidable.not_not, forall_const] - refine False.elim (h ?_) - exact IsTrans.trans φ3 φ2 φ1 h32 h21 + exact False.elim (h (IsTrans.trans φ3 φ2 φ1 h32 h21)) lemma timeOrderF_superCommuteF_ofCrAnOpF_ofCrAnOpF_eq_time {φ ψ : 𝓕.CrAnFieldOp} (h1 : crAnTimeOrderRel φ ψ) (h2 : crAnTimeOrderRel ψ φ) : diff --git a/Physlib/QFT/PerturbationTheory/FieldSpecification/CrAnSection.lean b/Physlib/QFT/PerturbationTheory/FieldSpecification/CrAnSection.lean index 6067efcf6..92235ada7 100644 --- a/Physlib/QFT/PerturbationTheory/FieldSpecification/CrAnSection.lean +++ b/Physlib/QFT/PerturbationTheory/FieldSpecification/CrAnSection.lean @@ -109,8 +109,7 @@ def nilEquiv : CrAnSection (𝓕 := 𝓕) [] ≃ Unit where have h2 := ψs.2 simp only [List.map_eq_nil_iff] at h2 simp [h2] - right_inv _ := by - simp + right_inv _ := by simp /-- The creation and annihilation sections for a singleton list is given by a choice of `𝓕.fieldOpToCreateAnnihilateType φ`. If `φ` is a asymptotic state @@ -127,9 +126,7 @@ def singletonEquiv {φ : 𝓕.FieldOp} : CrAnSection [φ] ≃ have h2 := ψs.tail.2 simp only [List.tail_cons, List.map_eq_nil_iff] at h2 simp [h2] - right_inv ψ := by - simp only [head] - rfl + right_inv ψ := rfl /-- An equivalence separating the head of a creation and annihilation section from the tail. -/ @@ -139,9 +136,7 @@ def consEquiv {φ : 𝓕.FieldOp} {φs : List 𝓕.FieldOp} : CrAnSection (φ :: invFun ψψs := match ψψs with | (ψ, ψs) => cons ψ ψs - left_inv ψs := by - apply Subtype.ext - exact Eq.symm eq_head_cons_tail + left_inv ψs := Subtype.ext (Eq.symm eq_head_cons_tail) right_inv ψψs := by match ψψs with | (ψ, ψs) => rfl @@ -156,14 +151,11 @@ instance fintype : (φs : List 𝓕.FieldOp) → Fintype (CrAnSection φs) @[simp] lemma card_nil_eq : Fintype.card (CrAnSection (𝓕 := 𝓕) []) = 1 := by - rw [Fintype.ofEquiv_card nilEquiv.symm] - simp + simpa using Fintype.ofEquiv_card nilEquiv.symm lemma card_cons_eq {φ : 𝓕.FieldOp} {φs : List 𝓕.FieldOp} : Fintype.card (CrAnSection (φ :: φs)) = Fintype.card (𝓕.fieldOpToCrAnType φ) * - Fintype.card (CrAnSection φs) := by - rw [Fintype.ofEquiv_card consEquiv.symm] - simp + Fintype.card (CrAnSection φs) := by simpa using Fintype.ofEquiv_card consEquiv.symm lemma card_eq_mul : {φs : List 𝓕.FieldOp} → Fintype.card (CrAnSection φs) = 2 ^ (List.countP 𝓕.statesIsPosition φs) @@ -171,20 +163,17 @@ lemma card_eq_mul : {φs : List 𝓕.FieldOp} → Fintype.card (CrAnSection φs) simp | FieldOp.position _ :: φs => by simp only [statesIsPosition, List.countP_cons_of_pos] - rw [card_cons_eq] - rw [card_eq_mul] + rw [card_cons_eq, card_eq_mul] simp only [fieldOpToCrAnType] erw [CreateAnnihilate.CreateAnnihilate_card_eq_two] ring | FieldOp.inAsymp x_ :: φs => by simp only [statesIsPosition, Bool.false_eq_true, not_false_eq_true, List.countP_cons_of_neg] - rw [card_cons_eq] - rw [card_eq_mul] + rw [card_cons_eq, card_eq_mul] simp [fieldOpToCrAnType] | FieldOp.outAsymp _ :: φs => by simp only [statesIsPosition, Bool.false_eq_true, not_false_eq_true, List.countP_cons_of_neg] - rw [card_cons_eq] - rw [card_eq_mul] + rw [card_cons_eq, card_eq_mul] simp [fieldOpToCrAnType] lemma card_perm_eq {φs φs' : List 𝓕.FieldOp} (h : φs.Perm φs') : @@ -196,21 +185,17 @@ lemma card_perm_eq {φs φs' : List 𝓕.FieldOp} (h : φs.Perm φs') : @[simp] lemma sum_nil (f : CrAnSection (𝓕 := 𝓕) [] → M) [AddCommMonoid M] : ∑ (s : CrAnSection []), f s = f ⟨[], rfl⟩ := by - rw [← nilEquiv.symm.sum_comp] - simp only [Finset.univ_unique, PUnit.default_eq_unit, Finset.sum_singleton] - rfl + simpa [nilEquiv] using Eq.symm (Equiv.sum_comp nilEquiv.symm f) lemma sum_cons (f : CrAnSection (φ :: φs) → M) [AddCommMonoid M] : ∑ (s : CrAnSection (φ :: φs)), f s = ∑ (a : 𝓕.fieldOpToCrAnType φ), ∑ (s : CrAnSection φs), f (cons a s) := by - rw [← consEquiv.symm.sum_comp, Fintype.sum_prod_type] - rfl + simpa [Fintype.sum_prod_type, consEquiv] using Eq.symm (consEquiv.symm.sum_comp f) lemma sum_over_length {s : CrAnSection φs} (f : Fin s.1.length → M) [AddCommMonoid M] : ∑ (n : Fin s.1.length), f n = - ∑ (n : Fin φs.length), f (Fin.cast (length_eq s).symm n) := by - rw [← (finCongr (length_eq s)).sum_comp] - rfl + ∑ (n : Fin φs.length), f (Fin.cast (length_eq s).symm n) := + Eq.symm (Equiv.sum_comp (finCongr (length_eq s)).symm f) /-- The equivalence between `CrAnSection φs` and `CrAnSection φs'` induced by an equality `φs = φs'`. -/ @@ -394,8 +379,7 @@ lemma eraseIdxEquiv_symm_eq_take_cons_drop {n : ℕ} (φs : List 𝓕.FieldOp) ( simp only [congr_fst] have hn : (List.take n φs).length = n := by rw [@List.length_take] - simp only [inf_eq_left] - exact Nat.le_of_succ_le hn + simpa only [inf_eq_left] using Nat.le_of_succ_le hn rw [hn] @[simp] @@ -423,8 +407,7 @@ lemma sum_eraseIdxEquiv (n : ℕ) (φs : List 𝓕.FieldOp) (hn : n < φs.length (f : CrAnSection φs → M) [AddCommMonoid M] : ∑ (s : CrAnSection φs), f s = ∑ (a : 𝓕.fieldOpToCrAnType φs[n]), ∑ (s : CrAnSection (φs.eraseIdx n)), f ((eraseIdxEquiv n φs hn).symm ⟨a, s⟩) := by - rw [← (eraseIdxEquiv n φs hn).symm.sum_comp] - rw [Fintype.sum_prod_type] + rw [← (eraseIdxEquiv n φs hn).symm.sum_comp, Fintype.sum_prod_type] end CrAnSection diff --git a/Physlib/QFT/PerturbationTheory/FieldSpecification/Filters.lean b/Physlib/QFT/PerturbationTheory/FieldSpecification/Filters.lean index 9af522575..02bc26ec2 100644 --- a/Physlib/QFT/PerturbationTheory/FieldSpecification/Filters.lean +++ b/Physlib/QFT/PerturbationTheory/FieldSpecification/Filters.lean @@ -40,13 +40,11 @@ lemma createFilter_cons_annihilate {φ : 𝓕.CrAnFieldOp} lemma createFilter_append (φs φs' : List 𝓕.CrAnFieldOp) : createFilter (φs ++ φs') = createFilter φs ++ createFilter φs' := by - rw [createFilter, List.filter_append] - rfl + simp [createFilter, List.filter_append] lemma createFilter_singleton_create (φ : 𝓕.CrAnFieldOp) (hφ : 𝓕 |>ᶜ φ = CreateAnnihilate.create) : - createFilter [φ] = [φ] := by - simp [createFilter, hφ] + createFilter [φ] = [φ] := by simp [createFilter, hφ] lemma createFilter_singleton_annihilate (φ : 𝓕.CrAnFieldOp) (hφ : 𝓕 |>ᶜ φ = CreateAnnihilate.annihilate) : createFilter [φ] = [] := by @@ -76,17 +74,14 @@ lemma annihilateFilter_cons_annihilate {φ : 𝓕.CrAnFieldOp} lemma annihilateFilter_append (φs φs' : List 𝓕.CrAnFieldOp) : annihilateFilter (φs ++ φs') = annihilateFilter φs ++ annihilateFilter φs' := by - rw [annihilateFilter, List.filter_append] - rfl + simp [annihilateFilter, List.filter_append] lemma annihilateFilter_singleton_create (φ : 𝓕.CrAnFieldOp) (hφ : 𝓕 |>ᶜ φ = CreateAnnihilate.create) : - annihilateFilter [φ] = [] := by - simp [annihilateFilter, hφ] + annihilateFilter [φ] = [] := by simp [annihilateFilter, hφ] lemma annihilateFilter_singleton_annihilate (φ : 𝓕.CrAnFieldOp) (hφ : 𝓕 |>ᶜ φ = CreateAnnihilate.annihilate) : - annihilateFilter [φ] = [φ] := by - simp [annihilateFilter, hφ] + annihilateFilter [φ] = [φ] := by simp [annihilateFilter, hφ] end FieldSpecification diff --git a/Physlib/QFT/PerturbationTheory/FieldSpecification/NormalOrder.lean b/Physlib/QFT/PerturbationTheory/FieldSpecification/NormalOrder.lean index 7ad2e23e2..d501ea7e9 100644 --- a/Physlib/QFT/PerturbationTheory/FieldSpecification/NormalOrder.lean +++ b/Physlib/QFT/PerturbationTheory/FieldSpecification/NormalOrder.lean @@ -171,8 +171,7 @@ lemma normalOrderSign_swap_create_create (φc φc' : 𝓕.CrAnFieldOp) (hφc : 𝓕 |>ᶜ φc = CreateAnnihilate.create) (hφc' : 𝓕 |>ᶜ φc' = CreateAnnihilate.create) : (φs φs' : List 𝓕.CrAnFieldOp) → normalOrderSign (φs ++ φc :: φc' :: φs') = normalOrderSign (φs ++ φc' :: φc :: φs') - | [], φs' => by - exact normalOrderSign_swap_create_create_fst φc φc' hφc hφc' φs' + | [], φs' => normalOrderSign_swap_create_create_fst φc φc' hφc hφc' φs' | φ :: φs, φs' => by rw [normalOrderSign] dsimp only [List.cons_append, Wick.koszulSign] @@ -205,8 +204,7 @@ lemma normalOrderSign_swap_annihilate_annihilate (φa φa' : 𝓕.CrAnFieldOp) (hφa : 𝓕 |>ᶜ φa = CreateAnnihilate.annihilate) (hφa' : 𝓕 |>ᶜ φa' = CreateAnnihilate.annihilate) : (φs φs' : List 𝓕.CrAnFieldOp) → normalOrderSign (φs ++ φa :: φa' :: φs') = normalOrderSign (φs ++ φa' :: φa :: φs') - | [], φs' => by - exact normalOrderSign_swap_annihilate_annihilate_fst φa φa' hφa hφa' φs' + | [], φs' => normalOrderSign_swap_annihilate_annihilate_fst φa φa' hφa hφa' φs' | φ :: φs, φs' => by rw [normalOrderSign] dsimp only [List.cons_append, Wick.koszulSign] @@ -214,11 +212,8 @@ lemma normalOrderSign_swap_annihilate_annihilate (φa φa' : 𝓕.CrAnFieldOp) rw [normalOrderSign_swap_annihilate_annihilate φa φa' hφa hφa'] dsimp only [normalOrderSign, Wick.koszulSign] rw [← normalOrderSign] - simp only [mul_eq_mul_right_iff] - apply Or.inl - apply Wick.koszulSignInsert_eq_perm - refine List.Perm.append_left φs ?h.h.a - exact List.Perm.swap φa' φa φs' + simpa only [mul_eq_mul_right_iff] using Or.inl (Wick.koszulSignInsert_eq_perm _ _ _ _ _ + (List.Perm.append_left φs (List.Perm.swap φa' φa φs'))) open FieldStatistic /-! @@ -238,13 +233,11 @@ def normalOrderList (φs : List 𝓕.CrAnFieldOp) : List 𝓕.CrAnFieldOp := List.insertionSort 𝓕.normalOrderRel φs @[simp] -lemma normalOrderList_nil : normalOrderList (𝓕 := 𝓕) [] = [] := by - simp [normalOrderList] +lemma normalOrderList_nil : normalOrderList (𝓕 := 𝓕) [] = [] := by simp [normalOrderList] @[simp] lemma normalOrderList_statistics (φs : List 𝓕.CrAnFieldOp) : - (𝓕 |>ₛ (normalOrderList φs)) = 𝓕 |>ₛ φs := by - simp [normalOrderList] + (𝓕 |>ₛ (normalOrderList φs)) = 𝓕 |>ₛ φs := by simp [normalOrderList] lemma orderedInsert_create (φ : 𝓕.CrAnFieldOp) (hφ : 𝓕 |>ᶜ φ = CreateAnnihilate.create) : @@ -363,8 +356,7 @@ lemma normalOrderSign_eraseIdx (φs : List 𝓕.CrAnFieldOp) (i : Fin φs.length normalOrderSign (φs.eraseIdx i) = normalOrderSign φs * 𝓢(𝓕 |>ₛ (φs.get i), 𝓕 |>ₛ (φs.take i)) * 𝓢(𝓕 |>ₛ (φs.get i), 𝓕 |>ₛ ((normalOrderList φs).take (normalOrderEquiv i))) := by - rw [normalOrderSign, Wick.koszulSign_eraseIdx, ← normalOrderSign] - rfl + exact Wick.koszulSign_eraseIdx 𝓕.crAnStatistics normalOrderRel φs i lemma orderedInsert_createFilter_append_annihilate (φ : 𝓕.CrAnFieldOp) (hφ : 𝓕 |>ᶜ φ = CreateAnnihilate.annihilate) : (φs φs' : List 𝓕.CrAnFieldOp) → @@ -417,8 +409,7 @@ lemma normalOrderList_eq_createFilter_append_annihilateFilter : (φs : List 𝓕 rw [List.filter_cons_of_neg] swap simp only [hφ, reduceCtorEq, decide_false, Bool.false_eq_true, not_false_eq_true] - rw [normalOrderList_eq_createFilter_append_annihilateFilter φs] - rfl + exact congrArg (List.cons φ) (normalOrderList_eq_createFilter_append_annihilateFilter φs) · simp only [normalOrderList, List.insertionSort_cons] rw [← normalOrderList] have hφ' : 𝓕 |>ᶜ φ = CreateAnnihilate.annihilate := by diff --git a/Physlib/QFT/PerturbationTheory/FieldSpecification/TimeOrder.lean b/Physlib/QFT/PerturbationTheory/FieldSpecification/TimeOrder.lean index 96b35b211..2144fc7a2 100644 --- a/Physlib/QFT/PerturbationTheory/FieldSpecification/TimeOrder.lean +++ b/Physlib/QFT/PerturbationTheory/FieldSpecification/TimeOrder.lean @@ -135,9 +135,7 @@ def timeOrderSign (φs : List 𝓕.FieldOp) : ℂ := Wick.koszulSign 𝓕.fieldOpStatistic 𝓕.timeOrderRel φs @[simp] -lemma timeOrderSign_nil : timeOrderSign (𝓕 := 𝓕) [] = 1 := by - simp only [timeOrderSign] - rfl +lemma timeOrderSign_nil : timeOrderSign (𝓕 := 𝓕) [] = 1 := rfl lemma timeOrderSign_pair_ordered {φ ψ : 𝓕.FieldOp} (h : timeOrderRel φ ψ) : timeOrderSign [φ, ψ] = 1 := by @@ -156,7 +154,6 @@ lemma timerOrderSign_of_eraseMaxTimeField (φ : 𝓕.FieldOp) (φs : List 𝓕.F 𝓢(𝓕 |>ₛ maxTimeField φ φs, 𝓕 |>ₛ (φ :: φs).take (maxTimeFieldPos φ φs)) := by rw [eraseMaxTimeField, insertionSortDropMinPos, timeOrderSign, Wick.koszulSign_eraseIdx_insertionSortMinPos] - rw [← timeOrderSign, ← maxTimeField] rfl /-- The time ordering of a list of states. A schematic example is: @@ -178,8 +175,7 @@ lemma timeOrderList_pair_not_ordered {φ ψ : 𝓕.FieldOp} (h : ¬ timeOrderRel exact fun h' => False.elim (h h') @[simp] -lemma timeOrderList_nil : timeOrderList (𝓕 := 𝓕) [] = [] := by - simp [timeOrderList] +lemma timeOrderList_nil : timeOrderList (𝓕 := 𝓕) [] = [] := by simp [timeOrderList] lemma timeOrderList_eq_maxTimeField_timeOrderList (φ : 𝓕.FieldOp) (φs : List 𝓕.FieldOp) : timeOrderList (φ :: φs) = maxTimeField φ φs :: timeOrderList (eraseMaxTimeField φ φs) := by @@ -237,9 +233,7 @@ def crAnTimeOrderSign (φs : List 𝓕.CrAnFieldOp) : ℂ := Wick.koszulSign 𝓕.crAnStatistics 𝓕.crAnTimeOrderRel φs @[simp] -lemma crAnTimeOrderSign_nil : crAnTimeOrderSign (𝓕 := 𝓕) [] = 1 := by - simp only [crAnTimeOrderSign] - rfl +lemma crAnTimeOrderSign_nil : crAnTimeOrderSign (𝓕 := 𝓕) [] = 1 := rfl lemma crAnTimeOrderSign_pair_ordered {φ ψ : 𝓕.CrAnFieldOp} (h : crAnTimeOrderRel φ ψ) : crAnTimeOrderSign [φ, ψ] = 1 := by @@ -264,8 +258,7 @@ def crAnTimeOrderList (φs : List 𝓕.CrAnFieldOp) : List 𝓕.CrAnFieldOp := List.insertionSort 𝓕.crAnTimeOrderRel φs @[simp] -lemma crAnTimeOrderList_nil : crAnTimeOrderList (𝓕 := 𝓕) [] = [] := by - simp [crAnTimeOrderList] +lemma crAnTimeOrderList_nil : crAnTimeOrderList (𝓕 := 𝓕) [] = [] := by simp [crAnTimeOrderList] lemma crAnTimeOrderList_pair_ordered {φ ψ : 𝓕.CrAnFieldOp} (h : crAnTimeOrderRel φ ψ) : crAnTimeOrderList [φ, ψ] = [φ, ψ] := by @@ -416,8 +409,7 @@ lemma orderedInsert_crAnTimeOrderRel_crAnSection {φ : 𝓕.FieldOp} {ψ : 𝓕. rw [← h1.1] at hr simp only [crAnFieldOpToFieldOp] at hr simp only [hr, ↓reduceIte, List.map_cons, List.cons.injEq] - apply And.intro h1.1 - exact orderedInsert_crAnTimeOrderRel_crAnSection h ⟨ψs, h1.2⟩ + exact And.intro h1.1 (orderedInsert_crAnTimeOrderRel_crAnSection h ⟨ψs, h1.2⟩) lemma crAnTimeOrderList_crAnSection_is_crAnSection : {φs : List 𝓕.FieldOp} → (ψs : CrAnSection φs) → (crAnTimeOrderList ψs.1).map 𝓕.crAnFieldOpToFieldOp = timeOrderList φs diff --git a/Physlib/QFT/PerturbationTheory/FieldStatistics/Basic.lean b/Physlib/QFT/PerturbationTheory/FieldStatistics/Basic.lean index c28b361e7..6284299c7 100644 --- a/Physlib/QFT/PerturbationTheory/FieldStatistics/Basic.lean +++ b/Physlib/QFT/PerturbationTheory/FieldStatistics/Basic.lean @@ -88,13 +88,11 @@ instance : Fintype FieldStatistic where intro c cases c · exact Finset.mem_insert_self bosonic {fermionic} - · refine Finset.insert_eq_self.mp ?_ - exact rfl + · exact Finset.insert_eq_self.mp rfl @[simp] -lemma fermionic_not_eq_bonsic : ¬ fermionic = bosonic := by - intro h - exact FieldStatistic.noConfusion h +lemma fermionic_not_eq_bonsic : ¬ fermionic = bosonic := + fun h => FieldStatistic.noConfusion h lemma bonsic_eq_fermionic_false : bosonic = fermionic ↔ false := by simp only [reduceCtorEq, Bool.false_eq_true] @@ -203,8 +201,7 @@ lemma ofList_append_eq_mul (s : 𝓕 → FieldStatistic) (φs φs' : List 𝓕) lemma ofList_perm (s : 𝓕 → FieldStatistic) {l l' : List 𝓕} (h : l.Perm l') : ofList s l = ofList s l' := by - rw [ofList_eq_prod, ofList_eq_prod] - exact List.Perm.prod_eq (List.Perm.map s h) + simpa [ofList_eq_prod] using List.Perm.prod_eq (List.Perm.map s h) lemma ofList_orderedInsert (s : 𝓕 → FieldStatistic) (le1 : 𝓕 → 𝓕 → Prop) [DecidableRel le1] (φs : List 𝓕) (φ : 𝓕) : ofList s (List.orderedInsert le1 φ φs) = ofList s (φ :: φs) := @@ -238,18 +235,15 @@ lemma ofList_map_eq_finset_prod (s : 𝓕 → FieldStatistic) : simp only [List.length_cons, mul_ite, ite_mul, one_mul, mul_one] by_cases ha : a = i · simp only [ha, ↓reduceIte, mul_self, true_or] - rw [if_neg] - rfl - simp only [List.length_cons, List.nodup_cons] at hl - exact hl.1 - · simp only [ha, ↓reduceIte, false_or] - rfl + exact if_neg (by + simp only [List.length_cons, List.nodup_cons] at hl + exact hl.1) + · simp only [ha, ↓reduceIte, false_or, Fin.getElem_fin] simp only [List.length_cons, List.nodup_cons] at hl exact hl.2 lemma ofList_pair (s : 𝓕 → FieldStatistic) (φ1 φ2 : 𝓕) : - ofList s [φ1, φ2] = s φ1 * s φ2 := by - rw [ofList_cons_eq_mul, ofList_singleton] + ofList s [φ1, φ2] = s φ1 * s φ2 := by rw [ofList_cons_eq_mul, ofList_singleton] /-! @@ -271,9 +265,7 @@ lemma ofList_take_eraseIdx (n : ℕ) (φs : List 𝓕) : rw [take_eraseIdx_same] lemma ofList_take_zero (φs : List 𝓕) : - ofList q (List.take 0 φs) = 1 := by - simp only [List.take_zero, ofList_empty] - rfl + ofList q (List.take 0 φs) = 1 := rfl lemma ofList_take_succ_cons (n : ℕ) (φ1 : 𝓕) (φs : List 𝓕) : ofList q ((φ1 :: φs).take (n + 1)) = q φ1 * ofList q (φs.take n) := by @@ -310,8 +302,7 @@ instance : AddMonoid FieldStatistic where add_assoc a b c := by cases a <;> cases b <;> cases c <;> rfl nsmul_zero a := by - simp only [Finset.univ_eq_empty, Finset.prod_const, Finset.card_empty, pow_zero] - rfl + cases a <;> rfl nsmul_succ a n := by simp only [Finset.prod_const, Finset.card_univ, Fintype.card_fin] rfl diff --git a/Physlib/QFT/PerturbationTheory/FieldStatistics/ExchangeSign.lean b/Physlib/QFT/PerturbationTheory/FieldStatistics/ExchangeSign.lean index 025ffab39..bc0ce6c1c 100644 --- a/Physlib/QFT/PerturbationTheory/FieldStatistics/ExchangeSign.lean +++ b/Physlib/QFT/PerturbationTheory/FieldStatistics/ExchangeSign.lean @@ -81,8 +81,7 @@ lemma bosonic_exchangeSign (a : FieldStatistic) : 𝓢(bosonic, a) = 1 := by rw [exchangeSign_symm, exchangeSign_bosonic] @[simp] -lemma fermionic_exchangeSign_fermionic : 𝓢(fermionic, fermionic) = - 1 := by - rfl +lemma fermionic_exchangeSign_fermionic : 𝓢(fermionic, fermionic) = - 1 := rfl lemma exchangeSign_eq_if (a b : FieldStatistic) : 𝓢(a, b) = if a = fermionic ∧ b = fermionic then - 1 else 1 := by @@ -98,8 +97,7 @@ lemma exchangeSign_mul_self_swap (a b : FieldStatistic) : 𝓢(a, b) * 𝓢(b, a lemma exchangeSign_ofList_cons (a : FieldStatistic) (s : 𝓕 → FieldStatistic) (φ : 𝓕) (φs : List 𝓕) : - 𝓢(a, ofList s (φ :: φs)) = 𝓢(a, s φ) * 𝓢(a, ofList s φs) := by - rw [ofList_cons_eq_mul, map_mul] + 𝓢(a, ofList s (φ :: φs)) = 𝓢(a, s φ) * 𝓢(a, ofList s φs) := by rw [ofList_cons_eq_mul, map_mul] /-- The exchange sign is a cocycle. -/ lemma exchangeSign_cocycle (a b c : FieldStatistic) : diff --git a/Physlib/QFT/PerturbationTheory/FieldStatistics/OfFinset.lean b/Physlib/QFT/PerturbationTheory/FieldStatistics/OfFinset.lean index b86ef25e3..85f2f0f4d 100644 --- a/Physlib/QFT/PerturbationTheory/FieldStatistics/OfFinset.lean +++ b/Physlib/QFT/PerturbationTheory/FieldStatistics/OfFinset.lean @@ -32,8 +32,7 @@ lemma ofFinset_empty (q : 𝓕 → FieldStatistic) (f : Fin n → 𝓕) : rfl lemma ofFinset_singleton {n : ℕ} (q : 𝓕 → FieldStatistic) (f : Fin n → 𝓕) (i : Fin n) : - ofFinset q f {i} = q (f i) := by - simp [ofFinset] + ofFinset q f {i} = q (f i) := by simp [ofFinset] lemma ofFinset_finset_map {n m : ℕ} (q : 𝓕 → FieldStatistic) (i : Fin m → Fin n) (hi : Function.Injective i) @@ -59,8 +58,7 @@ lemma ofFinset_insert (q : 𝓕 → FieldStatistic) (φs : List 𝓕) (a : Finse simp only [ofFinset, Fin.getElem_fin] rw [← ofList_cons_eq_mul] have h1 : (φs[↑i] :: List.map φs.get (a.sort (fun x1 x2 => x1 ≤ x2))) - = List.map φs.get (i :: a.sort (fun x1 x2 => x1 ≤ x2)) := by - simp + = List.map φs.get (i :: a.sort (fun x1 x2 => x1 ≤ x2)) := by simp erw [h1] apply ofList_perm refine List.Perm.map φs.get ?_ @@ -74,8 +72,7 @@ lemma ofFinset_insert (q : 𝓕 → FieldStatistic) (φs : List 𝓕) (a : Finse lemma ofFinset_erase (q : 𝓕 → FieldStatistic) (φs : List 𝓕) (a : Finset (Fin φs.length)) (i : Fin φs.length) (h : i ∈ a) : ofFinset q φs.get (a.erase i) = (q φs[i]) * ofFinset q φs.get a := by - have ha : a = Insert.insert i (a.erase i) := by - exact Eq.symm (Finset.insert_erase h) + have ha : a = Insert.insert i (a.erase i) := Eq.symm (Finset.insert_erase h) conv_rhs => rw [ha] rw [ofFinset_insert] rw [← mul_assoc] @@ -84,8 +81,7 @@ lemma ofFinset_erase (q : 𝓕 → FieldStatistic) (φs : List 𝓕) (a : Finset lemma ofFinset_eq_prod (q : 𝓕 → FieldStatistic) (φs : List 𝓕) (a : Finset (Fin φs.length)) : ofFinset q φs.get a = ∏ (i : Fin φs.length), if i ∈ a then (q φs[i]) else 1 := by - rw [ofFinset] - rw [ofList_map_eq_finset_prod] + rw [ofFinset, ofList_map_eq_finset_prod] congr funext i simp only [Finset.mem_sort, Fin.getElem_fin] @@ -93,8 +89,7 @@ lemma ofFinset_eq_prod (q : 𝓕 → FieldStatistic) (φs : List 𝓕) (a : Fins lemma ofFinset_union (q : 𝓕 → FieldStatistic) (φs : List 𝓕) (a b : Finset (Fin φs.length)) : ofFinset q φs.get a * ofFinset q φs.get b = ofFinset q φs.get ((a ∪ b) \ (a ∩ b)) := by - rw [ofFinset_eq_prod, ofFinset_eq_prod, ofFinset_eq_prod] - rw [← Finset.prod_mul_distrib] + rw [ofFinset_eq_prod, ofFinset_eq_prod, ofFinset_eq_prod, ← Finset.prod_mul_distrib] congr funext x simp only [Fin.getElem_fin, mul_ite, ite_mul, mul_self, one_mul, mul_one, @@ -108,8 +103,7 @@ lemma ofFinset_union (q : 𝓕 → FieldStatistic) (φs : List 𝓕) (a b : Fins lemma ofFinset_union_disjoint (q : 𝓕 → FieldStatistic) (φs : List 𝓕) (a b : Finset (Fin φs.length)) (h : Disjoint a b) : ofFinset q φs.get a * ofFinset q φs.get b = ofFinset q φs.get (a ∪ b) := by - rw [ofFinset_union, Finset.disjoint_iff_inter_eq_empty.mp h] - simp + simpa [Finset.disjoint_iff_inter_eq_empty.mp h] using ofFinset_union q φs a b lemma ofFinset_filter_mul_neg (q : 𝓕 → FieldStatistic) (φs : List 𝓕) (a : Finset (Fin φs.length)) (p : Fin φs.length → Prop) [DecidablePred p] : diff --git a/Physlib/QFT/PerturbationTheory/Koszul/KoszulSign.lean b/Physlib/QFT/PerturbationTheory/Koszul/KoszulSign.lean index 5de3325d7..c5e27524c 100644 --- a/Physlib/QFT/PerturbationTheory/Koszul/KoszulSign.lean +++ b/Physlib/QFT/PerturbationTheory/Koszul/KoszulSign.lean @@ -31,8 +31,7 @@ def koszulSign (q : 𝓕 → FieldStatistic) (le : 𝓕 → 𝓕 → Prop) [Deci @[simp] lemma koszulSign_singleton (q : 𝓕 → FieldStatistic) (le : 𝓕 → 𝓕 → Prop) [DecidableRel le] (φ : 𝓕) : - koszulSign q le [φ] = 1 := by - simp [koszulSign, koszulSignInsert] + koszulSign q le [φ] = 1 := by simp [koszulSign, koszulSignInsert] lemma koszulSign_mul_self (l : List 𝓕) : koszulSign q le l * koszulSign q le l = 1 := by induction l with @@ -47,8 +46,7 @@ lemma koszulSign_mul_self (l : List 𝓕) : koszulSign q le l * koszulSign q le @[simp] lemma koszulSign_freeMonoid_of (φ : 𝓕) : koszulSign q le (FreeMonoid.of φ) = 1 := by change koszulSign q le [φ] = 1 - simp only [koszulSign, mul_one] - rfl + simp [koszulSign, koszulSignInsert, mul_one] lemma koszulSignInsert_erase_boson {𝓕 : Type} (q : 𝓕 → FieldStatistic) (le : 𝓕 → 𝓕 → Prop) [DecidableRel le] (φ : 𝓕) : @@ -116,12 +114,10 @@ lemma koszulSign_insertIdx [Std.Total le] [IsTrans 𝓕 le] (φ : 𝓕) : change 𝓢(q φ, ofList q ((List.insertionSort le (φ1 :: φs)).take (↑(orderedInsertPos le ((List.insertionSort le (φ1 :: φs))) φ)))) rw [← koszulSignInsert_eq_exchangeSign_take q le] - rw [ofList_take_zero] simp | φ1 :: φs, n + 1, h => by conv_lhs => - rw [List.insertIdx_succ_cons] - rw [koszulSign] + rw [List.insertIdx_succ_cons, koszulSign] rw [koszulSign_insertIdx _ _ _ (Nat.le_of_lt_succ h)] conv_rhs => rhs @@ -171,12 +167,10 @@ lemma koszulSign_insertIdx [Std.Total le] [IsTrans 𝓕 le] (φ : 𝓕) : simp only [Function.comp_apply, Equiv.symm_apply_apply, List.get_eq_getElem, ni] simp_all only [List.length_cons, add_le_add_iff_right, List.getElem_insertIdx_self] have hc1 (hninro : ni.castSucc < nro) : ¬ le φ1 φ := by - rw [← hns] - exact lt_orderedInsertPos_rel le φ1 rs ni hninro + simpa [← hns] using lt_orderedInsertPos_rel le φ1 rs ni hninro have hc2 (hninro : ¬ ni.castSucc < nro) : le φ1 φ := by - rw [← hns] - refine gt_orderedInsertPos_rel le φ1 rs ?_ ni hninro - exact List.pairwise_insertionSort le (List.insertIdx φs n φ) + simpa [← hns] using gt_orderedInsertPos_rel le φ1 rs + (List.pairwise_insertionSort le (List.insertIdx φs n φ)) ni hninro by_cases hn : ni.castSucc < nro · simp only [hn, ↓reduceIte, Fin.val_castSucc] rw [ofList_take_insertIdx_gt] @@ -210,8 +204,7 @@ lemma koszulSign_eraseIdx [Std.Total le] [IsTrans 𝓕 le] (φs : List 𝓕) (n 𝓢(q (φs.get n), ofList q (List.take (↑(insertionSortEquiv le φs n)) (List.insertionSort le φs))) := by let φs' := φs.eraseIdx ↑n - have hφs : List.insertIdx φs' n (φs.get n) = φs := by - exact insertIdx_eraseIdx n.1 φs n.prop + have hφs : List.insertIdx φs' n (φs.get n) = φs := insertIdx_eraseIdx n.1 φs n.prop conv_rhs => lhs lhs @@ -241,10 +234,7 @@ lemma koszulSign_eraseIdx [Std.Total le] [IsTrans 𝓕 le] (φs : List 𝓕) (n rhs rw [exchangeSign_mul_self] simp only [Fin.getElem_fin, mul_one] - conv_rhs => - rhs - rw [ofList_take_eraseIdx, exchangeSign_mul_self] - simp + simp [ofList_take_eraseIdx, exchangeSign_mul_self] lemma koszulSign_eraseIdx_insertionSortMinPos [Std.Total le] [IsTrans 𝓕 le] (φ : 𝓕) (φs : List 𝓕) : koszulSign q le ((φ :: φs).eraseIdx (insertionSortMinPos le φ φs)) = koszulSign q le (φ :: φs) @@ -272,8 +262,7 @@ lemma koszulSign_swap_eq_rel_cons {ψ φ : 𝓕} lemma koszulSign_swap_eq_rel {ψ φ : 𝓕} (h1 : le φ ψ) (h2 : le ψ φ) : (φs φs' : List 𝓕) → koszulSign q le (φs ++ φ :: ψ :: φs') = koszulSign q le (φs ++ ψ :: φ :: φs') | [], φs' => by - simp only [List.nil_append] - exact koszulSign_swap_eq_rel_cons q le h1 h2 φs' + simpa only [List.nil_append] using koszulSign_swap_eq_rel_cons q le h1 h2 φs' | φ'' :: φs, φs' => by simp only [List.cons_append, koszulSign] rw [koszulSign_swap_eq_rel h1 h2] @@ -292,8 +281,7 @@ lemma koszulSign_eq_rel_eq_stat_append {ψ φ : 𝓕} [IsTrans 𝓕 le] congr simp only [koszulSignInsert, ite_mul, neg_mul] simp_all only [and_self, ite_true] - rw [koszulSignInsert_eq_rel_eq_stat q le h1 h2 hq] - simp + simp [koszulSignInsert_eq_rel_eq_stat q le h1 h2 hq] lemma koszulSign_eq_rel_eq_stat {ψ φ : 𝓕} [IsTrans 𝓕 le] (h1 : le φ ψ) (h2 : le ψ φ) (hq : q ψ = q φ) : (φs' φs : List 𝓕) → @@ -324,9 +312,8 @@ lemma koszulSign_of_sorted : (φs : List 𝓕) @[simp] lemma koszulSign_of_insertionSort [Std.Total le] [IsTrans 𝓕 le] (φs : List 𝓕) : - koszulSign q le (List.insertionSort le φs) = 1 := by - apply koszulSign_of_sorted - exact List.pairwise_insertionSort le φs + koszulSign q le (List.insertionSort le φs) = 1 := + koszulSign_of_sorted q le _ (List.pairwise_insertionSort le φs) lemma koszulSign_of_append_eq_insertionSort_left [Std.Total le] [IsTrans 𝓕 le] : (φs φs' : List 𝓕) → koszulSign q le (φs ++ φs') = @@ -354,15 +341,13 @@ lemma koszulSign_of_append_eq_insertionSort_left [Std.Total le] [IsTrans 𝓕 le congr 3 · have h2 : (List.insertionSort le φs ++ φ :: φs') = List.insertIdx (List.insertionSort le φs ++ φs') φs.length φ := by - rw [← insertIdx_length_fst_append] - simp + simp [← insertIdx_length_fst_append] rw [insertionSortEquiv_congr _ _ h2.symm] simp only [Equiv.trans_apply, RelIso.coe_fn_toEquiv, Fin.castOrderIso_apply, Fin.cast_mk, Fin.val_cast] rw [insertionSortEquiv_insertionSort_append] simp only [finCongr_apply, Fin.val_cast] - rw [insertionSortEquiv_congr _ _ h1.symm] - simp + simp [insertionSortEquiv_congr _ _ h1.symm] · rw [insertIdx_length_fst_append] rw [show φs.length = (List.insertionSort le φs).length by simp] rw [insertIdx_length_fst_append] @@ -379,10 +364,9 @@ lemma koszulSign_of_append_eq_insertionSort [Std.Total le] [IsTrans 𝓕 le] : ( simp only [List.cons_append, koszulSign] rw [koszulSign_of_append_eq_insertionSort φs'' φs φs', ← mul_assoc] congr 2 - apply koszulSignInsert_eq_perm - refine (List.perm_append_right_iff φs').mpr ?_ - refine List.Perm.append_left φs'' ?_ - exact List.Perm.symm (List.perm_insertionSort le φs) + exact koszulSignInsert_eq_perm q le _ _ _ + ((List.perm_append_right_iff φs').mpr + (List.Perm.append_left φs'' (List.Perm.symm (List.perm_insertionSort le φs)))) /-! @@ -415,8 +399,7 @@ lemma koszulSign_perm_eq_append [IsTrans 𝓕 le] (φ : 𝓕) (φs φs' φs2 : L simp_all only [and_self, implies_true, nonempty_prop, forall_const, motive] refine (ih2 ?_) intro φ' hφ - refine h φ' ?_ - exact (List.Perm.mem_iff (id (List.Perm.symm h1))).mp hφ + exact h φ' ((List.Perm.mem_iff (id (List.Perm.symm h1))).mp hφ) lemma koszulSign_perm_eq [IsTrans 𝓕 le] (φ : 𝓕) : (φs1 φs φs' φs2 : List 𝓕) → (h : ∀ φ' ∈ φs, le φ φ' ∧ le φ' φ) → (hp : φs.Perm φs') → @@ -429,8 +412,7 @@ lemma koszulSign_perm_eq [IsTrans 𝓕 le] (φ : 𝓕) : (φs1 φs φs' φs2 : L have ih := koszulSign_perm_eq φ φs1 φs φs' φs2 h hp rw [ih] congr 1 - apply koszulSignInsert_eq_perm - refine (List.perm_append_right_iff φs2).mpr ?_ - exact List.Perm.append_left φs1 hp + exact koszulSignInsert_eq_perm q le _ _ _ + ((List.perm_append_right_iff φs2).mpr (List.Perm.append_left φs1 hp)) end Wick diff --git a/Physlib/QFT/PerturbationTheory/Koszul/KoszulSignInsert.lean b/Physlib/QFT/PerturbationTheory/Koszul/KoszulSignInsert.lean index 96add368d..7cf6a5af4 100644 --- a/Physlib/QFT/PerturbationTheory/Koszul/KoszulSignInsert.lean +++ b/Physlib/QFT/PerturbationTheory/Koszul/KoszulSignInsert.lean @@ -103,8 +103,7 @@ lemma koszulSignInsert_eq_filter (φ : 𝓕) : (φs : List 𝓕) → lemma koszulSignInsert_eq_cons [Std.Total le] (φ : 𝓕) (φs : List 𝓕) : koszulSignInsert q le φ φs = koszulSignInsert q le φ (φ :: φs) := by simp only [koszulSignInsert, and_self] - have h1 : le φ φ := by - simpa only [or_self] using Std.Total.total (r := le) φ φ + have h1 : le φ φ := (Std.Total.total (r := le) φ φ).elim id id simp [h1] lemma koszulSignInsert_eq_grade (φ : 𝓕) (φs : List 𝓕) : @@ -148,15 +147,13 @@ lemma koszulSignInsert_eq_perm (φs φs' : List 𝓕) (φ : 𝓕) (h : φs.Perm simp only [decide_not, eq_iff_iff, and_congr_right_iff] intro h' have hg : ofList q (List.filter (fun i => !decide (le φ i)) φs) = - ofList q (List.filter (fun i => !decide (le φ i)) φs') := by - apply ofList_perm - exact List.Perm.filter (fun i => !decide (le φ i)) h + ofList q (List.filter (fun i => !decide (le φ i)) φs') := + ofList_perm q (List.Perm.filter (fun i => !decide (le φ i)) h) rw [hg] lemma koszulSignInsert_eq_sort (φs : List 𝓕) (φ : 𝓕) : - koszulSignInsert q le φ φs = koszulSignInsert q le φ (List.insertionSort le φs) := by - apply koszulSignInsert_eq_perm - exact List.Perm.symm (List.perm_insertionSort le φs) + koszulSignInsert q le φ φs = koszulSignInsert q le φ (List.insertionSort le φs) := + koszulSignInsert_eq_perm q le _ _ _ (List.Perm.symm (List.perm_insertionSort le φs)) lemma koszulSignInsert_eq_exchangeSign_take [Std.Total le] [IsTrans 𝓕 le] (φ : 𝓕) (φs : List 𝓕) : koszulSignInsert q le φ φs = 𝓢(q φ, ofList q @@ -168,8 +165,7 @@ lemma koszulSignInsert_eq_exchangeSign_take [Std.Total le] [IsTrans 𝓕 le] (φ (List.insertionSort le φs))) = if FieldStatistic.ofList q [φ] = fermionic ∧ FieldStatistic.ofList q (List.take (↑(orderedInsertPos le (List.insertionSort le φs) φ)) (List.insertionSort le φs)) = fermionic then - 1 else 1 := by - rw [exchangeSign_eq_if] - simp + simp [exchangeSign_eq_if] rw [hx] congr simp only [List.filter_filter, Bool.and_self] @@ -209,9 +205,8 @@ lemma koszulSignInsert_eq_exchangeSign_take [Std.Total le] [IsTrans 𝓕 le] (φ · simp [orderedInsertPos] lemma koszulSignInsert_insertIdx (i j : 𝓕) (r : List 𝓕) (n : ℕ) (hn : n ≤ r.length) : - koszulSignInsert q le j (List.insertIdx r n i) = koszulSignInsert q le j (i :: r) := by - apply koszulSignInsert_eq_perm - exact List.perm_insertIdx i r hn + koszulSignInsert q le j (List.insertIdx r n i) = koszulSignInsert q le j (i :: r) := + koszulSignInsert_eq_perm q le _ _ _ (List.perm_insertIdx i r hn) /-- The difference in `koszulSignInsert` on inserting `r0` into `r` compared to into `r1 :: r` for any `r`. -/ @@ -236,8 +231,7 @@ lemma koszulSignCons_eq_exchangeSign (φ0 φ1 : 𝓕) : koszulSignCons q le φ0 lemma koszulSignInsert_cons (r0 r1 : 𝓕) (r : List 𝓕) : koszulSignInsert q le r0 (r1 :: r) = (koszulSignCons q le r0 r1) * - koszulSignInsert q le r0 r := by - simp [koszulSignInsert, koszulSignCons] + koszulSignInsert q le r0 r := by simp [koszulSignInsert, koszulSignCons] lemma koszulSignInsert_of_le_mem (φ0 : 𝓕) : (φs : List 𝓕) → (h : ∀ b ∈ φs, le φ0 b) → koszulSignInsert q le φ0 φs = 1 @@ -263,8 +257,7 @@ lemma koszulSignInsert_eq_rel_eq_stat {ψ φ : 𝓕} [IsTrans 𝓕 le] · simp only [hr, ↓reduceIte] have h1' : le ψ φ' := by apply IsTrans.trans ψ φ φ' h2 hr - simp only [h1', ↓reduceIte] - exact koszulSignInsert_eq_rel_eq_stat h1 h2 hq φs + simpa only [h1', ↓reduceIte] using koszulSignInsert_eq_rel_eq_stat h1 h2 hq φs · have hψφ' : ¬ le ψ φ' := by intro hψφ' apply hr diff --git a/Physlib/QFT/PerturbationTheory/WickAlgebra/Basic.lean b/Physlib/QFT/PerturbationTheory/WickAlgebra/Basic.lean index 813ef0739..35eec32e3 100644 --- a/Physlib/QFT/PerturbationTheory/WickAlgebra/Basic.lean +++ b/Physlib/QFT/PerturbationTheory/WickAlgebra/Basic.lean @@ -72,9 +72,8 @@ instance : Coe (𝓕.FieldOpFreeAlgebra) (𝓕.WickAlgebra) := instance : Setoid (FieldOpFreeAlgebra 𝓕) := (TwoSidedIdeal.span 𝓕.fieldOpIdealSet).ringCon.toSetoid lemma equiv_iff_sub_mem_ideal (x y : FieldOpFreeAlgebra 𝓕) : - x ≈ y ↔ x - y ∈ TwoSidedIdeal.span 𝓕.fieldOpIdealSet := by - rw [← TwoSidedIdeal.rel_iff] - rfl + x ≈ y ↔ x - y ∈ TwoSidedIdeal.span 𝓕.fieldOpIdealSet := + (TwoSidedIdeal.span 𝓕.fieldOpIdealSet).rel_iff x y lemma equiv_iff_exists_add (x y : FieldOpFreeAlgebra 𝓕) : x ≈ y ↔ ∃ a, x = y + a ∧ a ∈ TwoSidedIdeal.span 𝓕.fieldOpIdealSet := by @@ -380,8 +379,7 @@ lemma ofFieldOpList_append (φs ψs : List 𝓕.FieldOp) : simp lemma ofFieldOpList_cons (φ : 𝓕.FieldOp) (φs : List 𝓕.FieldOp) : - ofFieldOpList (φ :: φs) = ofFieldOp φ * ofFieldOpList φs := by - aesop + ofFieldOpList (φ :: φs) = ofFieldOp φ * ofFieldOpList φs := by aesop lemma ofFieldOpList_singleton (φ : 𝓕.FieldOp) : ofFieldOpList [φ] = ofFieldOp φ := by @@ -418,8 +416,7 @@ lemma ofCrAnList_append (φs ψs : List 𝓕.CrAnFieldOp) : simp lemma ofCrAnList_singleton (φ : 𝓕.CrAnFieldOp) : - ofCrAnList [φ] = ofCrAnOp φ := by - simp only [ofCrAnList, ofCrAnOp, ofCrAnListF_singleton] + ofCrAnList [φ] = ofCrAnOp φ := by simp only [ofCrAnList, ofCrAnOp, ofCrAnListF_singleton] lemma ofFieldOpList_eq_sum (φs : List 𝓕.FieldOp) : ofFieldOpList φs = ∑ s : CrAnSection φs, ofCrAnList s.1 := by @@ -438,19 +435,16 @@ lemma anPart_eq_ι_anPartF (φ : 𝓕.FieldOp) : anPart φ = ι (anPartF φ) := @[simp] lemma anPart_inAsymp (φ : (Σ f, 𝓕.AsymptoticLabel f) × Momentum) : - anPart (FieldOp.inAsymp φ) = 0 := by - simp [anPart, anPartF] + anPart (FieldOp.inAsymp φ) = 0 := by simp [anPart, anPartF] @[simp] lemma anPart_position (φ : (Σ f, 𝓕.PositionLabel f) × SpaceTime) : anPart (FieldOp.position φ) = - ofCrAnOp ⟨FieldOp.position φ, CreateAnnihilate.annihilate⟩ := by - simp [anPart, ofCrAnOp] + ofCrAnOp ⟨FieldOp.position φ, CreateAnnihilate.annihilate⟩ := by simp [anPart, ofCrAnOp] @[simp] lemma anPart_outAsymp (φ : (Σ f, 𝓕.AsymptoticLabel f) × Momentum) : - anPart (FieldOp.outAsymp φ) = ofCrAnOp ⟨FieldOp.outAsymp φ, ()⟩ := by - simp [anPart, ofCrAnOp] + anPart (FieldOp.outAsymp φ) = ofCrAnOp ⟨FieldOp.outAsymp φ, ()⟩ := by simp [anPart, ofCrAnOp] /-- For a field specification `𝓕`, and an element `φ` of `𝓕.FieldOp`, the creation part of `𝓕.FieldOp` as an element of `𝓕.WickAlgebra`. @@ -464,19 +458,16 @@ lemma crPart_eq_ι_crPartF (φ : 𝓕.FieldOp) : crPart φ = ι (crPartF φ) := @[simp] lemma crPart_inAsymp (φ : (Σ f, 𝓕.AsymptoticLabel f) × Momentum) : - crPart (FieldOp.inAsymp φ) = ofCrAnOp ⟨FieldOp.inAsymp φ, ()⟩ := by - simp [crPart, ofCrAnOp] + crPart (FieldOp.inAsymp φ) = ofCrAnOp ⟨FieldOp.inAsymp φ, ()⟩ := by simp [crPart, ofCrAnOp] @[simp] lemma crPart_position (φ : (Σ f, 𝓕.PositionLabel f) × SpaceTime) : crPart (FieldOp.position φ) = - ofCrAnOp ⟨FieldOp.position φ, CreateAnnihilate.create⟩ := by - simp [crPart, ofCrAnOp] + ofCrAnOp ⟨FieldOp.position φ, CreateAnnihilate.create⟩ := by simp [crPart, ofCrAnOp] @[simp] lemma crPart_outAsymp (φ : (Σ f, 𝓕.AsymptoticLabel f) × Momentum) : - crPart (FieldOp.outAsymp φ) = 0 := by - simp [crPart] + crPart (FieldOp.outAsymp φ) = 0 := by simp [crPart] /-- For field specification `𝓕`, and an element `φ` of `𝓕.FieldOp` the following relation holds: @@ -486,18 +477,15 @@ That is, every field operator splits into its creation part plus its annihilatio -/ lemma ofFieldOp_eq_crPart_add_anPart (φ : 𝓕.FieldOp) : ofFieldOp φ = crPart φ + anPart φ := by - rw [ofFieldOp, crPart, anPart, ofFieldOpF_eq_crPartF_add_anPartF] - simp [map_add] + simp [ofFieldOp, crPart, anPart, ofFieldOpF_eq_crPartF_add_anPartF, map_add] lemma anPart_outAsymp_eq_ofFieldOp (φ : (Σ f, 𝓕.AsymptoticLabel f) × Momentum) : anPart (FieldOp.outAsymp φ) = ofFieldOp (FieldOp.outAsymp φ) := by - rw [ofFieldOp_eq_crPart_add_anPart] - simp + simp [ofFieldOp_eq_crPart_add_anPart] lemma crPart_inAsymp_eq_ofFieldOp (φ : (Σ f, 𝓕.AsymptoticLabel f) × Momentum) : crPart (FieldOp.inAsymp φ) = ofFieldOp (FieldOp.inAsymp φ) := by - rw [ofFieldOp_eq_crPart_add_anPart] - simp + simp [ofFieldOp_eq_crPart_add_anPart] end WickAlgebra end FieldSpecification diff --git a/Physlib/QFT/PerturbationTheory/WickAlgebra/Grading.lean b/Physlib/QFT/PerturbationTheory/WickAlgebra/Grading.lean index 077cdd961..de43bef79 100644 --- a/Physlib/QFT/PerturbationTheory/WickAlgebra/Grading.lean +++ b/Physlib/QFT/PerturbationTheory/WickAlgebra/Grading.lean @@ -44,8 +44,7 @@ lemma mem_bosonic_of_mem_free_bosonic (a : 𝓕.FieldOpFreeAlgebra) simp only [Set.mem_setOf_eq] at hx obtain ⟨φs, rfl, h⟩ := hx simp [p] - apply ofCrAnList_mem_statSubmodule_of_eq - exact h + exact ofCrAnList_mem_statSubmodule_of_eq φs bosonic h · simp only [map_zero, p] exact Submodule.zero_mem (statSubmodule bosonic) · intro x y hx hy hpx hpy @@ -65,8 +64,7 @@ lemma mem_fermionic_of_mem_free_fermionic (a : 𝓕.FieldOpFreeAlgebra) simp only [Set.mem_setOf_eq] at hx obtain ⟨φs, rfl, h⟩ := hx simp [p] - apply ofCrAnList_mem_statSubmodule_of_eq - exact h + exact ofCrAnList_mem_statSubmodule_of_eq φs fermionic h · simp only [map_zero, p] exact Submodule.zero_mem (statSubmodule fermionic) · intro x y hx hy hpx hpy @@ -126,8 +124,7 @@ def bosonicProj : 𝓕.WickAlgebra →ₗ[ℂ] statSubmodule (𝓕 := 𝓕) boso obtain ⟨x, hx⟩ := ι_surjective x obtain ⟨y, hy⟩ := ι_surjective y subst hx hy - rw [← map_add, ι_apply, ι_apply, ι_apply] - rw [Quotient.lift_mk, Quotient.lift_mk, Quotient.lift_mk] + rw [← map_add, ι_apply, ι_apply, ι_apply, Quotient.lift_mk, Quotient.lift_mk, Quotient.lift_mk] simp map_smul' c y := by obtain ⟨y, hy⟩ := ι_surjective y @@ -172,8 +169,7 @@ def fermionicProj : 𝓕.WickAlgebra →ₗ[ℂ] statSubmodule (𝓕 := 𝓕) fe obtain ⟨x, hx⟩ := ι_surjective x obtain ⟨y, hy⟩ := ι_surjective y subst hx hy - rw [← map_add, ι_apply, ι_apply, ι_apply] - rw [Quotient.lift_mk, Quotient.lift_mk, Quotient.lift_mk] + rw [← map_add, ι_apply, ι_apply, ι_apply, Quotient.lift_mk, Quotient.lift_mk, Quotient.lift_mk] simp map_smul' c y := by obtain ⟨y, hy⟩ := ι_surjective y @@ -209,10 +205,8 @@ lemma bosonicProj_mem_bosonic (a : 𝓕.WickAlgebra) (ha : a ∈ statSubmodule . simp only [p] apply Subtype.ext simp only - rw [ofCrAnList] - rw [bosonicProj_eq_bosonicProjFree] - rw [bosonicProjFree_eq_ι_bosonicProjF] - rw [bosonicProjF_of_mem_bosonic] + rw [ofCrAnList, bosonicProj_eq_bosonicProjFree] + rw [bosonicProjFree_eq_ι_bosonicProjF, bosonicProjF_of_mem_bosonic] exact ofCrAnListF_mem_statisticSubmodule_of _ _ h · simp only [map_zero, p] rfl @@ -233,9 +227,7 @@ lemma fermionicProj_mem_fermionic (a : 𝓕.WickAlgebra) (ha : a ∈ statSubmodu simp only [p] apply Subtype.ext simp only - rw [ofCrAnList] - rw [fermionicProj_eq_fermionicProjFree] - rw [fermionicProjFree_eq_ι_fermionicProjF] + rw [ofCrAnList, fermionicProj_eq_fermionicProjFree, fermionicProjFree_eq_ι_fermionicProjF] rw [fermionicProjF_of_mem_fermionic] exact ofCrAnListF_mem_statisticSubmodule_of _ _ h · simp only [map_zero, p] @@ -291,15 +283,13 @@ lemma eq_zero_of_bosonic_and_fermionic {a : 𝓕.WickAlgebra} @[simp] lemma bosonicProj_fermionicProj_eq_zero (a : 𝓕.WickAlgebra) : - bosonicProj (fermionicProj a).1 = 0 := by - apply bosonicProj_mem_fermionic - exact Submodule.coe_mem (fermionicProj a) + bosonicProj (fermionicProj a).1 = 0 := + bosonicProj_mem_fermionic (fermionicProj a).1 (Submodule.coe_mem (fermionicProj a)) @[simp] lemma fermionicProj_bosonicProj_eq_zero (a : 𝓕.WickAlgebra) : - fermionicProj (bosonicProj a).1 = 0 := by - apply fermionicProj_mem_bosonic - exact Submodule.coe_mem (bosonicProj a) + fermionicProj (bosonicProj a).1 = 0 := + fermionicProj_mem_bosonic (bosonicProj a).1 (Submodule.coe_mem (bosonicProj a)) @[simp] lemma bosonicProj_bosonicProj_eq_bosonicProj (a : 𝓕.WickAlgebra) : @@ -320,16 +310,14 @@ lemma bosonicProj_of_bosonic_part @[simp] lemma bosonicProj_of_fermionic_part (a : DirectSum FieldStatistic (fun i => (statSubmodule (𝓕 := 𝓕) i))) : - bosonicProj (a fermionic).1 = 0 := by - apply bosonicProj_mem_fermionic - exact Submodule.coe_mem (a.toFun fermionic) + bosonicProj (a fermionic).1 = 0 := + bosonicProj_mem_fermionic (a.toFun fermionic).1 (Submodule.coe_mem (a.toFun fermionic)) @[simp] lemma fermionicProj_of_bosonic_part (a : DirectSum FieldStatistic (fun i => (statSubmodule (𝓕 := 𝓕) i))) : - fermionicProj (a bosonic).1 = 0 := by - apply fermionicProj_mem_bosonic - exact Submodule.coe_mem (a.toFun bosonic) + fermionicProj (a bosonic).1 = 0 := + fermionicProj_mem_bosonic (a.toFun bosonic).1 (Submodule.coe_mem (a.toFun bosonic)) @[simp] lemma fermionicProj_of_fermionic_part @@ -400,9 +388,7 @@ instance WickAlgebraGrade : GradedAlgebra (A := 𝓕.WickAlgebra) statSubmodule simp only [statSubmodule] refine Submodule.mem_span.mpr fun p a => a ?_ simp only [Set.mem_setOf_eq] - use [] - simp only [ofCrAnList, ofCrAnListF_nil, map_one, ofList_empty, true_and] - rfl + exact ⟨[], rfl, rfl⟩ mul_mem f1 f2 a1 a2 h1 h2 := by let p (a2 : 𝓕.WickAlgebra) (hx : a2 ∈ statSubmodule f2) : Prop := a1 * a2 ∈ statSubmodule (f1 + f2) diff --git a/Physlib/QFT/PerturbationTheory/WickAlgebra/NormalOrder/Basic.lean b/Physlib/QFT/PerturbationTheory/WickAlgebra/NormalOrder/Basic.lean index 81412c81b..70229a01b 100644 --- a/Physlib/QFT/PerturbationTheory/WickAlgebra/NormalOrder/Basic.lean +++ b/Physlib/QFT/PerturbationTheory/WickAlgebra/NormalOrder/Basic.lean @@ -67,8 +67,7 @@ lemma ι_normalOrderF_superCommuteF_ofCrAnListF_eq_zero exact ι_normalOrderF_superCommuteF_ofCrAnListF_ofCrAnListF_eq_zero φa φa' φs l change (ι.toLinearMap ∘ₗ normalOrderF ∘ₗ mulLinearMap ((ofCrAnListF φs * [ofCrAnOpF φa, ofCrAnOpF φa']ₛF))) a = 0 - rw [hf] - simp + simp [hf] lemma ι_normalOrderF_superCommuteF_ofCrAnOpF_eq_zero_mul (φa φa' : 𝓕.CrAnFieldOp) (a b : 𝓕.FieldOpFreeAlgebra) : @@ -83,21 +82,17 @@ lemma ι_normalOrderF_superCommuteF_ofCrAnOpF_eq_zero_mul (φa φa' : 𝓕.CrAnF simp only [mulLinearMap, FieldOpFreeAlgebra.ofListBasis_eq_ofList, LinearMap.coe_comp, Function.comp_apply, LinearMap.flip_apply, LinearMap.coe_mk, AddHom.coe_mk, AlgHom.toLinearMap_apply, LinearMap.zero_apply] - rw [← mul_assoc] - exact ι_normalOrderF_superCommuteF_ofCrAnListF_eq_zero φa φa' _ _ - rw [hf] - simp + simpa [← mul_assoc] using ι_normalOrderF_superCommuteF_ofCrAnListF_eq_zero φa φa' _ _ + simp [hf] lemma ι_normalOrderF_superCommuteF_ofCrAnOpF_ofCrAnListF_eq_zero_mul (φa : 𝓕.CrAnFieldOp) (φs : List 𝓕.CrAnFieldOp) (a b : 𝓕.FieldOpFreeAlgebra) : ι 𝓝ᶠ(a * [ofCrAnOpF φa, ofCrAnListF φs]ₛF * b) = 0 := by rw [← ofCrAnListF_singleton, superCommuteF_ofCrAnListF_ofCrAnListF_eq_sum] - rw [Finset.mul_sum, Finset.sum_mul] - rw [map_sum, map_sum] + rw [Finset.mul_sum, Finset.sum_mul, map_sum, map_sum] apply Fintype.sum_eq_zero intro n - rw [← mul_assoc, ← mul_assoc] - rw [mul_assoc _ _ b, ofCrAnListF_singleton] + rw [← mul_assoc, ← mul_assoc, mul_assoc _ _ b, ofCrAnListF_singleton] rw [ι_normalOrderF_superCommuteF_ofCrAnOpF_eq_zero_mul] lemma ι_normalOrderF_superCommuteF_ofCrAnListF_ofCrAnOpF_eq_zero_mul (φa : 𝓕.CrAnFieldOp) @@ -106,8 +101,7 @@ lemma ι_normalOrderF_superCommuteF_ofCrAnListF_ofCrAnOpF_eq_zero_mul (φa : rw [← ofCrAnListF_singleton, superCommuteF_ofCrAnListF_ofCrAnListF_symm, ofCrAnListF_singleton] simp only [ofList_singleton, Algebra.mul_smul_comm, Algebra.smul_mul_assoc, map_smul] - rw [ι_normalOrderF_superCommuteF_ofCrAnOpF_ofCrAnListF_eq_zero_mul] - simp + simp [ι_normalOrderF_superCommuteF_ofCrAnOpF_ofCrAnListF_eq_zero_mul] lemma ι_normalOrderF_superCommuteF_ofCrAnListF_ofCrAnListF_eq_zero_mul (φs φs' : List 𝓕.CrAnFieldOp) (a b : 𝓕.FieldOpFreeAlgebra) : @@ -116,8 +110,7 @@ lemma ι_normalOrderF_superCommuteF_ofCrAnListF_ofCrAnListF_eq_zero_mul rw [map_sum, map_sum] apply Fintype.sum_eq_zero intro n - rw [← mul_assoc, ← mul_assoc] - rw [mul_assoc _ _ b] + rw [← mul_assoc, ← mul_assoc, mul_assoc _ _ b] rw [ι_normalOrderF_superCommuteF_ofCrAnListF_ofCrAnOpF_eq_zero_mul] lemma ι_normalOrderF_superCommuteF_ofCrAnListF_eq_zero_mul @@ -134,8 +127,7 @@ lemma ι_normalOrderF_superCommuteF_ofCrAnListF_eq_zero_mul LinearMap.coe_comp, Function.comp_apply, LinearMap.flip_apply, AlgHom.toLinearMap_apply, LinearMap.zero_apply] rw [ι_normalOrderF_superCommuteF_ofCrAnListF_ofCrAnListF_eq_zero_mul] - rw [hf] - simp + simp [hf] @[simp] lemma ι_normalOrderF_superCommuteF_eq_zero_mul @@ -150,32 +142,26 @@ lemma ι_normalOrderF_superCommuteF_eq_zero_mul LinearMap.coe_comp, Function.comp_apply, LinearMap.flip_apply, AlgHom.toLinearMap_apply, LinearMap.zero_apply] rw [ι_normalOrderF_superCommuteF_ofCrAnListF_eq_zero_mul] - rw [hf] - simp + simp [hf] @[simp] lemma ι_normalOrder_superCommuteF_eq_zero_mul_right (b c d : 𝓕.FieldOpFreeAlgebra) : ι 𝓝ᶠ([d, c]ₛF * b) = 0 := by - rw [← ι_normalOrderF_superCommuteF_eq_zero_mul 1 b c d] - simp + simpa using ι_normalOrderF_superCommuteF_eq_zero_mul (1 : 𝓕.FieldOpFreeAlgebra) b c d @[simp] lemma ι_normalOrderF_superCommuteF_eq_zero_mul_left (a c d : 𝓕.FieldOpFreeAlgebra) : ι 𝓝ᶠ(a * [d, c]ₛF) = 0 := by - rw [← ι_normalOrderF_superCommuteF_eq_zero_mul a 1 c d] - simp + simpa using ι_normalOrderF_superCommuteF_eq_zero_mul a (1 : 𝓕.FieldOpFreeAlgebra) c d @[simp] lemma ι_normalOrderF_superCommuteF_eq_zero_mul_mul_right (a b1 b2 c d: 𝓕.FieldOpFreeAlgebra) : ι 𝓝ᶠ(a * [d, c]ₛF * b1 * b2) = 0 := by - rw [← ι_normalOrderF_superCommuteF_eq_zero_mul a (b1 * b2) c d] - congr 2 - noncomm_ring + simpa [mul_assoc] using ι_normalOrderF_superCommuteF_eq_zero_mul a (b1 * b2) c d @[simp] lemma ι_normalOrderF_superCommuteF_eq_zero (c d : 𝓕.FieldOpFreeAlgebra) : ι 𝓝ᶠ([d, c]ₛF) = 0 := by - rw [← ι_normalOrderF_superCommuteF_eq_zero_mul 1 1 c d] - simp + simpa using ι_normalOrderF_superCommuteF_eq_zero_mul (1 : 𝓕.FieldOpFreeAlgebra) 1 c d /-! @@ -236,8 +222,7 @@ noncomputable def normalOrder : WickAlgebra 𝓕 →ₗ[ℂ] WickAlgebra 𝓕 wh map_add' x y := by obtain ⟨x, rfl⟩ := ι_surjective x obtain ⟨y, rfl⟩ := ι_surjective y - rw [← map_add, ι_apply, ι_apply, ι_apply] - rw [Quotient.lift_mk, Quotient.lift_mk, Quotient.lift_mk] + rw [← map_add, ι_apply, ι_apply, ι_apply, Quotient.lift_mk, Quotient.lift_mk, Quotient.lift_mk] simp map_smul' c y := by obtain ⟨y, rfl⟩ := ι_surjective y diff --git a/Physlib/QFT/PerturbationTheory/WickAlgebra/NormalOrder/Lemmas.lean b/Physlib/QFT/PerturbationTheory/WickAlgebra/NormalOrder/Lemmas.lean index c7d41c4c1..d33355862 100644 --- a/Physlib/QFT/PerturbationTheory/WickAlgebra/NormalOrder/Lemmas.lean +++ b/Physlib/QFT/PerturbationTheory/WickAlgebra/NormalOrder/Lemmas.lean @@ -34,29 +34,21 @@ lemma normalOrder_eq_ι_normalOrderF (a : 𝓕.FieldOpFreeAlgebra) : lemma normalOrder_ofCrAnList (φs : List 𝓕.CrAnFieldOp) : 𝓝(ofCrAnList φs) = normalOrderSign φs • ofCrAnList (normalOrderList φs) := by - rw [ofCrAnList, normalOrder_eq_ι_normalOrderF, normalOrderF_ofCrAnListF] - rfl + simp only [ofCrAnList, normalOrder_eq_ι_normalOrderF, normalOrderF_ofCrAnListF, map_smul] @[simp] lemma normalOrder_one_eq_one : normalOrder (𝓕 := 𝓕) 1 = 1 := by - have h1 : 1 = ofCrAnList (𝓕 := 𝓕) [] := by simp [ofCrAnList] - rw [h1] - rw [normalOrder_ofCrAnList] - simp + simpa [ofCrAnList, normalOrderSign_nil, normalOrderList_nil, one_smul] using + normalOrder_ofCrAnList (𝓕 := 𝓕) [] @[simp] lemma normalOrder_ofFieldOpList_nil : normalOrder (𝓕 := 𝓕) (ofFieldOpList []) = 1 := by - rw [ofFieldOpList] - rw [normalOrder_eq_ι_normalOrderF] - simp only [ofFieldOpListF_nil] - change normalOrder (𝓕 := 𝓕) 1 = _ - simp + simp [ofFieldOpList, ofFieldOpListF_nil] @[simp] lemma normalOrder_ofCrAnList_nil : normalOrder (𝓕 := 𝓕) (ofCrAnList []) = 1 := by - rw [normalOrder_ofCrAnList] - simp only [normalOrderSign_nil, normalOrderList_nil, ofCrAnList_nil] - module + simpa only [normalOrderSign_nil, normalOrderList_nil, ofCrAnList_nil, one_smul] using + normalOrder_ofCrAnList (𝓕 := 𝓕) [] lemma ofCrAnList_eq_normalOrder (φs : List 𝓕.CrAnFieldOp) : ofCrAnList (normalOrderList φs) = normalOrderSign φs • 𝓝(ofCrAnList φs) := by @@ -71,34 +63,16 @@ lemma normalOrder_normalOrder_mid (a b c : 𝓕.WickAlgebra) : rw [normalOrder_eq_ι_normalOrderF] simp only [← map_mul] rw [normalOrder_eq_ι_normalOrderF] - rw [normalOrderF_normalOrderF_mid] - rfl + exact congrArg ι (normalOrderF_normalOrderF_mid a b c) lemma normalOrder_normalOrder_left (a b : 𝓕.WickAlgebra) : - 𝓝(a * b) = 𝓝(𝓝(a) * b) := by - obtain ⟨a, rfl⟩ := ι_surjective a - obtain ⟨b, rfl⟩ := ι_surjective b - rw [normalOrder_eq_ι_normalOrderF] - simp only [← map_mul] - rw [normalOrder_eq_ι_normalOrderF] - rw [normalOrderF_normalOrderF_left] - rfl + 𝓝(a * b) = 𝓝(𝓝(a) * b) := by simpa using normalOrder_normalOrder_mid (1 : 𝓕.WickAlgebra) a b lemma normalOrder_normalOrder_right (a b : 𝓕.WickAlgebra) : - 𝓝(a * b) = 𝓝(a * 𝓝(b)) := by - obtain ⟨a, rfl⟩ := ι_surjective a - obtain ⟨b, rfl⟩ := ι_surjective b - rw [normalOrder_eq_ι_normalOrderF] - simp only [← map_mul] - rw [normalOrder_eq_ι_normalOrderF] - rw [normalOrderF_normalOrderF_right] - rfl + 𝓝(a * b) = 𝓝(a * 𝓝(b)) := by simpa using normalOrder_normalOrder_mid a b (1 : 𝓕.WickAlgebra) lemma normalOrder_normalOrder (a : 𝓕.WickAlgebra) : 𝓝(𝓝(a)) = 𝓝(a) := by - trans 𝓝(𝓝(a) * 1) - · simp - · rw [← normalOrder_normalOrder_left] - simp + simpa using (normalOrder_normalOrder_left a (1 : 𝓕.WickAlgebra)).symm /-! @@ -108,14 +82,12 @@ lemma normalOrder_normalOrder (a : 𝓕.WickAlgebra) : 𝓝(𝓝(a)) = 𝓝(a) : lemma normalOrder_mul_anPart (φ : 𝓕.FieldOp) (a : 𝓕.WickAlgebra) : 𝓝(a * anPart φ) = 𝓝(a) * anPart φ := by obtain ⟨a, rfl⟩ := ι_surjective a - rw [anPart, ← map_mul, normalOrder_eq_ι_normalOrderF, normalOrderF_mul_anPartF] - rfl + exact congrArg ι (normalOrderF_mul_anPartF _ _) lemma crPart_mul_normalOrder (φ : 𝓕.FieldOp) (a : 𝓕.WickAlgebra) : 𝓝(crPart φ * a) = crPart φ * 𝓝(a) := by obtain ⟨a, rfl⟩ := ι_surjective a - rw [crPart, ← map_mul, normalOrder_eq_ι_normalOrderF, normalOrderF_crPartF_mul] - rfl + exact congrArg ι (normalOrderF_crPartF_mul _ _) /-! @@ -130,8 +102,7 @@ lemma normalOrder_superCommute_eq_zero (a b : 𝓕.WickAlgebra) : 𝓝([a, b]ₛ) = 0 := by obtain ⟨a, rfl⟩ := ι_surjective a obtain ⟨b, rfl⟩ := ι_surjective b - rw [superCommute_eq_ι_superCommuteF, normalOrder_eq_ι_normalOrderF] - simp + simp [superCommute_eq_ι_superCommuteF, normalOrder_eq_ι_normalOrderF] @[simp] lemma normalOrder_superCommute_left_eq_zero (a b c: 𝓕.WickAlgebra) : @@ -139,8 +110,7 @@ lemma normalOrder_superCommute_left_eq_zero (a b c: 𝓕.WickAlgebra) : obtain ⟨a, rfl⟩ := ι_surjective a obtain ⟨b, rfl⟩ := ι_surjective b obtain ⟨c, rfl⟩ := ι_surjective c - rw [superCommute_eq_ι_superCommuteF, ← map_mul, normalOrder_eq_ι_normalOrderF] - simp + simp [superCommute_eq_ι_superCommuteF, ← map_mul, normalOrder_eq_ι_normalOrderF] @[simp] lemma normalOrder_superCommute_right_eq_zero (a b c: 𝓕.WickAlgebra) : @@ -148,8 +118,7 @@ lemma normalOrder_superCommute_right_eq_zero (a b c: 𝓕.WickAlgebra) : obtain ⟨a, rfl⟩ := ι_surjective a obtain ⟨b, rfl⟩ := ι_surjective b obtain ⟨c, rfl⟩ := ι_surjective c - rw [superCommute_eq_ι_superCommuteF, ← map_mul, normalOrder_eq_ι_normalOrderF] - simp + simp [superCommute_eq_ι_superCommuteF, ← map_mul, normalOrder_eq_ι_normalOrderF] @[simp] lemma normalOrder_superCommute_mid_eq_zero (a b c d : 𝓕.WickAlgebra) : @@ -158,8 +127,7 @@ lemma normalOrder_superCommute_mid_eq_zero (a b c d : 𝓕.WickAlgebra) : obtain ⟨b, rfl⟩ := ι_surjective b obtain ⟨c, rfl⟩ := ι_surjective c obtain ⟨d, rfl⟩ := ι_surjective d - rw [superCommute_eq_ι_superCommuteF, ← map_mul, ← map_mul, normalOrder_eq_ι_normalOrderF] - simp + simp [superCommute_eq_ι_superCommuteF, ← map_mul, ← map_mul, normalOrder_eq_ι_normalOrderF] /-! @@ -192,12 +160,10 @@ lemma normalOrder_anPart_ofFieldOpList_swap (φ : 𝓕.FieldOp) (φ' : List 𝓕 module | .position φ => simp only [anPart_position] - rw [normalOrder_ofCrAnOp_ofFieldOpList_swap] - rfl + exact normalOrder_ofCrAnOp_ofFieldOpList_swap _ _ | .outAsymp φ => simp only [anPart_outAsymp] - rw [normalOrder_ofCrAnOp_ofFieldOpList_swap] - rfl + exact normalOrder_ofCrAnOp_ofFieldOpList_swap _ _ lemma normalOrder_ofFieldOpList_anPart_swap (φ : 𝓕.FieldOp) (φ' : List 𝓕.FieldOp) : 𝓝(ofFieldOpList φ' * anPart φ) = 𝓢(𝓕 |>ₛ φ, 𝓕 |>ₛ φ') • 𝓝(anPart φ * ofFieldOpList φ') := by @@ -215,9 +181,7 @@ lemma anPart_mul_normalOrder_ofFieldOpList_eq_superCommute (φ : 𝓕.FieldOp) 𝓢(𝓕 |>ₛ φ, 𝓕 |>ₛ φs') • 𝓝(ofFieldOpList φs' * anPart φ) + [anPart φ, 𝓝(ofFieldOpList φs')]ₛ := by rw [anPart, ofFieldOpList, normalOrder_eq_ι_normalOrderF, ← map_mul] - rw [anPartF_mul_normalOrderF_ofFieldOpListF_eq_superCommuteF] - simp only [map_add, map_smul] - rfl + exact congrArg ι (anPartF_mul_normalOrderF_ofFieldOpListF_eq_superCommuteF _ _) /-! @@ -261,8 +225,7 @@ lemma ofCrAnOp_superCommute_normalOrder_ofCrAnList_sum (φ : 𝓕.CrAnFieldOp) 𝓢(𝓕 |>ₛ (φs.get n), 𝓕 |>ₛ ((normalOrderList φs).take (normalOrderEquiv n)))) * 𝓢(𝓕 |>ₛ (φs.get n), 𝓕 |>ₛ (φs.take n)) · ring_nf - rw [hs] - rfl + simp [hs] · simp [hs] · erw [superCommute_diff_statistic hs] simp only [zero_mul, smul_zero] @@ -330,9 +293,7 @@ Within a proto-operator algebra we have that lemma anPart_mul_normalOrder_ofFieldOpList_eq_superCommute_reorder (φ : 𝓕.FieldOp) (φs : List 𝓕.FieldOp) : anPart φ * 𝓝(ofFieldOpList φs) = 𝓝(anPart φ * ofFieldOpList φs) + [anPart φ, 𝓝(ofFieldOpList φs)]ₛ := by - rw [anPart_mul_normalOrder_ofFieldOpList_eq_superCommute] - simp only [add_left_inj] - rw [normalOrder_anPart_ofFieldOpList_swap] + rw [anPart_mul_normalOrder_ofFieldOpList_eq_superCommute, normalOrder_anPart_ofFieldOpList_swap] /-- Within a proto-operator algebra we have that @@ -438,15 +399,13 @@ lemma normalOrder_crPart_mul_anPart (φ φ' : 𝓕.FieldOp) : @[simp] lemma normalOrder_anPart_mul_crPart (φ φ' : 𝓕.FieldOp) : 𝓝(anPart φ * crPart φ') = 𝓢(𝓕 |>ₛ φ, 𝓕 |>ₛ φ') • crPart φ' * anPart φ := by - rw [anPart, crPart, ← map_mul, normalOrder_eq_ι_normalOrderF, normalOrderF_anPartF_mul_crPartF] - simp + simp [anPart, crPart, ← map_mul, normalOrder_eq_ι_normalOrderF, normalOrderF_anPartF_mul_crPartF] lemma normalOrder_ofFieldOp_mul_ofFieldOp (φ φ' : 𝓕.FieldOp) : 𝓝(ofFieldOp φ * ofFieldOp φ') = crPart φ * crPart φ' + 𝓢(𝓕 |>ₛ φ, 𝓕 |>ₛ φ') • (crPart φ' * anPart φ) + crPart φ * anPart φ' + anPart φ * anPart φ' := by - rw [ofFieldOp, ofFieldOp, ← map_mul, normalOrder_eq_ι_normalOrderF, - normalOrderF_ofFieldOpF_mul_ofFieldOpF] - rfl + rw [ofFieldOp, ofFieldOp, ← map_mul, normalOrder_eq_ι_normalOrderF] + simp [normalOrderF_ofFieldOpF_mul_ofFieldOpF, crPart, anPart] end WickAlgebra end FieldSpecification diff --git a/Physlib/QFT/PerturbationTheory/WickAlgebra/StaticWickTheorem.lean b/Physlib/QFT/PerturbationTheory/WickAlgebra/StaticWickTheorem.lean index 3261bf4f4..5a7f83d96 100644 --- a/Physlib/QFT/PerturbationTheory/WickAlgebra/StaticWickTheorem.lean +++ b/Physlib/QFT/PerturbationTheory/WickAlgebra/StaticWickTheorem.lean @@ -68,8 +68,7 @@ theorem static_wick_theorem : (φs : List 𝓕.FieldOp) → rw [Finset.mul_sum] apply Finset.sum_congr rfl intro c _ - rw [mul_staticWickTerm_eq_sum] - rfl + simp [mul_staticWickTerm_eq_sum] end WickAlgebra end FieldSpecification diff --git a/Physlib/QFT/PerturbationTheory/WickAlgebra/SuperCommute.lean b/Physlib/QFT/PerturbationTheory/WickAlgebra/SuperCommute.lean index 34ced8b47..171a599ee 100644 --- a/Physlib/QFT/PerturbationTheory/WickAlgebra/SuperCommute.lean +++ b/Physlib/QFT/PerturbationTheory/WickAlgebra/SuperCommute.lean @@ -41,9 +41,8 @@ lemma ι_superCommuteF_eq_zero_of_ι_left_zero (a b : 𝓕.FieldOpFreeAlgebra) ( -/ lemma ι_superCommuteF_right_zero_of_mem_ideal (a b : 𝓕.FieldOpFreeAlgebra) - (h : b ∈ TwoSidedIdeal.span 𝓕.fieldOpIdealSet) : ι [a, b]ₛF = 0 := by - apply ι_superCommuteF_eq_zero_of_ι_right_zero - exact (ι_eq_zero_iff_mem_ideal b).mpr h + (h : b ∈ TwoSidedIdeal.span 𝓕.fieldOpIdealSet) : ι [a, b]ₛF = 0 := + ι_superCommuteF_eq_zero_of_ι_right_zero a b ((ι_eq_zero_iff_mem_ideal b).mpr h) lemma ι_superCommuteF_eq_of_equiv_right (a b1 b2 : 𝓕.FieldOpFreeAlgebra) (h : b1 ≈ b2) : ι [a, b1]ₛF = ι [a, b2]ₛF := by @@ -60,8 +59,7 @@ noncomputable def superCommuteRight (a : 𝓕.FieldOpFreeAlgebra) : obtain ⟨x, hx⟩ := ι_surjective x obtain ⟨y, hy⟩ := ι_surjective y subst hx hy - rw [← map_add, ι_apply, ι_apply, ι_apply] - rw [Quotient.lift_mk, Quotient.lift_mk, Quotient.lift_mk] + rw [← map_add, ι_apply, ι_apply, ι_apply, Quotient.lift_mk, Quotient.lift_mk, Quotient.lift_mk] simp map_smul' c y := by obtain ⟨y, hy⟩ := ι_surjective y @@ -156,13 +154,11 @@ lemma superCommute_annihilate_annihilate {φ φ' : 𝓕.CrAnFieldOp} lemma superCommute_diff_statistic {φ φ' : 𝓕.CrAnFieldOp} (h : (𝓕 |>ₛ φ) ≠ 𝓕 |>ₛ φ') : [ofCrAnOp φ, ofCrAnOp φ']ₛ = 0 := by - rw [ofCrAnOp, ofCrAnOp] - rw [superCommute_eq_ι_superCommuteF, ι_superCommuteF_of_diff_statistic h] + rw [ofCrAnOp, ofCrAnOp, superCommute_eq_ι_superCommuteF, ι_superCommuteF_of_diff_statistic h] lemma superCommute_ofCrAnOp_ofFieldOp_diff_stat_zero (φ : 𝓕.CrAnFieldOp) (ψ : 𝓕.FieldOp) (h : (𝓕 |>ₛ φ) ≠ (𝓕 |>ₛ ψ)) : [ofCrAnOp φ, ofFieldOp ψ]ₛ = 0 := by - rw [ofFieldOp_eq_sum, map_sum] - rw [Finset.sum_eq_zero] + rw [ofFieldOp_eq_sum, map_sum, Finset.sum_eq_zero] intro x hx apply superCommute_diff_statistic simpa [crAnStatistics] using h @@ -186,10 +182,8 @@ lemma superCommute_ofCrAnOp_ofCrAnOp_mem_center (φ φ' : 𝓕.CrAnFieldOp) : lemma superCommute_ofCrAnOp_ofCrAnOp_commute (φ φ' : 𝓕.CrAnFieldOp) (a : WickAlgebra 𝓕) : - a * [ofCrAnOp φ, ofCrAnOp φ']ₛ = [ofCrAnOp φ, ofCrAnOp φ']ₛ * a := by - have h1 := superCommute_ofCrAnOp_ofCrAnOp_mem_center φ φ' - rw [@Subalgebra.mem_center_iff] at h1 - exact h1 a + a * [ofCrAnOp φ, ofCrAnOp φ']ₛ = [ofCrAnOp φ, ofCrAnOp φ']ₛ * a := + (Subalgebra.mem_center_iff.mp (superCommute_ofCrAnOp_ofCrAnOp_mem_center φ φ')) a lemma superCommute_ofCrAnOp_ofFieldOp_mem_center (φ : 𝓕.CrAnFieldOp) (φ' : 𝓕.FieldOp) : [ofCrAnOp φ, ofFieldOp φ']ₛ ∈ Subalgebra.center ℂ (WickAlgebra 𝓕) := by @@ -201,10 +195,8 @@ lemma superCommute_ofCrAnOp_ofFieldOp_mem_center (φ : 𝓕.CrAnFieldOp) (φ' : lemma superCommute_ofCrAnOp_ofFieldOp_commute (φ : 𝓕.CrAnFieldOp) (φ' : 𝓕.FieldOp) (a : WickAlgebra 𝓕) : a * [ofCrAnOp φ, ofFieldOp φ']ₛ = - [ofCrAnOp φ, ofFieldOp φ']ₛ * a := by - have h1 := superCommute_ofCrAnOp_ofFieldOp_mem_center φ φ' - rw [@Subalgebra.mem_center_iff] at h1 - exact h1 a + [ofCrAnOp φ, ofFieldOp φ']ₛ * a := + (Subalgebra.mem_center_iff.mp (superCommute_ofCrAnOp_ofFieldOp_mem_center φ φ')) a lemma superCommute_anPart_ofFieldOp_mem_center (φ φ' : 𝓕.FieldOp) : [anPart φ, ofFieldOp φ']ₛ ∈ Subalgebra.center ℂ (WickAlgebra 𝓕) := by @@ -226,59 +218,51 @@ lemma superCommute_anPart_ofFieldOp_mem_center (φ φ' : 𝓕.FieldOp) : lemma superCommute_ofCrAnList_ofCrAnList (φs φs' : List 𝓕.CrAnFieldOp) : [ofCrAnList φs, ofCrAnList φs']ₛ = ofCrAnList (φs ++ φs') - 𝓢(𝓕 |>ₛ φs, 𝓕 |>ₛ φs') • ofCrAnList (φs' ++ φs) := by - rw [ofCrAnList_eq_ι_ofCrAnListF, ofCrAnList_eq_ι_ofCrAnListF] - rw [superCommute_eq_ι_superCommuteF, superCommuteF_ofCrAnListF_ofCrAnListF] - rfl + simp [ofCrAnList_eq_ι_ofCrAnListF, superCommute_eq_ι_superCommuteF, + superCommuteF_ofCrAnListF_ofCrAnListF] lemma superCommute_ofCrAnOp_ofCrAnOp (φ φ' : 𝓕.CrAnFieldOp) : [ofCrAnOp φ, ofCrAnOp φ']ₛ = ofCrAnOp φ * ofCrAnOp φ' - 𝓢(𝓕 |>ₛ φ, 𝓕 |>ₛ φ') • ofCrAnOp φ' * ofCrAnOp φ := by - rw [ofCrAnOp, ofCrAnOp] - rw [superCommute_eq_ι_superCommuteF, superCommuteF_ofCrAnOpF_ofCrAnOpF] - rfl + simp [ofCrAnOp, superCommute_eq_ι_superCommuteF, + superCommuteF_ofCrAnOpF_ofCrAnOpF] lemma superCommute_ofCrAnList_ofFieldOpList (φcas : List 𝓕.CrAnFieldOp) (φs : List 𝓕.FieldOp) : [ofCrAnList φcas, ofFieldOpList φs]ₛ = ofCrAnList φcas * ofFieldOpList φs - 𝓢(𝓕 |>ₛ φcas, 𝓕 |>ₛ φs) • ofFieldOpList φs * ofCrAnList φcas := by - rw [ofCrAnList, ofFieldOpList] - rw [superCommute_eq_ι_superCommuteF, superCommuteF_ofCrAnListF_ofFieldOpFsList] - rfl + simp [ofCrAnList, ofFieldOpList, superCommute_eq_ι_superCommuteF, + superCommuteF_ofCrAnListF_ofFieldOpFsList] lemma superCommute_ofFieldOpList_ofFieldOpList (φs φs' : List 𝓕.FieldOp) : [ofFieldOpList φs, ofFieldOpList φs']ₛ = ofFieldOpList φs * ofFieldOpList φs' - 𝓢(𝓕 |>ₛ φs, 𝓕 |>ₛ φs') • ofFieldOpList φs' * ofFieldOpList φs := by - rw [ofFieldOpList, ofFieldOpList] - rw [superCommute_eq_ι_superCommuteF, superCommuteF_ofFieldOpListF_ofFieldOpFsList] - rfl + simp [ofFieldOpList, superCommute_eq_ι_superCommuteF, + superCommuteF_ofFieldOpListF_ofFieldOpFsList] lemma superCommute_ofFieldOp_ofFieldOpList (φ : 𝓕.FieldOp) (φs : List 𝓕.FieldOp) : [ofFieldOp φ, ofFieldOpList φs]ₛ = ofFieldOp φ * ofFieldOpList φs - 𝓢(𝓕 |>ₛ φ, 𝓕 |>ₛ φs) • ofFieldOpList φs * ofFieldOp φ := by - rw [ofFieldOp, ofFieldOpList] - rw [superCommute_eq_ι_superCommuteF, superCommuteF_ofFieldOpF_ofFieldOpFsList] - rfl + simpa [ofFieldOpList_singleton] using + superCommute_ofFieldOpList_ofFieldOpList (𝓕 := 𝓕) [φ] φs lemma superCommute_ofFieldOpList_ofFieldOp (φs : List 𝓕.FieldOp) (φ : 𝓕.FieldOp) : [ofFieldOpList φs, ofFieldOp φ]ₛ = ofFieldOpList φs * ofFieldOp φ - 𝓢(𝓕 |>ₛ φs, 𝓕 |>ₛ φ) • ofFieldOp φ * ofFieldOpList φs := by - rw [ofFieldOpList, ofFieldOp] - rw [superCommute_eq_ι_superCommuteF, superCommuteF_ofFieldOpListF_ofFieldOpF] - rfl + simpa [ofFieldOpList_singleton] using + superCommute_ofFieldOpList_ofFieldOpList (𝓕 := 𝓕) φs [φ] lemma superCommute_anPart_crPart (φ φ' : 𝓕.FieldOp) : [anPart φ, crPart φ']ₛ = anPart φ * crPart φ' - 𝓢(𝓕 |>ₛ φ, 𝓕 |>ₛ φ') • crPart φ' * anPart φ := by - rw [anPart, crPart] - rw [superCommute_eq_ι_superCommuteF, superCommuteF_anPartF_crPartF] - rfl + simp [anPart, crPart, superCommute_eq_ι_superCommuteF, + superCommuteF_anPartF_crPartF] lemma superCommute_crPart_anPart (φ φ' : 𝓕.FieldOp) : [crPart φ, anPart φ']ₛ = crPart φ * anPart φ' - 𝓢(𝓕 |>ₛ φ, 𝓕 |>ₛ φ') • anPart φ' * crPart φ := by - rw [anPart, crPart] - rw [superCommute_eq_ι_superCommuteF, superCommuteF_crPartF_anPartF] - rfl + simp [anPart, crPart, superCommute_eq_ι_superCommuteF, + superCommuteF_crPartF_anPartF] @[simp] lemma superCommute_crPart_crPart (φ φ' : 𝓕.FieldOp) : [crPart φ, crPart φ']ₛ = 0 := by @@ -323,30 +307,26 @@ lemma superCommute_anPart_anPart (φ φ' : 𝓕.FieldOp) : [anPart φ, anPart φ lemma superCommute_crPart_ofFieldOpList (φ : 𝓕.FieldOp) (φs : List 𝓕.FieldOp) : [crPart φ, ofFieldOpList φs]ₛ = crPart φ * ofFieldOpList φs - 𝓢(𝓕 |>ₛ φ, 𝓕 |>ₛ φs) • ofFieldOpList φs * crPart φ := by - rw [crPart, ofFieldOpList] - rw [superCommute_eq_ι_superCommuteF, superCommuteF_crPartF_ofFieldOpListF] - rfl + simp [crPart, ofFieldOpList, superCommute_eq_ι_superCommuteF, + superCommuteF_crPartF_ofFieldOpListF] lemma superCommute_anPart_ofFieldOpList (φ : 𝓕.FieldOp) (φs : List 𝓕.FieldOp) : [anPart φ, ofFieldOpList φs]ₛ = anPart φ * ofFieldOpList φs - 𝓢(𝓕 |>ₛ φ, 𝓕 |>ₛ φs) • ofFieldOpList φs * anPart φ := by - rw [anPart, ofFieldOpList] - rw [superCommute_eq_ι_superCommuteF, superCommuteF_anPartF_ofFieldOpListF] - rfl + simp [anPart, ofFieldOpList, superCommute_eq_ι_superCommuteF, + superCommuteF_anPartF_ofFieldOpListF] lemma superCommute_crPart_ofFieldOp (φ φ' : 𝓕.FieldOp) : [crPart φ, ofFieldOp φ']ₛ = crPart φ * ofFieldOp φ' - 𝓢(𝓕 |>ₛ φ, 𝓕 |>ₛ φ') • ofFieldOp φ' * crPart φ := by - rw [crPart, ofFieldOp] - rw [superCommute_eq_ι_superCommuteF, superCommuteF_crPartF_ofFieldOpF] - rfl + simp [crPart, ofFieldOp, superCommute_eq_ι_superCommuteF, + superCommuteF_crPartF_ofFieldOpF] lemma superCommute_anPart_ofFieldOp (φ φ' : 𝓕.FieldOp) : [anPart φ, ofFieldOp φ']ₛ = anPart φ * ofFieldOp φ' - 𝓢(𝓕 |>ₛ φ, 𝓕 |>ₛ φ') • ofFieldOp φ' * anPart φ := by - rw [anPart, ofFieldOp] - rw [superCommute_eq_ι_superCommuteF, superCommuteF_anPartF_ofFieldOpF] - rfl + simp [anPart, ofFieldOp, superCommute_eq_ι_superCommuteF, + superCommuteF_anPartF_ofFieldOpF] /-! @@ -361,60 +341,46 @@ lemma ofCrAnList_mul_ofCrAnList_eq_superCommute (φs φs' : List 𝓕.CrAnFieldO ofCrAnList φs * ofCrAnList φs' = 𝓢(𝓕 |>ₛ φs, 𝓕 |>ₛ φs') • ofCrAnList φs' * ofCrAnList φs + [ofCrAnList φs, ofCrAnList φs']ₛ := by - rw [superCommute_ofCrAnList_ofCrAnList] - simp [ofCrAnList_append] + simp [superCommute_ofCrAnList_ofCrAnList, ofCrAnList_append] lemma ofCrAnOp_mul_ofCrAnList_eq_superCommute (φ : 𝓕.CrAnFieldOp) (φs' : List 𝓕.CrAnFieldOp) : ofCrAnOp φ * ofCrAnList φs' = 𝓢(𝓕 |>ₛ φ, 𝓕 |>ₛ φs') • ofCrAnList φs' * ofCrAnOp φ + [ofCrAnOp φ, ofCrAnList φs']ₛ := by - rw [← ofCrAnList_singleton, ofCrAnList_mul_ofCrAnList_eq_superCommute] - simp + simpa [ofCrAnList_singleton] using ofCrAnList_mul_ofCrAnList_eq_superCommute [φ] φs' lemma ofFieldOpList_mul_ofFieldOpList_eq_superCommute (φs φs' : List 𝓕.FieldOp) : ofFieldOpList φs * ofFieldOpList φs' = 𝓢(𝓕 |>ₛ φs, 𝓕 |>ₛ φs') • ofFieldOpList φs' * ofFieldOpList φs - + [ofFieldOpList φs, ofFieldOpList φs']ₛ := by - rw [superCommute_ofFieldOpList_ofFieldOpList] - simp + + [ofFieldOpList φs, ofFieldOpList φs']ₛ := by simp [superCommute_ofFieldOpList_ofFieldOpList] lemma ofFieldOp_mul_ofFieldOpList_eq_superCommute (φ : 𝓕.FieldOp) (φs' : List 𝓕.FieldOp) : ofFieldOp φ * ofFieldOpList φs' = 𝓢(𝓕 |>ₛ φ, 𝓕 |>ₛ φs') • ofFieldOpList φs' * ofFieldOp φ + [ofFieldOp φ, ofFieldOpList φs']ₛ := by - rw [superCommute_ofFieldOp_ofFieldOpList] - simp + simpa [ofFieldOpList_singleton] using ofFieldOpList_mul_ofFieldOpList_eq_superCommute [φ] φs' lemma ofFieldOp_mul_ofFieldOp_eq_superCommute (φ φ' : 𝓕.FieldOp) : ofFieldOp φ * ofFieldOp φ' = 𝓢(𝓕 |>ₛ φ, 𝓕 |>ₛ φ') • ofFieldOp φ' * ofFieldOp φ + [ofFieldOp φ, ofFieldOp φ']ₛ := by - rw [← ofFieldOpList_singleton, ← ofFieldOpList_singleton] - rw [ofFieldOpList_mul_ofFieldOpList_eq_superCommute, ofFieldOpList_singleton] - simp + simpa [ofFieldOpList_singleton] using ofFieldOpList_mul_ofFieldOpList_eq_superCommute [φ] [φ'] lemma ofFieldOpList_mul_ofFieldOp_eq_superCommute (φs : List 𝓕.FieldOp) (φ : 𝓕.FieldOp) : ofFieldOpList φs * ofFieldOp φ = 𝓢(𝓕 |>ₛ φs, 𝓕 |>ₛ φ) • ofFieldOp φ * ofFieldOpList φs + [ofFieldOpList φs, ofFieldOp φ]ₛ := by - rw [superCommute_ofFieldOpList_ofFieldOp] - simp + simpa [ofFieldOpList_singleton] using ofFieldOpList_mul_ofFieldOpList_eq_superCommute φs [φ] lemma ofCrAnList_mul_ofFieldOpList_eq_superCommute (φs : List 𝓕.CrAnFieldOp) (φs' : List 𝓕.FieldOp) : ofCrAnList φs * ofFieldOpList φs' = 𝓢(𝓕 |>ₛ φs, 𝓕 |>ₛ φs') • ofFieldOpList φs' * ofCrAnList φs - + [ofCrAnList φs, ofFieldOpList φs']ₛ := by - rw [superCommute_ofCrAnList_ofFieldOpList] - simp + + [ofCrAnList φs, ofFieldOpList φs']ₛ := by simp [superCommute_ofCrAnList_ofFieldOpList] lemma crPart_mul_anPart_eq_superCommute (φ φ' : 𝓕.FieldOp) : crPart φ * anPart φ' = 𝓢(𝓕 |>ₛ φ, 𝓕 |>ₛ φ') • anPart φ' * crPart φ - + [crPart φ, anPart φ']ₛ := by - rw [superCommute_crPart_anPart] - simp + + [crPart φ, anPart φ']ₛ := by simp [superCommute_crPart_anPart] lemma anPart_mul_crPart_eq_superCommute (φ φ' : 𝓕.FieldOp) : anPart φ * crPart φ' = 𝓢(𝓕 |>ₛ φ, 𝓕 |>ₛ φ') • crPart φ' * anPart φ - + [anPart φ, crPart φ']ₛ := by - rw [superCommute_anPart_crPart] - simp + + [anPart φ, crPart φ']ₛ := by simp [superCommute_anPart_crPart] lemma crPart_mul_crPart_swap (φ φ' : 𝓕.FieldOp) : crPart φ * crPart φ' = 𝓢(𝓕 |>ₛ φ, 𝓕 |>ₛ φ') • crPart φ' * crPart φ := by @@ -446,9 +412,8 @@ lemma superCommute_ofCrAnList_ofCrAnList_symm (φs φs' : List 𝓕.CrAnFieldOp) lemma superCommute_ofCrAnOp_ofCrAnOp_symm (φ φ' : 𝓕.CrAnFieldOp) : [ofCrAnOp φ, ofCrAnOp φ']ₛ = (- 𝓢(𝓕 |>ₛ φ, 𝓕 |>ₛ φ')) • [ofCrAnOp φ', ofCrAnOp φ]ₛ := by - rw [ofCrAnOp, ofCrAnOp, superCommute_eq_ι_superCommuteF, - superCommuteF_ofCrAnOpF_ofCrAnOpF_symm] - rfl + simpa [ofCrAnList_singleton] using + superCommute_ofCrAnList_ofCrAnList_symm (𝓕 := 𝓕) [φ] [φ'] /-! @@ -464,8 +429,7 @@ lemma superCommute_ofCrAnList_ofCrAnList_eq_sum (φs φs' : List 𝓕.CrAnFieldO conv_lhs => rw [ofCrAnList, ofCrAnList, superCommute_eq_ι_superCommuteF, superCommuteF_ofCrAnListF_ofCrAnListF_eq_sum] - rw [map_sum] - rfl + exact map_sum _ _ _ lemma superCommute_ofCrAnOp_ofCrAnList_eq_sum (φ : 𝓕.CrAnFieldOp) (φs' : List 𝓕.CrAnFieldOp) : [ofCrAnOp φ, ofCrAnList φs']ₛ = @@ -477,8 +441,7 @@ lemma superCommute_ofCrAnOp_ofCrAnList_eq_sum (φ : 𝓕.CrAnFieldOp) funext n simp only [ofList_singleton, List.get_eq_getElem, Algebra.smul_mul_assoc] congr 1 - rw [ofCrAnList_singleton, superCommute_ofCrAnOp_ofCrAnOp_commute] - rw [mul_assoc, ← ofCrAnList_append] + rw [ofCrAnList_singleton, superCommute_ofCrAnOp_ofCrAnOp_commute, mul_assoc, ← ofCrAnList_append] congr exact Eq.symm (List.eraseIdx_eq_take_drop_succ φs' ↑n) @@ -490,8 +453,7 @@ lemma superCommute_ofCrAnList_ofFieldOpList_eq_sum (φs : List 𝓕.CrAnFieldOp) conv_lhs => rw [ofCrAnList, ofFieldOpList, superCommute_eq_ι_superCommuteF, superCommuteF_ofCrAnListF_ofFieldOpListF_eq_sum] - rw [map_sum] - rfl + exact map_sum _ _ _ lemma superCommute_ofCrAnOp_ofFieldOpList_eq_sum (φ : 𝓕.CrAnFieldOp) (φs' : List 𝓕.FieldOp) : [ofCrAnOp φ, ofFieldOpList φs']ₛ = diff --git a/Physlib/QFT/PerturbationTheory/WickAlgebra/TimeContraction.lean b/Physlib/QFT/PerturbationTheory/WickAlgebra/TimeContraction.lean index 091fa274b..571e33eb7 100644 --- a/Physlib/QFT/PerturbationTheory/WickAlgebra/TimeContraction.lean +++ b/Physlib/QFT/PerturbationTheory/WickAlgebra/TimeContraction.lean @@ -45,18 +45,15 @@ lemma timeContract_of_timeOrderRel (φ ψ : 𝓕.FieldOp) (h : timeOrderRel φ rw [ofFieldOp_eq_crPart_add_anPart] rw [map_add, superCommute_anPart_anPart, superCommute_anPart_crPart] simp only [timeContract, Algebra.smul_mul_assoc, add_zero] - rw [timeOrder_ofFieldOp_ofFieldOp_ordered h] - rw [normalOrder_ofFieldOp_mul_ofFieldOp] + rw [timeOrder_ofFieldOp_ofFieldOp_ordered h, normalOrder_ofFieldOp_mul_ofFieldOp] rw [ofFieldOp_eq_crPart_add_anPart, ofFieldOp_eq_crPart_add_anPart] simp only [mul_add, add_mul] abel_nf lemma timeContract_of_not_timeOrderRel (φ ψ : 𝓕.FieldOp) (h : ¬ timeOrderRel φ ψ) : timeContract φ ψ = 𝓢(𝓕 |>ₛ φ, 𝓕 |>ₛ ψ) • timeContract ψ φ := by - rw [timeContract_eq_smul] - rw [normalOrder_ofFieldOp_ofFieldOp_swap] - rw [timeOrder_ofFieldOp_ofFieldOp_not_ordered_eq_timeOrder h] - rw [timeContract_eq_smul] + rw [timeContract_eq_smul, normalOrder_ofFieldOp_ofFieldOp_swap, + timeOrder_ofFieldOp_ofFieldOp_not_ordered_eq_timeOrder h, timeContract_eq_smul] simp only [smul_add] rw [smul_smul, smul_smul, mul_comm] @@ -66,8 +63,7 @@ lemma timeContract_of_not_timeOrderRel (φ ψ : 𝓕.FieldOp) (h : ¬ timeOrderR `timeContract φ ψ = 𝓢(𝓕 |>ₛ φ, 𝓕 |>ₛ ψ) • [anPart ψ, ofFieldOp φ]ₛ`. -/ lemma timeContract_of_not_timeOrderRel_expand (φ ψ : 𝓕.FieldOp) (h : ¬ timeOrderRel φ ψ) : timeContract φ ψ = 𝓢(𝓕 |>ₛ φ, 𝓕 |>ₛ ψ) • [anPart ψ, ofFieldOp φ]ₛ := by - rw [timeContract_of_not_timeOrderRel _ _ h] - rw [timeContract_of_timeOrderRel _ _ _] + rw [timeContract_of_not_timeOrderRel _ _ h, timeContract_of_timeOrderRel _ _ _] have h1 := Std.Total.total (r := 𝓕.timeOrderRel) φ ψ simp_all @@ -146,10 +142,7 @@ lemma timeOrder_timeContract_eq_time_mid {φ ψ : 𝓕.FieldOp} lemma timeOrder_timeContract_eq_time_left {φ ψ : 𝓕.FieldOp} (h1 : timeOrderRel φ ψ) (h2 : timeOrderRel ψ φ) (b : 𝓕.WickAlgebra) : 𝓣(timeContract φ ψ * b) = timeContract φ ψ * 𝓣(b) := by - trans 𝓣(1 * timeContract φ ψ * b) - simp only [one_mul] - rw [timeOrder_timeContract_eq_time_mid h1 h2] - simp + simpa using timeOrder_timeContract_eq_time_mid h1 h2 (1 : 𝓕.WickAlgebra) b lemma timeOrder_timeContract_ne_time {φ ψ : 𝓕.FieldOp} (h1 : ¬ (timeOrderRel φ ψ ∧ timeOrderRel ψ φ)) : @@ -197,9 +190,7 @@ lemma timeOrder_timeContract_ne_time {φ ψ : 𝓕.FieldOp} This prevents Feynman diagrams where incoming vertices are connected to incoming vertices. -/ lemma timeContract_inAsymp_inAsymp (φ ψ : ((f : Field 𝓕) × AsymptoticLabel 𝓕 f) × Momentum) : - timeContract (.inAsymp φ) (.inAsymp ψ) = 0 := by - rw [timeContract_eq_superCommute] - simp + timeContract (.inAsymp φ) (.inAsymp ψ) = 0 := by simp [timeContract_eq_superCommute] /-- The time contraction of an outgoing asymptotic field with another outgoing asymptotic field is zero. @@ -208,8 +199,7 @@ lemma timeContract_inAsymp_inAsymp (φ ψ : ((f : Field 𝓕) × AsymptoticLabel connected to outgoing vertices. -/ lemma timeContract_outAsymp_outAsymp (φ ψ : ((f : Field 𝓕) × AsymptoticLabel 𝓕 f) × Momentum) : timeContract (.outAsymp φ) (.outAsymp ψ) = 0 := by - rw [timeContract_eq_superCommute, ← anPart_outAsymp_eq_ofFieldOp, ← anPart_outAsymp_eq_ofFieldOp] - simp [- anPart_outAsymp] + simp [timeContract_eq_superCommute, ← anPart_outAsymp_eq_ofFieldOp, - anPart_outAsymp] end WickAlgebra diff --git a/Physlib/QFT/PerturbationTheory/WickAlgebra/TimeOrder.lean b/Physlib/QFT/PerturbationTheory/WickAlgebra/TimeOrder.lean index 06137c996..6dbd24ff9 100644 --- a/Physlib/QFT/PerturbationTheory/WickAlgebra/TimeOrder.lean +++ b/Physlib/QFT/PerturbationTheory/WickAlgebra/TimeOrder.lean @@ -71,9 +71,8 @@ lemma ι_timeOrderF_superCommuteF_superCommuteF_eq_time_ofCrAnListF {φ1 φ2 φ3 simp only [decide_not, Bool.decide_and, ofCrAnListF_append, map_smul, map_mul, l1, l2, mul_assoc] congr 1 - have hp : List.Perm [φ1, φ3, φ2] [φ1, φ2, φ3] := by - refine List.Perm.cons φ1 ?_ - exact List.Perm.swap φ2 φ3 [] + have hp : List.Perm [φ1, φ3, φ2] [φ1, φ2, φ3] := + List.Perm.cons φ1 (List.Perm.swap φ2 φ3 []) rw [crAnTimeOrderSign, Wick.koszulSign_perm_eq _ _ φ1 _ _ _ _ _ hp, ← crAnTimeOrderSign] · simp · intro φ4 hφ4 @@ -82,10 +81,9 @@ lemma ι_timeOrderF_superCommuteF_superCommuteF_eq_time_ofCrAnListF {φ1 φ2 φ3 all_goals subst hφ4 simp_all - have hp231 : List.Perm [φ2, φ3, φ1] [φ1, φ2, φ3] := by - refine List.Perm.trans (l₂ := [φ2, φ1, φ3]) ?_ ?_ - refine List.Perm.cons φ2 (List.Perm.swap φ1 φ3 []) - exact List.Perm.swap φ1 φ2 [φ3] + have hp231 : List.Perm [φ2, φ3, φ1] [φ1, φ2, φ3] := + List.Perm.trans (List.Perm.cons φ2 (List.Perm.swap φ1 φ3 [])) + (List.Perm.swap φ1 φ2 [φ3]) have h231 : ι 𝓣ᶠ(ofCrAnListF (φs1 ++ φ2 :: φ3 :: φ1 :: φs2)) = crAnTimeOrderSign (φs1 ++ φ1 :: φ2 :: φ3 :: φs2) • (ι (ofCrAnListF l1) * ι (ofCrAnListF [φ2, φ3, φ1]) * ι (ofCrAnListF l2)) := by @@ -114,9 +112,8 @@ lemma ι_timeOrderF_superCommuteF_superCommuteF_eq_time_ofCrAnListF {φ1 φ2 φ3 simp only [decide_not, Bool.decide_and, ofCrAnListF_append, map_smul, map_mul, l1, l2, mul_assoc] congr 1 - have hp : List.Perm [φ3, φ2, φ1] [φ1, φ2, φ3] := by - refine List.Perm.trans ?_ hp231 - exact List.Perm.swap φ2 φ3 [φ1] + have hp : List.Perm [φ3, φ2, φ1] [φ1, φ2, φ3] := + List.Perm.trans (List.Perm.swap φ2 φ3 [φ1]) hp231 rw [crAnTimeOrderSign, Wick.koszulSign_perm_eq _ _ φ1 _ _ _ _ _ hp, ← crAnTimeOrderSign] · simp · intro φ4 hφ4 @@ -130,8 +127,7 @@ lemma ι_timeOrderF_superCommuteF_superCommuteF_eq_time_ofCrAnListF {φ1 φ2 φ3 ι [ofCrAnOpF φ1, [ofCrAnOpF φ2, ofCrAnOpF φ3]ₛF]ₛF * ι (ofCrAnListF l2)); swap · simp - rw [mul_assoc] - rw [← ofCrAnListF_singleton, ← ofCrAnListF_singleton, ← ofCrAnListF_singleton] + rw [mul_assoc, ← ofCrAnListF_singleton, ← ofCrAnListF_singleton, ← ofCrAnListF_singleton] rw [superCommuteF_ofCrAnListF_ofCrAnListF] simp only [List.singleton_append, ofList_singleton, map_sub, map_smul] rw [superCommuteF_ofCrAnListF_ofCrAnListF, superCommuteF_ofCrAnListF_ofCrAnListF] @@ -275,8 +271,7 @@ lemma ι_timeOrderF_superCommuteF_eq_time {φ ψ : 𝓕.CrAnFieldOp} ι (ofCrAnListF (List.filter (fun c => (crAnTimeOrderRel φ c ∧ crAnTimeOrderRel c φ)) φs)) * ι (ofCrAnListF (List.filter (fun c => (crAnTimeOrderRel φ c ∧ ¬crAnTimeOrderRel c φ)) - (List.insertionSort crAnTimeOrderRel (φs' ++ φs))))) := by - simp [mul_sub, sub_mul] + (List.insertionSort crAnTimeOrderRel (φs' ++ φs))))) := by simp [mul_sub, sub_mul] _ = crAnTimeOrderSign (φs' ++ [φ, ψ] ++ φs) • (ι (ofCrAnListF (List.takeWhile (fun c => ¬crAnTimeOrderRel φ c) (List.insertionSort crAnTimeOrderRel (φs' ++ φs)))) * @@ -304,14 +299,12 @@ lemma ι_timeOrderF_superCommuteF_eq_time {φ ψ : 𝓕.CrAnFieldOp} rw [← ofCrAnListF_append, ← ofCrAnListF_append, ← ofCrAnListF_append] have h1 := insertionSort_of_takeWhile_filter 𝓕.crAnTimeOrderRel φ φs' φs simp [decide_not, Bool.decide_and, List.append_assoc, List.cons_append] at h1 ⊢ - rw [← h1] - rw [← crAnTimeOrderList] + rw [← h1, ← crAnTimeOrderList] by_cases hq : (𝓕 |>ₛ φ) ≠ (𝓕 |>ₛ ψ) · rw [ι_superCommuteF_of_diff_statistic hq] simp · rw [crAnTimeOrderSign, Wick.koszulSign_eq_rel_eq_stat _ _, ← crAnTimeOrderSign] - rw [← ofCrAnListF_append] - rw [timeOrderF_ofCrAnListF] + rw [← ofCrAnListF_append, timeOrderF_ofCrAnListF] simp only [map_smul, Algebra.mul_smul_comm] exact hφψ exact hψφ @@ -430,8 +423,7 @@ noncomputable def timeOrder : WickAlgebra 𝓕 →ₗ[ℂ] WickAlgebra 𝓕 wher obtain ⟨x, hx⟩ := ι_surjective x obtain ⟨y, hy⟩ := ι_surjective y subst hx hy - rw [← map_add, ι_apply, ι_apply, ι_apply] - rw [Quotient.lift_mk, Quotient.lift_mk, Quotient.lift_mk] + rw [← map_add, ι_apply, ι_apply, ι_apply, Quotient.lift_mk, Quotient.lift_mk, Quotient.lift_mk] simp map_smul' c y := by obtain ⟨y, hy⟩ := ι_surjective y @@ -467,7 +459,6 @@ lemma timeOrder_ofFieldOp_ofFieldOp_not_ordered_eq_timeOrder {φ ψ : 𝓕.Field 𝓣(ofFieldOp φ * ofFieldOp ψ) = 𝓢(𝓕 |>ₛ φ, 𝓕 |>ₛ ψ) • 𝓣(ofFieldOp ψ * ofFieldOp φ) := by rw [ofFieldOp, ofFieldOp, ← map_mul, timeOrder_eq_ι_timeOrderF, timeOrderF_ofFieldOpF_ofFieldOpF_not_ordered_eq_timeOrderF h] - simp only [map_smul] rfl lemma timeOrder_ofFieldOpList_nil : 𝓣(ofFieldOpList (𝓕 := 𝓕) []) = 1 := by @@ -497,12 +488,10 @@ lemma timeOrder_superCommute_eq_time_mid {φ ψ : 𝓕.CrAnFieldOp} (hφψ : crAnTimeOrderRel φ ψ) (hψφ : crAnTimeOrderRel ψ φ) (a b : 𝓕.WickAlgebra) : 𝓣(a * [ofCrAnOp φ, ofCrAnOp ψ]ₛ * b) = [ofCrAnOp φ, ofCrAnOp ψ]ₛ * 𝓣(a * b) := by - rw [ofCrAnOp, ofCrAnOp] - rw [superCommute_eq_ι_superCommuteF] + rw [ofCrAnOp, ofCrAnOp, superCommute_eq_ι_superCommuteF] obtain ⟨a, rfl⟩ := ι_surjective a obtain ⟨b, rfl⟩ := ι_surjective b - rw [← map_mul, ← map_mul, timeOrder_eq_ι_timeOrderF] - rw [ι_timeOrderF_superCommuteF_eq_time] + rw [← map_mul, ← map_mul, timeOrder_eq_ι_timeOrderF, ι_timeOrderF_superCommuteF_eq_time] rfl · simp_all · simp_all @@ -519,9 +508,7 @@ lemma timeOrder_superCommute_eq_time_left {φ ψ : 𝓕.CrAnFieldOp} lemma timeOrder_superCommute_ne_time {φ ψ : 𝓕.CrAnFieldOp} (hφψ : ¬ (crAnTimeOrderRel φ ψ ∧ crAnTimeOrderRel ψ φ)) : 𝓣([ofCrAnOp φ, ofCrAnOp ψ]ₛ) = 0 := by - rw [ofCrAnOp, ofCrAnOp] - rw [superCommute_eq_ι_superCommuteF] - rw [timeOrder_eq_ι_timeOrderF] + rw [ofCrAnOp, ofCrAnOp, superCommute_eq_ι_superCommuteF, timeOrder_eq_ι_timeOrderF] trans ι (timeOrderF (1 * (superCommuteF (ofCrAnOpF φ)) (ofCrAnOpF ψ) * 1)) simp only [one_mul, mul_one] rw [ι_timeOrderF_superCommuteF_ne_time] @@ -557,26 +544,14 @@ lemma timeOrder_timeOrder_mid (a b c : 𝓕.WickAlgebra) : ← map_mul, ← map_mul, timeOrder_eq_ι_timeOrderF, timeOrderF_timeOrderF_mid] lemma timeOrder_timeOrder_left (b c : 𝓕.WickAlgebra) : - 𝓣(b * c) = 𝓣(𝓣(b) * c) := by - trans 𝓣(1 * b * c) - simp only [one_mul] - rw [timeOrder_timeOrder_mid] - simp + 𝓣(b * c) = 𝓣(𝓣(b) * c) := by simpa using timeOrder_timeOrder_mid (1 : 𝓕.WickAlgebra) b c lemma timeOrder_timeOrder_right (a b : 𝓕.WickAlgebra) : - 𝓣(a * b) = 𝓣(a * 𝓣(b)) := by - trans 𝓣(a * b * 1) - simp only [mul_one] - rw [timeOrder_timeOrder_mid] - simp + 𝓣(a * b) = 𝓣(a * 𝓣(b)) := by simpa using timeOrder_timeOrder_mid a b (1 : 𝓕.WickAlgebra) /-- Time ordering is a projection. -/ lemma timeOrder_timeOrder (a : 𝓕.WickAlgebra) : - 𝓣(𝓣(a)) = 𝓣(a) := by - trans 𝓣(𝓣(a) * 1) - · simp - · rw [← timeOrder_timeOrder_left] - simp + 𝓣(𝓣(a)) = 𝓣(a) := by simpa using (timeOrder_timeOrder_left a (1 : 𝓕.WickAlgebra)).symm end WickAlgebra end FieldSpecification diff --git a/Physlib/QFT/PerturbationTheory/WickAlgebra/Universality.lean b/Physlib/QFT/PerturbationTheory/WickAlgebra/Universality.lean index 85ef247f5..cc5bf44eb 100644 --- a/Physlib/QFT/PerturbationTheory/WickAlgebra/Universality.lean +++ b/Physlib/QFT/PerturbationTheory/WickAlgebra/Universality.lean @@ -68,8 +68,7 @@ def universalLift {A : Type} [Semiring A] [Algebra ℂ A] (f : 𝓕.CrAnFieldOp commutes' r := by rw [Algebra.algebraMap_eq_smul_one r] rw [show r • 1 = ι (𝓕 := 𝓕) (r • 1) from rfl, universalLiftMap_ι] - simp only [map_smul, map_one] - exact Eq.symm (Algebra.algebraMap_eq_smul_one r) + simpa only [map_smul, map_one] using Eq.symm (Algebra.algebraMap_eq_smul_one r) @[simp] lemma universalLift_ι {A : Type} [Semiring A] [Algebra ℂ A] (f : 𝓕.CrAnFieldOp → A) diff --git a/Physlib/QFT/PerturbationTheory/WickAlgebra/WickTerm.lean b/Physlib/QFT/PerturbationTheory/WickAlgebra/WickTerm.lean index 947fd32ec..f90ee7c7b 100644 --- a/Physlib/QFT/PerturbationTheory/WickAlgebra/WickTerm.lean +++ b/Physlib/QFT/PerturbationTheory/WickAlgebra/WickTerm.lean @@ -40,9 +40,7 @@ def wickTerm {φs : List 𝓕.FieldOp} (φsΛ : WickContraction φs.length) : corresponding to the empty set `∅` (the only Wick contraction of `[]`) is `1`. -/ @[simp] lemma wickTerm_empty_nil : - wickTerm (empty (n := ([] : List 𝓕.FieldOp).length)) = 1 := by - rw [wickTerm] - simp [sign_empty] + wickTerm (empty (n := ([] : List 𝓕.FieldOp).length)) = 1 := by simp [wickTerm, sign_empty] /-- For a list `φs = φ₀…φₙ` of `𝓕.FieldOp`, a Wick contraction `φsΛ` of `φs`, an element `φ` of @@ -84,8 +82,7 @@ lemma wickTerm_insert_none (φ : 𝓕.FieldOp) (φs : List 𝓕.FieldOp) · intro ha simp only [uncontracted, Finset.mem_filter, Finset.mem_univ, true_and, ha, and_true, forall_const] - have hx : φsΛ.getDual? a = none ↔ ¬ (φsΛ.getDual? a).isSome := by - simp + have hx : φsΛ.getDual? a = none ↔ ¬ (φsΛ.getDual? a).isSome := by simp rw [hx] simp only [Bool.not_eq_true, Bool.eq_false_or_eq_true_self, true_and] intro h1 h2 diff --git a/Physlib/QFT/PerturbationTheory/WickContraction/Basic.lean b/Physlib/QFT/PerturbationTheory/WickContraction/Basic.lean index e9ae5dd39..c20a58d9c 100644 --- a/Physlib/QFT/PerturbationTheory/WickContraction/Basic.lean +++ b/Physlib/QFT/PerturbationTheory/WickContraction/Basic.lean @@ -129,8 +129,7 @@ lemma congrLift_surjective {n m : ℕ} {c : WickContraction n} (h : n = m) : simp [Function.surjective_id] lemma congrLift_bijective {n m : ℕ} {c : WickContraction n} (h : n = m) : - Function.Bijective (c.congrLift h) := by - exact ⟨c.congrLift_injective h, c.congrLift_surjective h⟩ + Function.Bijective (c.congrLift h) := ⟨c.congrLift_injective h, c.congrLift_surjective h⟩ /-- Given a contracted pair in `c : WickContraction n` the contracted pair in `congr h c`. -/ @@ -203,8 +202,7 @@ lemma getDual?_get_self_mem (i : Fin n) (h : (c.getDual? i).isSome) : @[simp] lemma self_getDual?_get_mem (i : Fin n) (h : (c.getDual? i).isSome) : - {i, (c.getDual? i).get h} ∈ c.1 := by - rw [← getDual?_eq_some_iff_mem, Option.some_get] + {i, (c.getDual? i).get h} ∈ c.1 := by rw [← getDual?_eq_some_iff_mem, Option.some_get] lemma getDual?_eq_some_neq (i j : Fin n) (h : c.getDual? i = some j) : ¬ i = j := by @@ -257,21 +255,17 @@ lemma getDual?_isSome_iff (i : Fin n) : (c.getDual? i).isSome ↔ ∃ (a : c.1), simpa using hy ▸ a.2 lemma getDual?_isSome_of_mem (a : c.1) (i : a.1) : (c.getDual? i).isSome := by - rw [getDual?_isSome_iff] - exact ⟨⟨a.1, a.2⟩, Finset.coe_mem ..⟩ + exact (getDual?_isSome_iff (c := c) i).2 ⟨a, Finset.coe_mem i⟩ @[simp] lemma getDual?_getDual?_get_get (i : Fin n) (h : (c.getDual? i).isSome) : - c.getDual? ((c.getDual? i).get h) = some i := by - simp [getDual?_eq_some_iff_mem] + c.getDual? ((c.getDual? i).get h) = some i := by simp [getDual?_eq_some_iff_mem] lemma getDual?_getDual?_get_isSome (i : Fin n) (h : (c.getDual? i).isSome) : - (c.getDual? ((c.getDual? i).get h)).isSome := by - simp + (c.getDual? ((c.getDual? i).get h)).isSome := by simp lemma getDual?_getDual?_get_not_none (i : Fin n) (h : (c.getDual? i).isSome) : - ¬ (c.getDual? ((c.getDual? i).get h)) = none := by - simp + ¬ (c.getDual? ((c.getDual? i).get h)) = none := by simp /-! @@ -368,13 +362,11 @@ lemma fstFieldOfContract_lt_sndFieldOfContract (c : WickContraction n) (a : c.1) @[simp] lemma fstFieldOfContract_mem (c : WickContraction n) (a : c.1) : - c.fstFieldOfContract a ∈ a.1 := by - simp [finset_eq_fstFieldOfContract_sndFieldOfContract] + c.fstFieldOfContract a ∈ a.1 := by simp [finset_eq_fstFieldOfContract_sndFieldOfContract] lemma fstFieldOfContract_getDual?_isSome (c : WickContraction n) (a : c.1) : (c.getDual? (c.fstFieldOfContract a)).isSome := by - rw [getDual?_isSome_iff] - exact ⟨a, fstFieldOfContract_mem ..⟩ + exact (getDual?_isSome_iff (c := c) _).2 ⟨a, fstFieldOfContract_mem ..⟩ @[simp] lemma fstFieldOfContract_getDual? (c : WickContraction n) (a : c.1) : @@ -383,13 +375,11 @@ lemma fstFieldOfContract_getDual? (c : WickContraction n) (a : c.1) : @[simp] lemma sndFieldOfContract_mem (c : WickContraction n) (a : c.1) : - c.sndFieldOfContract a ∈ a.1 := by - simp [finset_eq_fstFieldOfContract_sndFieldOfContract] + c.sndFieldOfContract a ∈ a.1 := by simp [finset_eq_fstFieldOfContract_sndFieldOfContract] lemma sndFieldOfContract_getDual?_isSome (c : WickContraction n) (a : c.1) : (c.getDual? (c.sndFieldOfContract a)).isSome := by - rw [getDual?_isSome_iff] - exact ⟨a, sndFieldOfContract_mem ..⟩ + exact (getDual?_isSome_iff (c := c) _).2 ⟨a, sndFieldOfContract_mem ..⟩ @[simp] lemma sndFieldOfContract_getDual? (c : WickContraction n) (a : c.1) : @@ -520,9 +510,6 @@ def sigmaContractedEquiv : (a : c.1) × a ≃ {x : Fin n // (c.getDual? x).isSom not_false_eq_true] exact Subtype.ext (id (Eq.symm hc)) · simp - right_inv := by - intro x - cases x - rfl + right_inv := fun ⟨_, _⟩ => rfl end WickContraction diff --git a/Physlib/QFT/PerturbationTheory/WickContraction/Card.lean b/Physlib/QFT/PerturbationTheory/WickContraction/Card.lean index 16adb3620..fc5fffdcb 100644 --- a/Physlib/QFT/PerturbationTheory/WickContraction/Card.lean +++ b/Physlib/QFT/PerturbationTheory/WickContraction/Card.lean @@ -53,8 +53,7 @@ lemma wickContraction_zero_some_eq_sum : ext · simp [c.2.2.2] · rfl} - rw [Fintype.card_congr e1] - simp + simpa using Fintype.card_congr e1 lemma finset_succAbove_succ_disjoint (a : Finset (Fin n)) (i : Fin n.succ) : Disjoint ((Finset.map (Fin.succEmb (n + 1))) ((Finset.map i.succAboveEmb) a)) {0, i.succ} := by @@ -78,8 +77,7 @@ def consAddContract (i : Fin n.succ) (c : WickContraction n) : rcases h with h | h · obtain ⟨a, ha, rfl⟩ := h rw [Finset.mapEmbedding_apply, Finset.mapEmbedding_apply] - simp only [Finset.card_map] - exact c.2.1 a ha + simpa only [Finset.card_map] using c.2.1 a ha · subst h rw [@Finset.card_eq_two] use 0, i.succ @@ -111,14 +109,12 @@ def consAddContract (i : Fin n.succ) (c : WickContraction n) : @[simp] lemma consAddContract_getDual?_zero (i : Fin n.succ) (c : WickContraction n) : (consAddContract i c).getDual? 0 = some i.succ := by - rw [getDual?_eq_some_iff_mem] - simp [consAddContract] + simp [getDual?_eq_some_iff_mem, consAddContract] @[simp] lemma consAddContract_getDual?_self_succ (i : Fin n.succ) (c : WickContraction n) : (consAddContract i c).getDual? i.succ = some 0 := by - rw [getDual?_eq_some_iff_mem] - simp [consAddContract, Finset.pair_comm] + simp [getDual?_eq_some_iff_mem, consAddContract, Finset.pair_comm] lemma mem_consAddContract_of_mem_iff (i : Fin n.succ) (c : WickContraction n) (a : Finset (Fin n)) : a ∈ c.1 ↔ (a.map i.succAboveEmb).map (Fin.succEmb n.succ) ∈ (consAddContract i c).1 := by diff --git a/Physlib/QFT/PerturbationTheory/WickContraction/Erase.lean b/Physlib/QFT/PerturbationTheory/WickContraction/Erase.lean index 97c576804..d61221e16 100644 --- a/Physlib/QFT/PerturbationTheory/WickContraction/Erase.lean +++ b/Physlib/QFT/PerturbationTheory/WickContraction/Erase.lean @@ -63,8 +63,7 @@ lemma mem_erase_uncontracted_iff (c : WickContraction n.succ) (i : Fin n.succ) ( simp only [Nat.succ_eq_add_one, Finset.disjoint_insert_right, Finset.mem_insert, Finset.mem_singleton, true_or, not_true_eq_false, Finset.disjoint_singleton_right, not_or, false_and, or_false] at hc - have hi : i ∈ ({i.succAbove j, i.succAbove k} : Finset (Fin n.succ)) := by - simp [← hc] + have hi : i ∈ ({i.succAbove j, i.succAbove k} : Finset (Fin n.succ)) := by simp [← hc] simp only [Nat.succ_eq_add_one, Finset.mem_insert, Finset.mem_singleton] at hi rcases hi with hi | hi · exact False.elim (Fin.succAbove_ne _ _ hi.symm) diff --git a/Physlib/QFT/PerturbationTheory/WickContraction/ExtractEquiv.lean b/Physlib/QFT/PerturbationTheory/WickContraction/ExtractEquiv.lean index 7b8c3db81..d01363ef5 100644 --- a/Physlib/QFT/PerturbationTheory/WickContraction/ExtractEquiv.lean +++ b/Physlib/QFT/PerturbationTheory/WickContraction/ExtractEquiv.lean @@ -47,8 +47,7 @@ def extractEquiv (i : Fin n.succ) : WickContraction n.succ ≃ (c : WickContraction n) × Option c.uncontracted where toFun := fun c => ⟨erase c i, getDualErase c i⟩ invFun := fun ⟨c, j⟩ => insertAndContractNat c i j - left_inv f := by - simp + left_inv f := by simp right_inv f := by refine extractEquiv_equiv ?_ ?_ simp only [insertAndContractNat_erase] @@ -108,9 +107,7 @@ lemma sum_extractEquiv_congr [AddCommMonoid M] {n m : ℕ} (i : Fin n) (f : Wick ∑ c, f c = ∑ (c : WickContraction m), ∑ (k : Option c.uncontracted), f (congr h.symm ((extractEquiv (finCongr h i)).symm ⟨c, k⟩)) := by subst h - simp only [finCongr_refl, Equiv.refl_apply, congr_refl] - rw [← (extractEquiv i).symm.sum_comp] - rw [Finset.sum_sigma'] + rw [← (extractEquiv i).symm.sum_comp, Finset.sum_sigma'] rfl /-- For `n = 3` there are `4` possible Wick contractions: diff --git a/Physlib/QFT/PerturbationTheory/WickContraction/InsertAndContract.lean b/Physlib/QFT/PerturbationTheory/WickContraction/InsertAndContract.lean index 3a2ade00b..c724b3cb0 100644 --- a/Physlib/QFT/PerturbationTheory/WickContraction/InsertAndContract.lean +++ b/Physlib/QFT/PerturbationTheory/WickContraction/InsertAndContract.lean @@ -140,17 +140,14 @@ lemma insertAndContract_some_getDual?_some_eq (φ : 𝓕.FieldOp) (φs : List ((φsΛ ↩Λ φ i (some j)).getDual? (Fin.cast (insertIdx_length_fin φ φs i).symm (i.succAbove j))) = some (Fin.cast (insertIdx_length_fin φ φs i).symm i) := by - rw [getDual?_eq_some_iff_mem] - rw [@Finset.pair_comm] - rw [← getDual?_eq_some_iff_mem] + rw [getDual?_eq_some_iff_mem, @Finset.pair_comm, ← getDual?_eq_some_iff_mem] simp @[simp] lemma insertAndContract_none_succAbove_getDual?_eq_none_iff (φ : 𝓕.FieldOp) (φs : List 𝓕.FieldOp) (φsΛ : WickContraction φs.length) (i : Fin φs.length.succ) (j : Fin φs.length) : (φsΛ ↩Λ φ i none).getDual? (Fin.cast (insertIdx_length_fin φ φs i).symm - (i.succAbove j)) = none ↔ φsΛ.getDual? j = none := by - simp [insertAndContract, getDual?_congr] + (i.succAbove j)) = none ↔ φsΛ.getDual? j = none := by simp [insertAndContract, getDual?_congr] @[simp] lemma insertAndContract_some_succAbove_getDual?_eq_option (φ : 𝓕.FieldOp) (φs : List 𝓕.FieldOp) @@ -352,14 +349,12 @@ lemma stat_ofFinset_of_insertAndContractLiftFinset (φ : 𝓕.FieldOp) (φs : Li fin_list_sorted_monotone_sorted (a.sort (fun x1 x2 => x1 ≤ x2)) ?hl (⇑(finCongr (Eq.symm (insertIdx_length_fin φ φs i))) ∘ i.succAbove) ?hf exact a.pairwise_sort (fun x1 x2 => x1 ≤ x2) - refine StrictMono.comp (fun ⦃a b⦄ a => a) ?hf.hf - exact Fin.strictMono_succAbove i + exact StrictMono.comp (fun ⦃a b⦄ a => a) (Fin.strictMono_succAbove i) have h2 : (List.map (⇑(finCongr (insertIdx_length_fin φ φs i).symm)) (List.map i.succAbove (a.sort (fun x1 x2 => x1 ≤ x2)))).Nodup := by simp only [Nat.succ_eq_add_one, List.map_map] refine List.Nodup.map ?_ ?_ - apply (Equiv.comp_injective _ (finCongr _)).mpr - exact Fin.succAbove_right_injective + exact (Equiv.comp_injective _ (finCongr _)).mpr Fin.succAbove_right_injective exact a.sort_nodup (fun x1 x2 => x1 ≤ x2) have h3 : (List.map (⇑(finCongr (insertIdx_length_fin φ φs i).symm)) (List.map i.succAbove (a.sort (fun x1 x2 => x1 ≤ x2)))).toFinset @@ -374,8 +369,7 @@ lemma stat_ofFinset_of_insertAndContractLiftFinset (φ : 𝓕.FieldOp) (φs : Li intro x hx refine Fin.ne_of_val_ne ?h.inl.h simp only [Fin.val_cast, ne_eq] - rw [Fin.val_eq_val] - exact Fin.succAbove_ne i x + exact fun h => Fin.succAbove_ne i x (Fin.ext h) · obtain ⟨k, hk⟩ := hk subst hk simp only [Nat.succ_eq_add_one] diff --git a/Physlib/QFT/PerturbationTheory/WickContraction/InsertAndContractNat.lean b/Physlib/QFT/PerturbationTheory/WickContraction/InsertAndContractNat.lean index bc4cf4f25..e6a45f574 100644 --- a/Physlib/QFT/PerturbationTheory/WickContraction/InsertAndContractNat.lean +++ b/Physlib/QFT/PerturbationTheory/WickContraction/InsertAndContractNat.lean @@ -44,8 +44,7 @@ def insertAndContractNat (c : WickContraction n) (i : Fin n.succ) (j : Option (c forall_exists_index, and_imp, forall_apply_eq_imp_iff₂, f] intro a ha rw [Finset.mapEmbedding_apply] - simp only [Finset.card_map] - exact c.2.1 a ha + simpa only [Finset.card_map] using c.2.1 a ha | some j => simp only [Finset.mem_insert, forall_eq_or_imp] apply And.intro @@ -77,8 +76,7 @@ def insertAndContractNat (c : WickContraction n) (i : Fin n.succ) (j : Option (c simp_all only [Finset.mem_insert, Nat.succ_eq_add_one] match ha, hb with | Or.inl ha, Or.inl hb => - rw [ha, hb] - simp + simp [ha, hb] | Or.inl ha, Or.inr hb => apply Or.inr subst ha @@ -161,8 +159,7 @@ lemma self_mem_uncontracted_of_insertAndContractNat_none (c : WickContraction n) lemma self_not_mem_uncontracted_of_insertAndContractNat_some (c : WickContraction n) (i : Fin n.succ) (j : c.uncontracted) : i ∉ (insertAndContractNat c i (some j)).uncontracted := by - rw [mem_uncontracted_iff_not_contracted] - simp [insertAndContractNat] + simp [mem_uncontracted_iff_not_contracted, insertAndContractNat] lemma insertAndContractNat_succAbove_mem_uncontracted_iff (c : WickContraction n) (i : Fin n.succ) (j : Fin n) : @@ -343,18 +340,15 @@ lemma insertAndContractNat_some_uncontracted (c : WickContraction n) (i : Fin n. set_option backward.isDefEq.respectTransparency false in lemma insertAndContractNat_none_getDual?_isNone (c : WickContraction n) (i : Fin n.succ) : ((insertAndContractNat c i none).getDual? i).isNone := by - have hi : i ∈ (insertAndContractNat c i none).uncontracted := by - simp + have hi : i ∈ (insertAndContractNat c i none).uncontracted := by simp simp only [Nat.succ_eq_add_one, uncontracted, Finset.mem_filter, Finset.mem_univ, true_and] at hi - rw [hi] - simp + simp [hi] set_option backward.isDefEq.respectTransparency false in @[simp] lemma insertAndContractNat_none_getDual?_eq_none (c : WickContraction n) (i : Fin n.succ) : (insertAndContractNat c i none).getDual? i = none := by - have hi : i ∈ (insertAndContractNat c i none).uncontracted := by - simp + have hi : i ∈ (insertAndContractNat c i none).uncontracted := by simp simp only [Nat.succ_eq_add_one, uncontracted, Finset.mem_filter, Finset.mem_univ, true_and] at hi rw [hi] @@ -392,8 +386,7 @@ lemma insertAndContractNat_succAbove_getDual?_get (c : WickContraction n) (i : F lemma insertAndContractNat_some_getDual?_eq (c : WickContraction n) (i : Fin n.succ) (j : c.uncontracted) : (insertAndContractNat c i (some j)).getDual? i = some (i.succAbove j) := by - rw [getDual?_eq_some_iff_mem] - simp [insertAndContractNat] + simp [getDual?_eq_some_iff_mem, insertAndContractNat] lemma insertAndContractNat_some_getDual?_ne_none (c : WickContraction n) (i : Fin n.succ) (j : c.uncontracted) (k : Fin n) (hkj : k ≠ j.1) : @@ -503,8 +496,7 @@ lemma insertAndContractNat_erase (c : WickContraction n) (i : Fin n.succ) intro x exact fun a => Fin.succAbove_ne i x refine False.elim (hin ?_) - rw [ha] - simp + simp [ha] · obtain ⟨a', ha', ha''⟩ := ha rw [Finset.mapEmbedding_apply] at ha'' simp only [Finset.map_inj] at ha'' @@ -667,8 +659,7 @@ lemma insertAndContractNat_fstFieldOfContract (c : WickContraction n) (i : Fin n · simp only [Nat.succ_eq_add_one, insertLift, Finset.mem_map, Fin.succAboveEmb_apply] use (c.sndFieldOfContract a) simp - · refine Fin.succAbove_lt_succAbove_iff.mpr ?_ - exact fstFieldOfContract_lt_sndFieldOfContract c a + · exact Fin.succAbove_lt_succAbove_iff.mpr (fstFieldOfContract_lt_sndFieldOfContract c a) @[simp] lemma insertAndContractNat_sndFieldOfContract (c : WickContraction n) (i : Fin n.succ) @@ -683,8 +674,7 @@ lemma insertAndContractNat_sndFieldOfContract (c : WickContraction n) (i : Fin n · simp only [Nat.succ_eq_add_one, insertLift, Finset.mem_map, Fin.succAboveEmb_apply] use (c.sndFieldOfContract a) simp - · refine Fin.succAbove_lt_succAbove_iff.mpr ?_ - exact fstFieldOfContract_lt_sndFieldOfContract c a + · exact Fin.succAbove_lt_succAbove_iff.mpr (fstFieldOfContract_lt_sndFieldOfContract c a) /-- Given a contracted pair for a Wick contraction `WickContraction n`, the corresponding contracted pair of a wick contraction `(c.insert i (some j))` formed @@ -707,8 +697,7 @@ lemma insertLiftSome_injective {c : WickContraction n} (i : Fin n.succ) (j : c.u simp only [Finset.map_insert, Fin.succAboveEmb_apply, Finset.map_singleton] at hab have hi : i ∈ ({i.succAbove (c.fstFieldOfContract a), i.succAbove (c.sndFieldOfContract a)} : Finset (Fin (n + 1))) := by - rw [← hab] - simp + simp [← hab] simp only [Nat.succ_eq_add_one, Finset.mem_insert, Finset.mem_singleton] at hi rcases hi with hi | hi · exact False.elim (Fin.ne_succAbove _ _ hi) @@ -719,8 +708,7 @@ lemma insertLiftSome_injective {c : WickContraction n} (i : Fin n.succ) (j : c.u simp only [Finset.map_insert, Fin.succAboveEmb_apply, Finset.map_singleton] at hab have hi : i ∈ ({i.succAbove (c.fstFieldOfContract a), i.succAbove (c.sndFieldOfContract a)} : Finset (Fin (n + 1))) := by - rw [hab] - simp + simp [hab] simp only [Nat.succ_eq_add_one, Finset.mem_insert, Finset.mem_singleton] at hi rcases hi with hi | hi · exact False.elim (Fin.ne_succAbove _ _ hi) @@ -773,8 +761,7 @@ lemma insertAndContractNat_surjective_on_nodual (i : Fin n.succ) obtain ⟨a', ha', rfl⟩ := h exact ha' · intro h - have hi : i ∈ c.uncontracted := by - simpa [uncontracted] using hc + have hi : i ∈ c.uncontracted := by simpa [uncontracted] using hc rw [mem_uncontracted_iff_not_contracted] at hi obtain ⟨j, hj⟩ := (@Fin.exists_succAbove_eq_iff _ i (c.fstFieldOfContract ⟨a, h⟩)).mpr (by diff --git a/Physlib/QFT/PerturbationTheory/WickContraction/IsFull.lean b/Physlib/QFT/PerturbationTheory/WickContraction/IsFull.lean index 0e76f2f02..f5b061883 100644 --- a/Physlib/QFT/PerturbationTheory/WickContraction/IsFull.lean +++ b/Physlib/QFT/PerturbationTheory/WickContraction/IsFull.lean @@ -42,10 +42,8 @@ lemma isFull_iff_equivInvolution_no_fixed_point : /-- The equivalence between full contractions and fixed-point free involutions. -/ def isFullInvolutionEquiv : {c : WickContraction n // IsFull c} ≃ {f : Fin n → Fin n // Function.Involutive f ∧ (∀ i, f i ≠ i)} where - toFun c := ⟨equivInvolution c.1, by - apply And.intro (equivInvolution c.1).2 - rw [← isFull_iff_equivInvolution_no_fixed_point] - exact c.2⟩ + toFun c := ⟨equivInvolution c.1, + ⟨(equivInvolution c.1).2, (isFull_iff_equivInvolution_no_fixed_point (c := c.1)).mp c.2⟩⟩ invFun f := ⟨equivInvolution.symm ⟨f.1, f.2.1⟩, by rw [isFull_iff_equivInvolution_no_fixed_point] simpa using f.2.2⟩ diff --git a/Physlib/QFT/PerturbationTheory/WickContraction/Join.lean b/Physlib/QFT/PerturbationTheory/WickContraction/Join.lean index 5540142ca..0d8942184 100644 --- a/Physlib/QFT/PerturbationTheory/WickContraction/Join.lean +++ b/Physlib/QFT/PerturbationTheory/WickContraction/Join.lean @@ -41,8 +41,7 @@ def join {φs : List 𝓕.FieldOp} (φsΛ : WickContraction φs.length) · exact φsΛ.2.1 a ha · obtain ⟨a, ha, rfl⟩ := ha rw [Finset.mapEmbedding_apply] - simp only [Finset.card_map] - exact φsucΛ.2.1 a ha, by + simpa only [Finset.card_map] using φsucΛ.2.1 a ha, by intro a ha b hb simp only [Finset.le_eq_subset, Finset.mem_union, Finset.mem_map, RelEmbedding.coe_toEmbedding] at ha hb @@ -52,13 +51,11 @@ def join {φs : List 𝓕.FieldOp} (φsΛ : WickContraction φs.length) right symm rw [Finset.mapEmbedding_apply] - apply uncontractedListEmd_finset_disjoint_left - exact ha + exact uncontractedListEmd_finset_disjoint_left b a ha · obtain ⟨a, ha, rfl⟩ := ha right rw [Finset.mapEmbedding_apply] - apply uncontractedListEmd_finset_disjoint_left - exact hb + exact uncontractedListEmd_finset_disjoint_left a b hb · obtain ⟨a, ha, rfl⟩ := ha obtain ⟨b, hb, rfl⟩ := hb simp only [EmbeddingLike.apply_eq_iff_eq] @@ -113,8 +110,7 @@ lemma jointLiftLeft_disjoint_joinLiftRight {φs : List 𝓕.FieldOp} {φsΛ : Wi Disjoint (@joinLiftLeft _ _ _ φsucΛ a).1 (joinLiftRight b).1 := by simp only [joinLiftLeft, joinLiftRight] symm - apply uncontractedListEmd_finset_disjoint_left - exact a.2 + exact uncontractedListEmd_finset_disjoint_left b.1 a.1 a.2 lemma jointLiftLeft_ne_joinLiftRight {φs : List 𝓕.FieldOp} {φsΛ : WickContraction φs.length} {φsucΛ : WickContraction [φsΛ]ᵘᶜ.length} (a : φsΛ.1) (b : φsucΛ.1) : @@ -166,8 +162,7 @@ lemma joinLift_surjective {φs : List 𝓕.FieldOp} {φsΛ : WickContraction φs · rw [Finset.mapEmbedding_apply] at ha3 use Sum.inr ⟨a2, ha3.1⟩ simp only [joinLift, joinLiftRight] - refine Subtype.ext ?_ - exact ha3.2 + exact Subtype.ext ha3.2 lemma joinLift_bijective {φs : List 𝓕.FieldOp} {φsΛ : WickContraction φs.length} {φsucΛ : WickContraction [φsΛ]ᵘᶜ.length} : Function.Bijective (@joinLift _ _ φsΛ φsucΛ) := by @@ -208,8 +203,7 @@ lemma join_fstFieldOfContract_joinLiftRight {φs : List 𝓕.FieldOp} (φsΛ : W apply eq_fstFieldOfContract_of_mem _ _ _ (uncontractedListEmd (φsucΛ.sndFieldOfContract a)) · simp [joinLiftRight] · simp [joinLiftRight] - · apply uncontractedListEmd_strictMono - exact fstFieldOfContract_lt_sndFieldOfContract φsucΛ a + · exact uncontractedListEmd_strictMono (fstFieldOfContract_lt_sndFieldOfContract φsucΛ a) @[simp] lemma join_sndFieldOfContract_joinLiftRight {φs : List 𝓕.FieldOp} (φsΛ : WickContraction φs.length) @@ -219,8 +213,7 @@ lemma join_sndFieldOfContract_joinLiftRight {φs : List 𝓕.FieldOp} (φsΛ : W apply eq_sndFieldOfContract_of_mem _ _ (uncontractedListEmd (φsucΛ.fstFieldOfContract a)) · simp [joinLiftRight] · simp [joinLiftRight] - · apply uncontractedListEmd_strictMono - exact fstFieldOfContract_lt_sndFieldOfContract φsucΛ a + · exact uncontractedListEmd_strictMono (fstFieldOfContract_lt_sndFieldOfContract φsucΛ a) @[simp] lemma join_fstFieldOfContract_joinLiftLeft {φs : List 𝓕.FieldOp} (φsΛ : WickContraction φs.length) @@ -347,8 +340,7 @@ lemma mem_join_uncontracted_of_mem_right_uncontracted {φs : List 𝓕.FieldOp} simp only [join, Finset.le_eq_subset, Finset.mem_union, Finset.mem_map, RelEmbedding.coe_toEmbedding] at hp rcases hp with hp | hp - · have hi : uncontractedListEmd i ∈ φsΛ.uncontracted := by - exact uncontractedListEmd_mem_uncontracted i + · have hi : uncontractedListEmd i ∈ φsΛ.uncontracted := uncontractedListEmd_mem_uncontracted i rw [mem_uncontracted_iff_not_contracted] at hi exact hi p hp · obtain ⟨p, hp, rfl⟩ := hp @@ -362,8 +354,7 @@ lemma exists_mem_left_uncontracted_of_mem_join_uncontracted {φs : List 𝓕.Fie (φsucΛ : WickContraction [φsΛ]ᵘᶜ.length) (i : Fin φs.length) (ha : i ∈ (join φsΛ φsucΛ).uncontracted) : i ∈ φsΛ.uncontracted := by - rw [@mem_uncontracted_iff_not_contracted] - rw [@mem_uncontracted_iff_not_contracted] at ha + rw [@mem_uncontracted_iff_not_contracted] at ha ⊢ simp only [join, Finset.le_eq_subset, Finset.mem_union, Finset.mem_map, RelEmbedding.coe_toEmbedding] at ha intro p hp @@ -378,8 +369,7 @@ lemma exists_mem_right_uncontracted_of_mem_join_uncontracted {φs : List 𝓕.Fi obtain ⟨j, rfl⟩ := uncontractedListEmd_surjective_mem_uncontracted i hi' use j simp only [true_and] - rw [mem_uncontracted_iff_not_contracted] at hi - rw [mem_uncontracted_iff_not_contracted] + rw [mem_uncontracted_iff_not_contracted] at hi ⊢ intro p hp have hip := hi (p.map uncontractedListEmd) (by simp only [join, Finset.le_eq_subset, Finset.mem_union, Finset.mem_map, @@ -393,9 +383,7 @@ lemma exists_mem_right_uncontracted_of_mem_join_uncontracted {φs : List 𝓕.Fi lemma join_uncontractedList {φs : List 𝓕.FieldOp} (φsΛ : WickContraction φs.length) (φsucΛ : WickContraction [φsΛ]ᵘᶜ.length) : (join φsΛ φsucΛ).uncontractedList = List.map uncontractedListEmd φsucΛ.uncontractedList := by - rw [uncontractedList_eq_sort] - rw [uncontractedList_eq_sort] - rw [fin_finset_sort_map_monotone] + rw [uncontractedList_eq_sort, uncontractedList_eq_sort, fin_finset_sort_map_monotone] congr ext a simp only [Finset.mem_map] @@ -599,19 +587,14 @@ lemma join_singleton_getDual?_left {φs : List 𝓕.FieldOp} {i j : Fin φs.length} (h : i < j) (φsucΛ : WickContraction [singleton h]ᵘᶜ.length) : (join (singleton h) φsucΛ).getDual? i = some j := by - rw [@getDual?_eq_some_iff_mem] - simp [singleton, join] + simp [getDual?_eq_some_iff_mem, singleton, join] @[simp] lemma join_singleton_getDual?_right {φs : List 𝓕.FieldOp} {i j : Fin φs.length} (h : i < j) (φsucΛ : WickContraction [singleton h]ᵘᶜ.length) : (join (singleton h) φsucΛ).getDual? j = some i := by - rw [@getDual?_eq_some_iff_mem] - simp only [join, singleton, Finset.le_eq_subset, Finset.mem_union, Finset.mem_singleton, - Finset.mem_map, RelEmbedding.coe_toEmbedding] - left - exact Finset.pair_comm j i + simp [getDual?_eq_some_iff_mem, join, singleton, Finset.pair_comm] lemma exists_contraction_pair_of_card_ge_zero {φs : List 𝓕.FieldOp} (φsΛ : WickContraction φs.length) (h : 0 < φsΛ.1.card) : diff --git a/Physlib/QFT/PerturbationTheory/WickContraction/Perm.lean b/Physlib/QFT/PerturbationTheory/WickContraction/Perm.lean index f7a9b9323..5da4ea233 100644 --- a/Physlib/QFT/PerturbationTheory/WickContraction/Perm.lean +++ b/Physlib/QFT/PerturbationTheory/WickContraction/Perm.lean @@ -49,21 +49,18 @@ variable {φs : List 𝓕.FieldOp} {φsΛ φsΛ₁ φsΛ₂ φsΛ₃ : WickContr /-- The reflexivity of the `Perm` relation. -/ @[refl] -lemma refl : Perm φsΛ φsΛ := by - rw [Perm] +lemma refl : Perm φsΛ φsΛ := rfl /-- The symmetry of the `Perm` relation. -/ @[symm] -lemma symm (h : Perm φsΛ₁ φsΛ₂) : Perm φsΛ₂ φsΛ₁ := by - rw [Perm] at h ⊢ - exact h.symm +lemma symm (h : Perm φsΛ₁ φsΛ₂) : Perm φsΛ₂ φsΛ₁ := + show φsΛ₂.wickTerm = φsΛ₁.wickTerm from Eq.symm h /-- The transitivity of the `Perm` relation. -/ @[trans] lemma trans (h12 : Perm φsΛ₁ φsΛ₂) (h23 : Perm φsΛ₂ φsΛ₃) : - Perm φsΛ₁ φsΛ₃ := by - rw [Perm] at h12 h23 ⊢ - exact h12.trans h23 + Perm φsΛ₁ φsΛ₃ := + show φsΛ₁.wickTerm = φsΛ₃.wickTerm from Eq.trans h12 h23 /-- If `Perm φsΛ₁ φsΛ₂` and both contractions are grading-compliant, then if `φsΛ₁` is a full Wick contraction, so is `φsΛ₂`. -/ diff --git a/Physlib/QFT/PerturbationTheory/WickContraction/Sign/Basic.lean b/Physlib/QFT/PerturbationTheory/WickContraction/Sign/Basic.lean index c128c5c08..e343f09d3 100644 --- a/Physlib/QFT/PerturbationTheory/WickContraction/Sign/Basic.lean +++ b/Physlib/QFT/PerturbationTheory/WickContraction/Sign/Basic.lean @@ -51,9 +51,7 @@ def sign (φs : List 𝓕.FieldOp) (φsΛ : WickContraction φs.length) : ℂ := 𝓕 |>ₛ ⟨φs.get, φsΛ.signFinset (φsΛ.fstFieldOfContract a) (φsΛ.sndFieldOfContract a)⟩) lemma sign_empty (φs : List 𝓕.FieldOp) : - sign φs empty = 1 := by - rw [sign] - simp [empty] + sign φs empty = 1 := by simp [sign, empty] lemma sign_congr {φs φs' : List 𝓕.FieldOp} (h : φs = φs') (φsΛ : WickContraction φs.length) : sign φs' (congr (by simp [h]) φsΛ) = sign φs φsΛ := by diff --git a/Physlib/QFT/PerturbationTheory/WickContraction/Sign/InsertNone.lean b/Physlib/QFT/PerturbationTheory/WickContraction/Sign/InsertNone.lean index 4bf3e5334..dd36be363 100644 --- a/Physlib/QFT/PerturbationTheory/WickContraction/Sign/InsertNone.lean +++ b/Physlib/QFT/PerturbationTheory/WickContraction/Sign/InsertNone.lean @@ -58,8 +58,7 @@ lemma signFinset_insertAndContract_none (φ : 𝓕.FieldOp) (φs : List 𝓕.Fie · simp only [Nat.succ_eq_add_one, finCongr_apply, Finset.mem_insert, Fin.ext_iff, Fin.val_cast, or_iff_right_iff_imp] intro h - have h1 : i.succAbove k ≠ i := by - exact Fin.succAbove_ne i k + have h1 : i.succAbove k ≠ i := Fin.succAbove_ne i k omega · simp rw [h1] @@ -95,8 +94,7 @@ def signInsertNone (φ : 𝓕.FieldOp) (φs : List 𝓕.FieldOp) (φsΛ : WickCo lemma sign_insert_none_eq_signInsertNone_mul_sign (φ : 𝓕.FieldOp) (φs : List 𝓕.FieldOp) (φsΛ : WickContraction φs.length) (i : Fin φs.length.succ) : (φsΛ ↩Λ φ i none).sign = (φsΛ.signInsertNone φ φs i) * φsΛ.sign := by - rw [sign] - rw [signInsertNone, sign, ← Finset.prod_mul_distrib] + rw [sign, signInsertNone, sign, ← Finset.prod_mul_distrib] rw [insertAndContract_none_prod_contractions] congr funext a @@ -193,8 +191,7 @@ lemma signInsertNone_eq_filter_map (φ : 𝓕.FieldOp) (φs : List 𝓕.FieldOp) φsΛ.signInsertNone φ φs i = 𝓢(𝓕 |>ₛ φ, 𝓕 |>ₛ ((List.filter (fun x => (φsΛ.getDual? x).isSome ∧ i.succAbove x < i) (List.finRange φs.length)).map φs.get)) := by - rw [signInsertNone_eq_prod_getDual?_Some] - rw [FieldStatistic.ofList_map_eq_finset_prod] + rw [signInsertNone_eq_prod_getDual?_Some, FieldStatistic.ofList_map_eq_finset_prod] rw [map_prod] congr funext a @@ -208,8 +205,7 @@ lemma signInsertNone_eq_filter_map (φ : 𝓕.FieldOp) (φs : List 𝓕.FieldOp) · simp only [map_one] · rename_i h simp [h] - · refine List.Nodup.filter _ ?_ - exact List.nodup_finRange φs.length + · exact List.Nodup.filter _ (List.nodup_finRange φs.length) · exact hG /-- The following signs for a grading compliant Wick contraction are equal: @@ -254,8 +250,7 @@ lemma sign_insert_none (φ : 𝓕.FieldOp) (φs : List 𝓕.FieldOp) (φsΛ : WickContraction φs.length) (i : Fin φs.length.succ) (hG : GradingCompliant φs φsΛ) : (φsΛ ↩Λ φ i none).sign = 𝓢(𝓕 |>ₛ φ, 𝓕 |>ₛ ⟨φs.get, Finset.univ.filter (fun x => (φsΛ.getDual? x).isSome ∧ i.succAbove x < i)⟩) * φsΛ.sign := by - rw [sign_insert_none_eq_signInsertNone_mul_sign] - rw [signInsertNone_eq_filterset] + rw [sign_insert_none_eq_signInsertNone_mul_sign, signInsertNone_eq_filterset] exact hG /-- For a list `φs = φ₀…φₙ` of `𝓕.FieldOp`, a graded compliant Wick contraction `φsΛ` of `φs`, diff --git a/Physlib/QFT/PerturbationTheory/WickContraction/Sign/InsertSome.lean b/Physlib/QFT/PerturbationTheory/WickContraction/Sign/InsertSome.lean index c819bae03..8087002ef 100644 --- a/Physlib/QFT/PerturbationTheory/WickContraction/Sign/InsertSome.lean +++ b/Physlib/QFT/PerturbationTheory/WickContraction/Sign/InsertSome.lean @@ -365,8 +365,7 @@ lemma signInsertSomeProd_eq_prod_fin (φ : 𝓕.FieldOp) (φs : List 𝓕.FieldO then 𝓢(𝓕 |>ₛ φ, 𝓕 |>ₛ φs[x.1]) else 1 else 1 := by - rw [signInsertSomeProd_eq_prod_prod] - rw [Finset.prod_sigma'] + rw [signInsertSomeProd_eq_prod_prod, Finset.prod_sigma'] erw [← φsΛ.sigmaContractedEquiv.symm.prod_comp] let e2 : Fin φs.length ≃ {x // (φsΛ.getDual? x).isSome} ⊕ {x // ¬ (φsΛ.getDual? x).isSome} := by exact (Equiv.sumCompl fun a => (φsΛ.getDual? a).isSome = true).symm @@ -395,8 +394,7 @@ lemma signInsertSomeProd_eq_finset (φ : 𝓕.FieldOp) (φs : List 𝓕.FieldOp) ∀ (h : (φsΛ.getDual? x).isSome), x < j ∧ (i.succAbove x < i ∧ i < i.succAbove ((φsΛ.getDual? x).get h) ∨ j < ((φsΛ.getDual? x).get h) ∧ ¬ i.succAbove x < i)))⟩) := by - rw [signInsertSomeProd_eq_prod_fin] - rw [ofFinset_eq_prod] + rw [signInsertSomeProd_eq_prod_fin, ofFinset_eq_prod] rw [map_prod] congr funext x @@ -442,8 +440,7 @@ lemma stat_signFinset_insert_some_self_fst 𝓕 |>ₛ ⟨φs.get, (Finset.univ.filter (fun x => i < i.succAbove x ∧ x < j ∧ ((φsΛ.getDual? x = none) ∨ ∀ (h : (φsΛ.getDual? x).isSome), i < i.succAbove ((φsΛ.getDual? x).get h))))⟩ := by - rw [get_eq_insertIdx_succAbove φ _ i] - rw [ofFinset_finset_map] + rw [get_eq_insertIdx_succAbove φ _ i, ofFinset_finset_map] swap refine (Equiv.comp_injective i.succAbove (finCongr (Eq.symm (insertIdx_length_fin φ φs i)))).mpr ?hi.a diff --git a/Physlib/QFT/PerturbationTheory/WickContraction/Sign/Join.lean b/Physlib/QFT/PerturbationTheory/WickContraction/Sign/Join.lean index bb834f7b1..8c2a39b06 100644 --- a/Physlib/QFT/PerturbationTheory/WickContraction/Sign/Join.lean +++ b/Physlib/QFT/PerturbationTheory/WickContraction/Sign/Join.lean @@ -193,10 +193,8 @@ lemma join_singleton_sign_left {φs : List 𝓕.FieldOp} (φsucΛ : WickContraction [singleton h]ᵘᶜ.length) : (singleton h).sign = 𝓢(𝓕 |>ₛ φs[j], (𝓕 |>ₛ ⟨φs.get, (join (singleton h) φsucΛ).signFinset i j⟩)) * (joinSignLeftExtra h φsucΛ) := by - rw [singleton_sign_expand] - rw [join_singleton_left_signFinset_eq_filter h φsucΛ] - rw [map_mul] - rfl + simpa [joinSignLeftExtra, join_singleton_left_signFinset_eq_filter h φsucΛ, map_mul] using + singleton_sign_expand h lemma join_singleton_sign_right {φs : List 𝓕.FieldOp} {i j : Fin φs.length} (h : i < j) @@ -205,9 +203,8 @@ lemma join_singleton_sign_right {φs : List 𝓕.FieldOp} (joinSignRightExtra h φsucΛ) * (∏ a, 𝓢(𝓕|>ₛ [singleton h]ᵘᶜ[φsucΛ.sndFieldOfContract a], 𝓕|>ₛ ⟨φs.get, ((join (singleton h) φsucΛ).signFinset (uncontractedListEmd (φsucΛ.fstFieldOfContract a)) - (uncontractedListEmd (φsucΛ.sndFieldOfContract a)))⟩)) := by - rw [sign_right_eq_prod_mul_prod] - rfl + (uncontractedListEmd (φsucΛ.sndFieldOfContract a)))⟩)) := + sign_right_eq_prod_mul_prod (singleton h) φsucΛ lemma joinSignRightExtra_eq_i_j_finset_eq_if {φs : List 𝓕.FieldOp} {i j : Fin φs.length} (h : i < j) (φsucΛ : WickContraction [singleton h]ᵘᶜ.length) : @@ -246,8 +243,7 @@ lemma joinSignRightExtra_eq_i_j_finset_eq_if {φs : List 𝓕.FieldOp} not_forall, not_lt] intro hxij h1 h2 omega - · have hj1 : uncontractedListEmd (φsucΛ.fstFieldOfContract a) < j := by - omega + · have hj1 : uncontractedListEmd (φsucΛ.fstFieldOfContract a) < j := by omega by_cases hi1 : ¬ i < uncontractedListEmd (φsucΛ.sndFieldOfContract a) · simp only [hi1, and_false, ↓reduceIte, Finset.notMem_empty, or_false] have hj2 : ¬ j < uncontractedListEmd (φsucΛ.sndFieldOfContract a) := by omega @@ -255,8 +251,7 @@ lemma joinSignRightExtra_eq_i_j_finset_eq_if {φs : List 𝓕.FieldOp} not_or, not_forall, not_lt] intro hxij h1 h2 omega - · have hi1 : i < uncontractedListEmd (φsucΛ.sndFieldOfContract a) := by - omega + · have hi1 : i < uncontractedListEmd (φsucΛ.sndFieldOfContract a) := by omega simp only [hj1, true_and, hi1, and_true] by_cases hi2 : ¬ uncontractedListEmd (φsucΛ.fstFieldOfContract a) < i · simp only [hi2, and_false, ↓reduceIte, Finset.notMem_empty, or_self, iff_false, not_and, @@ -338,9 +333,8 @@ lemma joinSignLeftExtra_eq_joinSignRightExtra {φs : List 𝓕.FieldOp} funext a have hjneqsnd := singleton_uncontractedEmd_ne_right h (φsucΛ.sndFieldOfContract a) have hl : uncontractedListEmd (φsucΛ.fstFieldOfContract a) < - uncontractedListEmd (φsucΛ.sndFieldOfContract a) := by - apply uncontractedListEmd_strictMono - exact fstFieldOfContract_lt_sndFieldOfContract φsucΛ a + uncontractedListEmd (φsucΛ.sndFieldOfContract a) := + uncontractedListEmd_strictMono (fstFieldOfContract_lt_sndFieldOfContract φsucΛ a) by_cases hj1 : ¬ uncontractedListEmd (φsucΛ.fstFieldOfContract a) < j · have hi1 : ¬ uncontractedListEmd (φsucΛ.fstFieldOfContract a) < i := by omega simp [hj1, hi1] @@ -410,16 +404,14 @@ lemma join_sign_induction {φs : List 𝓕.FieldOp} (φsΛ : WickContraction φs obtain ⟨i, j, hij, φsucΛ', rfl, h1, h2, h3⟩ := exists_join_singleton_of_card_ge_zero φsΛ (by simp [hn]) hc rw [join_assoc, join_sign_singleton hij h1, join_sign_singleton hij h1] - have hn : φsucΛ'.1.card = n := by - omega + have hn : φsucΛ'.1.card = n := by omega rw [join_sign_induction φsucΛ' (congr (by simp [join_uncontractedListGet]) φsucΛ) h2 n hn] rw [mul_assoc] simp only [mul_eq_mul_left_iff] left left - apply sign_congr - exact join_uncontractedListGet (singleton hij) φsucΛ' + exact sign_congr (join_uncontractedListGet (singleton hij) φsucΛ') φsucΛ /-- For a list `φs` of `𝓕.FieldOp`, a grading compliant Wick contraction `φsΛ` of `φs`, and a Wick contraction `φsucΛ` of `[φsΛ]ᵘᶜ`, the following relation holds diff --git a/Physlib/QFT/PerturbationTheory/WickContraction/Singleton.lean b/Physlib/QFT/PerturbationTheory/WickContraction/Singleton.lean index 103fd57af..b3bdcd747 100644 --- a/Physlib/QFT/PerturbationTheory/WickContraction/Singleton.lean +++ b/Physlib/QFT/PerturbationTheory/WickContraction/Singleton.lean @@ -40,12 +40,10 @@ def singleton {i j : Fin n} (hij : i < j) : WickContraction n := simp_all⟩ lemma mem_singleton {i j : Fin n} (hij : i < j) : - {i, j} ∈ (singleton hij).1 := by - simp [singleton] + {i, j} ∈ (singleton hij).1 := by simp [singleton] lemma mem_singleton_iff {i j : Fin n} (hij : i < j) {a : Finset (Fin n)} : - a ∈ (singleton hij).1 ↔ a = {i, j} := by - simp [singleton] + a ∈ (singleton hij).1 ↔ a = {i, j} := by simp [singleton] lemma of_singleton_eq {i j : Fin n} (hij : i < j) (a : (singleton hij).1) : a = ⟨{i, j}, mem_singleton hij⟩ := by @@ -55,8 +53,7 @@ lemma of_singleton_eq {i j : Fin n} (hij : i < j) (a : (singleton hij).1) : lemma singleton_prod {φs : List 𝓕.FieldOp} {i j : Fin φs.length} (hij : i < j) (f : (singleton hij).1 → M) [CommMonoid M] : - ∏ a, f a = f ⟨{i,j}, mem_singleton hij⟩:= by - simp [singleton, of_singleton_eq] + ∏ a, f a = f ⟨{i,j}, mem_singleton hij⟩:= by simp [singleton, of_singleton_eq] @[simp] lemma singleton_fstFieldOfContract {i j : Fin n} (hij : i < j) : @@ -81,8 +78,7 @@ lemma singleton_sign_expand {φs : List 𝓕.FieldOp} {i j : Fin φs.length} (hi lemma singleton_getDual?_eq_none_iff_neq {i j : Fin n} (hij : i < j) (a : Fin n) : (singleton hij).getDual? a = none ↔ (i ≠ a ∧ j ≠ a) := by - rw [getDual?_eq_none_iff_mem_uncontracted] - rw [mem_uncontracted_iff_not_contracted] + rw [getDual?_eq_none_iff_mem_uncontracted, mem_uncontracted_iff_not_contracted] simp only [singleton, Finset.mem_singleton, forall_eq, Finset.mem_insert, not_or, ne_eq] omega diff --git a/Physlib/QFT/PerturbationTheory/WickContraction/SubContraction.lean b/Physlib/QFT/PerturbationTheory/WickContraction/SubContraction.lean index e0b2db5cd..6d7a1285f 100644 --- a/Physlib/QFT/PerturbationTheory/WickContraction/SubContraction.lean +++ b/Physlib/QFT/PerturbationTheory/WickContraction/SubContraction.lean @@ -33,8 +33,7 @@ def subContraction (S : Finset (Finset (Fin φs.length))) (ha : S ⊆ φsΛ.1) : exact φsΛ.2.2 i (ha hi) j (ha hj)⟩ lemma mem_of_mem_subContraction {S : Finset (Finset (Fin φs.length))} {hs : S ⊆ φsΛ.1} - {a : Finset (Fin φs.length)} (ha : a ∈ (φsΛ.subContraction S hs).1) : a ∈ φsΛ.1 := by - exact hs ha + {a : Finset (Fin φs.length)} (ha : a ∈ (φsΛ.subContraction S hs).1) : a ∈ φsΛ.1 := hs ha /-- Given a Wick contraction `φsΛ`, and a subset `S` of `φsΛ.1`, the Wick contraction on the uncontracted list `[φsΛ.subContraction S ha]ᵘᶜ` @@ -101,9 +100,7 @@ lemma mem_subContraction_or_quotContraction {S : Finset (Finset (Fin φs.length) @[simp] lemma subContraction_uncontractedList_get {S : Finset (Finset (Fin φs.length))} {hs : S ⊆ φsΛ.1} {a : Fin [subContraction S hs]ᵘᶜ.length} : - [subContraction S hs]ᵘᶜ[a] = φs[uncontractedListEmd a] := by - erw [← getElem_uncontractedListEmd] - rfl + [subContraction S hs]ᵘᶜ[a] = φs[uncontractedListEmd a] := (getElem_uncontractedListEmd a).symm @[simp] lemma subContraction_fstFieldOfContract {S : Finset (Finset (Fin φs.length))} {hs : S ⊆ φsΛ.1} diff --git a/Physlib/QFT/PerturbationTheory/WickContraction/TimeCond.lean b/Physlib/QFT/PerturbationTheory/WickContraction/TimeCond.lean index b50b356d8..42fe58d92 100644 --- a/Physlib/QFT/PerturbationTheory/WickContraction/TimeCond.lean +++ b/Physlib/QFT/PerturbationTheory/WickContraction/TimeCond.lean @@ -48,8 +48,7 @@ lemma timeOrderRel_both_of_eqTimeOnly {i j : Fin φs.length} (h : {i, j} ∈ φs apply And.intro · exact timeOrderRel_of_eqTimeOnly_pair φsΛ h hc · apply timeOrderRel_of_eqTimeOnly_pair φsΛ _ hc - rw [@Finset.pair_comm] - exact h + simpa [@Finset.pair_comm] using h lemma eqTimeOnly_iff_forall_finset {φs : List 𝓕.FieldOp} (φsΛ : WickContraction φs.length) : φsΛ.EqTimeOnly ↔ ∀ (a : φsΛ.1), @@ -95,8 +94,7 @@ lemma eqTimeOnly_iff_forall_finset {φs : List 𝓕.FieldOp} (φsΛ : WickContra @[simp] lemma empty_mem {φs : List 𝓕.FieldOp} : empty (n := φs.length).EqTimeOnly := by - rw [eqTimeOnly_iff_forall_finset] - simp [empty] + simp [eqTimeOnly_iff_forall_finset, empty] /-- Let `φs` be a list of `𝓕.FieldOp` and `φsΛ` a `WickContraction` of `φs` within which every contraction involves two `𝓕.FieldOp`s that have the same time, then @@ -110,9 +108,8 @@ lemma staticContract_eq_timeContract_of_eqTimeOnly (h : φsΛ.EqTimeOnly) : simp only [List.get_eq_getElem] rw [timeContract_of_timeOrderRel] apply timeOrderRel_of_eqTimeOnly_pair φsΛ - rw [← finset_eq_fstFieldOfContract_sndFieldOfContract] - exact a.2 - exact h + · simp [← finset_eq_fstFieldOfContract_sndFieldOfContract, a.2] + · exact h lemma eqTimeOnly_congr {φs φs' : List 𝓕.FieldOp} (h : φs = φs') (φsΛ : WickContraction φs.length) : (congr (by simp [h]) φsΛ).EqTimeOnly (φs := φs') ↔ φsΛ.EqTimeOnly := by @@ -177,8 +174,7 @@ lemma timeOrder_timeContract_mul_of_eqTimeOnly_mid_induction {φs : List 𝓕.Fi | Nat.succ n, hn => by obtain ⟨i, j, hij, φsucΛ, rfl, h2, h3, h4⟩ := exists_join_singleton_of_card_ge_zero φsΛ (by simp [hn]) hl - rw [join_timeContract] - rw [singleton_timeContract] + rw [join_timeContract, singleton_timeContract] simp only [Fin.getElem_fin, MulMemClass.coe_mul] trans timeOrder (a * WickAlgebra.timeContract φs[↑i] φs[↑j] * (φsucΛ.timeContract.1 * b)) simp only [mul_assoc, Fin.getElem_fin] @@ -205,10 +201,8 @@ lemma timeOrder_timeContract_mul_of_eqTimeOnly_left {φs : List 𝓕.FieldOp} (φsΛ : WickContraction φs.length) (hl : φsΛ.EqTimeOnly) (b : 𝓕.WickAlgebra) : 𝓣(φsΛ.timeContract.1 * b) = φsΛ.timeContract.1 * 𝓣(b) := by - trans 𝓣(1 * φsΛ.timeContract.1 * b) - simp only [one_mul] - rw [timeOrder_timeContract_mul_of_eqTimeOnly_mid φsΛ hl] - simp + simpa using + timeOrder_timeContract_mul_of_eqTimeOnly_mid φsΛ hl (1 : 𝓕.WickAlgebra) b set_option maxHeartbeats 400000 in lemma exists_join_singleton_of_not_eqTimeOnly {φs : List 𝓕.FieldOp} @@ -240,11 +234,9 @@ lemma timeOrder_timeContract_of_not_eqTimeOnly {φs : List 𝓕.FieldOp} (φsΛ : WickContraction φs.length) (hl : ¬ φsΛ.EqTimeOnly) : 𝓣(φsΛ.timeContract.1) = 0 := by obtain ⟨i, j, hij, φsucΛ, rfl, hr⟩ := exists_join_singleton_of_not_eqTimeOnly φsΛ hl - rw [join_timeContract] - rw [singleton_timeContract] + rw [join_timeContract, singleton_timeContract] simp only [Fin.getElem_fin, MulMemClass.coe_mul] - rw [timeOrder_timeOrder_left] - rw [timeOrder_timeContract_ne_time] + rw [timeOrder_timeOrder_left, timeOrder_timeContract_ne_time] simp only [zero_mul, map_zero] simp_all only [Fin.getElem_fin, not_and] intro h @@ -258,8 +250,7 @@ lemma timeOrder_staticContract_of_not_mem {φs : List 𝓕.FieldOp} (φsΛ : Wic obtain ⟨i, j, hij, φsucΛ, rfl, hr⟩ := exists_join_singleton_of_not_eqTimeOnly φsΛ hl rw [join_staticContract] simp only [MulMemClass.coe_mul] - rw [singleton_staticContract] - rw [timeOrder_timeOrder_left] + rw [singleton_staticContract, timeOrder_timeOrder_left] rw [timeOrder_superCommute_anPart_ofFieldOp_ne_time] simp only [zero_mul, map_zero] intro h @@ -308,14 +299,11 @@ lemma haveEqTime_iff_finset {φs : List 𝓕.FieldOp} (φsΛ : WickContraction use φsΛ.fstFieldOfContract ⟨a, h1⟩ use φsΛ.sndFieldOfContract ⟨a, h1⟩ simp_all only [and_true, true_and] - rw [← finset_eq_fstFieldOfContract_sndFieldOfContract] - exact h1 + simpa [← finset_eq_fstFieldOfContract_sndFieldOfContract] using h1 @[simp] lemma empty_not_haveEqTime {φs : List 𝓕.FieldOp} : - ¬ HaveEqTime (empty : WickContraction φs.length) := by - rw [haveEqTime_iff_finset] - simp [empty] + ¬ HaveEqTime (empty : WickContraction φs.length) := by simp [haveEqTime_iff_finset, empty] /-- Given a Wick contraction the subset of contracted pairs between equal time fields. -/ def eqTimeContractSet {φs : List 𝓕.FieldOp} (φsΛ : WickContraction φs.length) : @@ -495,8 +483,7 @@ lemma join_haveEqTime_of_eqTimeOnly_nonEmpty {φs : List 𝓕.FieldOp} (φsΛ : use i, j simp_all only [ne_eq, true_or, true_and] apply h1 j i - rw [Finset.pair_comm] - exact h + simpa [Finset.pair_comm] using h lemma hasEqTimeEquiv_ext_sigma {φs : List 𝓕.FieldOp} {x1 x2 : Σ (φsΛ : {φsΛ : WickContraction φs.length // φsΛ.EqTimeOnly ∧ φsΛ ≠ empty}), @@ -536,8 +523,7 @@ def hasEqTimeEquiv (φs : List 𝓕.FieldOp) : apply Subtype.ext ext a simp only [subContraction] - rw [join_eqTimeContractSet] - rw [eqTimeContractSet_of_not_haveEqTime h2] + rw [join_eqTimeContractSet, eqTimeContractSet_of_not_haveEqTime h2] simp only [Finset.le_eq_subset, ne_eq, Finset.map_empty, Finset.union_empty] rw [eqTimeContractSet_of_mem_eqTimeOnly h1.1] refine hasEqTimeEquiv_ext_sigma ?_ ?_ @@ -547,11 +533,9 @@ def hasEqTimeEquiv (φs : List 𝓕.FieldOp) : apply Subtype.ext ext a simp only [quotContraction, Finset.mem_filter, Finset.mem_univ, true_and] - rw [mem_congr_iff] - rw [mem_join_right_iff] + rw [mem_congr_iff, mem_join_right_iff] simp only [ne_eq] - rw [uncontractedListEmd_congr hs] - rw [Finset.map_map] + rw [uncontractedListEmd_congr hs, Finset.map_map] lemma sum_haveEqTime (φs : List 𝓕.FieldOp) (f : WickContraction φs.length → M) [AddCommMonoid M]: diff --git a/Physlib/QFT/PerturbationTheory/WickContraction/TimeContract.lean b/Physlib/QFT/PerturbationTheory/WickContraction/TimeContract.lean index ec014fd96..a34f80727 100644 --- a/Physlib/QFT/PerturbationTheory/WickContraction/TimeContract.lean +++ b/Physlib/QFT/PerturbationTheory/WickContraction/TimeContract.lean @@ -77,9 +77,7 @@ lemma timeContract_insertAndContract_some @[simp] lemma timeContract_empty (φs : List 𝓕.FieldOp) : - (@empty φs.length).timeContract = 1 := by - rw [timeContract, empty] - simp + (@empty φs.length).timeContract = 1 := by simp [timeContract, empty] open FieldStatistic @@ -122,8 +120,7 @@ lemma timeContract_insert_some_of_lt congr rw [← List.map_take] congr - rw [take_uncontractedIndexEquiv_symm] - rw [filter_uncontractedList] + rw [take_uncontractedIndexEquiv_symm, filter_uncontractedList] rw [h1] simp only [exchangeSign_mul_self] · exact ht diff --git a/Physlib/QFT/PerturbationTheory/WickContraction/Uncontracted.lean b/Physlib/QFT/PerturbationTheory/WickContraction/Uncontracted.lean index 5f4a8ebf1..b8ce1a2d8 100644 --- a/Physlib/QFT/PerturbationTheory/WickContraction/Uncontracted.lean +++ b/Physlib/QFT/PerturbationTheory/WickContraction/Uncontracted.lean @@ -30,8 +30,7 @@ lemma congr_uncontracted {n m : ℕ} (c : WickContraction n) (h : n = m) : simp lemma getDual?_eq_none_iff_mem_uncontracted (i : Fin n) : - c.getDual? i = none ↔ i ∈ c.uncontracted := by - simp [uncontracted] + c.getDual? i = none ↔ i ∈ c.uncontracted := by simp [uncontracted] /-- The equivalence of `Option c.uncontracted` for two propositionally equal Wick contractions. -/ def uncontractedCongr {c c': WickContraction n} (h : c = c') : @@ -40,8 +39,7 @@ def uncontractedCongr {c c': WickContraction n} (h : c = c') : @[simp] lemma uncontractedCongr_none {c c': WickContraction n} (h : c = c') : - (uncontractedCongr h) none = none := by - simp [uncontractedCongr] + (uncontractedCongr h) none = none := by simp [uncontractedCongr] @[simp] lemma uncontractedCongr_some {c c': WickContraction n} (h : c = c') (i : c.uncontracted) : @@ -85,8 +83,7 @@ lemma getDual?_empty_eq_none (i : Fin n) : empty.getDual? i = none := by simpa [uncontracted] using mem_uncontracted_empty i @[simp] -lemma uncontracted_empty {n : ℕ} : (@empty n).uncontracted = Finset.univ := by - simp [uncontracted] +lemma uncontracted_empty {n : ℕ} : (@empty n).uncontracted = Finset.univ := by simp [uncontracted] lemma uncontracted_card_le (c : WickContraction n) : c.uncontracted.card ≤ n := by simp only [uncontracted] @@ -103,9 +100,7 @@ lemma uncontracted_card_eq_iff (c : WickContraction n) : by_contra hn have hc' := exists_pair_of_not_eq_empty c hn obtain ⟨i, j, hij⟩ := hc' - have hci : c.getDual? i = some j := by - rw [@getDual?_eq_some_iff_mem] - exact hij + have hci : c.getDual? i = some j := by simpa [getDual?_eq_some_iff_mem] using hij simp_all · intro h subst h diff --git a/Physlib/QFT/PerturbationTheory/WickContraction/UncontractedList.lean b/Physlib/QFT/PerturbationTheory/WickContraction/UncontractedList.lean index 732cf0dfe..2613a8574 100644 --- a/Physlib/QFT/PerturbationTheory/WickContraction/UncontractedList.lean +++ b/Physlib/QFT/PerturbationTheory/WickContraction/UncontractedList.lean @@ -44,29 +44,21 @@ lemma fin_list_sorted_monotone_sorted {n m : ℕ} (l: List (Fin n)) (hl : l.Pair exact ih hl.2 lemma fin_list_sorted_succAboveEmb_sorted (l: List (Fin n)) (hl : l.Pairwise (· ≤ ·)) - (i : Fin n.succ) : ((List.map i.succAboveEmb l)).Pairwise (· ≤ ·) := by - apply fin_list_sorted_monotone_sorted - exact hl - simp only [Fin.coe_succAboveEmb] - exact Fin.strictMono_succAbove i + (i : Fin n.succ) : ((List.map i.succAboveEmb l)).Pairwise (· ≤ ·) := + fin_list_sorted_monotone_sorted l hl i.succAboveEmb (Fin.strictMono_succAbove i) lemma fin_finset_sort_map_monotone {n m : ℕ} (a : Finset (Fin n)) (f : Fin n ↪ Fin m) (hf : StrictMono f) : (a.sort (· ≤ ·)).map f = ((a.map f).sort (· ≤ ·)) := by - have h1 : ((a.sort (· ≤ ·)).map f).Pairwise (· ≤ ·) := by - apply fin_list_sorted_monotone_sorted - exact a.pairwise_sort (fun x1 x2 => x1 ≤ x2) - exact hf - have h2 : ((a.sort (· ≤ ·)).map f).Nodup := by - refine (List.nodup_map_iff_inj_on ?_).mpr ?_ - exact a.sort_nodup (fun x1 x2 => x1 ≤ x2) - intro a ha b hb hf - exact f.2 hf + have h1 : ((a.sort (· ≤ ·)).map f).Pairwise (· ≤ ·) := + fin_list_sorted_monotone_sorted _ (a.pairwise_sort (fun x1 x2 => x1 ≤ x2)) f hf + have h2 : ((a.sort (· ≤ ·)).map f).Nodup := + (List.nodup_map_iff_inj_on (a.sort_nodup (fun x1 x2 => x1 ≤ x2))).mpr + fun _ _ _ _ hf => f.2 hf have h3 : ((a.sort (· ≤ ·)).map f).toFinset = (a.map f) := by ext a simp - rw [← h3] - exact ((List.toFinset_sort (· ≤ ·) h2).mpr h1).symm + simpa [← h3] using ((List.toFinset_sort (· ≤ ·) h2).mpr h1).symm lemma fin_list_sorted_split : (l : List (Fin n)) → (hl : l.Pairwise (· ≤ ·)) → (i : ℕ) → @@ -196,8 +188,7 @@ lemma orderedInsert_eq_insertIdx_of_fin_list_sorted (l : List (Fin n)) (hl : l.P def uncontractedList : List (Fin n) := List.filter (fun x => x ∈ c.uncontracted) (List.finRange n) lemma uncontractedList_mem_iff (i : Fin n) : - i ∈ c.uncontractedList ↔ i ∈ c.uncontracted := by - simp [uncontractedList] + i ∈ c.uncontractedList ↔ i ∈ c.uncontracted := by simp [uncontractedList] @[simp] lemma uncontractedList_empty : (empty (n := n)).uncontractedList = List.finRange n := by @@ -220,23 +211,19 @@ lemma uncontractedList_sorted : List.Pairwise (· ≤ ·) c.uncontractedList := rw [uncontractedList] apply List.Pairwise.filter rw [← List.ofFn_id] - refine List.sortedLE_iff_pairwise.mp ?_ - exact Monotone.sortedLE_ofFn fun ⦃a b⦄ a => a + exact List.sortedLE_iff_pairwise.mp (Monotone.sortedLE_ofFn fun ⦃a b⦄ a => a) lemma uncontractedList_sorted_lt : List.Pairwise (· < ·) c.uncontractedList := by rw [uncontractedList] apply List.Pairwise.filter - rw [← List.ofFn_id] - exact List.pairwise_ofFn.mpr fun ⦃i j⦄ a => a + simp [← List.ofFn_id] lemma uncontractedList_nodup : c.uncontractedList.Nodup := by rw [uncontractedList] - refine List.Nodup.filter (fun x => decide (x ∈ c.uncontracted)) ?_ - exact List.nodup_finRange n + exact List.Nodup.filter (fun x => decide (x ∈ c.uncontracted)) (List.nodup_finRange n) lemma uncontractedList_toFinset (c : WickContraction n) : - c.uncontractedList.toFinset = c.uncontracted := by - simp [uncontractedList] + c.uncontractedList.toFinset = c.uncontracted := by simp [uncontractedList] lemma uncontractedList_eq_sort (c : WickContraction n) : c.uncontractedList = c.uncontracted.sort (· ≤ ·) := by @@ -247,24 +234,19 @@ lemma uncontractedList_eq_sort (c : WickContraction n) : · exact uncontractedList_sorted c lemma uncontractedList_length_eq_card (c : WickContraction n) : - c.uncontractedList.length = c.uncontracted.card := by - rw [uncontractedList_eq_sort] - exact Finset.length_sort fun x1 x2 => x1 ≤ x2 + c.uncontractedList.length = c.uncontracted.card := by simp [uncontractedList_eq_sort] lemma filter_uncontractedList (c : WickContraction n) (p : Fin n → Prop) [DecidablePred p] : (c.uncontractedList.filter p) = (c.uncontracted.filter p).sort (· ≤ ·) := by - have h1 : (c.uncontractedList.filter p).Pairwise (· ≤ ·) := by - apply List.Pairwise.filter - exact uncontractedList_sorted c - have h2 : (c.uncontractedList.filter p).Nodup := by - refine List.Nodup.filter _ ?_ - exact uncontractedList_nodup c + have h1 : (c.uncontractedList.filter p).Pairwise (· ≤ ·) := + List.Pairwise.filter _ (uncontractedList_sorted c) + have h2 : (c.uncontractedList.filter p).Nodup := + List.Nodup.filter _ (uncontractedList_nodup c) have h3 : (c.uncontractedList.filter p).toFinset = (c.uncontracted.filter p) := by ext a simp only [List.toFinset_filter, decide_eq_true_eq, Finset.mem_filter, List.mem_toFinset, and_congr_left_iff] - rw [uncontractedList_mem_iff] - simp + simp [uncontractedList_mem_iff] have hx := (List.toFinset_sort (· ≤ ·) h2).mpr h1 rw [← hx, h3] @@ -301,8 +283,7 @@ lemma uncontractedIndexEquiv_symm_eq_filter_length (k : c.uncontracted) : rw [fin_list_sorted_indexOf_mem] · simp · exact uncontractedList_sorted c - · rw [uncontractedList_mem_iff] - exact k.2 + · simp [uncontractedList_mem_iff, k.2] lemma take_uncontractedIndexEquiv_symm (k : c.uncontracted) : c.uncontractedList.take (c.uncontractedIndexEquiv.symm k).val = @@ -311,8 +292,7 @@ lemma take_uncontractedIndexEquiv_symm (k : c.uncontracted) : conv_lhs => rhs rw [hl] - rw [uncontractedIndexEquiv_symm_eq_filter_length] - simp + simp [uncontractedIndexEquiv_symm_eq_filter_length] /-! ## Uncontracted List get @@ -332,8 +312,7 @@ scoped[WickContraction] notation "[" φsΛ "]ᵘᶜ" => uncontractedListGet φs @[simp] lemma uncontractedListGet_empty {φs : List 𝓕.FieldOp} : - (empty (n := φs.length)).uncontractedListGet = φs := by - simp [uncontractedListGet] + (empty (n := φs.length)).uncontractedListGet = φs := by simp [uncontractedListGet] /-! @@ -351,8 +330,7 @@ def uncontractedFieldOpEquiv (φs : List 𝓕.FieldOp) (φsΛ : WickContraction @[simp] lemma uncontractedFieldOpEquiv_none (φs : List 𝓕.FieldOp) (φsΛ : WickContraction φs.length) : - (uncontractedFieldOpEquiv φs φsΛ).toFun none = none := by - simp [uncontractedFieldOpEquiv] + (uncontractedFieldOpEquiv φs φsΛ).toFun none = none := by simp [uncontractedFieldOpEquiv] lemma uncontractedFieldOpEquiv_list_sum [AddCommMonoid α] (φs : List 𝓕.FieldOp) (φsΛ : WickContraction φs.length) (f : Option (Fin [φsΛ]ᵘᶜ.length) → α) : @@ -380,17 +358,14 @@ lemma uncontractedListEmd_congr {φs : List 𝓕.FieldOp} {φsΛ φsΛ' : WickCo lemma uncontractedListEmd_toFun_eq_get (φs : List 𝓕.FieldOp) (φsΛ : WickContraction φs.length) : (uncontractedListEmd (φsΛ := φsΛ)).toFun = - φsΛ.uncontractedList.get ∘ (finCongr (by simp [uncontractedListGet])) := by - rfl + φsΛ.uncontractedList.get ∘ (finCongr (by simp [uncontractedListGet])) := rfl lemma uncontractedListEmd_strictMono {φs : List 𝓕.FieldOp} {φsΛ : WickContraction φs.length} {i j : Fin [φsΛ]ᵘᶜ.length} (h : i < j) : uncontractedListEmd i < uncontractedListEmd j := by simp only [uncontractedListEmd, uncontractedIndexEquiv, List.get_eq_getElem, Equiv.trans_toEmbedding, Function.Embedding.trans_apply, Equiv.coe_toEmbedding, finCongr_apply, Equiv.coe_fn_mk, Fin.val_cast, Function.Embedding.coe_subtype] - apply List.SortedLT.strictMono_get - exact φsΛ.uncontractedList_sorted_lt.sortedLT - exact h + exact List.SortedLT.strictMono_get φsΛ.uncontractedList_sorted_lt.sortedLT h lemma uncontractedListEmd_mem_uncontracted {φs : List 𝓕.FieldOp} {φsΛ : WickContraction φs.length} (i : Fin [φsΛ]ᵘᶜ.length) : uncontractedListEmd i ∈ φsΛ.uncontracted := by @@ -452,9 +427,8 @@ lemma uncontractedListEmd_empty {φs : List 𝓕.FieldOp} : -/ lemma uncontractedList_succAboveEmb_sorted (c : WickContraction n) (i : Fin n.succ) : - ((List.map i.succAboveEmb c.uncontractedList)).Pairwise (· ≤ ·) := by - apply fin_list_sorted_succAboveEmb_sorted - exact uncontractedList_sorted c + ((List.map i.succAboveEmb c.uncontractedList)).Pairwise (· ≤ ·) := + fin_list_sorted_succAboveEmb_sorted c.uncontractedList (uncontractedList_sorted c) i lemma uncontractedList_succAboveEmb_nodup (c : WickContraction n) (i : Fin n.succ) : ((List.map i.succAboveEmb c.uncontractedList)).Nodup := by @@ -487,8 +461,7 @@ lemma uncontractedList_succAbove_orderedInsert_toFinset (c : WickContraction n) ext a simp only [Nat.succ_eq_add_one, Fin.coe_succAboveEmb, List.mem_toFinset, List.mem_orderedInsert, List.mem_map, Finset.mem_insert, Finset.mem_map, Fin.succAboveEmb_apply] - rw [← uncontractedList_toFinset] - simp + simp [← uncontractedList_toFinset] lemma uncontractedList_succAbove_orderedInsert_eq_sort (c : WickContraction n) (i : Fin n.succ) : (List.orderedInsert (· ≤ ·) i (List.map i.succAboveEmb c.uncontractedList)) = @@ -540,14 +513,12 @@ lemma uncontractedList_succAboveEmb_eraseIdx_toFinset (c : WickContraction n) (i exact uncontractedList_succAboveEmb_nodup c i lemma uncontractedList_succAboveEmb_eraseIdx_sorted (c : WickContraction n) (i : Fin n.succ) - (k: ℕ) : ((List.map i.succAboveEmb c.uncontractedList).eraseIdx k).Pairwise (· ≤ ·) := by - apply Physlib.List.eraseIdx_sorted - exact uncontractedList_succAboveEmb_sorted c i + (k: ℕ) : ((List.map i.succAboveEmb c.uncontractedList).eraseIdx k).Pairwise (· ≤ ·) := + Physlib.List.eraseIdx_sorted (· ≤ ·) _ k (uncontractedList_succAboveEmb_sorted c i) lemma uncontractedList_succAboveEmb_eraseIdx_nodup (c : WickContraction n) (i : Fin n.succ) (k: ℕ) : - ((List.map i.succAboveEmb c.uncontractedList).eraseIdx k).Nodup := by - refine List.Nodup.eraseIdx k ?_ - exact uncontractedList_succAboveEmb_nodup c i + ((List.map i.succAboveEmb c.uncontractedList).eraseIdx k).Nodup := + List.Nodup.eraseIdx k (uncontractedList_succAboveEmb_nodup c i) lemma uncontractedList_succAboveEmb_eraseIdx_eq_sort (c : WickContraction n) (i : Fin n.succ) (k : ℕ) (hk : k < c.uncontractedList.length) : @@ -563,8 +534,7 @@ lemma uncontractedList_succAboveEmb_eraseIdx_eq_sort (c : WickContraction n) (i lemma uncontractedList_extractEquiv_symm_some (c : WickContraction n) (i : Fin n.succ) (k : c.uncontracted) : ((extractEquiv i).symm ⟨c, some k⟩).uncontractedList = ((c.uncontractedList).map i.succAboveEmb).eraseIdx (c.uncontractedIndexEquiv.symm k) := by - rw [uncontractedList_eq_sort] - rw [uncontractedList_succAboveEmb_eraseIdx_eq_sort] + rw [uncontractedList_eq_sort, uncontractedList_succAboveEmb_eraseIdx_eq_sort] swap simp only [Fin.is_lt] congr @@ -580,8 +550,7 @@ lemma uncontractedList_succAboveEmb_toFinset (c : WickContraction n) (i : Fin n. ext a simp only [Fin.coe_succAboveEmb, List.mem_toFinset, List.mem_map, Finset.mem_map, Fin.succAboveEmb_apply] - rw [← c.uncontractedList_toFinset] - simp + simp [← c.uncontractedList_toFinset] /-! @@ -614,18 +583,14 @@ lemma take_uncontractedListOrderPos_eq_filter_sort (c : WickContraction n) (i : (c.uncontractedList.take (c.uncontractedListOrderPos i)) = (c.uncontracted.filter (fun x => x.1 < i.1)).sort (· ≤ ·) := by rw [take_uncontractedListOrderPos_eq_filter] - have h1 : (c.uncontractedList.filter (fun x => x.1 < i.1)).Pairwise (· ≤ ·) := by - apply List.Pairwise.filter - exact uncontractedList_sorted c - have h2 : (c.uncontractedList.filter (fun x => x.1 < i.1)).Nodup := by - refine List.Nodup.filter _ ?_ - exact uncontractedList_nodup c + have h1 : (c.uncontractedList.filter (fun x => x.1 < i.1)).Pairwise (· ≤ ·) := + List.Pairwise.filter _ (uncontractedList_sorted c) + have h2 : (c.uncontractedList.filter (fun x => x.1 < i.1)).Nodup := + List.Nodup.filter _ (uncontractedList_nodup c) have h3 : (c.uncontractedList.filter (fun x => x.1 < i.1)).toFinset = (c.uncontracted.filter (fun x => x.1 < i.1)) := by - rw [uncontractedList_eq_sort] - simp - rw [← h3] - exact ((List.toFinset_sort (α := Fin n) (· ≤ ·) h2).mpr h1).symm + simp [uncontractedList_eq_sort] + simpa [← h3] using ((List.toFinset_sort (α := Fin n) (· ≤ ·) h2).mpr h1).symm lemma orderedInsert_succAboveEmb_uncontractedList_eq_insertIdx (c : WickContraction n) (i : Fin n.succ) : diff --git a/Physlib/QFT/QED/AnomalyCancellation/Basic.lean b/Physlib/QFT/QED/AnomalyCancellation/Basic.lean index 593e4f8f8..3a9e802a6 100644 --- a/Physlib/QFT/QED/AnomalyCancellation/Basic.lean +++ b/Physlib/QFT/QED/AnomalyCancellation/Basic.lean @@ -128,9 +128,7 @@ lemma pureU1_linear {n : ℕ} (S : (PureU1 n).LinSols) : /-- A solution to the pure U(1) accs satisfies the cubic ACCs. -/ lemma pureU1_cube {n : ℕ} (S : (PureU1 n).Sols) : - ∑ i, (S.val i) ^ 3 = 0 := by - rw [← PureU1.accCube_explicit] - exact S.cubicSol + ∑ i, (S.val i) ^ 3 = 0 := (PureU1.accCube_explicit n S.val) ▸ S.cubicSol /-- The last charge of a solution to the linear ACCs is equal to the negation of the sum of the other charges. -/ @@ -151,8 +149,7 @@ lemma pureU1_anomalyFree_ext {n : ℕ} {S T : (PureU1 n.succ).LinSols} · obtain ⟨j, hj⟩ := hi subst hj exact h j - · rw [hi, pureU1_last, pureU1_last] - exact neg_inj.mpr (Finset.sum_congr rfl fun j _ => h j) + · simpa [hi, pureU1_last] using neg_inj.mpr (Finset.sum_congr rfl fun j _ => h j) namespace PureU1 @@ -164,8 +161,7 @@ lemma sum_of_charges {n : ℕ} (f : Fin k → (PureU1 n).Charges) (j : Fin n) : · rfl · rename_i k hl rw [Fin.sum_univ_castSucc, Fin.sum_univ_castSucc] - erw [← hl (f ∘ Fin.castSucc)] - rfl + exact congrArg₂ (· + ·) (hl (f ∘ Fin.castSucc)) rfl /-- The `j`th charge of a sum of solutions to the linear ACC is equal to the sum of their `j`th charges. -/ @@ -175,7 +171,6 @@ lemma sum_of_anomaly_free_linear {n : ℕ} (f : Fin k → (PureU1 n).LinSols) (j · rfl · rename_i k hl rw [Fin.sum_univ_castSucc, Fin.sum_univ_castSucc] - erw [← hl (f ∘ Fin.castSucc)] - rfl + exact congrArg₂ (· + ·) (hl (f ∘ Fin.castSucc)) rfl end PureU1 diff --git a/Physlib/QFT/QED/AnomalyCancellation/BasisLinear.lean b/Physlib/QFT/QED/AnomalyCancellation/BasisLinear.lean index 4b9f954ae..ba277ced6 100644 --- a/Physlib/QFT/QED/AnomalyCancellation/BasisLinear.lean +++ b/Physlib/QFT/QED/AnomalyCancellation/BasisLinear.lean @@ -33,8 +33,7 @@ def asCharges (j : Fin n) : (PureU1 n.succ).Charges := else 0) lemma asCharges_eq_castSucc (j : Fin n) : - asCharges j (Fin.castSucc j) = 1 := by - simp [asCharges] + asCharges j (Fin.castSucc j) = 1 := by simp [asCharges] lemma asCharges_ne_castSucc {k j : Fin n} (h : k ≠ j) : asCharges k ⟨j, by simp⟩= 0 := by @@ -51,8 +50,7 @@ def asLinSols (j : Fin n) : (PureU1 n.succ).LinSols := | ⟨0, _⟩=> simp only [PureU1_linearACCs, accGrav, LinearMap.coe_mk, AddHom.coe_mk] - rw [Fin.sum_univ_castSucc] - rw [Finset.sum_eq_single j] + rw [Fin.sum_univ_castSucc, Finset.sum_eq_single j] · simp only [asCharges, ↓reduceIte] have hn : ¬ (Fin.last n = Fin.castSucc j) := Fin.ne_of_gt j.prop split @@ -72,12 +70,8 @@ lemma sum_of_vectors {n : ℕ} (f : Fin k → (PureU1 n).LinSols) (j : Fin n) : noncomputable def coordinateMap : (PureU1 n.succ).LinSols ≃ₗ[ℚ] Fin n →₀ ℚ where toFun S := (Finsupp.linearEquivFunOnFinite ℚ ℚ (Fin n)).symm (S.1 ∘ Fin.castSucc) - map_add' S T := by - rw [← map_add] - rfl - map_smul' a S := by - rw [← map_smul] - rfl + map_add' S T := map_add _ _ _ + map_smul' a S := (Finsupp.linearEquivFunOnFinite ℚ ℚ (Fin n)).symm.map_smul a (S.1 ∘ Fin.castSucc) invFun f := ∑ i : Fin n, f i • asLinSols i left_inv S := by simp only [Nat.succ_eq_add_one, @@ -89,8 +83,7 @@ def coordinateMap : (PureU1 n.succ).LinSols ≃ₗ[ℚ] Fin n →₀ ℚ where rw [Finset.sum_eq_single j] · simp only [asCharges, ↓reduceIte, mul_one] · intro k _ hkj - erw [asCharges_ne_castSucc hkj] - exact Rat.mul_zero (S.val k.castSucc) + exact mul_eq_zero_of_right (S.val k.castSucc) (asCharges_ne_castSucc hkj) · simp right_inv f := by simp only @@ -103,8 +96,7 @@ def coordinateMap : (PureU1 n.succ).LinSols ≃ₗ[ℚ] Fin n →₀ ℚ where rw [Finset.sum_eq_single j] · simp only [asCharges, ↓reduceIte, mul_one] · intro k _ hkj - erw [asCharges_ne_castSucc hkj] - exact Rat.mul_zero (f k) + exact mul_eq_zero_of_right (f k) (asCharges_ne_castSucc hkj) · simp /-- The basis of `LinSols`. -/ diff --git a/Physlib/QFT/QED/AnomalyCancellation/ConstAbs.lean b/Physlib/QFT/QED/AnomalyCancellation/ConstAbs.lean index 13008404c..660d09e74 100644 --- a/Physlib/QFT/QED/AnomalyCancellation/ConstAbs.lean +++ b/Physlib/QFT/QED/AnomalyCancellation/ConstAbs.lean @@ -41,8 +41,7 @@ lemma constAbs_perm (S : (PureU1 n).Charges) (M :(FamilyPermutations n).group) : exact h2 lemma constAbs_sort {S : (PureU1 n).Charges} (CA : ConstAbs S) : ConstAbs (sort S) := by - rw [sort] - exact (constAbs_perm S _).mpr CA + simpa [sort] using (constAbs_perm S _).mpr CA /-- The condition for a set of charges to be `sorted`, and have `constAbs`-/ def ConstAbsSorted (S : (PureU1 n).Charges) : Prop := ConstAbs S ∧ Sorted S @@ -63,10 +62,8 @@ lemma lt_eq {k i : Fin n.succ} (hk : S k ≤ 0) (hik : i ≤ k) : S i = S k := b · linarith include hS in -lemma val_le_zero {i : Fin n.succ} (hi : S i ≤ 0) : S i = S (0 : Fin n.succ) := by - symm - apply lt_eq hS hi - exact Fin.zero_le i +lemma val_le_zero {i : Fin n.succ} (hi : S i ≤ 0) : S i = S (0 : Fin n.succ) := + (lt_eq hS hi (Fin.zero_le i)).symm include hS in lemma gt_eq {k i: Fin n.succ} (hk : 0 ≤ S k) (hik : k ≤ i) : S i = S k := by @@ -115,8 +112,7 @@ lemma boundary_succ {k : Fin n} (hk : Boundary S k) : S k.succ = - S (0 : Fin n. rw [opposite_signs_eq_neg hS (le_of_lt hk.left) (le_of_lt hk.right)] at hn linear_combination -(1 * hn) -lemma boundary_split (k : Fin n) : k.succ.val + (n.succ - k.succ.val) = n.succ := by - omega +lemma boundary_split (k : Fin n) : k.succ.val + (n.succ - k.succ.val) = n.succ := by omega set_option backward.isDefEq.respectTransparency false in lemma boundary_accGrav' (k : Fin n) : accGrav n.succ S = @@ -131,8 +127,7 @@ set_option backward.isDefEq.respectTransparency false in include hS in lemma boundary_accGrav'' (k : Fin n) (hk : Boundary S k) : accGrav n.succ S = (2 * ↑↑k + 1 - ↑n) * S (0 : Fin n.succ) := by - rw [boundary_accGrav' k] - rw [Fin.sum_univ_add] + rw [boundary_accGrav' k, Fin.sum_univ_add] have hfst (i : Fin k.succ.val) : S (Fin.cast (boundary_split k) (Fin.castAdd (n.succ - k.succ.val) i)) = S k.castSucc := by apply lt_eq hS (le_of_lt hk.left) (Fin.is_le i) @@ -207,9 +202,8 @@ lemma AFL_odd_zero {A : (PureU1 (2 * n + 1)).LinSols} (h : ConstAbsSorted A.val) 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 - apply ACCSystemLinear.LinSols.ext - exact is_zero h (AFL_odd_zero h) + A = 0 := + ACCSystemLinear.LinSols.ext (is_zero h (AFL_odd_zero h)) lemma AFL_even_Boundary {A : (PureU1 (2 * n.succ)).LinSols} (h : ConstAbsSorted A.val) (hA : A.val (0 : Fin (2 * n.succ)) ≠ 0) {k : Fin (2 * n + 1)} (hk : Boundary A.val k) : @@ -232,16 +226,14 @@ lemma AFL_even_below' {A : (PureU1 (2 * n.succ)).LinSols} (h : ConstAbsSorted A. apply lt_eq h (le_of_lt hk.left) rw [Fin.le_def] simp only [Fin.val_cast, Fin.val_castAdd, mul_eq, Fin.val_castSucc] - rw [AFL_even_Boundary h hA hk] - exact Fin.is_le i + simpa [AFL_even_Boundary h hA hk] using Fin.is_le i lemma AFL_even_below (A : (PureU1 (2 * n.succ)).LinSols) (h : ConstAbsSorted A.val) (i : Fin n.succ) : A.val (Fin.cast (split_equal n.succ) (Fin.castAdd n.succ i)) = A.val (0 : Fin (2*n.succ)) := by by_cases hA : A.val (0 : Fin (2*n.succ)) = 0 - · rw [is_zero h hA] - rfl + · exact (congrFun (is_zero h hA) _).trans hA.symm · exact AFL_even_below' h hA i lemma AFL_even_above' {A : (PureU1 (2 * n.succ)).LinSols} (h : ConstAbsSorted A.val) @@ -253,8 +245,7 @@ lemma AFL_even_above' {A : (PureU1 (2 * n.succ)).LinSols} (h : ConstAbsSorted A. apply gt_eq h (le_of_lt hk.right) rw [Fin.le_def] simp only [mul_eq, Fin.val_succ, Fin.val_cast, Fin.val_natAdd] - rw [AFL_even_Boundary h hA hk] - exact Nat.le_add_right (n + 1) ↑i + simp [AFL_even_Boundary h hA hk] lemma AFL_even_above (A : (PureU1 (2 * n.succ)).LinSols) (h : ConstAbsSorted A.val) (i : Fin n.succ) : diff --git a/Physlib/QFT/QED/AnomalyCancellation/Even/BasisLinear.lean b/Physlib/QFT/QED/AnomalyCancellation/Even/BasisLinear.lean index aed41de11..45965bc82 100644 --- a/Physlib/QFT/QED/AnomalyCancellation/Even/BasisLinear.lean +++ b/Physlib/QFT/QED/AnomalyCancellation/Even/BasisLinear.lean @@ -152,8 +152,7 @@ lemma sum_even (S : Fin (2 * n.succ) → ℚ) : -/ -lemma n_cond₂ (n : ℕ) : 1 + ((n + n) + 1) = 2 * n.succ := by - linarith +lemma n_cond₂ (n : ℕ) : 1 + ((n + n) + 1) = 2 * n.succ := by linarith /-- The inclusion of `Fin n` into `Fin (1 + (n + n + 1))` via the first `n`, casted into `Fin (2 * n.succ)`. -/ @@ -298,8 +297,7 @@ lemma basis_on_evenSnd_self (j : Fin n.succ) : basisAsCharges j (evenSnd j) = - rw [basis_evenSnd_eq_neg_evenFst, basis_on_evenFst_self] lemma basis_on_evenSnd_other {k j : Fin n.succ} (h : k ≠ j) : basisAsCharges k (evenSnd j) = 0 := by - rw [basis_evenSnd_eq_neg_evenFst, basis_on_evenFst_other h] - rfl + simp [basis_evenSnd_eq_neg_evenFst, basis_on_evenFst_other h] /-! @@ -358,11 +356,9 @@ lemma P_evenFst (f : Fin n.succ → ℚ) (j : Fin n.succ) : P f (evenFst j) = f rw [P, sum_of_charges] simp only [succ_eq_add_one, HSMul.hSMul, SMul.smul] rw [Finset.sum_eq_single j] - · rw [basis_on_evenFst_self] - exact Rat.mul_one (f j) + · simp [basis_on_evenFst_self] · intro k _ hkj - rw [basis_on_evenFst_other hkj] - exact Rat.mul_zero (f k) + exact mul_eq_zero_of_right (f k) (basis_on_evenFst_other hkj) · simp only [mem_univ, not_true_eq_false, _root_.mul_eq_zero, IsEmpty.forall_iff] lemma P_evenSnd (f : Fin n.succ → ℚ) (j : Fin n.succ) : P f (evenSnd j) = - f j := by @@ -407,8 +403,7 @@ lemma P_accCube (f : Fin n.succ → ℚ) : accCube (2 * n.succ) (P f) = 0 := by lemma P_zero (f : Fin n.succ → ℚ) (h : P f = 0) : ∀ i, f i = 0 := by intro i erw [← P_evenFst f] - rw [h] - rfl + exact congr_fun h (evenFst i) /-! @@ -422,8 +417,7 @@ def P' (f : Fin n.succ → ℚ) : (PureU1 (2 * n.succ)).LinSols := ∑ i, f i lemma P'_val (f : Fin n.succ → ℚ) : (P' f).val = P f := by simp only [succ_eq_add_one, P', P] funext i - rw [sum_of_anomaly_free_linear, sum_of_charges] - rfl + exact (sum_of_anomaly_free_linear _ i).trans (sum_of_charges _ i).symm /-! @@ -461,8 +455,7 @@ lemma vectorLikeEven_in_span (S : (PureU1 (2 * n.succ)).LinSols) erw [P'_val] apply ext_even · intro i - rw [P_evenFst] - rfl + exact P_evenFst f i · intro i rw [P_evenSnd] have ht := hS i @@ -470,8 +463,7 @@ lemma vectorLikeEven_in_span (S : (PureU1 (2 * n.succ)).LinSols) have h : sort S.val (evenSnd i) = - sort S.val (evenFst i) := by rw [ht] ring - rw [h] - rfl + exact h.symm /-! @@ -550,8 +542,7 @@ lemma basis!_on_evenShiftSnd_self (j : Fin n) : basis!AsCharges j (evenShiftSnd lemma basis!_on_evenShiftSnd_other {k j : Fin n} (h : k ≠ j) : basis!AsCharges k (evenShiftSnd j) = 0 := by - rw [basis!_evenShftSnd_eq_neg_evenShiftFst, basis!_on_evenShiftFst_other h] - rfl + simp [basis!_evenShftSnd_eq_neg_evenShiftFst, basis!_on_evenShiftFst_other h] set_option backward.isDefEq.respectTransparency false in lemma basis!_on_evenShiftZero (j : Fin n) : basis!AsCharges j evenShiftZero = 0 := by @@ -601,8 +592,7 @@ lemma basis!_linearACC (j : Fin n) : (accGrav (2 * n.succ)) (basis!AsCharges j) lemma basis!_accCube (j : Fin n) : accCube (2 * n.succ) (basis!AsCharges j) = 0 := by - rw [accCube_explicit, sum_evenShift] - rw [basis!_on_evenShiftLast, basis!_on_evenShiftZero] + rw [accCube_explicit, sum_evenShift, basis!_on_evenShiftLast, basis!_on_evenShiftZero] simp only [ne_eq, OfNat.ofNat_ne_zero, not_false_eq_true, zero_pow, add_zero, Function.comp_apply, zero_add] apply Finset.sum_eq_zero @@ -643,22 +633,18 @@ lemma P!_evenShiftFst (f : Fin n → ℚ) (j : Fin n) : P! f (evenShiftFst j) = rw [P!, sum_of_charges] simp only [HSMul.hSMul, SMul.smul] rw [Finset.sum_eq_single j] - · rw [basis!_on_evenShiftFst_self] - exact Rat.mul_one (f j) + · simp [basis!_on_evenShiftFst_self] · intro k _ hkj - rw [basis!_on_evenShiftFst_other hkj] - exact Rat.mul_zero (f k) + exact mul_eq_zero_of_right (f k) (basis!_on_evenShiftFst_other hkj) · simp only [mem_univ, not_true_eq_false, _root_.mul_eq_zero, IsEmpty.forall_iff] lemma P!_evenShiftSnd (f : Fin n → ℚ) (j : Fin n) : P! f (evenShiftSnd j) = - f j := by rw [P!, sum_of_charges] simp only [HSMul.hSMul, SMul.smul] rw [Finset.sum_eq_single j] - · rw [basis!_on_evenShiftSnd_self] - exact mul_neg_one (f j) + · simp [basis!_on_evenShiftSnd_self] · intro k _ hkj - rw [basis!_on_evenShiftSnd_other hkj] - exact Rat.mul_zero (f k) + exact mul_eq_zero_of_right (f k) (basis!_on_evenShiftSnd_other hkj) · simp lemma P!_evenShiftZero (f : Fin n → ℚ) : P! f (evenShiftZero) = 0 := by @@ -693,8 +679,7 @@ lemma P!_accCube (f : Fin n → ℚ) : accCube (2 * n.succ) (P! f) = 0 := by lemma P!_zero (f : Fin n → ℚ) (h : P! f = 0) : ∀ i, f i = 0 := by intro i rw [← P!_evenShiftFst f] - rw [h] - rfl + exact congr_fun h (evenShiftFst i) /-! @@ -719,8 +704,7 @@ def P!' (f : Fin n → ℚ) : (PureU1 (2 * n.succ)).LinSols := ∑ i, f i • ba lemma P!'_val (f : Fin n → ℚ) : (P!' f).val = P! f := by simp only [succ_eq_add_one, P!', P!] funext i - rw [sum_of_anomaly_free_linear, sum_of_charges] - rfl + exact (sum_of_anomaly_free_linear _ i).trans (sum_of_charges _ i).symm /-! @@ -917,8 +901,7 @@ def Pa' (f : (Fin n.succ) ⊕ (Fin n) → ℚ) : (PureU1 (2 * n.succ)).LinSols : ∑ i, f i • basisa i lemma Pa'_P'_P!' (f : (Fin n.succ) ⊕ (Fin n) → ℚ) : - Pa' f = P' (f ∘ Sum.inl) + P!' (f ∘ Sum.inr) := by - exact Fintype.sum_sum_type _ + Pa' f = P' (f ∘ Sum.inl) + P!' (f ∘ Sum.inr) := Fintype.sum_sum_type _ /-! @@ -956,9 +939,7 @@ lemma Pa'_eq (f f' : (Fin n.succ) ⊕ (Fin n) → ℚ) : Pa' f = Pa' f' ↔ f = · rw [Pa', Pa'] at h have h1 : ∑ i : Fin (succ n) ⊕ Fin n, (f i + (- f' i)) • basisa i = 0 := by simp only [add_smul, neg_smul] - rw [Finset.sum_add_distrib] - rw [h] - rw [← Finset.sum_add_distrib] + rw [Finset.sum_add_distrib, h, ← Finset.sum_add_distrib] simp have h2 : ∀ i, (f i + (- f' i)) = 0 := by exact Fintype.linearIndependent_iff.mp (@basisa_linear_independent n) @@ -979,8 +960,7 @@ lemma Pa'_elim_eq_iff (g g' : Fin n.succ → ℚ) (f f' : Fin n → ℚ) : lemma Pa_eq (g g' : Fin n.succ → ℚ) (f f' : Fin n → ℚ) : Pa g f = Pa g' f' ↔ g = g' ∧ f = f' := by - rw [← Pa'_elim_eq_iff, ← Sum.elim_eq_iff] - exact Pa'_eq _ _ + simpa [← Pa'_elim_eq_iff, ← Sum.elim_eq_iff] using Pa'_eq _ _ /-! @@ -1036,10 +1016,8 @@ lemma span_basis_swap! {S : (PureU1 (2 * n.succ)).LinSols} (j : Fin n) S'.val = P g' + P! f' ∧ P! f' = P! f + (S.val (evenShiftSnd j) - S.val (evenShiftFst j)) • basis!AsCharges j ∧ g' = g := by let X := P! f + (S.val (evenShiftSnd j) - S.val (evenShiftFst j)) • basis!AsCharges j - have hX : X ∈ Submodule.span ℚ (Set.range (basis!AsCharges)) := by - apply Submodule.add_mem - exact (P!_in_span f) - exact (smul_basis!AsCharges_in_span S j) + have hX : X ∈ Submodule.span ℚ (Set.range (basis!AsCharges)) := + Submodule.add_mem _ (P!_in_span f) (smul_basis!AsCharges_in_span S j) have hXsum := (Submodule.mem_span_range_iff_exists_fun ℚ).mp hX obtain ⟨f', hf'⟩ := hXsum use g @@ -1047,9 +1025,7 @@ lemma span_basis_swap! {S : (PureU1 (2 * n.succ)).LinSols} (j : Fin n) change P! f' = _ at hf' erw [hf'] simp only [and_self, and_true, X] - rw [← add_assoc, ← h] - apply swap!_as_add at hS - exact hS + simpa [← add_assoc, ← h] using swap!_as_add j hS end VectorLikeEvenPlane diff --git a/Physlib/QFT/QED/AnomalyCancellation/Even/Parameterization.lean b/Physlib/QFT/QED/AnomalyCancellation/Even/Parameterization.lean index 5c469ac08..db61c4261 100644 --- a/Physlib/QFT/QED/AnomalyCancellation/Even/Parameterization.lean +++ b/Physlib/QFT/QED/AnomalyCancellation/Even/Parameterization.lean @@ -108,8 +108,7 @@ lemma generic_or_special (S : (PureU1 (2 * n.succ)).Sols) : GenericCase S ∨ SpecialCase S := by obtain ⟨g, f, h⟩ := span_basis S.1.1 have h1 : accCubeTriLinSymm (P g) (P g) (P! f) ≠ 0 ∨ - accCubeTriLinSymm (P g) (P g) (P! f) = 0 := by - exact ne_or_eq _ _ + accCubeTriLinSymm (P g) (P g) (P! f) = 0 := ne_or_eq _ _ rcases h1 with h1 | h1 · exact Or.inl (genericCase_exists S ⟨g, f, h, h1⟩) · exact Or.inr (specialCase_exists S ⟨g, f, h, h1⟩) @@ -121,8 +120,7 @@ theorem generic_case {S : (PureU1 (2 * n.succ)).Sols} (h : GenericCase S) : rw [parameterization] apply ACCSystem.Sols.ext rw [parameterizationAsLinear_val] - rw [anomalyFree_param _ _ hS] - rw [neg_neg, ← smul_add, smul_smul, inv_mul_cancel₀, one_smul] + rw [anomalyFree_param _ _ hS, neg_neg, ← smul_add, smul_smul, inv_mul_cancel₀, one_smul] · exact hS · have h := h g f hS rw [anomalyFree_param _ _ hS] at h diff --git a/Physlib/QFT/QED/AnomalyCancellation/Odd/BasisLinear.lean b/Physlib/QFT/QED/AnomalyCancellation/Odd/BasisLinear.lean index b1e743abf..2323ae1d6 100644 --- a/Physlib/QFT/QED/AnomalyCancellation/Odd/BasisLinear.lean +++ b/Physlib/QFT/QED/AnomalyCancellation/Odd/BasisLinear.lean @@ -106,8 +106,7 @@ section theDeltas -/ -lemma odd_shift_eq (n : ℕ) : (1 + n) + n = 2 * n +1 := by - omega +lemma odd_shift_eq (n : ℕ) : (1 + n) + n = 2 * n +1 := by omega /-- The inclusion of `Fin n` into `Fin ((n + 1) + n)` via the first `n`. This is then casted to `Fin (2 * n + 1)`. -/ @@ -131,12 +130,10 @@ lemma sum_odd (S : Fin (2 * n + 1) → ℚ) : · intro i simp only [mem_univ, Fin.symm_castOrderIso, RelIso.coe_fn_toEquiv] · exact fun _ _ => rfl - rw [h1] - rw [Fin.sum_univ_add, Fin.sum_univ_add] + rw [h1, Fin.sum_univ_add, Fin.sum_univ_add] simp only [univ_unique, Fin.default_eq_zero, Fin.isValue, sum_singleton, Function.comp_apply] nth_rewrite 2 [add_comm] - rw [add_assoc] - rw [Finset.sum_add_distrib] + rw [add_assoc, Finset.sum_add_distrib] rfl /-! @@ -178,8 +175,7 @@ lemma sum_oddShift (S : Fin (2 * n + 1) → ℚ) : -/ -lemma odd_shift_shift_eq (n : ℕ) : ((1+n)+1) + n.succ = 2 * n.succ + 1 := by - omega +lemma odd_shift_shift_eq (n : ℕ) : ((1+n)+1) + n.succ = 2 * n.succ + 1 := by omega /-- The element representing the first `1` in `Fin (1 + n + 1 + n.succ)` casted to `Fin (2 * n.succ + 1)`. -/ @@ -219,8 +215,7 @@ lemma oddShiftShiftFst_eq_oddFst_succ (j : Fin n) : exact Nat.add_comm 1 ↑j lemma oddShiftShiftFst_eq_oddShiftFst_castSucc (j : Fin n) : - oddShiftShiftFst j = oddShiftFst j.castSucc := by - rfl + oddShiftShiftFst j = oddShiftFst j.castSucc := rfl lemma oddShiftShiftMid_eq_oddMid : @oddShiftShiftMid n = oddMid := by rw [Fin.ext_iff] @@ -228,17 +223,14 @@ lemma oddShiftShiftMid_eq_oddMid : @oddShiftShiftMid n = oddMid := by Fin.val_natAdd, Fin.val_eq_zero, add_zero, oddMid] exact Nat.add_comm 1 n -lemma oddShiftShiftMid_eq_oddShiftFst_last : oddShiftShiftMid = oddShiftFst (Fin.last n) := by - rfl +lemma oddShiftShiftMid_eq_oddShiftFst_last : oddShiftShiftMid = oddShiftFst (Fin.last n) := rfl lemma oddShiftShiftSnd_eq_oddSnd (j : Fin n.succ) : oddShiftShiftSnd j = oddSnd j := by rw [Fin.ext_iff] simp only [succ_eq_add_one, oddShiftShiftSnd, Fin.val_cast, Fin.val_natAdd, oddSnd, add_left_inj] exact Nat.add_comm 1 n -lemma oddShiftShiftSnd_eq_oddShiftSnd (j : Fin n.succ) : oddShiftShiftSnd j = oddShiftSnd j := by - rw [Fin.ext_iff] - rfl +lemma oddShiftShiftSnd_eq_oddShiftSnd (j : Fin n.succ) : oddShiftShiftSnd j = oddShiftSnd j := rfl lemma oddSnd_eq_oddShiftSnd (j : Fin n) : oddSnd j = oddShiftSnd j := by rw [Fin.ext_iff] @@ -296,8 +288,7 @@ def basisAsCharges (j : Fin n) : (PureU1 (2 * n + 1)).Charges := -/ -lemma basis_on_oddFst_self (j : Fin n) : basisAsCharges j (oddFst j) = 1 := by - simp [basisAsCharges] +lemma basis_on_oddFst_self (j : Fin n) : basisAsCharges j (oddFst j) = 1 := by simp [basisAsCharges] set_option backward.isDefEq.respectTransparency false in lemma basis_on_oddFst_other {k j : Fin n} (h : k ≠ j) : @@ -349,8 +340,7 @@ lemma basis_on_oddSnd_self (j : Fin n) : basisAsCharges j (oddSnd j) = - 1 := by rw [basis_oddSnd_eq_minus_oddFst, basis_on_oddFst_self] lemma basis_on_oddSnd_other {k j : Fin n} (h : k ≠ j) : basisAsCharges k (oddSnd j) = 0 := by - rw [basis_oddSnd_eq_minus_oddFst, basis_on_oddFst_other h] - rfl + simp [basis_oddSnd_eq_minus_oddFst, basis_on_oddFst_other h] set_option backward.isDefEq.respectTransparency false in lemma basis_on_oddMid (j : Fin n) : basisAsCharges j oddMid = 0 := by @@ -412,22 +402,18 @@ lemma P_oddFst (f : Fin n → ℚ) (j : Fin n) : P f (oddFst j) = f j := by rw [P, sum_of_charges] simp only [HSMul.hSMul, SMul.smul] rw [Finset.sum_eq_single j] - · rw [basis_on_oddFst_self] - exact Rat.mul_one (f j) + · simp [basis_on_oddFst_self] · intro k _ hkj - rw [basis_on_oddFst_other hkj] - exact Rat.mul_zero (f k) + exact mul_eq_zero_of_right (f k) (basis_on_oddFst_other hkj) · simp only [mem_univ, not_true_eq_false, _root_.mul_eq_zero, IsEmpty.forall_iff] lemma P_oddSnd (f : Fin n → ℚ) (j : Fin n) : P f (oddSnd j) = - f j := by rw [P, sum_of_charges] simp only [HSMul.hSMul, SMul.smul] rw [Finset.sum_eq_single j] - · rw [basis_on_oddSnd_self] - exact mul_neg_one (f j) + · simp [basis_on_oddSnd_self] · intro k _ hkj - rw [basis_on_oddSnd_other hkj] - exact Rat.mul_zero (f k) + exact mul_eq_zero_of_right (f k) (basis_on_oddSnd_other hkj) · simp lemma P_oddMid (f : Fin n → ℚ) : P f oddMid = 0 := by @@ -463,8 +449,7 @@ lemma P_accCube (f : Fin n → ℚ) : accCube (2 * n +1) (P f) = 0 := by lemma P_zero (f : Fin n → ℚ) (h : P f = 0) : ∀ i, f i = 0 := by intro i erw [← P_oddFst f] - rw [h] - rfl + exact congr_fun h (oddFst i) /-- A point in the span of the first part of the basis. -/ def P' (f : Fin n → ℚ) : (PureU1 (2 * n + 1)).LinSols := ∑ i, f i • basis i @@ -472,8 +457,7 @@ def P' (f : Fin n → ℚ) : (PureU1 (2 * n + 1)).LinSols := ∑ i, f i • basi lemma P'_val (f : Fin n → ℚ) : (P' f).val = P f := by simp only [P', P] funext i - rw [sum_of_anomaly_free_linear, sum_of_charges] - rfl + exact (sum_of_anomaly_free_linear _ i).trans (sum_of_charges _ i).symm /-! @@ -535,13 +519,12 @@ lemma basis!_on_oddShiftFst_other {k j : Fin n} (h : k ≠ j) : simp_all rw [Fin.ext_iff] at h simp_all - · split - · rename_i h1 h2 - simp_all - rw [Fin.ext_iff] at h2 - simp only [Fin.val_castAdd, Fin.val_natAdd] at h2 - omega - rfl + · split <;> try rfl + rename_i h1 h2 + simp_all + rw [Fin.ext_iff] at h2 + simp only [Fin.val_castAdd, Fin.val_natAdd] at h2 + omega set_option backward.isDefEq.respectTransparency false in lemma basis!_on_other {k : Fin n} {j : Fin (2 * n + 1)} @@ -573,8 +556,7 @@ lemma basis!_on_oddShiftSnd_self (j : Fin n) : basis!AsCharges j (oddShiftSnd j) lemma basis!_on_oddShiftSnd_other {k j : Fin n} (h : k ≠ j) : basis!AsCharges k (oddShiftSnd j) = 0 := by - rw [basis!_oddShiftSnd_eq_minus_oddShiftFst, basis!_on_oddShiftFst_other h] - rfl + simp [basis!_oddShiftSnd_eq_minus_oddShiftFst, basis!_on_oddShiftFst_other h] set_option backward.isDefEq.respectTransparency false in lemma basis!_on_oddShiftZero (j : Fin n) : basis!AsCharges j oddShiftZero = 0 := by @@ -661,22 +643,18 @@ lemma P!_oddShiftFst (f : Fin n → ℚ) (j : Fin n) : P! f (oddShiftFst j) = f rw [P!, sum_of_charges] simp only [HSMul.hSMul, SMul.smul] rw [Finset.sum_eq_single j] - · rw [basis!_on_oddShiftFst_self] - exact Rat.mul_one (f j) + · simp [basis!_on_oddShiftFst_self] · intro k _ hkj - rw [basis!_on_oddShiftFst_other hkj] - exact Rat.mul_zero (f k) + exact mul_eq_zero_of_right (f k) (basis!_on_oddShiftFst_other hkj) · simp only [mem_univ, not_true_eq_false, _root_.mul_eq_zero, IsEmpty.forall_iff] lemma P!_oddShiftSnd (f : Fin n → ℚ) (j : Fin n) : P! f (oddShiftSnd j) = - f j := by rw [P!, sum_of_charges] simp only [HSMul.hSMul, SMul.smul] rw [Finset.sum_eq_single j] - · rw [basis!_on_oddShiftSnd_self] - exact mul_neg_one (f j) + · simp [basis!_on_oddShiftSnd_self] · intro k _ hkj - rw [basis!_on_oddShiftSnd_other hkj] - exact Rat.mul_zero (f k) + exact mul_eq_zero_of_right (f k) (basis!_on_oddShiftSnd_other hkj) · simp lemma P!_oddShiftZero (f : Fin n → ℚ) : P! f oddShiftZero = 0 := by @@ -712,8 +690,7 @@ lemma P!_accCube (f : Fin n → ℚ) : accCube (2 * n +1) (P! f) = 0 := by lemma P!_zero (f : Fin n → ℚ) (h : P! f = 0) : ∀ i, f i = 0 := by intro i rw [← P!_oddShiftFst f] - rw [h] - rfl + exact congr_fun h (oddShiftFst i) /-! @@ -727,8 +704,7 @@ def P!' (f : Fin n → ℚ) : (PureU1 (2 * n + 1)).LinSols := ∑ i, f i • bas lemma P!'_val (f : Fin n → ℚ) : (P!' f).val = P! f := by simp only [P!', P!] funext i - rw [sum_of_anomaly_free_linear, sum_of_charges] - rfl + exact (sum_of_anomaly_free_linear _ i).trans (sum_of_charges _ i).symm /-! @@ -878,8 +854,7 @@ def Pa' (f : (Fin n) ⊕ (Fin n) → ℚ) : (PureU1 (2 * n + 1)).LinSols := ∑ i, f i • basisa i lemma Pa'_P'_P!' (f : (Fin n) ⊕ (Fin n) → ℚ) : - Pa' f = P' (f ∘ Sum.inl) + P!' (f ∘ Sum.inr) := by - exact Fintype.sum_sum_type _ + Pa' f = P' (f ∘ Sum.inl) + P!' (f ∘ Sum.inr) := Fintype.sum_sum_type _ /-! @@ -942,9 +917,7 @@ lemma Pa'_elim_eq_iff (g g' : Fin n.succ → ℚ) (f f' : Fin n.succ → ℚ) : lemma Pa_eq (g g' : Fin n.succ → ℚ) (f f' : Fin n.succ → ℚ) : Pa g f = Pa g' f' ↔ g = g' ∧ f = f' := by - rw [← Pa'_elim_eq_iff] - rw [← Sum.elim_eq_iff] - exact Pa'_eq _ _ + simpa [← Pa'_elim_eq_iff, ← Sum.elim_eq_iff] using Pa'_eq _ _ /-! @@ -1011,10 +984,8 @@ lemma span_basis_swap! {S : (PureU1 (2 * n.succ + 1)).LinSols} (j : Fin n.succ) apply SetLike.mem_of_subset apply Submodule.subset_span simp_all only [Set.mem_range, exists_apply_eq_apply] - have hX : X ∈ Submodule.span ℚ (Set.range (basis!AsCharges)) := by - apply Submodule.add_mem - exact hf - exact hP + have hX : X ∈ Submodule.span ℚ (Set.range (basis!AsCharges)) := + Submodule.add_mem _ hf hP have hXsum := (Submodule.mem_span_range_iff_exists_fun ℚ).mp hX obtain ⟨f', hf'⟩ := hXsum use g @@ -1022,9 +993,7 @@ lemma span_basis_swap! {S : (PureU1 (2 * n.succ + 1)).LinSols} (j : Fin n.succ) change P! f' = _ at hf' erw [hf'] simp only [and_self, and_true, X] - rw [← add_assoc, ← hS1] - apply swap!_as_add at hS - exact hS + simpa [← add_assoc, ← hS1] using swap!_as_add j hS end VectorLikeOddPlane diff --git a/Physlib/QFT/QED/AnomalyCancellation/Odd/Parameterization.lean b/Physlib/QFT/QED/AnomalyCancellation/Odd/Parameterization.lean index 567fbb4a6..38489f821 100644 --- a/Physlib/QFT/QED/AnomalyCancellation/Odd/Parameterization.lean +++ b/Physlib/QFT/QED/AnomalyCancellation/Odd/Parameterization.lean @@ -46,9 +46,7 @@ set_option backward.isDefEq.respectTransparency false in lemma parameterizationCharge_cube (g f : Fin n → ℚ) (a : ℚ) : accCube (2 * n + 1) (parameterizationAsLinear g f a).val = 0 := by change accCubeTriLinSymm.toCubic _ = 0 - rw [parameterizationAsLinear_val] - rw [HomogeneousCubic.map_smul] - rw [TriLinearSymm.toCubic_add] + rw [parameterizationAsLinear_val, HomogeneousCubic.map_smul, TriLinearSymm.toCubic_add] rw [HomogeneousCubic.map_smul, HomogeneousCubic.map_smul] erw [P_accCube g, P!_accCube f] rw [accCubeTriLinSymm.map_smul₁, accCubeTriLinSymm.map_smul₂, @@ -110,8 +108,7 @@ lemma generic_or_special (S : (PureU1 (2 * n.succ + 1)).Sols) : GenericCase S ∨ SpecialCase S := by obtain ⟨g, f, h⟩ := span_basis S.1.1 have h1 : accCubeTriLinSymm (P g) (P g) (P! f) ≠ 0 ∨ - accCubeTriLinSymm (P g) (P g) (P! f) = 0 := by - exact ne_or_eq _ _ + accCubeTriLinSymm (P g) (P g) (P! f) = 0 := ne_or_eq _ _ cases h1 <;> rename_i h1 · exact Or.inl (genericCase_exists S ⟨g, f, h, h1⟩) · exact Or.inr (specialCase_exists S ⟨g, f, h, h1⟩) diff --git a/Physlib/QFT/QED/AnomalyCancellation/Permutations.lean b/Physlib/QFT/QED/AnomalyCancellation/Permutations.lean index 221f1e0bc..4041e08bc 100644 --- a/Physlib/QFT/QED/AnomalyCancellation/Permutations.lean +++ b/Physlib/QFT/QED/AnomalyCancellation/Permutations.lean @@ -80,13 +80,11 @@ def FamilyPermutations (n : ℕ) : ACCSystemGroupAction (PureU1 n) where lemma FamilyPermutations_charges_apply (S : (PureU1 n).Charges) (i : Fin n) (f : (FamilyPermutations n).group) : - ((FamilyPermutations n).rep f S) i = S (f.invFun i) := by - rfl + ((FamilyPermutations n).rep f S) i = S (f.invFun i) := rfl lemma FamilyPermutations_anomalyFreeLinear_apply (S : (PureU1 n).LinSols) (i : Fin n) (f : (FamilyPermutations n).group) : - ((FamilyPermutations n).linSolRep f S).val i = S.val (f.invFun i) := by - rfl + ((FamilyPermutations n).linSolRep f S).val i = S.val (f.invFun i) := rfl /-- A permutation of fermions which takes one ordered subset into another. -/ noncomputable def permOfInjection (f g : Fin m ↪ Fin n) : (FamilyPermutations n).group := @@ -101,8 +99,7 @@ def permTwoInj : Fin 2 ↪ Fin n where toFun s := match s with | 0 => i | 1 => j - inj' s1 s2 := by - aesop + inj' s1 s2 := by aesop lemma permTwoInj_fst : i ∈ Set.range ⇑(permTwoInj hij) := by simp only [Set.mem_range] @@ -158,8 +155,7 @@ def permThreeInj : Fin 3 ↪ Fin n where | 0 => i | 1 => j | 2 => k - inj' s1 s2 := by - aesop + inj' s1 s2 := by aesop lemma permThreeInj_fst : i ∈ Set.range ⇑(permThreeInj hij hjk hik) := by simp only [Set.mem_range] diff --git a/Physlib/QFT/QED/AnomalyCancellation/Sorts.lean b/Physlib/QFT/QED/AnomalyCancellation/Sorts.lean index e28cd3136..5befe83f3 100644 --- a/Physlib/QFT/QED/AnomalyCancellation/Sorts.lean +++ b/Physlib/QFT/QED/AnomalyCancellation/Sorts.lean @@ -43,8 +43,7 @@ lemma sort_perm {n : ℕ} (S : (PureU1 n).Charges) (M :(FamilyPermutations n).gr @Tuple.comp_perm_comp_sort_eq_comp_sort n ℚ _ S M⁻¹ lemma sort_apply {n : ℕ} (S : (PureU1 n).Charges) (j : Fin n) : - sort S j = S ((Tuple.sort S) j) := by - rfl + sort S j = S ((Tuple.sort S) j) := rfl lemma sort_zero {n : ℕ} (S : (PureU1 n).Charges) (hS : sort S = 0) : S = 0 := by funext i @@ -55,8 +54,7 @@ lemma sort_zero {n : ℕ} (S : (PureU1 n).Charges) (hS : sort S = 0) : S = 0 := have hi := hj ((Tuple.sort S).invFun i) rw [sort_apply] at hi simp only [Equiv.invFun_as_coe, Equiv.apply_symm_apply] at hi - rw [hi] - rfl + exact hi lemma sort_projection {n : ℕ} (S : (PureU1 n).Charges) : sort (sort S) = sort S := sort_perm S (Tuple.sort S).symm @@ -65,15 +63,13 @@ lemma sort_projection {n : ℕ} (S : (PureU1 n).Charges) : sort (sort S) = sort def sortAFL {n : ℕ} (S : (PureU1 n).LinSols) : (PureU1 n).LinSols := ((FamilyPermutations n).linSolRep (Tuple.sort S.val).symm S) -lemma sortAFL_val {n : ℕ} (S : (PureU1 n).LinSols) : (sortAFL S).val = sort S.val := by - rfl +lemma sortAFL_val {n : ℕ} (S : (PureU1 n).LinSols) : (sortAFL S).val = sort S.val := rfl lemma sortAFL_zero {n : ℕ} (S : (PureU1 n).LinSols) (hS : sortAFL S = 0) : S = 0 := by apply ACCSystemLinear.LinSols.ext have h1 : sort S.val = 0 := by rw [← sortAFL_val] - rw [hS] - rfl + exact congrArg ACCSystemLinear.LinSols.val hS exact sort_zero S.val h1 end PureU1 diff --git a/Physlib/QuantumMechanics/DDimensions/Basic.lean b/Physlib/QuantumMechanics/DDimensions/Basic.lean index 3c7f22b3a..cad943ed4 100644 --- a/Physlib/QuantumMechanics/DDimensions/Basic.lean +++ b/Physlib/QuantumMechanics/DDimensions/Basic.lean @@ -114,8 +114,7 @@ lemma potentialCLM_apply (h_HTG : Q.potential.HasTemperateGrowth) (ψ : 𝓢(Spa @[simp] lemma potentialCLM_apply_apply (h_HTG : Q.potential.HasTemperateGrowth) (ψ : 𝓢(Space Q.d, ℂ)) (x : Space Q.d) : - Q.potentialCLM ψ x = Q.potential x • ψ x := by - rw [potentialCLM_apply h_HTG] + Q.potentialCLM ψ x = Q.potential x • ψ x := by rw [potentialCLM_apply h_HTG] /-- The potential operator as a self-adjoint, unbounded multiplication operator with domain `{ψ ∈ Q.HS | Q.potential • ψ ∈ Q.HS}`. -/ diff --git a/Physlib/QuantumMechanics/DDimensions/Hydrogen/Basic.lean b/Physlib/QuantumMechanics/DDimensions/Hydrogen/Basic.lean index 9396e875d..d5d2fa985 100644 --- a/Physlib/QuantumMechanics/DDimensions/Hydrogen/Basic.lean +++ b/Physlib/QuantumMechanics/DDimensions/Hydrogen/Basic.lean @@ -51,8 +51,7 @@ lemma potential_eq : H.potential = fun x ↦ -H.k * ‖x‖⁻¹ := H.coulomb_po @[fun_prop] lemma potential_AESM : AEStronglyMeasurable H.potential := by - rw [potential_eq] - exact AEMeasurable.aestronglyMeasurable (by fun_prop) + simpa [potential_eq] using AEMeasurable.aestronglyMeasurable (by fun_prop) @[fun_prop] lemma potential_AEM : AEMeasurable H.potential := H.potential_AESM.aemeasurable diff --git a/Physlib/QuantumMechanics/DDimensions/Hydrogen/LaplaceRungeLenzVector.lean b/Physlib/QuantumMechanics/DDimensions/Hydrogen/LaplaceRungeLenzVector.lean index 44d43347b..546cfd16f 100644 --- a/Physlib/QuantumMechanics/DDimensions/Hydrogen/LaplaceRungeLenzVector.lean +++ b/Physlib/QuantumMechanics/DDimensions/Hydrogen/LaplaceRungeLenzVector.lean @@ -448,8 +448,7 @@ private lemma sum_Lprx (d : ℕ) (ε : ℝˣ) : calc _ = 𝐋 i j ∘L (𝐩 j ∘L 𝐱 i - 𝐩 i ∘L 𝐱 j) := by simp [angularMomentumOperator_antisymm j i, comp_assoc, sub_eq_add_neg] - _ = 𝐋 i j ∘L 𝐋 i j := by - simp [momentum_comp_position_eq, symm j i, angularMomentumOperator] + _ = 𝐋 i j ∘L 𝐋 i j := by simp [momentum_comp_position_eq, symm j i, angularMomentumOperator] rw [← angularMomentumSqr_comp_radiusRegPow_commute, angularMomentumOperatorSqr] private lemma sum_rxpL (d : ℕ) (ε : ℝˣ) : diff --git a/Physlib/QuantumMechanics/DDimensions/Operators/Covariance.lean b/Physlib/QuantumMechanics/DDimensions/Operators/Covariance.lean index aa5fb91c5..39ddee379 100644 --- a/Physlib/QuantumMechanics/DDimensions/Operators/Covariance.lean +++ b/Physlib/QuantumMechanics/DDimensions/Operators/Covariance.lean @@ -62,8 +62,7 @@ def covariance : ℝ := /-- Covariance, unfolded to the real part of the centered inner product. -/ lemma covariance_eq_re_inner_centered : covariance A B ψ hψB = - (⟪centered A ψ, centered B ⟨ψ, hψB⟩⟫_ℂ).re := - rfl + (⟪centered A ψ, centered B ⟨ψ, hψB⟩⟫_ℂ).re := rfl /-- Swapping the two observables does not change the covariance. -/ lemma covariance_comm : @@ -84,8 +83,7 @@ lemma covariance_eq_re_symm_centered : ((⟪centered A ψ, centered B ⟨ψ, hψB⟩⟫_ℂ + ⟪centered B ⟨ψ, hψB⟩, centered A ψ⟫_ℂ).re) / 2 := by let z : ℂ := ⟪centered A ψ, centered B ⟨ψ, hψB⟩⟫_ℂ - have hz : ⟪centered B ⟨ψ, hψB⟩, centered A ψ⟫_ℂ = star z := by - simp [z, inner_conj_symm] + have hz : ⟪centered B ⟨ψ, hψB⟩, centered A ψ⟫_ℂ = star z := by simp [z, inner_conj_symm] rw [covariance_eq_re_inner_centered, hz] change z.re = ((z + star z).re) / 2 simp only [Complex.add_re, Complex.star_def, Complex.conj_re, add_self_div_two] diff --git a/Physlib/QuantumMechanics/DDimensions/Operators/Momentum.lean b/Physlib/QuantumMechanics/DDimensions/Operators/Momentum.lean index cd6fadb33..82531220e 100644 --- a/Physlib/QuantumMechanics/DDimensions/Operators/Momentum.lean +++ b/Physlib/QuantumMechanics/DDimensions/Operators/Momentum.lean @@ -69,8 +69,7 @@ notation "𝐩[" d' "]" => momentumCLM (d := d') lemma momentumCLM_apply_fun (ψ : 𝓢(Space d, ℂ)) : 𝐩 i ψ = (-I * ℏ) • ∂[i] ψ := rfl @[simp] -lemma momentumCLM_apply (ψ : 𝓢(Space d, ℂ)) (x : Space d) : 𝐩 i ψ x = -I * ℏ * ∂[i] ψ x := - rfl +lemma momentumCLM_apply (ψ : 𝓢(Space d, ℂ)) (x : Space d) : 𝐩 i ψ x = -I * ℏ * ∂[i] ψ x := rfl /-! diff --git a/Physlib/QuantumMechanics/DDimensions/Operators/Multiplication.lean b/Physlib/QuantumMechanics/DDimensions/Operators/Multiplication.lean index 67daf3b36..f56a9d797 100644 --- a/Physlib/QuantumMechanics/DDimensions/Operators/Multiplication.lean +++ b/Physlib/QuantumMechanics/DDimensions/Operators/Multiplication.lean @@ -294,8 +294,7 @@ lemma mulOperator_adjoint_eq_conj {f : Space d → ℂ} (hf : AEStronglyMeasurab lemma mulOperator_isSelfAdjoint_ofReal {f : Space d → ℂ} (hf : AEStronglyMeasurable f) (hf' : conj ∘ f = f) : - IsSelfAdjoint (𝓜 f) := by - rw [isSelfAdjoint_def, mulOperator_adjoint_eq_conj hf, hf'] + IsSelfAdjoint (𝓜 f) := by rw [isSelfAdjoint_def, mulOperator_adjoint_eq_conj hf, hf'] /-! ## D. Closable & unbounded diff --git a/Physlib/QuantumMechanics/DDimensions/Operators/Position.lean b/Physlib/QuantumMechanics/DDimensions/Operators/Position.lean index faf088297..01ebe70b8 100644 --- a/Physlib/QuantumMechanics/DDimensions/Operators/Position.lean +++ b/Physlib/QuantumMechanics/DDimensions/Operators/Position.lean @@ -110,14 +110,12 @@ notation "𝐫₀[" d' "]" => radiusRegPowCLM (d := d') lemma radiusRegPowCLM_apply_fun {d : ℕ} (ε : ℝˣ) (s : ℝ) (ψ : 𝓢(Space d, ℂ)) : 𝐫₀ ε s ψ = fun x ↦ (‖x‖ ^ 2 + ε ^ 2) ^ (s / 2) • ψ x := by ext x - dsimp [radiusRegPowCLM] refine smulLeftCLM_apply_apply ?_ ψ x exact HasTemperateGrowth.comp (by fun_prop) (normRegularizedPow_hasTemperateGrowth d ε s) @[simp] lemma radiusRegPowCLM_apply {d : ℕ} (ε : ℝˣ) (s : ℝ) (ψ : 𝓢(Space d, ℂ)) (x : Space d) : - 𝐫₀ ε s ψ x = (‖x‖ ^ 2 + ε ^ 2) ^ (s / 2) • ψ x := by - rw [radiusRegPowCLM_apply_fun] + 𝐫₀ ε s ψ x = (‖x‖ ^ 2 + ε ^ 2) ^ (s / 2) • ψ x := by rw [radiusRegPowCLM_apply_fun] @[simp] lemma radiusRegPowCLM_comp_eq {d : ℕ} (ε : ℝˣ) (s t : ℝ) : @@ -158,8 +156,7 @@ lemma radiusPowLM_apply_fun {d : ℕ} (s : ℝ) (ψ : 𝓢(Space d, ℂ)) : @[simp] lemma radiusPowLM_apply {d : ℕ} (s : ℝ) (ψ : 𝓢(Space d, ℂ)) (x : Space d) : - 𝐫 s ψ x = ‖x‖ ^ s • ψ x := by - rw [radiusPowLM_apply_fun] + 𝐫 s ψ x = ‖x‖ ^ s • ψ x := by rw [radiusPowLM_apply_fun] /-- `x ↦ ‖x‖ˢψ(x)` is smooth away from `x = 0`. -/ @[fun_prop] diff --git a/Physlib/QuantumMechanics/DDimensions/Operators/SpectralTheory/Basic.lean b/Physlib/QuantumMechanics/DDimensions/Operators/SpectralTheory/Basic.lean index d10a099b4..38d41d1f2 100644 --- a/Physlib/QuantumMechanics/DDimensions/Operators/SpectralTheory/Basic.lean +++ b/Physlib/QuantumMechanics/DDimensions/Operators/SpectralTheory/Basic.lean @@ -150,11 +150,10 @@ lemma isLowerBound_closure def regularityDomain (T : H →ₗ.[ℂ] H) : Set ℂ := {z : ℂ | ∃ c > 0, IsLowerBound T z c} @[simp] -lemma regularityDomain_neg (T : H →ₗ.[ℂ] H) : (-T).regularityDomain = -T.regularityDomain := by - ext z - constructor - · exact fun ⟨c, hc, h_bound⟩ ↦ ⟨c, hc, neg_neg T ▸ isLowerBound_neg h_bound⟩ - · exact fun ⟨c, hc, h_bound⟩ ↦ ⟨c, hc, neg_neg z ▸ isLowerBound_neg h_bound⟩ +lemma regularityDomain_neg (T : H →ₗ.[ℂ] H) : (-T).regularityDomain = -T.regularityDomain := + Set.ext fun z => + ⟨fun ⟨c, hc, h_bound⟩ ↦ ⟨c, hc, neg_neg T ▸ isLowerBound_neg h_bound⟩, + fun ⟨c, hc, h_bound⟩ ↦ ⟨c, hc, neg_neg z ▸ isLowerBound_neg h_bound⟩⟩ @[simp] lemma regularityDomain_smul (T : H →ₗ.[ℂ] H) {w : ℂ} (hw : w ≠ 0) : @@ -166,8 +165,7 @@ lemma regularityDomain_smul (T : H →ₗ.[ℂ] H) {w : ℂ} (hw : w ≠ 0) : · refine ⟨‖w‖⁻¹ * c, by positivity, fun x ↦ ?_⟩ rw [mul_assoc] apply (inv_mul_le_iff₀ <| norm_pos_iff.mpr hw).mpr - rw [← norm_smul, smul_sub, smul_smul, mul_inv_cancel_left₀ hw] - exact h_bound x + simpa [← norm_smul, smul_sub, smul_smul, mul_inv_cancel_left₀ hw] using h_bound x · simp [hw] · intro ⟨u, ⟨c, hc, h_bound⟩, huz⟩ refine ⟨‖w‖ * c, by positivity, fun x ↦ ?_⟩ @@ -658,8 +656,7 @@ def resolventSet (T : H →ₗ.[ℂ] H) : Set ℂ := scoped notation "ρ" => resolventSet lemma resolventSet_eq (T : H →ₗ.[ℂ] H) : - ρ T = {z | (T - z • 1).toFun.ker = ⊥ ∧ (T - z • 1).toFun.range = ⊤ ∧ Continuous (𝑅 T z)} := - rfl + ρ T = {z | (T - z • 1).toFun.ker = ⊥ ∧ (T - z • 1).toFun.range = ⊤ ∧ Continuous (𝑅 T z)} := rfl lemma mem_resolventSet_iff {T : H →ₗ.[ℂ] H} {z : ℂ} : z ∈ ρ T ↔ (T - z • 1).toFun.ker = ⊥ ∧ (T - z • 1).toFun.range = ⊤ ∧ Continuous (𝑅 T z) := @@ -783,8 +780,7 @@ def residualSpectrum (T : H →ₗ.[ℂ] H) : Set ℂ := scoped notation "σʳ" => residualSpectrum lemma residualSpectrum_eq (T : H →ₗ.[ℂ] H) : - σʳ T = {z | (T - z • 1).toFun.ker = ⊥ ∧ (T - z • 1).toFun.range ≠ ⊤ ∧ Continuous (𝑅 T z)} := - rfl + σʳ T = {z | (T - z • 1).toFun.ker = ⊥ ∧ (T - z • 1).toFun.range ≠ ⊤ ∧ Continuous (𝑅 T z)} := rfl lemma mem_residualSpectrum_iff {T : H →ₗ.[ℂ] H} {z : ℂ} : z ∈ σʳ T ↔ (T - z • 1).toFun.ker = ⊥ ∧ (T - z • 1).toFun.range ≠ ⊤ ∧ Continuous (𝑅 T z) := diff --git a/Physlib/QuantumMechanics/DDimensions/Operators/StateObservables/ExpectedValue.lean b/Physlib/QuantumMechanics/DDimensions/Operators/StateObservables/ExpectedValue.lean index e5dc6f9b0..e1f4e8459 100644 --- a/Physlib/QuantumMechanics/DDimensions/Operators/StateObservables/ExpectedValue.lean +++ b/Physlib/QuantumMechanics/DDimensions/Operators/StateObservables/ExpectedValue.lean @@ -40,8 +40,7 @@ variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] private lemma conj_inner_apply_self_eq_of_isSymmetric (T : H →ₗ.[ℂ] H) (hT : T.IsSymmetric) (ψ : T.domain) : - (starRingEnd ℂ) ⟪(ψ : H), T ψ⟫_ℂ = ⟪(ψ : H), T ψ⟫_ℂ := by - simpa [inner_conj_symm] using hT ψ ψ + (starRingEnd ℂ) ⟪(ψ : H), T ψ⟫_ℂ = ⟪(ψ : H), T ψ⟫_ℂ := by simpa [inner_conj_symm] using hT ψ ψ /-- Expectation value `re ⟪ψ, Tψ⟫_ℂ` for `ψ ∈ T.domain`. @@ -52,8 +51,7 @@ def expectedValue (T : H →ₗ.[ℂ] H) (ψ : T.domain) : ℝ := /-- The expectation value, unfolded as a real part. -/ lemma expectedValue_eq_re_inner (T : H →ₗ.[ℂ] H) (ψ : T.domain) : - expectedValue T ψ = (⟪(ψ : H), T ψ⟫_ℂ).re := - rfl + expectedValue T ψ = (⟪(ψ : H), T ψ⟫_ℂ).re := rfl /-- If `T` is symmetric, `⟪ψ, Tψ⟫_ℂ` is the expectation value, coerced to `ℂ`. -/ lemma expectedValue_eq_inner (T : H →ₗ.[ℂ] H) (hT : T.IsSymmetric) (ψ : T.domain) : @@ -74,13 +72,11 @@ def centered (T : H →ₗ.[ℂ] H) (ψ : T.domain) : H := /-- The centered vector, unfolded to its raw expression. -/ lemma centered_eq (T : H →ₗ.[ℂ] H) (ψ : T.domain) : - centered T ψ = T ψ - (expectedValue T ψ : ℂ) • (ψ : H) := - rfl + centered T ψ = T ψ - (expectedValue T ψ : ℂ) • (ψ : H) := rfl /-- A centered vector vanishes exactly when `Tψ = ⟨T⟩_ψ ψ`. -/ lemma centered_eq_zero_iff (T : H →ₗ.[ℂ] H) (ψ : T.domain) : - centered T ψ = 0 ↔ T ψ = (expectedValue T ψ : ℂ) • (ψ : H) := by - rw [centered_eq, sub_eq_zero] + centered T ψ = 0 ↔ T ψ = (expectedValue T ψ : ℂ) • (ψ : H) := by rw [centered_eq, sub_eq_zero] /-- For a unit vector and symmetric `T`, the centered vector is orthogonal to the state. -/ lemma inner_state_centered_eq_zero (T : H →ₗ.[ℂ] H) (hT : T.IsSymmetric) diff --git a/Physlib/QuantumMechanics/DDimensions/Operators/StateObservables/Variance.lean b/Physlib/QuantumMechanics/DDimensions/Operators/StateObservables/Variance.lean index 8cbf85f9f..4916268b4 100644 --- a/Physlib/QuantumMechanics/DDimensions/Operators/StateObservables/Variance.lean +++ b/Physlib/QuantumMechanics/DDimensions/Operators/StateObservables/Variance.lean @@ -52,14 +52,12 @@ def variance (T : H →ₗ.[ℂ] H) (ψ : T.domain) : ℝ := /-- The variance is the squared norm of the centered vector. -/ lemma variance_eq_centered_norm_sq (T : H →ₗ.[ℂ] H) (ψ : T.domain) : - variance T ψ = ‖centered T ψ‖ ^ 2 := - rfl + variance T ψ = ‖centered T ψ‖ ^ 2 := rfl /-- `variance` with `centered` unfolded to `Tψ - ⟨T⟩_ψ • ψ`. -/ lemma variance_eq_norm_sub_sq (T : H →ₗ.[ℂ] H) (ψ : T.domain) : variance T ψ = - ‖T ψ - (expectedValue T ψ : ℂ) • (ψ : H)‖ ^ 2 := - rfl + ‖T ψ - (expectedValue T ψ : ℂ) • (ψ : H)‖ ^ 2 := rfl /-- For symmetric `T` and `‖ψ‖ = 1`, variance equals `‖Tψ‖ ^ 2 - ⟨T⟩_ψ ^ 2`. -/ lemma variance_eq_norm_sq_sub_expectedValue_sq (T : H →ₗ.[ℂ] H) @@ -67,10 +65,8 @@ lemma variance_eq_norm_sq_sub_expectedValue_sq (T : H →ₗ.[ℂ] H) variance T ψ = ‖T ψ‖ ^ 2 - expectedValue T ψ ^ 2 := by let μ := expectedValue T ψ let a : H := T ψ - have hμ_right : ⟪(ψ : H), a⟫_ℂ = (μ : ℂ) := by - simpa [a, μ] using expectedValue_eq_inner T hT ψ - have hμ_left : ⟪a, (ψ : H)⟫_ℂ = (μ : ℂ) := by - simpa [inner_conj_symm] using congrArg star hμ_right + have hμ_right : ⟪(ψ : H), a⟫_ℂ = (μ : ℂ) := by simpa [a, μ] using expectedValue_eq_inner T hT ψ + have hμ_left : ⟪a, (ψ : H)⟫_ℂ = (μ : ℂ) := by simpa [inner_conj_symm] using congrArg star hμ_right have h_re_inner_centered : (⟪a, (μ : ℂ) • (ψ : H)⟫_ℂ).re = μ ^ 2 := by rw [inner_smul_right, hμ_left] simp [μ] @@ -88,15 +84,11 @@ lemma variance_eq_norm_sq_sub_expectedValue_sq (T : H →ₗ.[ℂ] H) /-- Variance is nonnegative. -/ lemma variance_nonneg (T : H →ₗ.[ℂ] H) (ψ : T.domain) : - 0 ≤ variance T ψ := by - rw [variance_eq_centered_norm_sq] - exact sq_nonneg _ + 0 ≤ variance T ψ := by simp [variance_eq_centered_norm_sq] /-- Zero variance is the same as a zero centered vector. -/ lemma variance_eq_zero_iff_centered_eq_zero (T : H →ₗ.[ℂ] H) (ψ : T.domain) : - variance T ψ = 0 ↔ centered T ψ = 0 := by - rw [variance_eq_centered_norm_sq] - exact sq_eq_zero_iff.trans norm_eq_zero + variance T ψ = 0 ↔ centered T ψ = 0 := by simp [variance_eq_centered_norm_sq] /-- Zero variance is the same as `Tψ = ⟨T⟩_ψ ψ`. -/ lemma variance_eq_zero_iff (T : H →ₗ.[ℂ] H) (ψ : T.domain) : @@ -126,20 +118,17 @@ def standardDeviation (T : H →ₗ.[ℂ] H) (ψ : T.domain) : ℝ := /-- The standard deviation, unfolded to the square root of the variance. -/ lemma standardDeviation_eq_sqrt_variance (T : H →ₗ.[ℂ] H) (ψ : T.domain) : - standardDeviation T ψ = Real.sqrt (variance T ψ) := - rfl + standardDeviation T ψ = Real.sqrt (variance T ψ) := rfl /-- Standard deviation is nonnegative. -/ lemma standardDeviation_nonneg (T : H →ₗ.[ℂ] H) (ψ : T.domain) : - 0 ≤ standardDeviation T ψ := by - rw [standardDeviation_eq_sqrt_variance] - exact Real.sqrt_nonneg _ + 0 ≤ standardDeviation T ψ := + Real.sqrt_nonneg _ @[simp] lemma standardDeviation_sq (T : H →ₗ.[ℂ] H) (ψ : T.domain) : standardDeviation T ψ ^ 2 = variance T ψ := by - rw [standardDeviation_eq_sqrt_variance, Real.sq_sqrt] - exact variance_nonneg T ψ + simpa [standardDeviation_eq_sqrt_variance] using Real.sq_sqrt (variance_nonneg T ψ) /-- Zero standard deviation is the same as a zero centered vector. -/ lemma standardDeviation_eq_zero_iff_centered_eq_zero (T : H →ₗ.[ℂ] H) diff --git a/Physlib/QuantumMechanics/DDimensions/Operators/Unbounded.lean b/Physlib/QuantumMechanics/DDimensions/Operators/Unbounded.lean index 0da5aa699..9096d2c80 100644 --- a/Physlib/QuantumMechanics/DDimensions/Operators/Unbounded.lean +++ b/Physlib/QuantumMechanics/DDimensions/Operators/Unbounded.lean @@ -366,8 +366,7 @@ lemma adjoint_add_le_add_adjoint [CompleteSpace H] lemma adjoint_sub_le_sub_adjoint [CompleteSpace H] (U₁ U₂ : H →ₗ.[ℂ] H') (h₁₂ : (U₁ - U₂).HasDenseDomain) : U₁† - U₂† ≤ (U₁ - U₂)† := by - simp only [sub_eq_add_neg, ← adjoint_neg] - exact adjoint_add_le_add_adjoint U₁ (-U₂) h₁₂ + simpa only [sub_eq_add_neg, ← adjoint_neg] using adjoint_add_le_add_adjoint U₁ (-U₂) h₁₂ lemma adjoint_compRestricted_le_compRestricted_adjoint [CompleteSpace H] [CompleteSpace H'] (hV : V.HasDenseDomain) (hVU : (V ∘ᵣ U).HasDenseDomain) : U† ∘ᵣ V† ≤ (V ∘ᵣ U)† := by @@ -690,9 +689,8 @@ lemma IsSelfAdjoint.isEssentiallySelfAdjoint [CompleteSpace H] (h : IsSelfAdjoin isEssentiallySelfAdjoint_def.mpr (h.isClosed.closure_eq.symm ▸ h) @[aesop safe apply] -lemma IsSelfAdjoint.adjoint [CompleteSpace H] (h : IsSelfAdjoint T) : IsSelfAdjoint T† := by - apply isSelfAdjoint_def.mp at h - exact h.symm ▸ h +lemma IsSelfAdjoint.adjoint [CompleteSpace H] (h : IsSelfAdjoint T) : IsSelfAdjoint T† := + isSelfAdjoint_def.mpr ((isSelfAdjoint_def.mp h).symm ▸ isSelfAdjoint_def.mp h) @[aesop safe apply] lemma IsSelfAdjoint.smul [CompleteSpace H] diff --git a/Physlib/QuantumMechanics/DDimensions/Operators/Uncertainty.lean b/Physlib/QuantumMechanics/DDimensions/Operators/Uncertainty.lean index 01f7556fb..aad85eae0 100644 --- a/Physlib/QuantumMechanics/DDimensions/Operators/Uncertainty.lean +++ b/Physlib/QuantumMechanics/DDimensions/Operators/Uncertainty.lean @@ -115,18 +115,14 @@ lemma raw_commutator_eq_of_symmetric (h_raw : ⟪(ψ : H), A ⟨B ⟨ψ, hψB⟩, hAB⟩ - B ⟨A ψ, hBA⟩⟫_ℂ = Complex.I * c) : ⟪A ψ, B ⟨ψ, hψB⟩⟫_ℂ - ⟪B ⟨ψ, hψB⟩, A ψ⟫_ℂ = Complex.I * c := by have ha_pairing : - ⟪A ψ, B ⟨ψ, hψB⟩⟫_ℂ = ⟪(ψ : H), A ⟨B ⟨ψ, hψB⟩, hAB⟩⟫_ℂ := by - exact hA ψ ⟨B ⟨ψ, hψB⟩, hAB⟩ + ⟪A ψ, B ⟨ψ, hψB⟩⟫_ℂ = ⟪(ψ : H), A ⟨B ⟨ψ, hψB⟩, hAB⟩⟫_ℂ := hA ψ ⟨B ⟨ψ, hψB⟩, hAB⟩ have hb_pairing : - ⟪B ⟨ψ, hψB⟩, A ψ⟫_ℂ = ⟪(ψ : H), B ⟨A ψ, hBA⟩⟫_ℂ := by - exact hB ⟨ψ, hψB⟩ ⟨A ψ, hBA⟩ + ⟪B ⟨ψ, hψB⟩, A ψ⟫_ℂ = ⟪(ψ : H), B ⟨A ψ, hBA⟩⟫_ℂ := hB ⟨ψ, hψB⟩ ⟨A ψ, hBA⟩ calc ⟪A ψ, B ⟨ψ, hψB⟩⟫_ℂ - ⟪B ⟨ψ, hψB⟩, A ψ⟫_ℂ = ⟪(ψ : H), A ⟨B ⟨ψ, hψB⟩, hAB⟩⟫_ℂ - - ⟪(ψ : H), B ⟨A ψ, hBA⟩⟫_ℂ := by - rw [ha_pairing, hb_pairing] - _ = ⟪(ψ : H), A ⟨B ⟨ψ, hψB⟩, hAB⟩ - B ⟨A ψ, hBA⟩⟫_ℂ := by - rw [inner_sub_right] + ⟪(ψ : H), B ⟨A ψ, hBA⟩⟫_ℂ := by rw [ha_pairing, hb_pairing] + _ = ⟪(ψ : H), A ⟨B ⟨ψ, hψB⟩, hAB⟩ - B ⟨A ψ, hBA⟩⟫_ℂ := by rw [inner_sub_right] _ = Complex.I * c := h_raw /-- The scalar commutator of the centered vectors of `A` and `B` in the state `ψ`. -/ @@ -245,27 +241,22 @@ lemma inner_centered_commutator_of_raw_commutator : let b : H := B ⟨ψ, hψB⟩ let μa : ℝ := expectedValue A ψ let μb : ℝ := expectedValue B ⟨ψ, hψB⟩ - have hμa_right : ⟪(ψ : H), a⟫_ℂ = (μa : ℂ) := by - simpa [a, μa] using expectedValue_eq_inner A hA ψ + have hμa_right : ⟪(ψ : H), a⟫_ℂ = (μa : ℂ) := by simpa [a, μa] using expectedValue_eq_inner A hA ψ have hμa_left : ⟪a, (ψ : H)⟫_ℂ = (μa : ℂ) := by - have h_symm : ⟪a, (ψ : H)⟫_ℂ = ⟪(ψ : H), a⟫_ℂ := by - simpa [a] using hA ψ ψ + have h_symm : ⟪a, (ψ : H)⟫_ℂ = ⟪(ψ : H), a⟫_ℂ := by simpa [a] using hA ψ ψ simpa [h_symm] using hμa_right have hμb_right : ⟪(ψ : H), b⟫_ℂ = (μb : ℂ) := by simpa [b, μb] using expectedValue_eq_inner B hB ⟨ψ, hψB⟩ have hμb_left : ⟪b, (ψ : H)⟫_ℂ = (μb : ℂ) := by - have h_symm : ⟪b, (ψ : H)⟫_ℂ = ⟪(ψ : H), b⟫_ℂ := by - simpa [b] using hB ⟨ψ, hψB⟩ ⟨ψ, hψB⟩ + have h_symm : ⟪b, (ψ : H)⟫_ℂ = ⟪(ψ : H), b⟫_ℂ := by simpa [b] using hB ⟨ψ, hψB⟩ ⟨ψ, hψB⟩ simpa [h_symm] using hμb_right calc centeredCommutatorExpectation A B ψ hψB = ⟪centered A ψ, centered B ⟨ψ, hψB⟩⟫_ℂ - - ⟪centered B ⟨ψ, hψB⟩, centered A ψ⟫_ℂ := by - rfl + ⟪centered B ⟨ψ, hψB⟩, centered A ψ⟫_ℂ := rfl _ = ⟪a - (μa : ℂ) • (ψ : H), b - (μb : ℂ) • (ψ : H)⟫_ℂ - - ⟪b - (μb : ℂ) • (ψ : H), a - (μa : ℂ) • (ψ : H)⟫_ℂ := by - rfl + ⟪b - (μb : ℂ) • (ψ : H), a - (μa : ℂ) • (ψ : H)⟫_ℂ := rfl _ = ⟪a, b⟫_ℂ - ⟪b, a⟫_ℂ := sub_expectation_commutator_eq_raw (ψ : H) a b μa μb hμa_right hμa_left hμb_right hμb_left hψ_norm diff --git a/Physlib/QuantumMechanics/DDimensions/SpaceDHilbertSpace/PolyBddSchwartzSubmodule.lean b/Physlib/QuantumMechanics/DDimensions/SpaceDHilbertSpace/PolyBddSchwartzSubmodule.lean index 6ac8e891a..c8b15c11a 100644 --- a/Physlib/QuantumMechanics/DDimensions/SpaceDHilbertSpace/PolyBddSchwartzSubmodule.lean +++ b/Physlib/QuantumMechanics/DDimensions/SpaceDHilbertSpace/PolyBddSchwartzSubmodule.lean @@ -77,8 +77,7 @@ def PolyBddSchwartzMap (d : ℕ) (a : ℕ∞) : Submodule ℂ 𝓢(Space d, ℂ) obtain ⟨C₂, hC₂_pos, hC₂⟩ := hg k hk refine ⟨C₁ + C₂, by positivity, fun x ↦ ?_⟩ refine le_trans ?_ (add_le_add (hC₁ x) (hC₂ x)) - rw [← mul_add] - exact mul_le_mul_of_nonneg_left (norm_add_le (f x) (g x)) (by positivity) + simpa [← mul_add] using mul_le_mul_of_nonneg_left (norm_add_le (f x) (g x)) (by positivity) zero_mem' := fun _ _ ↦ ⟨1, by simp⟩ smul_mem' := by intro c f hf k hk @@ -119,8 +118,7 @@ instance {d : ℕ} {a : ℕ∞} : CoeFun (PolyBddSchwartzMap d a) (fun _ ↦ Spa @[simp] lemma toFun_eq_coe {d : ℕ} {a : ℕ∞} (f : PolyBddSchwartzMap d a) (x : Space d) : - f.val.toFun x = f.val x := - rfl + f.val.toFun x = f.val x := rfl lemma polyBddSchwartzEquiv_symm_apply_coe {d : ℕ} {a : ℕ∞} {ψ : SchwartzSubmodule d} (hψ : ↑ψ ∈ PolyBddSchwartzSubmodule d a) : diff --git a/Physlib/QuantumMechanics/OneDimension/GeneralPotential/Basic.lean b/Physlib/QuantumMechanics/OneDimension/GeneralPotential/Basic.lean index 6c2b716a9..231b6ccff 100644 --- a/Physlib/QuantumMechanics/OneDimension/GeneralPotential/Basic.lean +++ b/Physlib/QuantumMechanics/OneDimension/GeneralPotential/Basic.lean @@ -22,11 +22,9 @@ namespace OneDimension open HilbertSpace Constants private lemma fun_add {α : Type*} (f g : α → ℂ) : - (fun x ↦ f x) + (fun x ↦ g x) = fun x ↦ f x + g x := by - rfl + (fun x ↦ f x) + (fun x ↦ g x) = fun x ↦ f x + g x := rfl -private lemma fun_smul (a1: ℂ) (f : ℝ → ℂ) : (a1 • fun x ↦ f x) = (fun x ↦ a1*(f x)) := by - rfl +private lemma fun_smul (a1: ℂ) (f : ℝ → ℂ) : (a1 • fun x ↦ f x) = (fun x ↦ a1*(f x)) := by rfl lemma momentumOperator_linear (a1 a2 : ℂ) (ψ1 ψ2 : ℝ → ℂ) (hψ1_x: Differentiable ℝ ψ1) (hψ2_x: Differentiable ℝ ψ2) : @@ -102,8 +100,7 @@ noncomputable def schrodingerOperator (ψ : ℝ → ℂ) : ℝ → ℂ := fun x ↦ 1 / (2 * Q.m) * (momentumOperator (momentumOperator ψ) x) + (Q.V x) * ψ x private lemma eval_add (f g : ℝ → ℂ) : - (f + g) x = f x + g x := - rfl + (f + g) x = f x + g x := rfl lemma schrodingerOperator_linear (a1 a2 : ℂ) (ψ1 ψ2 : ℝ → ℂ) (hψ1_x: Differentiable ℝ ψ1) (hψ2_x: Differentiable ℝ ψ2) diff --git a/Physlib/QuantumMechanics/OneDimension/HarmonicOscillator/Basic.lean b/Physlib/QuantumMechanics/OneDimension/HarmonicOscillator/Basic.lean index 26f3c20e4..1dbba481e 100644 --- a/Physlib/QuantumMechanics/OneDimension/HarmonicOscillator/Basic.lean +++ b/Physlib/QuantumMechanics/OneDimension/HarmonicOscillator/Basic.lean @@ -38,8 +38,7 @@ lemma Complex.ofReal_hasDerivAt : HasDerivAt Complex.ofReal 1 x := by let f1 : ℂ → ℂ := id change HasDerivAt (f1 ∘ Complex.ofReal) 1 x apply HasDerivAt.comp_ofReal - simp only [f1] - exact hasDerivAt_id _ + simpa only [f1] using hasDerivAt_id _ @[simp] lemma Complex.deriv_ofReal : deriv Complex.ofReal x = 1 := by @@ -131,9 +130,7 @@ lemma one_over_ξ : 1/Q.ξ = √(Q.m * Q.ω / ℏ) := by rw [← Real.sqrt_inv] field_simp -lemma ξ_inverse : Q.ξ⁻¹ = √(Q.m * Q.ω / ℏ) := by - rw [inv_eq_one_div] - exact one_over_ξ Q +lemma ξ_inverse : Q.ξ⁻¹ = √(Q.m * Q.ω / ℏ) := by simpa only [inv_eq_one_div] using one_over_ξ Q lemma one_over_ξ_sq : (1/Q.ξ)^2 = Q.m * Q.ω / ℏ := by rw [one_over_ξ] diff --git a/Physlib/QuantumMechanics/OneDimension/HarmonicOscillator/Completeness.lean b/Physlib/QuantumMechanics/OneDimension/HarmonicOscillator/Completeness.lean index 8d2e465d2..42180c32f 100644 --- a/Physlib/QuantumMechanics/OneDimension/HarmonicOscillator/Completeness.lean +++ b/Physlib/QuantumMechanics/OneDimension/HarmonicOscillator/Completeness.lean @@ -108,9 +108,7 @@ lemma mul_polynomial_integrable (f : ℝ → ℂ) (hf : MemHS f) (P : Polynomial funext x simp only [Complex.ofReal_exp, Complex.ofReal_div, Complex.ofReal_neg, Complex.ofReal_pow, Complex.ofReal_mul, Complex.ofReal_ofNat, Complex.real_smul] - rw [hf'] - apply MeasureTheory.Integrable.fun_smul - exact Q.mul_physHermite_integrable f hf i + simpa [hf'] using (Q.mul_physHermite_integrable f hf i).fun_smul (a i) lemma mul_power_integrable (f : ℝ → ℂ) (hf : MemHS f) (r : ℕ) : MeasureTheory.Integrable (fun x => x ^ r * (f x * Real.exp (- x^2 / (2 * Q.ξ^2)))) volume := by @@ -143,8 +141,7 @@ lemma mul_power_integrable (f : ℝ → ℂ) (hf : MemHS f) (r : ℕ) : lemma orthogonal_eigenfunction_of_mem_orthogonal (f : ℝ → ℂ) (hf : MemHS f) (hOrth : ∀ n : ℕ, ⟪HilbertSpace.mk (Q.eigenfunction_memHS n), HilbertSpace.mk hf⟫_ℂ = 0) (n : ℕ) : ∫ (x : ℝ), Q.eigenfunction n x * f x = 0 := by - rw [← hOrth n] - rw [inner_mk_mk] + rw [← hOrth n, inner_mk_mk] simp local notation "m" => Q.m diff --git a/Physlib/QuantumMechanics/OneDimension/HilbertSpace/Basic.lean b/Physlib/QuantumMechanics/OneDimension/HilbertSpace/Basic.lean index 67623e9d4..b7aa49ef4 100644 --- a/Physlib/QuantumMechanics/OneDimension/HilbertSpace/Basic.lean +++ b/Physlib/QuantumMechanics/OneDimension/HilbertSpace/Basic.lean @@ -152,12 +152,10 @@ lemma mk_smul {f : ℝ → ℂ} {c : ℂ} {hf : MemHS f} : mk (memHS_smul (c := c) hf) = c • mk hf := rfl lemma mk_eq_iff {f g : ℝ → ℂ} {hf : MemHS f} {hg : MemHS g} : - mk hf = mk hg ↔ f =ᵐ[volume] g := by - simp [mk] + mk hf = mk hg ↔ f =ᵐ[volume] g := by simp [mk] lemma ext_iff {f g : HilbertSpace} : - f = g ↔ (f : ℝ → ℂ) =ᶠ[ae volume] (g : ℝ → ℂ) := by - exact Lp.ext_iff + f = g ↔ (f : ℝ → ℂ) =ᶠ[ae volume] (g : ℝ → ℂ) := Lp.ext_iff end HilbertSpace end diff --git a/Physlib/QuantumMechanics/OneDimension/HilbertSpace/Gaussians.lean b/Physlib/QuantumMechanics/OneDimension/HilbertSpace/Gaussians.lean index e855bf752..a8215732a 100644 --- a/Physlib/QuantumMechanics/OneDimension/HilbertSpace/Gaussians.lean +++ b/Physlib/QuantumMechanics/OneDimension/HilbertSpace/Gaussians.lean @@ -72,9 +72,8 @@ lemma exp_mul_gaussian_integrable (b c : ℝ) (hb : 0 < b) : field_simp ring rw [h1] - apply MeasureTheory.Integrable.const_mul - apply Integrable.comp_sub_right (f := (fun x => Real.exp (- b * x ^ 2))) - exact integrable_exp_neg_mul_sq hb + exact (Integrable.comp_sub_right (f := (fun x => Real.exp (- b * x ^ 2))) + (integrable_exp_neg_mul_sq hb) (c / (2 * b))).const_mul _ lemma exp_abs_mul_gaussian_integrable (b c : ℝ) (hb : 0 < b) : MeasureTheory.Integrable (fun x => Real.exp (|c * x|) * Real.exp (- b * x ^ 2)) := by diff --git a/Physlib/QuantumMechanics/OneDimension/HilbertSpace/SchwartzSubmodule.lean b/Physlib/QuantumMechanics/OneDimension/HilbertSpace/SchwartzSubmodule.lean index 85891c6f9..51b3e4335 100644 --- a/Physlib/QuantumMechanics/OneDimension/HilbertSpace/SchwartzSubmodule.lean +++ b/Physlib/QuantumMechanics/OneDimension/HilbertSpace/SchwartzSubmodule.lean @@ -48,8 +48,7 @@ lemma schwartzIncl_inner (ψ1 ψ2 : 𝓢(ℝ, ℂ)) : filter_upwards [h1, h2] with _ h1 h2 rw [← h1, ← h2] simp only [RCLike.inner_apply] - rw [mul_comm] - rfl + exact mul_comm _ _ end HilbertSpace end diff --git a/Physlib/QuantumMechanics/OneDimension/Operators/Momentum.lean b/Physlib/QuantumMechanics/OneDimension/Operators/Momentum.lean index 448334e5c..eaf4d2488 100644 --- a/Physlib/QuantumMechanics/OneDimension/Operators/Momentum.lean +++ b/Physlib/QuantumMechanics/OneDimension/Operators/Momentum.lean @@ -42,8 +42,7 @@ open HilbertSpace SchwartzMap def momentumOperator (ψ : ℝ → ℂ) : ℝ → ℂ := fun x ↦ - Complex.I * ℏ * deriv ψ x lemma momentumOperator_eq_smul (ψ : ℝ → ℂ) : - momentumOperator ψ = fun x => (- Complex.I * ℏ) • deriv ψ x := by - rfl + momentumOperator ψ = fun x => (- Complex.I * ℏ) • deriv ψ x := rfl @[fun_prop] lemma continuous_momentumOperator (ψ : ℝ → ℂ) (hψ : ContDiff ℝ 1 ψ) : @@ -75,16 +74,12 @@ lemma momentumOperator_add {ψ1 ψ2 : ℝ → ℂ} `𝓢(ℝ, ℂ)` to itself, such that `ψ` is taken to `fun x => - I ℏ * ψ' x`. -/ def momentumOperatorSchwartz : 𝓢(ℝ, ℂ) →L[ℂ] 𝓢(ℝ, ℂ) where toFun ψ := (- Complex.I * ℏ) • SchwartzMap.derivCLM ℂ ℂ ψ - map_add' ψ1 ψ2 := by - simp only [neg_mul, map_add, smul_add, neg_smul] - map_smul' a ψ := by - simp only [map_smul, RingHom.id_apply, smul_comm (-Complex.I * ℏ) a] + map_add' ψ1 ψ2 := by simp only [neg_mul, map_add, smul_add, neg_smul] + map_smul' a ψ := by simp only [map_smul, RingHom.id_apply, smul_comm (-Complex.I * ℏ) a] cont := by fun_prop lemma momentumOperatorSchwartz_apply (ψ : 𝓢(ℝ, ℂ)) - (x : ℝ) : (momentumOperatorSchwartz ψ) x = (- Complex.I * ℏ) * (deriv ψ x) := by - rw [momentumOperatorSchwartz] - rfl + (x : ℝ) : (momentumOperatorSchwartz ψ) x = (- Complex.I * ℏ) * (deriv ψ x) := rfl /-- The unbounded momentum operator, whose domain is Schwartz maps. -/ def momentumOperatorUnbounded : UnboundedOperator schwartzIncl schwartzIncl_injective := @@ -99,8 +94,7 @@ def momentumOperatorUnbounded : UnboundedOperator schwartzIncl schwartzIncl_inje lemma planeWaveFunctional_generalized_eigenvector_momentumOperatorUnbounded (k : ℝ) : momentumOperatorUnbounded.IsGeneralizedEigenvector (planewaveFunctional k) (2 * Real.pi * ℏ * k) := by - dsimp [momentumOperatorUnbounded] - rw [UnboundedOperator.isGeneralizedEigenvector_ofSelfCLM_iff] + rw [momentumOperatorUnbounded, UnboundedOperator.isGeneralizedEigenvector_ofSelfCLM_iff] intro ψ trans (-((Complex.I * ↑↑ℏ) • (SchwartzMap.fourierTransformCLM ℂ) ((SchwartzMap.derivCLM ℂ ℂ) ψ) k)) diff --git a/Physlib/QuantumMechanics/OneDimension/Operators/Position.lean b/Physlib/QuantumMechanics/OneDimension/Operators/Position.lean index d0e8de9a2..5db2c171a 100644 --- a/Physlib/QuantumMechanics/OneDimension/Operators/Position.lean +++ b/Physlib/QuantumMechanics/OneDimension/Operators/Position.lean @@ -64,15 +64,11 @@ open SchwartzMap def positionOperatorSchwartz : 𝓢(ℝ, ℂ) →L[ℂ] 𝓢(ℝ, ℂ) := Distribution.powOneMul ℂ lemma positionOperatorSchwartz_apply_fun (ψ : 𝓢(ℝ, ℂ)) : - (positionOperatorSchwartz ψ) = fun x => x * ψ x := by - simp [positionOperatorSchwartz] - rfl + (positionOperatorSchwartz ψ) = fun x => x * ψ x := rfl @[simp] lemma positionOperatorSchwartz_apply (ψ : 𝓢(ℝ, ℂ)) (x : ℝ) : - (positionOperatorSchwartz ψ) x = x * ψ x := by - simp [positionOperatorSchwartz] - rfl + (positionOperatorSchwartz ψ) x = x * ψ x := rfl /-- The unbounded position operator, whose domain is Schwartz maps. -/ def positionOperatorUnbounded : UnboundedOperator schwartzIncl schwartzIncl_injective := @@ -86,8 +82,7 @@ def positionOperatorUnbounded : UnboundedOperator schwartzIncl schwartzIncl_inje lemma positionStates_generalized_eigenvector_positionOperatorUnbounded (x : ℝ) : positionOperatorUnbounded.IsGeneralizedEigenvector (positionState x) x := by - dsimp [positionOperatorUnbounded] - rw [UnboundedOperator.isGeneralizedEigenvector_ofSelfCLM_iff] + rw [positionOperatorUnbounded, UnboundedOperator.isGeneralizedEigenvector_ofSelfCLM_iff] intro ψ simp [positionState_apply] diff --git a/Physlib/Relativity/CliffordAlgebra.lean b/Physlib/Relativity/CliffordAlgebra.lean index f1029532c..9627892c6 100644 --- a/Physlib/Relativity/CliffordAlgebra.lean +++ b/Physlib/Relativity/CliffordAlgebra.lean @@ -91,8 +91,7 @@ representation. -/ @[simp] def γSet : Set (Matrix (Fin 4) (Fin 4) ℂ) := {γ i | i : Fin 4} -lemma γ_in_γSet (μ : Fin 4) : γ μ ∈ γSet := by - simp [γSet] +lemma γ_in_γSet (μ : Fin 4) : γ μ ∈ γSet := by simp [γSet] /-- The algebra generated by the gamma matrices in the Dirac representation. -/ def diracAlgebra : Subalgebra ℝ (Matrix (Fin 4) (Fin 4) ℂ) := @@ -188,8 +187,7 @@ lemma ofCliffordAlgebra_range_eq_top : ofCliffordAlgebra.range = ⊤ := by /-- The homomorphism `ofCliffordAlgebra` is surjective. -/ theorem ofCliffordAlgebra_surjective : Function.Surjective ofCliffordAlgebra := by - rw [← AlgHom.range_eq_top] - exact ofCliffordAlgebra_range_eq_top + simpa [← AlgHom.range_eq_top] using ofCliffordAlgebra_range_eq_top end γ diff --git a/Physlib/Relativity/LorentzAlgebra/ExponentialMap.lean b/Physlib/Relativity/LorentzAlgebra/ExponentialMap.lean index a906c0aab..9c10b89ad 100644 --- a/Physlib/Relativity/LorentzAlgebra/ExponentialMap.lean +++ b/Physlib/Relativity/LorentzAlgebra/ExponentialMap.lean @@ -61,16 +61,14 @@ lemma exp_transpose_of_mem_algebra (A : lorentzAlgebra) : val_inv := minkowskiMatrix.sq, inv_val := minkowskiMatrix.sq } rw [show -(η * A.1 * η) = η * (-A.1) * η by noncomm_ring] - erw [NormedSpace.exp_units_conj P_gl (-A.1)] - rfl + exact NormedSpace.exp_units_conj P_gl (-A.1) set_option backward.isDefEq.respectTransparency false in /-- The exponential of an element of the Lorentz algebra is a member of the Lorentz group. -/ theorem exp_mem_lorentzGroup (A : lorentzAlgebra) : NormedSpace.exp A.1 ∈ LorentzGroup 3 := by - rw [LorentzGroup.mem_iff_transpose_mul_minkowskiMatrix_mul_self] - rw [← Matrix.exp_transpose] + rw [LorentzGroup.mem_iff_transpose_mul_minkowskiMatrix_mul_self, ← Matrix.exp_transpose] rw [exp_transpose_of_mem_algebra A] calc (η * NormedSpace.exp (-A.1) * η) * η * NormedSpace.exp A.1 @@ -108,8 +106,7 @@ variable {n R ι : Type*} [Fintype n]-- [DecidableEq n] @[simp] lemma trace_reindex [Semiring R] [Fintype ι] (e : n ≃ ι) (A : Matrix n n R) : trace (A.submatrix e.symm e.symm) = trace A := by - simp only [trace, diag_apply, submatrix_apply] - exact e.symm.sum_comp (fun i : n => A i i) + simpa only [trace, diag_apply, submatrix_apply] using e.symm.sum_comp (fun i : n => A i i) variable {n R ι : Type*} [Fintype n] [DecidableEq n] @@ -177,5 +174,4 @@ theorem exp_isOrthochronous (A : lorentzAlgebra) : restricted Lorentz group. -/ theorem exp_mem_restricted_lorentzGroup (A : lorentzAlgebra) : (⟨NormedSpace.exp A.1, exp_mem_lorentzGroup A⟩ : LorentzGroup 3) ∈ - LorentzGroup.restricted 3 := by - exact ⟨exp_isProper A, exp_isOrthochronous A⟩ + LorentzGroup.restricted 3 := ⟨exp_isProper A, exp_isOrthochronous A⟩ diff --git a/Physlib/Relativity/LorentzGroup/Basic.lean b/Physlib/Relativity/LorentzGroup/Basic.lean index 7ae8ca105..f82962cf4 100644 --- a/Physlib/Relativity/LorentzGroup/Basic.lean +++ b/Physlib/Relativity/LorentzGroup/Basic.lean @@ -60,12 +60,10 @@ variable {Λ Λ' : Matrix (Fin 1 ⊕ Fin d) (Fin 1 ⊕ Fin d) ℝ} -/ -lemma mem_iff_self_mul_dual : Λ ∈ LorentzGroup d ↔ Λ * dual Λ = 1 := by - rfl +lemma mem_iff_self_mul_dual : Λ ∈ LorentzGroup d ↔ Λ * dual Λ = 1 := Iff.rfl lemma mem_iff_dual_mul_self : Λ ∈ LorentzGroup d ↔ dual Λ * Λ = 1 := by - rw [mem_iff_self_mul_dual] - exact _root_.mul_eq_one_comm + simpa [mem_iff_self_mul_dual] using (_root_.mul_eq_one_comm (a := Λ) (b := dual Λ)) lemma mem_iff_transpose : Λ ∈ LorentzGroup d ↔ Λᵀ ∈ LorentzGroup d := by refine Iff.intro (fun h ↦ ?_) (fun h ↦ ?_) @@ -81,8 +79,7 @@ lemma mem_iff_transpose : Λ ∈ LorentzGroup d ↔ Λᵀ ∈ LorentzGroup d := noncomm_ring lemma mem_iff_neg_mem : Λ ∈ LorentzGroup d ↔ -Λ ∈ LorentzGroup d := by - rw [mem_iff_self_mul_dual, mem_iff_self_mul_dual] - simp [dual] + simp [mem_iff_self_mul_dual, dual] lemma mem_mul (hΛ : Λ ∈ LorentzGroup d) (hΛ' : Λ' ∈ LorentzGroup d) : Λ * Λ' ∈ LorentzGroup d := by rw [mem_iff_dual_mul_self, dual_mul] @@ -91,9 +88,7 @@ lemma mem_mul (hΛ : Λ ∈ LorentzGroup d) (hΛ' : Λ' ∈ LorentzGroup d) : Λ · rw [(mem_iff_dual_mul_self).mp hΛ] simp [(mem_iff_dual_mul_self).mp hΛ'] -lemma one_mem : 1 ∈ LorentzGroup d := by - rw [mem_iff_dual_mul_self] - simp +lemma one_mem : 1 ∈ LorentzGroup d := by simp [mem_iff_dual_mul_self] lemma dual_mem (h : Λ ∈ LorentzGroup d) : dual Λ ∈ LorentzGroup d := by rw [mem_iff_dual_mul_self, dual_dual] @@ -105,8 +100,7 @@ A matrix `Λ` is in the Lorentz group if and only if it satisfies `Λᵀ * η * lemma mem_iff_transpose_mul_minkowskiMatrix_mul_self (Λ : Matrix (Fin 1 ⊕ Fin d) (Fin 1 ⊕ Fin d) ℝ) : Λ ∈ LorentzGroup d ↔ Λᵀ * η * Λ = η := by - rw [mem_iff_dual_mul_self] - rw [dual] + rw [mem_iff_dual_mul_self, dual] constructor · intro h have h' : η * ((η * Λᵀ * η) * Λ) = η * 1 := congr_arg (η * ·) h @@ -176,8 +170,7 @@ lemma isClosedEmbedding_val {d : ℕ} : -/ lemma inv_eq_dual (Λ : LorentzGroup d) : - (Λ⁻¹ : LorentzGroup d) = ⟨minkowskiMatrix.dual Λ.1, LorentzGroup.dual_mem Λ.2⟩ := by - rfl + (Λ⁻¹ : LorentzGroup d) = ⟨minkowskiMatrix.dual Λ.1, LorentzGroup.dual_mem Λ.2⟩ := rfl lemma coe_inv : (Λ⁻¹).1 = Λ.1⁻¹:= (inv_eq_left_inv (mem_iff_dual_mul_self.mp Λ.2)).symm @@ -429,8 +422,7 @@ def toComplex : LorentzGroup d →* Matrix (Fin 1 ⊕ Fin d) (Fin 1 ⊕ Fin d) map_mul' Λ Λ' := by ext i j simp only [lorentzGroupIsGroup_mul_coe, map_apply, ofRealHom_eq_coe] - simp only [← Matrix.map_mul] - rfl + simp [← Matrix.map_mul] /-- The image of a Lorentz transformation under `toComplex` is invertible. -/ instance (M : LorentzGroup d) : Invertible (toComplex M) where @@ -474,8 +466,7 @@ lemma toComplex_mulVec_ofReal (v : Fin 1 ⊕ Fin d → ℝ) (Λ : LorentzGroup d toComplex Λ *ᵥ (ofRealHom ∘ v) = ofRealHom ∘ (Λ *ᵥ v) := by simp only [toComplex, MonoidHom.coe_mk, OneHom.coe_mk] funext i - rw [← RingHom.map_mulVec] - rfl + exact (RingHom.map_mulVec ofRealHom Λ.val v i).symm /-- The parity transformation. -/ def parity : LorentzGroup d := ⟨minkowskiMatrix, by @@ -489,8 +480,7 @@ def parity : LorentzGroup d := ⟨minkowskiMatrix, by -/ lemma eq_of_mulVec_eq {Λ Λ' : LorentzGroup d} - (h : ∀ (x : Fin 1 ⊕ Fin d → ℝ), Λ.1 *ᵥ x = Λ'.1 *ᵥ x) : Λ = Λ' := by - apply Subtype.ext - exact ext_of_mulVec_single fun i => h (Pi.single i 1) + (h : ∀ (x : Fin 1 ⊕ Fin d → ℝ), Λ.1 *ᵥ x = Λ'.1 *ᵥ x) : Λ = Λ' := + Subtype.ext (ext_of_mulVec_single fun i => h (Pi.single i 1)) end LorentzGroup diff --git a/Physlib/Relativity/LorentzGroup/Boosts/Basic.lean b/Physlib/Relativity/LorentzGroup/Boosts/Basic.lean index a45850ad4..58aae9217 100644 --- a/Physlib/Relativity/LorentzGroup/Boosts/Basic.lean +++ b/Physlib/Relativity/LorentzGroup/Boosts/Basic.lean @@ -30,8 +30,7 @@ def γ (β : ℝ) : ℝ := 1 / Real.sqrt (1 - β^2) lemma γ_sq (β : ℝ) (hβ : |β| < 1) : (γ β)^2 = 1 / (1 - β^2) := by simp only [γ, one_div, inv_pow, _root_.inv_inj] refine Real.sq_sqrt ?_ - simp only [sub_nonneg, sq_le_one_iff_abs_le_one] - exact le_of_lt hβ + simpa only [sub_nonneg, sq_le_one_iff_abs_le_one] using le_of_lt hβ @[simp] lemma γ_zero : γ 0 = 1 := by simp [γ] @@ -209,50 +208,39 @@ lemma boost_inverse (i : Fin d) {β : ℝ} (hβ : |β| < 1) : @[simp] lemma boost_inl_0_inl_0 (i : Fin d) {β : ℝ} (hβ : |β| < 1) : - (boost i β hβ).1 (Sum.inl 0) (Sum.inl 0) = γ β := by - simp [boost] + (boost i β hβ).1 (Sum.inl 0) (Sum.inl 0) = γ β := by simp [boost] @[simp] lemma boost_inr_self_inr_self (i : Fin d) {β : ℝ} (hβ : |β| < 1) : - (boost i β hβ).1 (Sum.inr i) (Sum.inr i) = γ β := by - simp [boost] + (boost i β hβ).1 (Sum.inr i) (Sum.inr i) = γ β := by simp [boost] @[simp] lemma boost_inl_0_inr_self (i : Fin d) {β : ℝ} (hβ : |β| < 1) : - (boost i β hβ).1 (Sum.inl 0) (Sum.inr i) = - γ β * β := by - simp [boost] + (boost i β hβ).1 (Sum.inl 0) (Sum.inr i) = - γ β * β := by simp [boost] @[simp] lemma boost_inr_self_inl_0 (i : Fin d) {β : ℝ} (hβ : |β| < 1) : - (boost i β hβ).1 (Sum.inr i) (Sum.inl 0) = - γ β * β := by - simp [boost] + (boost i β hβ).1 (Sum.inr i) (Sum.inl 0) = - γ β * β := by simp [boost] lemma boost_inl_0_inr_other {i j : Fin d} {β : ℝ} (hβ : |β| < 1) (hij : j ≠ i) : - (boost i β hβ).1 (Sum.inl 0) (Sum.inr j) = 0 := by - simp [boost, hij] + (boost i β hβ).1 (Sum.inl 0) (Sum.inr j) = 0 := by simp [boost, hij] lemma boost_inr_other_inl_0 {i j : Fin d} {β : ℝ} (hβ : |β| < 1) (hij : j ≠ i) : - (boost i β hβ).1 (Sum.inr j) (Sum.inl 0) = 0 := by - simp [boost, hij] + (boost i β hβ).1 (Sum.inr j) (Sum.inl 0) = 0 := by simp [boost, hij] lemma boost_inr_self_inr_other {i j : Fin d} {β : ℝ} (hβ : |β| < 1) (hij : j ≠ i) : - (boost i β hβ).1 (Sum.inr i) (Sum.inr j) = 0 := by - simp [boost, hij, Ne.symm hij] + (boost i β hβ).1 (Sum.inr i) (Sum.inr j) = 0 := by simp [boost, hij, Ne.symm hij] lemma boost_inr_other_inr_self {i j : Fin d} {β : ℝ} (hβ : |β| < 1) (hij : j ≠ i) : - (boost i β hβ).1 (Sum.inr j) (Sum.inr i) = 0 := by - simp [boost, hij] + (boost i β hβ).1 (Sum.inr j) (Sum.inr i) = 0 := by simp [boost, hij] lemma boost_inr_other_inr {i j k : Fin d} {β : ℝ} (hβ : |β| < 1) (hij : j ≠ i) : - (boost i β hβ).1 (Sum.inr j) (Sum.inr k) = if j = k then 1 else 0:= by - simp [boost, hij] + (boost i β hβ).1 (Sum.inr j) (Sum.inr k) = if j = k then 1 else 0:= by simp [boost, hij] lemma boost_inr_inr_other {i j k : Fin d} {β : ℝ} (hβ : |β| < 1) (hij : j ≠ i) : (boost i β hβ).1 (Sum.inr k) (Sum.inr j) = if j = k then 1 else 0:= by rw [← boost_transpose_eq_self] - simp only [transpose, transpose_apply] - rw [boost_inr_other_inr] - exact hij + simpa only [transpose, transpose_apply] using boost_inr_other_inr hβ hij /-! ## Properties of boosts in the zero-direction @@ -302,8 +290,7 @@ lemma boost_zero_inr_nat_succ_inr_0 {d : ℕ} {β : ℝ} (hβ : |β| < 1) (i : lemma boost_zero_inr_succ_inr_succ {d : ℕ} {β : ℝ} (hβ : |β| < 1) (i1 i2 : Fin d) : (boost (0 : Fin d.succ) β hβ).1 (Sum.inr i1.succ) (Sum.inr i2.succ) = if i1 = i2 then 1 else 0 := by - rw [boost_inr_inr_other hβ (Fin.succ_ne_zero i2)] - simp [Fin.succ_inj, eq_comm] + simp [boost_inr_inr_other hβ (Fin.succ_ne_zero i2), Fin.succ_inj, eq_comm] end LorentzGroup diff --git a/Physlib/Relativity/LorentzGroup/Boosts/Generalized.lean b/Physlib/Relativity/LorentzGroup/Boosts/Generalized.lean index 55c9e9457..166e49a8f 100644 --- a/Physlib/Relativity/LorentzGroup/Boosts/Generalized.lean +++ b/Physlib/Relativity/LorentzGroup/Boosts/Generalized.lean @@ -45,8 +45,7 @@ variable {d : ℕ} /-- An auxiliary linear map used in the definition of a generalised boost. -/ def genBoostAux₁ (u v : Velocity d) : Vector d →ₗ[ℝ] Vector d where toFun x := (2 * ⟪x, u⟫ₘ) • v - map_add' x y := by - simp [map_add, mul_add, _root_.add_smul] + map_add' x y := by simp [map_add, mul_add, _root_.add_smul] map_smul' c x := by simp only [map_smul, RingHom.id_apply, smul_smul] simp only [FunLike.coe_smul, Pi.smul_apply, smul_eq_mul] @@ -105,15 +104,13 @@ lemma genBoostAux₂_basis_minkowskiProduct (u v : Velocity d) (μ ν : Fin 1 ⟪genBoostAux₂ u v (Vector.basis μ), genBoostAux₂ u v (Vector.basis ν)⟫ₘ = 2 * η μ μ * η ν ν * (u.1 μ + v.1 μ) * (u.1 ν + v.1 ν) * (1 + ⟪u, v.1⟫ₘ)⁻¹ := by - rw [genBoostAux₂_apply_basis, genBoostAux₂_apply_basis] - rw [map_smul, map_smul] + rw [genBoostAux₂_apply_basis, genBoostAux₂_apply_basis, map_smul, map_smul] have h1 : ⟪u.1 + v.1, u.1 + v.1⟫ₘ = 2 * (1 + ⟪u.1, v.1⟫ₘ) := by simp only [map_add, add_apply, Velocity.minkowskiProduct_self_eq_one] rw [minkowskiProduct_symm] ring dsimp - have h2 : (1 + ⟪u.1, v.1⟫ₘ) ≠ 0 := by - exact Velocity.one_add_minkowskiProduct_ne_zero u v + have h2 : (1 + ⟪u.1, v.1⟫ₘ) ≠ 0 := Velocity.one_add_minkowskiProduct_ne_zero u v field_simp [h2] have h2 : (minkowskiProduct ↑v) u.1 = ⟪u.1, v.1⟫ₘ := by rw [minkowskiProduct_symm] simp only [map_add, _root_.smul_add, _root_.neg_smul, add_apply, _root_.neg_apply, smul_apply, @@ -124,16 +121,14 @@ lemma genBoostAux₂_basis_minkowskiProduct (u v : Velocity d) (μ ν : Fin 1 lemma genBoostAux₁_basis_genBoostAux₂_minkowskiProduct (u v : Velocity d) (μ ν : Fin 1 ⊕ Fin d) : ⟪genBoostAux₁ u v (Vector.basis μ), genBoostAux₂ u v (Vector.basis ν)⟫ₘ = - 2 * η μ μ * η ν ν * u.1 μ * (u.1 ν + v.1 ν) := by - rw [genBoostAux₁_apply_basis, genBoostAux₂_apply_basis] - rw [map_smul, map_smul] + rw [genBoostAux₁_apply_basis, genBoostAux₂_apply_basis, map_smul, map_smul] have h1 : ⟪v.1, u.1 + v.1⟫ₘ = (1 + ⟪u.1, v.1⟫ₘ) := by simp only [map_add, Velocity.minkowskiProduct_self_eq_one] rw [minkowskiProduct_symm] ring simp only [smul_apply, map_add, Velocity.minkowskiProduct_self_eq_one, smul_eq_mul, neg_mul, neg_inj] - have h2 : (1 + ⟪u.1, v.1⟫ₘ) ≠ 0 := by - exact Velocity.one_add_minkowskiProduct_ne_zero u v + have h2 : (1 + ⟪u.1, v.1⟫ₘ) ≠ 0 := Velocity.one_add_minkowskiProduct_ne_zero u v field_simp [h2] rw [minkowskiProduct_symm] ring @@ -174,8 +169,7 @@ lemma basis_minkowskiProduct_genBoostAux₁_add_genBoostAux₂ (u v : Velocity d rw [genBoostAux₁_apply_basis, genBoostAux₂_apply_basis] rw [map_smul, map_smul] simp - have h2 : (1 + ⟪u.1, v.1⟫ₘ) ≠ 0 := by - exact Velocity.one_add_minkowskiProduct_ne_zero u v + have h2 : (1 + ⟪u.1, v.1⟫ₘ) ≠ 0 := Velocity.one_add_minkowskiProduct_ne_zero u v field_simp ring diff --git a/Physlib/Relativity/LorentzGroup/Orthochronous/Basic.lean b/Physlib/Relativity/LorentzGroup/Orthochronous/Basic.lean index 1a9a3add9..3db8ce3fb 100644 --- a/Physlib/Relativity/LorentzGroup/Orthochronous/Basic.lean +++ b/Physlib/Relativity/LorentzGroup/Orthochronous/Basic.lean @@ -37,8 +37,7 @@ def IsOrthochronous : Prop := 0 ≤ Λ.1 (Sum.inl 0) (Sum.inl 0) /-- A Lorentz transformation is `orthochronous` if and only if its first column is future pointing. -/ lemma isOrthochronous_iff_toVector_timeComponet_nonneg : - IsOrthochronous Λ ↔ 0 ≤ (toVector Λ).timeComponent := by - simp [IsOrthochronous, timeComponent] + IsOrthochronous Λ ↔ 0 ≤ (toVector Λ).timeComponent := by simp [IsOrthochronous, timeComponent] /-- A Lorentz transformation is orthochronous if and only if its transpose is orthochronous. -/ lemma isOrthochronous_iff_transpose : @@ -94,13 +93,10 @@ lemma not_isOrthochronous_iff_le_zero : ¬ IsOrthochronous Λ ↔ Λ.1 (Sum.inl constructor <;> intro h <;> rcases h1 with h1 | h1 <;> linarith lemma not_isOrthochronous_iff_toVector_timeComponet_nonpos : - ¬ IsOrthochronous Λ ↔ (toVector Λ).timeComponent ≤ 0:= by - rw [not_isOrthochronous_iff_le_zero] - simp + ¬ IsOrthochronous Λ ↔ (toVector Λ).timeComponent ≤ 0:= by simp [not_isOrthochronous_iff_le_zero] /-- The identity Lorentz transformation is orthochronous. -/ -lemma id_isOrthochronous : @IsOrthochronous d 1 := by - simp [IsOrthochronous] +lemma id_isOrthochronous : @IsOrthochronous d 1 := by simp [IsOrthochronous] /-- The continuous map taking a Lorentz transformation to its `0 0` element. -/ def timeCompCont : C(LorentzGroup d, ℝ) := ⟨fun Λ => Λ.1 (Sum.inl 0) (Sum.inl 0), @@ -159,8 +155,7 @@ def orthchroMap : C(LorentzGroup d, ℤ₂) := /-- A Lorentz transformation which is orthochronous maps under `orthchroMap` to `1` in `ℤ₂` (the identity element). -/ lemma orthchroMap_IsOrthochronous {Λ : LorentzGroup d} (h : IsOrthochronous Λ) : - orthchroMap Λ = 1 := by - simp [orthchroMap, orthchroMapReal_on_IsOrthochronous h] + orthchroMap Λ = 1 := by simp [orthchroMap, orthchroMapReal_on_IsOrthochronous h] /-- A Lorentz transformation which is not-orthochronous maps under `orthchroMap` to the non-identity element of `ℤ₂`. -/ @@ -168,8 +163,7 @@ lemma orthchroMap_not_IsOrthochronous {Λ : LorentzGroup d} (h : ¬ IsOrthochron orthchroMap Λ = Additive.toMul (1 : ZMod 2) := by simp only [orthchroMap, ContinuousMap.comp_apply, ContinuousMap.coe_mk, orthchroMapReal_on_not_IsOrthochronous h, coeForℤ₂_apply, Subtype.mk.injEq, Nat.reduceAdd] - rw [if_neg (by norm_num)] - rfl + exact if_neg (by norm_num) /-- The product of two orthochronous Lorentz transformations is orthochronous. -/ lemma isOrthochronous_mul {Λ Λ' : LorentzGroup d} (h : IsOrthochronous Λ) @@ -231,7 +225,6 @@ to the same element via the homomorphism from `LorentzGroup` to `ℤ₂`. -/ lemma isOrthochronous_iff_of_orthchroMap_eq {Λ Λ' : LorentzGroup d} (h : orthchroMap Λ = orthchroMap Λ') : IsOrthochronous Λ ↔ IsOrthochronous Λ' := by rw [IsOrthochronous.iff_in_orthchroRep_ker, IsOrthochronous.iff_in_orthchroRep_ker] - rw [MonoidHom.mem_ker, MonoidHom.mem_ker] change orthchroMap Λ = 1 ↔ orthchroMap Λ' = 1 rw [h] diff --git a/Physlib/Relativity/LorentzGroup/Proper.lean b/Physlib/Relativity/LorentzGroup/Proper.lean index 98bbc1201..a2a051ead 100644 --- a/Physlib/Relativity/LorentzGroup/Proper.lean +++ b/Physlib/Relativity/LorentzGroup/Proper.lean @@ -43,8 +43,7 @@ local notation "ℤ₂" => Multiplicative (ZMod 2) instance : TopologicalSpace ℤ₂ := instTopologicalSpaceFin /-- The topological space defined by `ℤ₂` is discrete. -/ -instance : DiscreteTopology ℤ₂ := by - exact discreteTopology_iff_forall_isOpen.mpr fun _ => trivial +instance : DiscreteTopology ℤ₂ := discreteTopology_iff_forall_isOpen.mpr fun _ => trivial /-- The instance of a topological group on `ℤ₂` defined via the discrete topology. -/ instance : IsTopologicalGroup ℤ₂ := IsTopologicalGroup.mk @@ -74,8 +73,7 @@ lemma detContinuous_eq_one (Λ : LorentzGroup d) : refine Iff.intro (fun h => ?_) (fun h => ?_) · by_contra hn have h' := h hn - change (1 : Fin 2) = (0 : Fin 2) at h' - simp only [Fin.isValue, one_ne_zero] at h' + exact (show (1 : Fin 2) ≠ 0 by decide) h' · intro h' exact False.elim (h' h) @@ -86,8 +84,7 @@ lemma detContinuous_eq_zero (Λ : LorentzGroup d) : refine Iff.intro (fun h => ?_) (fun h => ?_) · by_contra hn rw [if_pos] at h - · change (0 : Fin 2) = (1 : Fin 2) at h - simp only [Fin.isValue, zero_ne_one] at h + · exact (show (0 : Fin 2) ≠ 1 by decide) h · cases' det_eq_one_or_neg_one Λ with h2 h2 · simp_all only [ite_true] · simp_all only [not_true_eq_false] @@ -109,14 +106,10 @@ lemma detContinuous_eq_iff_det_eq (Λ Λ' : LorentzGroup d) : simp only [Nat.reduceAdd] | .inl h1, .inr h2 => rw [h1, h2, (detContinuous_eq_one Λ).mpr h1, (detContinuous_eq_zero Λ').mpr h2] - change (0 : Fin 2) = (1 : Fin 2) ↔ _ - simp only [zero_ne_one, false_iff] - linarith + exact iff_of_false (by decide) (by linarith) | .inr h1, .inl h2 => rw [h1, h2, (detContinuous_eq_zero Λ).mpr h1, (detContinuous_eq_one Λ').mpr h2] - change (1 : Fin 2) = (0 : Fin 2) ↔ _ - simp only [one_ne_zero, false_iff] - linarith + exact iff_of_false (show (1 : Fin 2) ≠ 0 by decide) (by linarith) /-- The representation taking a Lorentz matrix to its determinant. -/ @[simps!] @@ -193,8 +186,7 @@ lemma isProper_iff (Λ : LorentzGroup d) : IsProper Λ ↔ detRep Λ = 1 := by simp only [IsProper, lorentzGroupIsGroup_one_coe, det_one] /-- The identity Lorentz transformation is proper. -/ -lemma isProper_id : @IsProper d 1 := by - simp [IsProper] +lemma isProper_id : @IsProper d 1 := by simp [IsProper] /-- If two Lorentz transformations are in the same connected component, and one is proper then the other is also proper. -/ diff --git a/Physlib/Relativity/LorentzGroup/Restricted/FromBoostRotation.lean b/Physlib/Relativity/LorentzGroup/Restricted/FromBoostRotation.lean index 83ca99d28..46ba4a485 100644 --- a/Physlib/Relativity/LorentzGroup/Restricted/FromBoostRotation.lean +++ b/Physlib/Relativity/LorentzGroup/Restricted/FromBoostRotation.lean @@ -52,8 +52,7 @@ def toRotation {d} (Λ : LorentzGroup.restricted d) : Rotations d := erw [generalizedBoost_apply_fst] simp · refine isProper_mul ?_ Λ.2.1 - rw [generalizedBoost_inv] - exact generalizedBoost_isProper _ _⟩ + simpa [generalizedBoost_inv] using generalizedBoost_isProper _ _⟩ @[fun_prop] lemma toRotation_continuous {d} : diff --git a/Physlib/Relativity/LorentzGroup/Rotations.lean b/Physlib/Relativity/LorentzGroup/Rotations.lean index f476e2c64..4103c4fbe 100644 --- a/Physlib/Relativity/LorentzGroup/Rotations.lean +++ b/Physlib/Relativity/LorentzGroup/Rotations.lean @@ -46,8 +46,7 @@ def Rotations (d) : Subgroup (LorentzGroup d) where · simpa [inv_eq_dual, IsProper] using h.2 lemma mem_rotations_iff {d} (Λ : LorentzGroup d) : - Λ ∈ Rotations d ↔ Λ.1 (Sum.inl 0) (Sum.inl 0) = 1 ∧ IsProper Λ := by - rfl + Λ ∈ Rotations d ↔ Λ.1 (Sum.inl 0) (Sum.inl 0) = 1 ∧ IsProper Λ := Iff.rfl @[simp] lemma transpose_mem_rotations {d} (Λ : LorentzGroup d) : @@ -78,8 +77,7 @@ def ofSpecialOrthogonal {d} : let M : Matrix (Fin d) (Fin d) ℝ := fun i j => Λ.1 (Sum.inr i) (Sum.inr j) have h1 : Matrix.fromBlocks 1 0 0 M = Λ.1 := by have h1 : LorentzGroup.toVector Λ = Lorentz.Vector.basis (Sum.inl 0) := by - rw [LorentzGroup.toVector_eq_basis_iff_timeComponent_eq_one] - exact h.1 + simpa [LorentzGroup.toVector_eq_basis_iff_timeComponent_eq_one] using h.1 have h2 : LorentzGroup.toVector (LorentzGroup.transpose Λ) = Lorentz.Vector.basis (Sum.inl 0) := by rw [LorentzGroup.toVector_eq_basis_iff_timeComponent_eq_one] @@ -123,16 +121,14 @@ def ofSpecialOrthogonal {d} : simp only [Submonoid.coe_mul, MulMemClass.mk_mul_mk] apply Subtype.ext simp [Matrix.fromBlocks_multiply] - left_inv Λ := by - simp + left_inv Λ := by simp right_inv Λ := by match Λ with | ⟨Λ, h⟩ => let M : Matrix (Fin d) (Fin d) ℝ := fun i j => Λ.1 (Sum.inr i) (Sum.inr j) have h1 : Matrix.fromBlocks 1 0 0 M = Λ.1 := by have h1 : LorentzGroup.toVector Λ = Lorentz.Vector.basis (Sum.inl 0) := by - rw [LorentzGroup.toVector_eq_basis_iff_timeComponent_eq_one] - exact h.1 + simpa [LorentzGroup.toVector_eq_basis_iff_timeComponent_eq_one] using h.1 have h2 : LorentzGroup.toVector (LorentzGroup.transpose Λ) = Lorentz.Vector.basis (Sum.inl 0) := by rw [LorentzGroup.toVector_eq_basis_iff_timeComponent_eq_one] @@ -181,8 +177,7 @@ lemma rotations_subset_restricted (d) : Rotations d ≤ LorentzGroup.restricted @[simp] lemma toVector_rotation {d} (Λ : Rotations d) : LorentzGroup.toVector Λ.1= Lorentz.Vector.basis (Sum.inl 0) := by - rw [LorentzGroup.toVector_eq_basis_iff_timeComponent_eq_one] - exact Λ.2.1 + simpa [LorentzGroup.toVector_eq_basis_iff_timeComponent_eq_one] using Λ.2.1 end LorentzGroup diff --git a/Physlib/Relativity/LorentzGroup/ToVector.lean b/Physlib/Relativity/LorentzGroup/ToVector.lean index 08af8b687..42c01950b 100644 --- a/Physlib/Relativity/LorentzGroup/ToVector.lean +++ b/Physlib/Relativity/LorentzGroup/ToVector.lean @@ -25,17 +25,14 @@ open Vector def toVector {d : ℕ} (Λ : LorentzGroup d) : Lorentz.Vector d := Λ • basis (Sum.inl 0) lemma toVector_mul {d : ℕ} (Λ₁ Λ₂ : LorentzGroup d) : - toVector (Λ₁ * Λ₂) = Λ₁ • toVector Λ₂ := by - rw [toVector, toVector, smul_smul] + toVector (Λ₁ * Λ₂) = Λ₁ • toVector Λ₂ := by rw [toVector, toVector, smul_smul] lemma toVector_neg {d : ℕ} (Λ : LorentzGroup d) : - toVector (-Λ) = -toVector Λ := by - simp [toVector, neg_smul] + toVector (-Λ) = -toVector Λ := by simp [toVector, neg_smul] @[simp] lemma toVector_apply {d : ℕ} (Λ : LorentzGroup d) - (i : Fin 1 ⊕ Fin d) : (toVector Λ) i = Λ.1 i (Sum.inl 0) := by - simp [toVector, smul_eq_sum] + (i : Fin 1 ⊕ Fin d) : (toVector Λ) i = Λ.1 i (Sum.inl 0) := by simp [toVector, smul_eq_sum] lemma toVector_eq_fun {d : ℕ} (Λ : LorentzGroup d) : toVector Λ = (fun i => Λ.1 i (Sum.inl 0)) := by @@ -54,13 +51,11 @@ lemma toVector_continuous {d : ℕ} : Continuous (toVector (d := d)) := by fun_prop lemma toVector_timeComponent {d : ℕ} (Λ : LorentzGroup d) : - (toVector Λ).timeComponent = Λ.1 (Sum.inl 0) (Sum.inl 0) := by - simp + (toVector Λ).timeComponent = Λ.1 (Sum.inl 0) (Sum.inl 0) := by simp @[simp] lemma toVector_minkowskiProduct_self {d : ℕ} (Λ : LorentzGroup d) : - ⟪toVector Λ, toVector Λ⟫ₘ = 1 := by - simp [toVector, minkowskiMatrix.inl_0_inl_0] + ⟪toVector Λ, toVector Λ⟫ₘ = 1 := by simp [toVector, minkowskiMatrix.inl_0_inl_0] lemma one_le_abs_timeComponent {d : ℕ} (Λ : LorentzGroup d) : 1 ≤ |Λ.1 (Sum.inl 0) (Sum.inl 0)| := by diff --git a/Physlib/Relativity/MinkowskiMatrix.lean b/Physlib/Relativity/MinkowskiMatrix.lean index d06f5350e..a7c890f57 100644 --- a/Physlib/Relativity/MinkowskiMatrix.lean +++ b/Physlib/Relativity/MinkowskiMatrix.lean @@ -113,8 +113,7 @@ We prove some simple properties related to the components of the Minkowski matri /-- The `time-time` component of the Minkowski matrix is `1`. -/ @[simp] -lemma inl_0_inl_0 : @minkowskiMatrix d (Sum.inl 0) (Sum.inl 0) = 1 := by - rfl +lemma inl_0_inl_0 : @minkowskiMatrix d (Sum.inl 0) (Sum.inl 0) = 1 := by rfl /-- The space diagonal components of the Minkowski matrix are `-1`. -/ @[simp] @@ -126,8 +125,7 @@ lemma inr_i_inr_i (i : Fin d) : @minkowskiMatrix d (Sum.inr i) (Sum.inr i) = -1 lemma off_diag_zero {μ ν : Fin 1 ⊕ Fin d} (h : μ ≠ ν) : η μ ν = 0 := by aesop (add safe forward as_diagonal) -lemma η_diag_ne_zero {μ : Fin 1 ⊕ Fin d} : η μ μ ≠ 0 := by - aesop (add safe forward as_diagonal) +lemma η_diag_ne_zero {μ : Fin 1 ⊕ Fin d} : η μ μ ≠ 0 := by aesop (add safe forward as_diagonal) /-! @@ -140,8 +138,7 @@ as well as other properties related to squaring the Minkowski matrix. /-- The Minkowski matrix is self-inverting. -/ @[simp] -lemma sq : @minkowskiMatrix d * minkowskiMatrix = 1 := by - simp [as_block, fromBlocks_multiply] +lemma sq : @minkowskiMatrix d * minkowskiMatrix = 1 := by simp [as_block, fromBlocks_multiply] /-- Multiplying any element on the diagonal of the Minkowski matrix by itself gives `1`. -/ @[simp] @@ -162,8 +159,7 @@ The Minkowski matrix is symmetric, due to it being diagonal. /-- The Minkowski matrix is symmetric. -/ @[simp] -lemma eq_transpose : minkowskiMatrixᵀ = @minkowskiMatrix d := by - simp [as_diagonal] +lemma eq_transpose : minkowskiMatrixᵀ = @minkowskiMatrix d := by simp [as_diagonal] /-! @@ -177,8 +173,7 @@ We show the determinant of the Minkowski matrix is equal to `(-1)^d` where /-- The determinant of the Minkowski matrix is equal to `-1` to the power of the number of spatial dimensions. -/ @[simp] -lemma det_eq_neg_one_pow_d : (@minkowskiMatrix d).det = (- 1) ^ d := by - simp [as_diagonal] +lemma det_eq_neg_one_pow_d : (@minkowskiMatrix d).det = (- 1) ^ d := by simp [as_diagonal] /-! @@ -205,14 +200,12 @@ We show properties of the action of the Minkowski matrix on vectors. /-- The time components of a vector acted on by the Minkowski matrix remains unchanged. -/ @[simp] lemma mulVec_inl_0 (v : (Fin 1 ⊕ Fin d) → ℝ) : - (η *ᵥ v) (Sum.inl 0) = v (Sum.inl 0) := by - simp [as_diagonal, mulVec_diagonal] + (η *ᵥ v) (Sum.inl 0) = v (Sum.inl 0) := by simp [as_diagonal, mulVec_diagonal] /-- The space components of a vector acted on by the Minkowski matrix swaps sign. -/ @[simp] lemma mulVec_inr_i (v : (Fin 1 ⊕ Fin d) → ℝ) (i : Fin d) : - (η *ᵥ v) (Sum.inr i) = - v (Sum.inr i) := by - simp [as_diagonal, mulVec_diagonal] + (η *ᵥ v) (Sum.inr i) = - v (Sum.inr i) := by simp [as_diagonal, mulVec_diagonal] /-! @@ -285,8 +278,7 @@ lemma dual_dual : Function.Involutive (@dual d) := by /-- The Minkowski dual commutes with the transpose. -/ @[simp] -lemma dual_transpose : dual Λᵀ = (dual Λ)ᵀ := by - simp [dual, mul_assoc] +lemma dual_transpose : dual Λᵀ = (dual Λ)ᵀ := by simp [dual, mul_assoc] /-! @@ -296,8 +288,7 @@ lemma dual_transpose : dual Λᵀ = (dual Λ)ᵀ := by /-- The Minkowski dual preserves the Minkowski matrix. -/ @[simp] -lemma dual_eta : @dual d η = η := by - simp [dual] +lemma dual_eta : @dual d η = η := by simp [dual] /-! @@ -324,13 +315,11 @@ We show a number of properties related to the components of the duals. /-- Expansion of the components of the Minkowski dual in terms of the components of the original matrix. -/ lemma dual_apply (μ ν : Fin 1 ⊕ Fin d) : - dual Λ μ ν = η μ μ * Λ ν μ * η ν ν := by - simp [dual, as_diagonal] + dual Λ μ ν = η μ μ * Λ ν μ * η ν ν := by simp [dual, as_diagonal] /-- The components of the Minkowski dual of a matrix multiplied by the Minkowski matrix in terms of the original matrix. -/ lemma dual_apply_minkowskiMatrix (μ ν : Fin 1 ⊕ Fin d) : - dual Λ μ ν * η ν ν = η μ μ * Λ ν μ := by - simp [dual_apply, mul_assoc] + dual Λ μ ν * η ν ν = η μ μ * Λ ν μ := by simp [dual_apply, mul_assoc] end minkowskiMatrix diff --git a/Physlib/Relativity/PauliMatrices/AsTensor.lean b/Physlib/Relativity/PauliMatrices/AsTensor.lean index d1fcdbb6f..7bbfebbe8 100644 --- a/Physlib/Relativity/PauliMatrices/AsTensor.lean +++ b/Physlib/Relativity/PauliMatrices/AsTensor.lean @@ -42,8 +42,7 @@ lemma asTensor_expand_complexContrBasis : asTensor = complexContrBasis (Sum.inl 0) ⊗ₜ leftRightToMatrix.symm (pauliBasis (Sum.inl 0)) + complexContrBasis (Sum.inr 0) ⊗ₜ leftRightToMatrix.symm (pauliBasis (Sum.inr 0)) + complexContrBasis (Sum.inr 1) ⊗ₜ leftRightToMatrix.symm (pauliBasis (Sum.inr 1)) - + complexContrBasis (Sum.inr 2) ⊗ₜ leftRightToMatrix.symm (pauliBasis (Sum.inr 2)) := by - rfl + + complexContrBasis (Sum.inr 2) ⊗ₜ leftRightToMatrix.symm (pauliBasis (Sum.inr 2)) := rfl /-- The expansion of the pauli matrix `σ₀` in terms of a basis of tensor product vectors. -/ lemma leftRightToMatrix_σSA_inl_0_expand : leftRightToMatrix.symm (pauliBasis (Sum.inl 0)) = @@ -100,8 +99,7 @@ def asConsTensor : map_add' := fun x y => by simp only [add_smul] map_smul' := fun m x => by - simp only [smul_smul] - rfl + simp only [smul_eq_mul, smul_smul, RingHom.id_apply] isIntertwining' M := by refine LinearMap.ext fun x : ℂ => ?_ change x • asTensor = @@ -173,9 +171,7 @@ def asConsTensor : /-- The map `𝟙_ (Rep ℂ SL(2,ℂ)) ⟶ complexContr ⊗ leftHanded ⊗ rightHanded` corresponding to Pauli matrices, when evaluated on `1` corresponds to the tensor `PauliMatrix.asTensor`. -/ -lemma asConsTensor_apply_one : asConsTensor (1 : ℂ) = asTensor := by - change (1 : ℂ) • asTensor = asTensor - simp only [one_smul] +lemma asConsTensor_apply_one : asConsTensor (1 : ℂ) = asTensor := by simp [asConsTensor] end end PauliMatrix diff --git a/Physlib/Relativity/PauliMatrices/Basic.lean b/Physlib/Relativity/PauliMatrices/Basic.lean index 471937671..1f5c31824 100644 --- a/Physlib/Relativity/PauliMatrices/Basic.lean +++ b/Physlib/Relativity/PauliMatrices/Basic.lean @@ -60,8 +60,7 @@ scoped[PauliMatrix] notation "σ2" => σ (Sum.inr 1) /-- The Pauli matrix corresponding to the matrix `!![1, 0; 0, -1]`. -/ scoped[PauliMatrix] notation "σ3" => σ (Sum.inr 2) -lemma pauliMatrix_inl_zero_eq_one : pauliMatrix (Sum.inl 0) = 1 := by - dsimp [pauliMatrix] +lemma pauliMatrix_inl_zero_eq_one : pauliMatrix (Sum.inl 0) = 1 := rfl /-! @@ -73,8 +72,7 @@ lemma pauliMatrix_selfAdjoint (μ : Fin 1 ⊕ Fin 3) : (σ μ)ᴴ = σ μ := by fin_cases μ all_goals - dsimp [pauliMatrix] - rw [eta_fin_two _ᴴ] + rw [pauliMatrix.eq_def, eta_fin_two _ᴴ] simp ext i j fin_cases i <;> fin_cases j @@ -92,8 +90,7 @@ lemma pauliMatrix_mul_self (μ : Fin 1 ⊕ Fin 3) : (σ μ) * (σ μ) = 1 := by fin_cases μ all_goals - dsimp [pauliMatrix] - simp [one_fin_two] + simp [pauliMatrix, one_fin_two] instance pauliMatrixInvertiable (μ : Fin 1 ⊕ Fin 3) : Invertible (σ μ) := by use σ μ @@ -143,28 +140,24 @@ lemma σ1_σ1_trace : Matrix.trace (σ1 * σ1) = 2 := by simp /-- The trace of `σ1` multiplied by `σ2` is equal to `0`. -/ @[simp] -lemma σ1_σ2_trace : Matrix.trace (σ1 * σ2) = 0 := by - simp [pauliMatrix] +lemma σ1_σ2_trace : Matrix.trace (σ1 * σ2) = 0 := by simp [pauliMatrix] /-- The trace of `σ1` multiplied by `σ3` is equal to `0`. -/ @[simp] -lemma σ1_σ3_trace : Matrix.trace (σ1 * σ3) = 0 := by - simp [pauliMatrix] +lemma σ1_σ3_trace : Matrix.trace (σ1 * σ3) = 0 := by simp [pauliMatrix] /-- The trace of `σ2` multiplied by `σ0` is equal to `0`. -/ lemma σ2_σ0_trace : Matrix.trace (σ2 * σ0) = 0 := by simp [pauliMatrix] /-- The trace of `σ2` multiplied by `σ1` is equal to `0`. -/ -lemma σ2_σ1_trace : Matrix.trace (σ2 * σ1) = 0 := by - simp [pauliMatrix] +lemma σ2_σ1_trace : Matrix.trace (σ2 * σ1) = 0 := by simp [pauliMatrix] /-- The trace of `σ2` multiplied by `σ2` is equal to `2`. -/ lemma σ2_σ2_trace : Matrix.trace (σ2 * σ2) = 2 := by simp /-- The trace of `σ2` multiplied by `σ3` is equal to `0`. -/ @[simp] -lemma σ2_σ3_trace : Matrix.trace (σ2 * σ3) = 0 := by - simp [pauliMatrix] +lemma σ2_σ3_trace : Matrix.trace (σ2 * σ3) = 0 := by simp [pauliMatrix] /-- The trace of `σ3` multiplied by `σ0` is equal to `0`. -/ lemma σ3_σ0_trace : Matrix.trace (σ3 * σ0) = 0 := by simp [pauliMatrix] diff --git a/Physlib/Relativity/SL2C/Basic.lean b/Physlib/Relativity/SL2C/Basic.lean index 3f7ba29f2..673763862 100644 --- a/Physlib/Relativity/SL2C/Basic.lean +++ b/Physlib/Relativity/SL2C/Basic.lean @@ -72,8 +72,7 @@ lemma toSelfAdjointMap_apply (A : selfAdjoint (Matrix (Fin 2) (Fin 2) ℂ)) : (star_eq_conjTranspose A.1).symm.trans $ selfAdjoint.mem_iff.mp A.2]⟩ := rfl lemma toSelfAdjointMap_apply_det (M : SL(2, ℂ)) (A : selfAdjoint (Matrix (Fin 2) (Fin 2) ℂ)) : - det ((toSelfAdjointMap M) A).1 = det A.1 := by - simp [toSelfAdjointMap] + det ((toSelfAdjointMap M) A).1 = det A.1 := by simp [toSelfAdjointMap] lemma toSelfAdjointMap_apply_pauliBasis'_inl (M : SL(2, ℂ)) : toSelfAdjointMap M (PauliMatrix.pauliBasis' (Sum.inl 0)) = @@ -152,8 +151,7 @@ lemma toMatrix_apply_contrMod (M : SL(2, ℂ)) (v : ContrMod 3) : *ᵥ (((Finsupp.linearEquivFunOnFinite ℝ ℝ (Fin 1 ⊕ Fin 3)) (PauliMatrix.pauliBasis'.repr a)))) = _ apply congrArg - erw [LinearMap.toMatrix_mulVec_repr] - rfl + exact LinearMap.toMatrix_mulVec_repr PauliMatrix.pauliBasis' _ _ a lemma toMatrix_mem_lorentzGroup (M : SL(2, ℂ)) : toMatrix M ∈ LorentzGroup 3 := by rw [LorentzGroup.mem_iff_norm] @@ -167,17 +165,14 @@ lemma toMatrix_mem_lorentzGroup (M : SL(2, ℂ)) : toMatrix M ∈ LorentzGroup 3 @[simps!] def toLorentzGroup : SL(2, ℂ) →* LorentzGroup 3 where toFun M := ⟨toMatrix M, toMatrix_mem_lorentzGroup M⟩ - map_one' := by - simp only [_root_.map_one] - rfl + map_one' := Subtype.ext (by simp) map_mul' M N := by ext1 simp only [_root_.map_mul, lorentzGroupIsGroup_mul_coe] lemma toLorentzGroup_eq_pauliBasis' (M : SL(2, ℂ)) : toLorentzGroup M = LinearMap.toMatrix - PauliMatrix.pauliBasis' PauliMatrix.pauliBasis' (toSelfAdjointMap M) := by - rfl + PauliMatrix.pauliBasis' PauliMatrix.pauliBasis' (toSelfAdjointMap M) := rfl lemma toSelfAdjointMap_basis (i : Fin 1 ⊕ Fin 3) : toSelfAdjointMap M (PauliMatrix.pauliBasis' i) = @@ -235,8 +230,7 @@ lemma toLorentzGroup_fst_col (M : SL(2, ℂ)) : refine sub_eq_zero.mp ?_ refine Fintype.linearIndependent_iff.mp PauliMatrix.pauliBasis'.linearIndependent (fun x => ((toLorentzGroup M).1 x (Sum.inl 0) - k x)) ?_ μ - simp only [sub_smul] - exact h1x + simpa only [sub_smul] using h1x /-- The first element of the image of `SL(2, ℂ)` in the Lorentz group. -/ lemma toLorentzGroup_inl_inl (M : SL(2, ℂ)) : diff --git a/Physlib/Relativity/SL2C/SelfAdjoint.lean b/Physlib/Relativity/SL2C/SelfAdjoint.lean index d8e873171..1290658d7 100644 --- a/Physlib/Relativity/SL2C/SelfAdjoint.lean +++ b/Physlib/Relativity/SL2C/SelfAdjoint.lean @@ -122,8 +122,7 @@ lemma toSelfAdjointMap_det_one' {M : ℂ²ˣ²} (hM : M.IsUpperTriangular) (detM have he' : Mᴴ = !![conj x, 0; _, conj y] := Matrix.ext fun | 0, 0 | 1, 0 | 1, 1 => rfl | 0, 1 => by simp [hM10] have hxy : x * y = 1 := by rw [show x * y = M.det by rw [he]; simp, detM] - have detA_one : normSq x * normSq y = 1 := by - rw [← Complex.normSq_mul, hxy, Complex.normSq_one] + have detA_one : normSq x * normSq y = 1 := by rw [← Complex.normSq_mul, hxy, Complex.normSq_one] have detD_one : D.det = 1 := let z := x * conj y have k₀ : (M * E₂ * Mᴴ) 0 1 = z := by rw [he', he]; simp [E₂, z] diff --git a/Physlib/Relativity/Special/ProperTime.lean b/Physlib/Relativity/Special/ProperTime.lean index 4ca7759fa..0771bc087 100644 --- a/Physlib/Relativity/Special/ProperTime.lean +++ b/Physlib/Relativity/Special/ProperTime.lean @@ -36,9 +36,7 @@ def properTime {d : ℕ} (q p : SpaceTime d) : ℝ := lemma properTime_pos_ofTimeLike {d : ℕ} (q p : SpaceTime d) (h : causalCharacter (p - q) = .timeLike) : 0 < properTime q p := by - rw [properTime] - refine sqrt_pos_of_pos ?_ - exact (timeLike_iff_norm_sq_pos (p - q)).mp h + simpa [properTime] using sqrt_pos_of_pos ((timeLike_iff_norm_sq_pos (p - q)).mp h) lemma properTime_zero_ofLightLike {d : ℕ} (q p : SpaceTime d) (h : causalCharacter (p - q) = .lightLike) : diff --git a/Physlib/Relativity/Tensors/Basic.lean b/Physlib/Relativity/Tensors/Basic.lean index efc05c52f..0c9805737 100644 --- a/Physlib/Relativity/Tensors/Basic.lean +++ b/Physlib/Relativity/Tensors/Basic.lean @@ -102,8 +102,7 @@ lemma congr_mid {n : ℕ} {c : Fin n → C} (c' : C) (p : Pure S c) subst hi simp only [LinearEquiv.cast_apply, cast_eq] symm - apply congr_right - exact h + exact congr_right p i j h lemma map_mid_move_left {n n1 : ℕ} {c : Fin n → C} {c1 : Fin n1 → C} (p : Pure S c) (p' : Pure S c1) {c' : C} @@ -136,8 +135,7 @@ lemma update_eq_function_update {n : ℕ} {c : Fin n → C} [inst : DecidableEq @[simp] lemma update_same {n : ℕ} {c : Fin n → C} [inst : DecidableEq (Fin n)] (p : Pure S c) (i : Fin n) - (x : V (c i)) : (update p i x) i = x := by - simp [update] + (x : V (c i)) : (update p i x) i = x := by simp [update] lemma update_diff {n : ℕ} {c : Fin n → C} [inst : DecidableEq (Fin n)] (p : Pure S c) (i j : Fin n) (x : V (c i)) (hij : i ≠ j) : (update p i x) j = p j := by @@ -149,8 +147,7 @@ lemma update_succAbove_apply {n : ℕ} {c : Fin (n + 1) → C} [inst : Decidable (p : Pure S c) (i : Fin (n + 1)) (j : Fin n) (x : V (c (i.succAbove j))) : update p (i.succAbove j) x i = p i := by simp only [update] - rw [Function.update_of_ne] - exact Fin.ne_succAbove i j + simp [Function.update_of_ne, Fin.ne_succAbove i j] @[simp] lemma toTensor_update_add {n : ℕ} {c : Fin n → C} [inst : DecidableEq (Fin n)] (p : Pure S c) @@ -161,8 +158,7 @@ lemma toTensor_update_add {n : ℕ} {c : Fin n → C} [inst : DecidableEq (Fin n @[simp] lemma toTensor_update_smul {n : ℕ} {c : Fin n → C} [inst : DecidableEq (Fin n)] (p : Pure S c) (i : Fin n) (r : k) (y : V (c i)) : - (update p i (r • y)).toTensor = r • (update p i y).toTensor := by - simp [toTensor, update] + (update p i (r • y)).toTensor = r • (update p i y).toTensor := by simp [toTensor, update] /-- Given a list of indices `c` of length `n + 1`, a pure tensor `p` and an `i : Fin (n + 1)`, then `drop p i` is the tensor `p` with it's `i`th part dropped. @@ -184,8 +180,7 @@ lemma update_succAbove_drop {n : ℕ} {c : Fin (n + 1) → C} [inst : DecidableE · rw [Function.update_of_ne h, Function.update_of_ne] · rfl · simp only [ne_eq] - rw [Function.Injective.eq_iff (Fin.succAbove_right_injective (p := i))] - exact h + simpa [Function.Injective.eq_iff (Fin.succAbove_right_injective (p := i))] using h @[simp] lemma update_drop_self {n : ℕ} {c : Fin (n + 1) → C} [inst : DecidableEq (Fin (n + 1))] @@ -193,8 +188,7 @@ lemma update_drop_self {n : ℕ} {c : Fin (n + 1) → C} [inst : DecidableEq (Fi (update p i x).drop i = p.drop i := by ext k simp only [Function.comp_apply, drop, update] - rw [Function.update_of_ne] - exact Fin.succAbove_ne i k + simp [Function.update_of_ne, Fin.succAbove_ne i k] /-! @@ -219,8 +213,7 @@ lemma component_eq_drop {n : ℕ} {c : Fin (n + 1) → C} (p : Pure S c) (i : Fi p.component φ = ((b (c i)).repr (p i) (φ i)) * ((drop p i).component (fun j => φ (i.succAbove j))) := by simp only [component, Function.comp_apply] - rw [Fin.prod_univ_succAbove _ i] - rfl + exact Fin.prod_univ_succAbove _ i @[simp] lemma component_update_add {n : ℕ} [inst : DecidableEq (Fin n)] @@ -258,13 +251,11 @@ noncomputable def componentMap {n : ℕ} (c : Fin n → C) : exact component_update_add p i x y b map_update_smul' p i x y := by ext b - change component (update p i (x • y)) b = x * component (update p i y) b exact component_update_smul p i x y b @[simp] lemma componentMap_apply {n : ℕ} (c : Fin n → C) - (p : Pure S c) : componentMap c p = p.component := by - rfl + (p : Pure S c) : componentMap c p = p.component := rfl /-- Given an component idx `b` in `ComponentIdx c`, `basisVector c b` is the pure tensor formed by `S.basis (c i) (b i)`. -/ @@ -288,8 +279,7 @@ lemma component_basisVector {n : ℕ} (c : Fin n → C) (b1 b2 : ComponentIdx (S simp_all only [not_forall] obtain ⟨w, h⟩ := h refine Finset.prod_eq_zero (Finset.mem_univ i) ?_ - rw [Finsupp.single_eq_of_ne] - exact fun a => hi (id (Eq.symm a)) + exact Finsupp.single_eq_of_ne fun a => hi (id (Eq.symm a)) end Pure @@ -327,10 +317,8 @@ lemma componentMap_pure {n : ℕ} (c : Fin n → C) def ofComponents {n : ℕ} (c : Fin n → C) : (ComponentIdx (S := S) c → k) →ₗ[k] S.Tensor c where toFun f := ∑ b, f b • (Pure.basisVector c b).toTensor - map_add' fb gb := by - simp [add_smul, Finset.sum_add_distrib] - map_smul' fb r := by - simp [smul_smul, Finset.smul_sum] + map_add' fb gb := by simp [add_smul, Finset.sum_add_distrib] + map_smul' fb r := by simp [smul_smul, Finset.smul_sum] @[simp] lemma componentMap_ofComponents {n : ℕ} (c : Fin n → C) (f : ComponentIdx c → k) : @@ -487,8 +475,6 @@ lemma actionP_cast {g : G} {p : Pure S c} (h : c = c1) : lemma drop_actionP {n : ℕ} {c : Fin (n + 1) → C} {i : Fin (n + 1)} {p : Pure S c} (g : G) : (g • p).drop i = g • (p.drop i) := by ext j - rw [drop, actionP_eq, actionP_eq] - simp only [Function.comp_apply] rfl end Pure @@ -506,19 +492,16 @@ lemma actionT_eq {g : G} {t : S.Tensor c} : g • t = PiTensorProduct.map (fun i => rep (c i) g) t := rfl noncomputable instance actionT : MulAction G (S.Tensor c) where - one_smul t := by - simp [actionT_eq] + one_smul t := by simp [actionT_eq] mul_smul g g' t := by simp [actionT_eq] change _ = (PiTensorProduct.map (fun i => rep (c i) g) ∘ₗ (PiTensorProduct.map (fun i => rep (c i) g'))) t - rw [← PiTensorProduct.map_comp] - rfl + exact LinearMap.congr_fun (PiTensorProduct.map_comp _ _) t lemma actionT_pure {g : G} {p : Pure S c} : g • p.toTensor = Pure.toTensor (g • p) := by - rw [actionT_eq, Pure.toTensor, PiTensorProduct.map_tprod] - rfl + exact PiTensorProduct.map_tprod (R := k) (fun i => rep (c i) g) p lemma actionT_add {g : G} {t1 t2 : S.Tensor c} : g • (t1 + t2) = g • t1 + g • t2 := by @@ -531,14 +514,10 @@ lemma actionT_smul {g : G} {r : k} {t : S.Tensor c} : rw [actionT_eq, actionT_eq (S := S)] simp -lemma actionT_zero {g : G} : g • (0 : S.Tensor c) = 0 := by - simp [actionT_eq] +lemma actionT_zero {g : G} : g • (0 : S.Tensor c) = 0 := by simp [actionT_eq] lemma actionT_neg {g : G} {t : S.Tensor c} : - g • (-t) = -(g • t) := by - rw [actionT_eq] - simp only [map_neg, neg_inj] - rfl + g • (-t) = -(g • t) := by simp [actionT_eq] noncomputable instance : DistribMulAction G (S.Tensor c) where smul_zero g := by simp [actionT_zero] @@ -775,8 +754,7 @@ noncomputable def toField {c : Fin 0 → C} : S.Tensor c →ₗ[k] k := (PiTensorProduct.isEmptyEquiv (Fin 0)).toLinearMap lemma toField_default {c : Fin 0 → C} : - toField (Pure.toTensor default : S.Tensor c) = 1 := by - simp [toField, Pure.toTensor] + toField (Pure.toTensor default : S.Tensor c) = 1 := by simp [toField, Pure.toTensor] lemma toField_injective {c : Fin 0 → C} : Function.Injective (toField : S.Tensor c → k) := @@ -805,8 +783,7 @@ lemma toField_basis_default {c : Fin 0 → C} : simp [basis_apply] lemma toField_basis {c : Fin 0 → C} (b : ComponentIdx (S := S) c) : - toField (basis c b) = 1 := by - simp [basis_apply] + toField (basis c b) = 1 := by simp [basis_apply] lemma toField_eq_repr {c : Fin 0 → C} (t : Tensor S c) : t.toField = (basis c).repr t (fun j => Fin.elim0 j) := by diff --git a/Physlib/Relativity/Tensors/ComplexTensor/Matrix/Pre.lean b/Physlib/Relativity/Tensors/ComplexTensor/Matrix/Pre.lean index d0175eb43..576b8bde7 100644 --- a/Physlib/Relativity/Tensors/ComplexTensor/Matrix/Pre.lean +++ b/Physlib/Relativity/Tensors/ComplexTensor/Matrix/Pre.lean @@ -118,8 +118,7 @@ lemma contrContrToMatrix_ρ (v : (ContrℂModule ⊗[ℂ] ContrℂModule)) (M : have h1 := (LinearMap.toMatrix_mulVec_repr (complexContrBasis.tensorProduct complexContrBasis) (complexContrBasis.tensorProduct complexContrBasis) (TensorProduct.map (ContrℂModule.SL2CRep M) (ContrℂModule.SL2CRep M)) v) - erw [h1] - rfl + exact h1.symm rw [TensorProduct.toMatrix_map] funext i j change ∑ k, ((kroneckerMap (fun x1 x2 => x1 * x2) @@ -162,8 +161,7 @@ lemma coCoToMatrix_ρ (v : (CoℂModule ⊗[ℂ] CoℂModule)) (M : SL(2,ℂ)) : have h1 := (LinearMap.toMatrix_mulVec_repr (complexCoBasis.tensorProduct complexCoBasis) (complexCoBasis.tensorProduct complexCoBasis) (TensorProduct.map (CoℂModule.SL2CRep M) (CoℂModule.SL2CRep M)) v) - erw [h1] - rfl + exact h1.symm rw [TensorProduct.toMatrix_map] funext i j change ∑ k, ((kroneckerMap (fun x1 x2 => x1 * x2) @@ -205,8 +203,7 @@ lemma contrCoToMatrix_ρ (v : (ContrℂModule ⊗[ℂ] CoℂModule)) (M : SL(2, have h1 := (LinearMap.toMatrix_mulVec_repr (complexContrBasis.tensorProduct complexCoBasis) (complexContrBasis.tensorProduct complexCoBasis) (TensorProduct.map (ContrℂModule.SL2CRep M) (CoℂModule.SL2CRep M)) v) - erw [h1] - rfl + exact h1.symm rw [TensorProduct.toMatrix_map] funext i j change ∑ k, ((kroneckerMap (fun x1 x2 => x1 * x2) @@ -248,8 +245,7 @@ lemma coContrToMatrix_ρ (v : (CoℂModule ⊗[ℂ] ContrℂModule)) (M : SL(2, have h1 := (LinearMap.toMatrix_mulVec_repr (complexCoBasis.tensorProduct complexContrBasis) (complexCoBasis.tensorProduct complexContrBasis) (TensorProduct.map (CoℂModule.SL2CRep M) (ContrℂModule.SL2CRep M)) v) - erw [h1] - rfl + exact h1.symm rw [TensorProduct.toMatrix_map] funext i j change ∑ k, ((kroneckerMap (fun x1 x2 => x1 * x2) diff --git a/Physlib/Relativity/Tensors/ComplexTensor/Metrics/Basic.lean b/Physlib/Relativity/Tensors/ComplexTensor/Metrics/Basic.lean index d9f832f19..13fc2fb0e 100644 --- a/Physlib/Relativity/Tensors/ComplexTensor/Metrics/Basic.lean +++ b/Physlib/Relativity/Tensors/ComplexTensor/Metrics/Basic.lean @@ -85,14 +85,10 @@ open Tensor -/ lemma coMetric_eq_fromConstPair : η' = fromConstPair (S := complexLorentzTensor) - (c1 := .down) (c2 := .down) Lorentz.coMetric := by - rw [Lorentz.coMetric] - rfl + (c1 := .down) (c2 := .down) Lorentz.coMetric := rfl lemma contrMetric_eq_fromConstPair : η = fromConstPair (S := complexLorentzTensor) - (c1 := .up) (c2 := .up) Lorentz.contrMetric := by - rw [Lorentz.contrMetric] - rfl + (c1 := .up) (c2 := .up) Lorentz.contrMetric := rfl lemma leftMetric_eq_fromConstPair : εL = fromConstPair Fermion.leftMetric := rfl @@ -109,34 +105,28 @@ lemma dualRightMetric_eq_fromConstPair : εR' = fromConstPair Fermion.dualRightM -/ lemma coMetric_eq_fromPairT : η' = fromPairT (Lorentz.coMetricVal) := by - rw [coMetric_eq_fromConstPair, fromConstPair] - congr 1 - exact Lorentz.coMetric_apply_one + simpa only [coMetric_eq_fromConstPair, fromConstPair] using + congrArg fromPairT Lorentz.coMetric_apply_one lemma contrMetric_eq_fromPairT : η = fromPairT (Lorentz.contrMetricVal) := by - rw [contrMetric_eq_fromConstPair, fromConstPair] - congr 1 - exact Lorentz.contrMetric_apply_one + simpa only [contrMetric_eq_fromConstPair, fromConstPair] using + congrArg fromPairT Lorentz.contrMetric_apply_one lemma leftMetric_eq_fromPairT : εL = fromPairT (Fermion.leftMetricVal) := by - rw [leftMetric_eq_fromConstPair, fromConstPair] - congr 1 - exact Fermion.leftMetric_apply_one + simpa only [leftMetric_eq_fromConstPair, fromConstPair] using + congrArg fromPairT Fermion.leftMetric_apply_one lemma rightMetric_eq_fromPairT : εR = fromPairT (Fermion.rightMetricVal) := by - rw [rightMetric_eq_fromConstPair, fromConstPair] - congr 1 - exact Fermion.rightMetric_apply_one + simpa only [rightMetric_eq_fromConstPair, fromConstPair] using + congrArg fromPairT Fermion.rightMetric_apply_one lemma dualLeftMetric_eq_fromPairT : εL' = fromPairT (Fermion.dualLeftMetricVal) := by - rw [dualLeftMetric_eq_fromConstPair, fromConstPair] - congr 1 - exact Fermion.dualLeftMetric_apply_one + simpa only [dualLeftMetric_eq_fromConstPair, fromConstPair] using + congrArg fromPairT Fermion.dualLeftMetric_apply_one lemma dualRightMetric_eq_fromPairT : εR' = fromPairT (Fermion.dualRightMetricVal) := by - rw [dualRightMetric_eq_fromConstPair, fromConstPair] - congr 1 - exact Fermion.dualRightMetric_apply_one + simpa only [dualRightMetric_eq_fromConstPair, fromConstPair] using + congrArg fromPairT Fermion.dualRightMetric_apply_one /-! @@ -160,8 +150,7 @@ lemma coMetric_eq_complexCoBasisFin4 : η' = - fromPairT (complexCoBasisFin4 2 ⊗ₜ[ℂ] complexCoBasisFin4 2) - fromPairT (complexCoBasisFin4 3 ⊗ₜ[ℂ] complexCoBasisFin4 3) := by rw [coMetric_eq_complexCoBasis] - simp [complexCoBasisFin4] - rfl + simp [complexCoBasisFin4, finSumFinEquiv, Fin.addCases] open Lorentz in lemma contrMetric_eq_complexContrBasis : η = @@ -179,8 +168,7 @@ lemma contrMetric_eq_complexContrBasisFin4 : η = - fromPairT (complexContrBasisFin4 2 ⊗ₜ[ℂ] complexContrBasisFin4 2) - fromPairT (complexContrBasisFin4 3 ⊗ₜ[ℂ] complexContrBasisFin4 3) := by rw [contrMetric_eq_complexContrBasis] - simp [complexContrBasisFin4] - rfl + simp [complexContrBasisFin4, finSumFinEquiv, Fin.addCases] open Fermion in lemma leftMetric_eq_leftBasis : εL = @@ -403,34 +391,22 @@ lemma dualRightMetric_eq_ofRat : εR' = ofRat fun f => open TensorSpecies -set_option backward.isDefEq.respectTransparency false in /-- The tensor `coMetric` is invariant under the action of `SL(2,ℂ)`. -/ -lemma actionT_coMetric (g : SL(2,ℂ)) : g • η' = η' := by - rw [metricTensor_invariant] +lemma actionT_coMetric (g : SL(2,ℂ)) : g • η' = η' := metricTensor_invariant g -set_option backward.isDefEq.respectTransparency false in /-- The tensor `contrMetric` is invariant under the action of `SL(2,ℂ)`. -/ -lemma actionT_contrMetric (g : SL(2,ℂ)) : g • η = η := by - rw [metricTensor_invariant] +lemma actionT_contrMetric (g : SL(2,ℂ)) : g • η = η := metricTensor_invariant g -set_option backward.isDefEq.respectTransparency false in /-- The tensor `leftMetric` is invariant under the action of `SL(2,ℂ)`. -/ -lemma actionT_leftMetric (g : SL(2,ℂ)) : g • εL = εL := by - rw [metricTensor_invariant] +lemma actionT_leftMetric (g : SL(2,ℂ)) : g • εL = εL := metricTensor_invariant g -set_option backward.isDefEq.respectTransparency false in /-- The tensor `rightMetric` is invariant under the action of `SL(2,ℂ)`. -/ -lemma actionT_rightMetric (g : SL(2,ℂ)) : g • εR = εR := by - rw [metricTensor_invariant] +lemma actionT_rightMetric (g : SL(2,ℂ)) : g • εR = εR := metricTensor_invariant g -set_option backward.isDefEq.respectTransparency false in /-- The tensor `dualLeftMetric` is invariant under the action of `SL(2,ℂ)`. -/ -lemma actionT_dualLeftMetric (g : SL(2,ℂ)) : g • εL' = εL' := by - rw [metricTensor_invariant] +lemma actionT_dualLeftMetric (g : SL(2,ℂ)) : g • εL' = εL' := metricTensor_invariant g -set_option backward.isDefEq.respectTransparency false in /-- The tensor `dualRightMetric` is invariant under the action of `SL(2,ℂ)`. -/ -lemma actionT_dualRightMetric (g : SL(2,ℂ)) : g • εR' = εR' := by - rw [metricTensor_invariant] +lemma actionT_dualRightMetric (g : SL(2,ℂ)) : g • εR' = εR' := metricTensor_invariant g end complexLorentzTensor diff --git a/Physlib/Relativity/Tensors/ComplexTensor/Metrics/Pre.lean b/Physlib/Relativity/Tensors/ComplexTensor/Metrics/Pre.lean index 0be7cec11..ce8b812b6 100644 --- a/Physlib/Relativity/Tensors/ComplexTensor/Metrics/Pre.lean +++ b/Physlib/Relativity/Tensors/ComplexTensor/Metrics/Pre.lean @@ -55,9 +55,7 @@ def contrMetric : (Representation.trivial ℂ SL(2,ℂ) ℂ).IntertwiningMap a' • contrMetricVal map_add' := fun x y => by simp only [add_smul] - map_smul' := fun m x => by - simp only [smul_smul] - rfl + map_smul' := fun m x => by simp only [smul_eq_mul, smul_smul, RingHom.id_apply] isIntertwining' M := by refine LinearMap.ext fun x : ℂ => ?_ change x • contrMetricVal = @@ -69,9 +67,7 @@ def contrMetric : (Representation.trivial ℂ SL(2,ℂ) ℂ).IntertwiningMap apply congrArg simp only [LorentzGroup.toComplex_mul_minkowskiMatrix_mul_transpose] -lemma contrMetric_apply_one : contrMetric (1 : ℂ) = contrMetricVal := by - change (1 : ℂ) • contrMetricVal = contrMetricVal - simp only [one_smul] +lemma contrMetric_apply_one : contrMetric (1 : ℂ) = contrMetricVal := by simp [contrMetric] /-- The metric `ηᵢᵢ` as an element of `(complexCo ⊗ complexCo).V`. -/ def coMetricVal : (CoℂModule ⊗[ℂ] CoℂModule) := @@ -105,9 +101,7 @@ def coMetric : (Representation.trivial ℂ SL(2,ℂ) ℂ).IntertwiningMap a' • coMetricVal map_add' := fun x y => by simp only [add_smul] - map_smul' := fun m x => by - simp only [smul_smul] - rfl + map_smul' := fun m x => by simp only [smul_eq_mul, smul_smul, RingHom.id_apply] isIntertwining' M := by refine LinearMap.ext fun x : ℂ => ?_ change x • coMetricVal = @@ -121,9 +115,7 @@ def coMetric : (Representation.trivial ℂ SL(2,ℂ) ℂ).IntertwiningMap simp only [LorentzGroup.inv_eq_dual, SL2C.toLorentzGroup_apply_coe, LorentzGroup.toComplex_transpose_mul_minkowskiMatrix_mul_self] -lemma coMetric_apply_one : coMetric (1 : ℂ) = coMetricVal := by - change (1 : ℂ) • coMetricVal = coMetricVal - simp only [one_smul] +lemma coMetric_apply_one : coMetric (1 : ℂ) = coMetricVal := by simp [coMetric] /-! diff --git a/Physlib/Relativity/Tensors/ComplexTensor/OfRat.lean b/Physlib/Relativity/Tensors/ComplexTensor/OfRat.lean index 5490f8761..28942f482 100644 --- a/Physlib/Relativity/Tensors/ComplexTensor/OfRat.lean +++ b/Physlib/Relativity/Tensors/ComplexTensor/OfRat.lean @@ -50,8 +50,7 @@ noncomputable def ofRat {n : ℕ} {c : Fin n → complexLorentzTensor.Color} : lemma ofRat_basis_repr_apply {n : ℕ} {c : Fin n → complexLorentzTensor.Color} (f : (ComponentIdx c) → RatComplexNum) (b :(ComponentIdx c)) : - (Tensor.basis c).repr (ofRat f) b = toComplexNum (f b) := by - simp [ofRat] + (Tensor.basis c).repr (ofRat f) b = toComplexNum (f b) := by simp [ofRat] lemma basis_eq_ofRat {n : ℕ} {c : Fin n → complexLorentzTensor.Color} (b : (ComponentIdx c)) : diff --git a/Physlib/Relativity/Tensors/ComplexTensor/Units/Basic.lean b/Physlib/Relativity/Tensors/ComplexTensor/Units/Basic.lean index 947062b86..0ad7057c2 100644 --- a/Physlib/Relativity/Tensors/ComplexTensor/Units/Basic.lean +++ b/Physlib/Relativity/Tensors/ComplexTensor/Units/Basic.lean @@ -84,29 +84,17 @@ scoped[complexLorentzTensor] notation "δR" => rightDualRightUnit -/ -lemma coContrUnit_eq_fromConstPair : δ' = fromConstPair Lorentz.coContrUnit := by - rw [Lorentz.coContrUnit] - rfl +lemma coContrUnit_eq_fromConstPair : δ' = fromConstPair Lorentz.coContrUnit := rfl -lemma contrCoUnit_eq_fromConstPair : δ = fromConstPair Lorentz.contrCoUnit := by - rw [Lorentz.contrCoUnit] - rfl +lemma contrCoUnit_eq_fromConstPair : δ = fromConstPair Lorentz.contrCoUnit := rfl -lemma dualLeftLeftUnit_eq_fromConstPair : δL' = fromConstPair Fermion.dualLeftLeftUnit := by - rw [Fermion.dualLeftLeftUnit] - rfl +lemma dualLeftLeftUnit_eq_fromConstPair : δL' = fromConstPair Fermion.dualLeftLeftUnit := rfl -lemma leftDualLeftUnit_eq_fromConstPair : δL = fromConstPair Fermion.leftDualLeftUnit := by - rw [Fermion.leftDualLeftUnit] - rfl +lemma leftDualLeftUnit_eq_fromConstPair : δL = fromConstPair Fermion.leftDualLeftUnit := rfl -lemma dualRightRightUnit_eq_fromConstPair : δR' = fromConstPair Fermion.dualRightRightUnit := by - rw [Fermion.dualRightRightUnit] - rfl +lemma dualRightRightUnit_eq_fromConstPair : δR' = fromConstPair Fermion.dualRightRightUnit := rfl -lemma rightDualRightUnit_eq_fromConstPair : δR = fromConstPair Fermion.rightDualRightUnit := by - rw [Fermion.rightDualRightUnit] - rfl +lemma rightDualRightUnit_eq_fromConstPair : δR = fromConstPair Fermion.rightDualRightUnit := rfl /-! @@ -115,34 +103,28 @@ lemma rightDualRightUnit_eq_fromConstPair : δR = fromConstPair Fermion.rightDua -/ lemma coContrUnit_eq_fromPairT : δ' = fromPairT (Lorentz.coContrUnitVal) := by - rw [coContrUnit_eq_fromConstPair, fromConstPair] - congr 1 - exact Lorentz.coContrUnit_apply_one + simpa only [coContrUnit_eq_fromConstPair, fromConstPair] using + congrArg fromPairT Lorentz.coContrUnit_apply_one lemma contrCoUnit_eq_fromPairT : δ = fromPairT (Lorentz.contrCoUnitVal) := by - rw [contrCoUnit_eq_fromConstPair, fromConstPair] - congr 1 - exact Lorentz.contrCoUnit_apply_one + simpa only [contrCoUnit_eq_fromConstPair, fromConstPair] using + congrArg fromPairT Lorentz.contrCoUnit_apply_one lemma dualLeftLeftUnit_eq_fromPairT : δL' = fromPairT (Fermion.dualLeftLeftUnitVal) := by - rw [dualLeftLeftUnit_eq_fromConstPair, fromConstPair] - congr 1 - exact Fermion.dualLeftLeftUnit_apply_one + simpa only [dualLeftLeftUnit_eq_fromConstPair, fromConstPair] using + congrArg fromPairT Fermion.dualLeftLeftUnit_apply_one lemma leftDualLeftUnit_eq_fromPairT : δL = fromPairT (Fermion.leftDualLeftUnitVal) := by - rw [leftDualLeftUnit_eq_fromConstPair, fromConstPair] - congr 1 - exact Fermion.leftDualLeftUnit_apply_one + simpa only [leftDualLeftUnit_eq_fromConstPair, fromConstPair] using + congrArg fromPairT Fermion.leftDualLeftUnit_apply_one lemma dualRightRightUnit_eq_fromPairT : δR' = fromPairT (Fermion.dualRightRightUnitVal) := by - rw [dualRightRightUnit_eq_fromConstPair, fromConstPair] - congr 1 - exact Fermion.dualRightRightUnit_apply_one + simpa only [dualRightRightUnit_eq_fromConstPair, fromConstPair] using + congrArg fromPairT Fermion.dualRightRightUnit_apply_one lemma rightDualRightUnit_eq_fromPairT : δR = fromPairT (Fermion.rightDualRightUnitVal) := by - rw [rightDualRightUnit_eq_fromConstPair, fromConstPair] - congr 1 - exact Fermion.rightDualRightUnit_apply_one + simpa only [rightDualRightUnit_eq_fromConstPair, fromConstPair] using + congrArg fromPairT Fermion.rightDualRightUnit_apply_one /-! @@ -153,52 +135,44 @@ lemma rightDualRightUnit_eq_fromPairT : δR = fromPairT (Fermion.rightDualRightU open Lorentz in lemma coContrUnit_eq_complexCoBasis_complexContrBasis : δ' = ∑ i, fromPairT (complexCoBasis i ⊗ₜ[ℂ] complexContrBasis i) := by - rw [coContrUnit_eq_fromPairT, coContrUnitVal_expand_tmul] - rfl + exact (coContrUnit_eq_fromPairT.trans (congrArg fromPairT coContrUnitVal_expand_tmul)).trans rfl open Lorentz in lemma coContrUnit_eq_complexCoBasisFin4_complexContrBasisFin4 : δ' = ∑ i, fromPairT (complexCoBasisFin4 i ⊗ₜ[ℂ] complexContrBasisFin4 i) := by - rw [coContrUnit_eq_complexCoBasis_complexContrBasis] - rw [← finSumFinEquiv.symm.sum_comp] + rw [coContrUnit_eq_complexCoBasis_complexContrBasis, ← finSumFinEquiv.symm.sum_comp] simp [complexCoBasisFin4, complexContrBasisFin4] open Lorentz in lemma contrCoUnit_eq_complexContrBasis_complexCoBasis : δ = ∑ i, fromPairT (complexContrBasis i ⊗ₜ[ℂ] complexCoBasis i) := by - rw [contrCoUnit_eq_fromPairT, contrCoUnitVal_expand_tmul] - rfl + exact (contrCoUnit_eq_fromPairT.trans (congrArg fromPairT contrCoUnitVal_expand_tmul)).trans rfl open Lorentz in lemma contrCoUnit_eq_complexContrBasisFin4_complexCoBasisFin4 : δ = ∑ i, fromPairT (complexContrBasisFin4 i ⊗ₜ[ℂ] complexCoBasisFin4 i) := by - rw [contrCoUnit_eq_complexContrBasis_complexCoBasis] - rw [← finSumFinEquiv.symm.sum_comp] + rw [contrCoUnit_eq_complexContrBasis_complexCoBasis, ← finSumFinEquiv.symm.sum_comp] simp [complexContrBasisFin4, complexCoBasisFin4] open Fermion in lemma dualLeftLeftUnit_eq_dualLeftBasis_leftBasis : δL' = ∑ i, fromPairT (dualLeftBasis i ⊗ₜ[ℂ] leftBasis i) := by - rw [dualLeftLeftUnit_eq_fromPairT, dualLeftLeftUnitVal_expand_tmul] - rfl + simp [dualLeftLeftUnit_eq_fromPairT, dualLeftLeftUnitVal_expand_tmul] open Fermion in lemma leftDualLeftUnit_eq_leftBasis_dualLeftBasis : δL = ∑ i, fromPairT (leftBasis i ⊗ₜ[ℂ] dualLeftBasis i) := by - rw [leftDualLeftUnit_eq_fromPairT, leftDualLeftUnitVal_expand_tmul] - rfl + simp [leftDualLeftUnit_eq_fromPairT, leftDualLeftUnitVal_expand_tmul] open Fermion in lemma dualRightRightUnit_eq_dualRightBasis_rightBasis : δR' = ∑ i, fromPairT (dualRightBasis i ⊗ₜ[ℂ] rightBasis i) := by - rw [dualRightRightUnit_eq_fromPairT, dualRightRightUnitVal_expand_tmul] - rfl + simp [dualRightRightUnit_eq_fromPairT, dualRightRightUnitVal_expand_tmul] open Fermion in lemma rightDualRightUnit_eq_rightBasis_dualRightBasis : δR = ∑ i, fromPairT (rightBasis i ⊗ₜ[ℂ] dualRightBasis i) := by - rw [rightDualRightUnit_eq_fromPairT, rightDualRightUnitVal_expand_tmul] - rfl + simp [rightDualRightUnit_eq_fromPairT, rightDualRightUnitVal_expand_tmul] /-! @@ -210,66 +184,42 @@ lemma coContrUnit_eq_basis : δ' = ∑ i, Tensor.basis (S := complexLorentzTensor) ![Color.down, Color.up] (fun | 0 => i | 1 => i) := by rw [coContrUnit_eq_complexCoBasisFin4_complexContrBasisFin4] - conv_lhs => - enter [2, x] - change fromPairT ((complexLorentzTensor.basis .down x) ⊗ₜ[ℂ] - (complexLorentzTensor.basis .up _)) - rw [fromPairT_apply_basis_repr] + simp [fromPairT_apply_basis_repr] rfl lemma contrCoUnit_eq_basis : δ = ∑ i, Tensor.basis (S := complexLorentzTensor) ![Color.up, Color.down] (fun | 0 => i | 1 => i) := by rw [contrCoUnit_eq_complexContrBasisFin4_complexCoBasisFin4] - conv_lhs => - enter [2, x] - change fromPairT ((complexLorentzTensor.basis .up x) ⊗ₜ[ℂ] - (complexLorentzTensor.basis .down _)) - rw [fromPairT_apply_basis_repr] + simp [fromPairT_apply_basis_repr] rfl lemma dualLeftLeftUnit_eq_basis : δL' = ∑ i, Tensor.basis (S := complexLorentzTensor) ![Color.downL, Color.upL] (fun | 0 => i | 1 => i) := by rw [dualLeftLeftUnit_eq_dualLeftBasis_leftBasis] - conv_lhs => - enter [2, x] - change fromPairT ((complexLorentzTensor.basis .downL x) ⊗ₜ[ℂ] - (complexLorentzTensor.basis .upL _)) - rw [fromPairT_apply_basis_repr] + simp [fromPairT_apply_basis_repr] rfl lemma leftDualLeftUnit_eq_basis : δL = ∑ i, Tensor.basis (S := complexLorentzTensor) ![Color.upL, Color.downL] (fun | 0 => i | 1 => i) := by rw [leftDualLeftUnit_eq_leftBasis_dualLeftBasis] - conv_lhs => - enter [2, x] - change fromPairT ((complexLorentzTensor.basis .upL x) ⊗ₜ[ℂ] - (complexLorentzTensor.basis .downL _)) - rw [fromPairT_apply_basis_repr] + simp [fromPairT_apply_basis_repr] rfl lemma dualRightRightUnit_eq_basis : δR' = ∑ i, Tensor.basis (S := complexLorentzTensor) ![Color.downR, Color.upR] (fun | 0 => i | 1 => i) := by rw [dualRightRightUnit_eq_dualRightBasis_rightBasis] - conv_lhs => - enter [2, x] - change fromPairT ((complexLorentzTensor.basis .downR x) ⊗ₜ[ℂ] - (complexLorentzTensor.basis .upR _)) - rw [fromPairT_apply_basis_repr] + simp [fromPairT_apply_basis_repr] rfl lemma rightDualRightUnit_eq_basis : δR = ∑ i, Tensor.basis (S := complexLorentzTensor) ![Color.upR, Color.downR] (fun | 0 => i | 1 => i) := by rw [rightDualRightUnit_eq_rightBasis_dualRightBasis] - conv_lhs => - enter [2, x] - change fromPairT ((complexLorentzTensor.basis .upR x) ⊗ₜ[ℂ] - (complexLorentzTensor.basis .downR _)) - rw [fromPairT_apply_basis_repr] + simp [fromPairT_apply_basis_repr] rfl /-! @@ -344,34 +294,22 @@ lemma rightDualRightUnit_eq_ofRat : δR = ofRat fun f => -/ -set_option backward.isDefEq.respectTransparency false in /-- The tensor `coContrUnit` is invariant under the action of `SL(2,ℂ)`. -/ -lemma actionT_coContrUnit (g : SL(2,ℂ)) : g • δ' = δ' := by - rw [unitTensor_invariant] +lemma actionT_coContrUnit (g : SL(2,ℂ)) : g • δ' = δ' := unitTensor_invariant g -set_option backward.isDefEq.respectTransparency false in /-- The tensor `contrCoUnit` is invariant under the action of `SL(2,ℂ)`. -/ -lemma actionT_contrCoUnit (g : SL(2,ℂ)) : g • δ = δ := by - rw [unitTensor_invariant] +lemma actionT_contrCoUnit (g : SL(2,ℂ)) : g • δ = δ := unitTensor_invariant g -set_option backward.isDefEq.respectTransparency false in /-- The tensor `dualLeftLeftUnit` is invariant under the action of `SL(2,ℂ)`. -/ -lemma actionT_dualLeftLeftUnit (g : SL(2,ℂ)) : g • δL' = δL' := by - rw [unitTensor_invariant] +lemma actionT_dualLeftLeftUnit (g : SL(2,ℂ)) : g • δL' = δL' := unitTensor_invariant g -set_option backward.isDefEq.respectTransparency false in /-- The tensor `leftDualLeftUnit` is invariant under the action of `SL(2,ℂ)`. -/ -lemma actionT_leftDualLeftUnit (g : SL(2,ℂ)) : g • δL = δL := by - rw [unitTensor_invariant] +lemma actionT_leftDualLeftUnit (g : SL(2,ℂ)) : g • δL = δL := unitTensor_invariant g -set_option backward.isDefEq.respectTransparency false in /-- The tensor `dualRightRightUnit` is invariant under the action of `SL(2,ℂ)`. -/ -lemma actionT_dualRightRightUnit (g : SL(2,ℂ)) : g • δR' = δR' := by - rw [unitTensor_invariant] +lemma actionT_dualRightRightUnit (g : SL(2,ℂ)) : g • δR' = δR' := unitTensor_invariant g -set_option backward.isDefEq.respectTransparency false in /-- The tensor `rightDualRightUnit` is invariant under the action of `SL(2,ℂ)`. -/ -lemma actionT_rightDualRightUnit (g : SL(2,ℂ)) : g • δR = δR := by - rw [unitTensor_invariant] +lemma actionT_rightDualRightUnit (g : SL(2,ℂ)) : g • δR = δR := unitTensor_invariant g end complexLorentzTensor diff --git a/Physlib/Relativity/Tensors/ComplexTensor/Units/Pre.lean b/Physlib/Relativity/Tensors/ComplexTensor/Units/Pre.lean index b766a96ff..d0bc3ba8d 100644 --- a/Physlib/Relativity/Tensors/ComplexTensor/Units/Pre.lean +++ b/Physlib/Relativity/Tensors/ComplexTensor/Units/Pre.lean @@ -57,9 +57,7 @@ def contrCoUnit : (Representation.trivial ℂ SL(2,ℂ) ℂ).IntertwiningMap a' • contrCoUnitVal map_add' := fun x y => by simp only [add_smul] - map_smul' := fun m x => by - simp only [smul_smul] - rfl + map_smul' := fun m x => by simp only [smul_eq_mul, smul_smul, RingHom.id_apply] isIntertwining' M := by refine LinearMap.ext fun x : ℂ => ?_ change x • contrCoUnitVal = @@ -71,9 +69,7 @@ def contrCoUnit : (Representation.trivial ℂ SL(2,ℂ) ℂ).IntertwiningMap apply congrArg simp -lemma contrCoUnit_apply_one : contrCoUnit (1 : ℂ) = contrCoUnitVal := by - change (1 : ℂ) • contrCoUnitVal = contrCoUnitVal - rw [one_smul] +lemma contrCoUnit_apply_one : contrCoUnit (1 : ℂ) = contrCoUnitVal := by simp [contrCoUnit] /-- The co-contra unit for complex lorentz vectors. Usually denoted `δᵢⁱ`. -/ def coContrUnitVal : CoℂModule ⊗[ℂ] ContrℂModule := @@ -108,9 +104,7 @@ def coContrUnit : (Representation.trivial ℂ SL(2,ℂ) ℂ).IntertwiningMap a' • coContrUnitVal map_add' := fun x y => by simp only [add_smul] - map_smul' := fun m x => by - simp only [smul_smul] - rfl + map_smul' := fun m x => by simp only [smul_eq_mul, smul_smul, RingHom.id_apply] isIntertwining' M := by refine LinearMap.ext fun x : ℂ => ?_ change x • coContrUnitVal = @@ -124,9 +118,7 @@ def coContrUnit : (Representation.trivial ℂ SL(2,ℂ) ℂ).IntertwiningMap refine transpose_eq_one.mp ?h.h.h.a simp -lemma coContrUnit_apply_one : coContrUnit (1 : ℂ) = coContrUnitVal := by - change (1 : ℂ) • coContrUnitVal = coContrUnitVal - rw [one_smul] +lemma coContrUnit_apply_one : coContrUnit (1 : ℂ) = coContrUnitVal := by simp [coContrUnit] /-! @@ -168,16 +160,14 @@ open CategoryTheory lemma contrCoUnit_symm : contrCoUnit (1 : ℂ) = LinearMap.lTensor _ (LinearEquiv.refl _ _).toLinearMap (TensorProduct.comm ℂ _ _ (coContrUnit (1 : ℂ))) := by - rw [contrCoUnit_apply_one, contrCoUnitVal_expand_tmul] - rw [coContrUnit_apply_one, coContrUnitVal_expand_tmul] - rfl + simp [contrCoUnit_apply_one, contrCoUnitVal_expand_tmul, + coContrUnit_apply_one, coContrUnitVal_expand_tmul] lemma coContrUnit_symm : (coContrUnit (1 : ℂ)) = LinearMap.lTensor _ (LinearEquiv.refl _ _).toLinearMap (TensorProduct.comm ℂ _ _ (contrCoUnit (1 : ℂ))) := by - rw [coContrUnit_apply_one, coContrUnitVal_expand_tmul] - rw [contrCoUnit_apply_one, contrCoUnitVal_expand_tmul] - rfl + simp [coContrUnit_apply_one, coContrUnitVal_expand_tmul, + contrCoUnit_apply_one, contrCoUnitVal_expand_tmul] end Lorentz end diff --git a/Physlib/Relativity/Tensors/ComplexTensor/Units/Symm.lean b/Physlib/Relativity/Tensors/ComplexTensor/Units/Symm.lean index a7f32eae1..c8eca1e95 100644 --- a/Physlib/Relativity/Tensors/ComplexTensor/Units/Symm.lean +++ b/Physlib/Relativity/Tensors/ComplexTensor/Units/Symm.lean @@ -27,39 +27,33 @@ open TensorSpecies open Tensor /-- Swapping indices of `coContrUnit` returns `contrCoUnit`: `{δ' | μ ν = δ | ν μ}ᵀ`. -/ -lemma coContrUnit_symm : {δ' | μ ν = δ | ν μ}ᵀ := by - rw [coContrUnit, unitTensor_eq_permT_dual] - rfl +lemma coContrUnit_symm : {δ' | μ ν = δ | ν μ}ᵀ := + unitTensor_eq_permT_dual (S := complexLorentzTensor) Color.up /-- Swapping indices of `contrCoUnit` returns `coContrUnit`: `{δ | μ ν = δ' | ν μ}ᵀ`. -/ -lemma contrCoUnit_symm : {δ | μ ν = δ' | ν μ}ᵀ := by - rw [contrCoUnit, unitTensor_eq_permT_dual] - rfl +lemma contrCoUnit_symm : {δ | μ ν = δ' | ν μ}ᵀ := + unitTensor_eq_permT_dual (S := complexLorentzTensor) Color.down /-- Swapping indices of `dualLeftLeftUnit` returns `leftDualLeftUnit`: `{δL' | α α' = δL | α' α}ᵀ`. -/ -lemma dualLeftLeftUnit_symm : {δL' | α α' = δL | α' α}ᵀ := by - rw [dualLeftLeftUnit, unitTensor_eq_permT_dual] - rfl +lemma dualLeftLeftUnit_symm : {δL' | α α' = δL | α' α}ᵀ := + unitTensor_eq_permT_dual (S := complexLorentzTensor) Color.upL /-- Swapping indices of `leftDualLeftUnit` returns `dualLeftLeftUnit`: `{δL | α α' = δL' | α' α}ᵀ`. -/ -lemma leftDualLeftUnit_symm : {δL | α α' = δL' | α' α}ᵀ := by - rw [leftDualLeftUnit, unitTensor_eq_permT_dual] - rfl +lemma leftDualLeftUnit_symm : {δL | α α' = δL' | α' α}ᵀ := + unitTensor_eq_permT_dual (S := complexLorentzTensor) Color.downL /-- Swapping indices of `dualRightRightUnit` returns `rightDualRightUnit`: `{δR' | β β' = δR | β' β}ᵀ`. -/ -lemma dualRightRightUnit_symm : {δR' | β β' = δR | β' β}ᵀ := by - rw [dualRightRightUnit, unitTensor_eq_permT_dual] - rfl +lemma dualRightRightUnit_symm : {δR' | β β' = δR | β' β}ᵀ := + unitTensor_eq_permT_dual (S := complexLorentzTensor) Color.upR /-- Swapping indices of `rightDualRightUnit` returns `dualRightRightUnit`: `{δR | β β' = δR' | β' β}ᵀ`. -/ -lemma rightDualRightUnit_symm : {δR | β β' = δR' | β' β}ᵀ := by - rw [rightDualRightUnit, unitTensor_eq_permT_dual] - rfl +lemma rightDualRightUnit_symm : {δR | β β' = δR' | β' β}ᵀ := + unitTensor_eq_permT_dual (S := complexLorentzTensor) Color.downR end complexLorentzTensor diff --git a/Physlib/Relativity/Tensors/ComplexTensor/Vector/Pre/Basic.lean b/Physlib/Relativity/Tensors/ComplexTensor/Vector/Pre/Basic.lean index 583458750..00d103ec7 100644 --- a/Physlib/Relativity/Tensors/ComplexTensor/Vector/Pre/Basic.lean +++ b/Physlib/Relativity/Tensors/ComplexTensor/Vector/Pre/Basic.lean @@ -31,9 +31,7 @@ def complexContrBasis : Basis (Fin 1 ⊕ Fin 3) ℂ ContrℂModule := @[simp] lemma complexContrBasis_toFin13ℂ (i :Fin 1 ⊕ Fin 3) : - (complexContrBasis i).toFin13ℂ = Pi.single i 1 := by - simp only [complexContrBasis, Basis.coe_ofEquivFun] - rfl + (complexContrBasis i).toFin13ℂ = Pi.single i 1 := by simp [complexContrBasis] @[simp] lemma complexContrBasis_ρ_apply (M : SL(2,ℂ)) (i j : Fin 1 ⊕ Fin 3) : @@ -46,44 +44,37 @@ lemma complexContrBasis_ρ_apply (M : SL(2,ℂ)) (i j : Fin 1 ⊕ Fin 3) : lemma complexContrBasis_ρ_val (M : SL(2,ℂ)) (v : ContrℂModule) : ((ContrℂModule.SL2CRep M) v).val = - LorentzGroup.toComplex (SL2C.toLorentzGroup M) *ᵥ v.val := by - rfl + LorentzGroup.toComplex (SL2C.toLorentzGroup M) *ᵥ v.val := rfl /-- The standard basis of complex contravariant Lorentz vectors indexed by `Fin 4`. -/ def complexContrBasisFin4 : Basis (Fin 4) ℂ ContrℂModule := Basis.reindex complexContrBasis finSumFinEquiv lemma complexContrBasisFin4_eq_reindex : - complexContrBasisFin4 = complexContrBasis.reindex finSumFinEquiv := - rfl + complexContrBasisFin4 = complexContrBasis.reindex finSumFinEquiv := rfl lemma complexContrBasis_reindex_apply_eq_fin4 (j : Fin 4) : - (complexContrBasis.reindex finSumFinEquiv) j = complexContrBasisFin4 j := - rfl + (complexContrBasis.reindex finSumFinEquiv) j = complexContrBasisFin4 j := rfl @[simp] lemma complexContrBasisFin4_apply_zero : complexContrBasisFin4 0 = complexContrBasis (Sum.inl 0) := by - simp only [complexContrBasisFin4, Basis.reindex_apply] - rfl + simp [complexContrBasisFin4, finSumFinEquiv, Fin.addCases] @[simp] lemma complexContrBasisFin4_apply_one : complexContrBasisFin4 1 = complexContrBasis (Sum.inr 0) := by - simp only [complexContrBasisFin4, Basis.reindex_apply] - rfl + simp [complexContrBasisFin4, finSumFinEquiv, Fin.addCases] @[simp] lemma complexContrBasisFin4_apply_two : complexContrBasisFin4 2 = complexContrBasis (Sum.inr 1) := by - simp only [complexContrBasisFin4, Basis.reindex_apply] - rfl + simp [complexContrBasisFin4, finSumFinEquiv, Fin.addCases] @[simp] lemma complexContrBasisFin4_apply_three : complexContrBasisFin4 3 = complexContrBasis (Sum.inr 2) := by - simp only [complexContrBasisFin4, Basis.reindex_apply] - rfl + simp [complexContrBasisFin4, finSumFinEquiv, Fin.addCases] @[simp] lemma complexContrBasisFin4_apply_succ (i : Fin 3) : @@ -98,8 +89,7 @@ def complexCoBasis : Basis (Fin 1 ⊕ Fin 3) ℂ CoℂModule := @[simp] lemma complexCoBasis_toFin13ℂ (i :Fin 1 ⊕ Fin 3) : (complexCoBasis i).toFin13ℂ = Pi.single i 1 := by - simp only [complexCoBasis, Basis.coe_ofEquivFun] - rfl + simp [complexCoBasis] @[simp] lemma complexCoBasis_ρ_apply (M : SL(2,ℂ)) (i j : Fin 1 ⊕ Fin 3) : @@ -112,44 +102,37 @@ lemma complexCoBasis_ρ_apply (M : SL(2,ℂ)) (i j : Fin 1 ⊕ Fin 3) : lemma CoℂModule.SL2CRep_val (M : SL(2,ℂ)) (v : CoℂModule) : ((CoℂModule.SL2CRep M) v).val = - (LorentzGroup.toComplex (SL2C.toLorentzGroup M))⁻¹ᵀ *ᵥ v.val := by - rfl + (LorentzGroup.toComplex (SL2C.toLorentzGroup M))⁻¹ᵀ *ᵥ v.val := rfl /-- The standard basis of complex covariant Lorentz vectors indexed by `Fin 4`. -/ def complexCoBasisFin4 : Basis (Fin 4) ℂ CoℂModule := Basis.reindex complexCoBasis finSumFinEquiv lemma complexCoBasisFin4_eq_reindex : - complexCoBasisFin4 = complexCoBasis.reindex finSumFinEquiv := - rfl + complexCoBasisFin4 = complexCoBasis.reindex finSumFinEquiv := rfl lemma complexCoBasis_reindex_apply_eq_fin4 (j : Fin 4) : - (complexCoBasis.reindex finSumFinEquiv) j = complexCoBasisFin4 j := - rfl + (complexCoBasis.reindex finSumFinEquiv) j = complexCoBasisFin4 j := rfl @[simp] lemma complexCoBasisFin4_apply_zero : complexCoBasisFin4 0 = complexCoBasis (Sum.inl 0) := by - simp only [complexCoBasisFin4, Basis.reindex_apply] - rfl + simp [complexCoBasisFin4, finSumFinEquiv, Fin.addCases] @[simp] lemma complexCoBasisFin4_apply_one : complexCoBasisFin4 1 = complexCoBasis (Sum.inr 0) := by - simp only [complexCoBasisFin4, Basis.reindex_apply] - rfl + simp [complexCoBasisFin4, finSumFinEquiv, Fin.addCases] @[simp] lemma complexCoBasisFin4_apply_two : complexCoBasisFin4 2 = complexCoBasis (Sum.inr 1) := by - simp only [complexCoBasisFin4, Basis.reindex_apply] - rfl + simp [complexCoBasisFin4, finSumFinEquiv, Fin.addCases] @[simp] lemma complexCoBasisFin4_apply_three : complexCoBasisFin4 3 = complexCoBasis (Sum.inr 2) := by - simp only [complexCoBasisFin4, Basis.reindex_apply] - rfl + simp [complexCoBasisFin4, finSumFinEquiv, Fin.addCases] /-! @@ -197,15 +180,13 @@ lemma inclCongrRealLorentz_ρ (M : SL(2, ℂ)) (v : ContrMod 3) : inclCongrRealLorentz (ContrMod.rep (SL2C.toLorentzGroup M) v) := by apply Lorentz.ContrℂModule.ext rw [complexContrBasis_ρ_val, inclCongrRealLorentz_val, inclCongrRealLorentz_val] - rw [LorentzGroup.toComplex_mulVec_ofReal] - rfl + exact LorentzGroup.toComplex_mulVec_ofReal _ _ lemma SL2CRep_ρ_basis (M : SL(2, ℂ)) (i : Fin 1 ⊕ Fin 3) : (ContrℂModule.SL2CRep M) (complexContrBasis i) = ∑ j, (SL2C.toLorentzGroup M).1 j i • complexContrBasis j := by - rw [complexContrBasis_of_real, inclCongrRealLorentz_ρ] - rw [Contr.ρ_stdBasis, map_sum] + rw [complexContrBasis_of_real, inclCongrRealLorentz_ρ, Contr.ρ_stdBasis, map_sum] apply congrArg funext j simp only [LinearMap.map_smulₛₗ, ofRealHom_eq_coe, coe_smul] diff --git a/Physlib/Relativity/Tensors/ComplexTensor/Vector/Pre/Contraction.lean b/Physlib/Relativity/Tensors/ComplexTensor/Vector/Pre/Contraction.lean index ed154264d..59d50aee4 100644 --- a/Physlib/Relativity/Tensors/ComplexTensor/Vector/Pre/Contraction.lean +++ b/Physlib/Relativity/Tensors/ComplexTensor/Vector/Pre/Contraction.lean @@ -35,18 +35,15 @@ def contrCoContrBi : ContrℂModule →ₗ[ℂ] CoℂModule →ₗ[ℂ] ℂ wher rw [dotProduct_add] map_smul' := by intro r φ - simp only [LinearEquiv.map_smul] - rw [dotProduct_smul] - rfl} + simp only [LinearEquiv.map_smul, dotProduct_smul, RingHom.id_apply]} map_add' ψ ψ':= by refine LinearMap.ext (fun φ => ?_) simp only [map_add, LinearMap.coe_mk, AddHom.coe_mk, LinearMap.add_apply] rw [add_dotProduct] map_smul' r ψ := by refine LinearMap.ext (fun φ => ?_) - simp only [LinearEquiv.map_smul, LinearMap.coe_mk, AddHom.coe_mk] - rw [smul_dotProduct] - rfl + simp only [LinearEquiv.map_smul, LinearMap.coe_mk, AddHom.coe_mk, smul_dotProduct, + LinearMap.smul_apply, RingHom.id_apply] /-- The bi-linear map corresponding to contraction of a covariant Lorentz vector with a contravariant Lorentz vector. -/ @@ -59,18 +56,15 @@ def contrContrCoBi : CoℂModule →ₗ[ℂ] ContrℂModule →ₗ[ℂ] ℂ wher rw [dotProduct_add] map_smul' := by intro r ψ - simp only [LinearEquiv.map_smul] - rw [dotProduct_smul] - rfl} + simp only [LinearEquiv.map_smul, dotProduct_smul, RingHom.id_apply]} map_add' φ φ' := by refine LinearMap.ext (fun ψ => ?_) simp only [map_add, LinearMap.coe_mk, AddHom.coe_mk, LinearMap.add_apply] rw [add_dotProduct] map_smul' r φ := by refine LinearMap.ext (fun ψ => ?_) - simp only [LinearEquiv.map_smul, LinearMap.coe_mk, AddHom.coe_mk] - rw [smul_dotProduct] - rfl + simp only [LinearEquiv.map_smul, LinearMap.coe_mk, AddHom.coe_mk, smul_dotProduct, + LinearMap.smul_apply, RingHom.id_apply] /-- The linear map from complexContr ⊗ complexCo to ℂ given by summing over components of contravariant Lorentz vector and @@ -89,8 +83,7 @@ def contrCoContraction : (ContrℂModule.SL2CRep.tprod CoℂModule.SL2CRep).Inte simp lemma contrCoContraction_hom_tmul (ψ : ContrℂModule) (φ : CoℂModule) : - contrCoContraction (ψ ⊗ₜ φ) = ψ.toFin13ℂ ⬝ᵥ φ.toFin13ℂ := by - rfl + contrCoContraction (ψ ⊗ₜ φ) = ψ.toFin13ℂ ⬝ᵥ φ.toFin13ℂ := by rfl lemma contrCoContraction_basis (i j : Fin 4) : contrCoContraction (complexContrBasisFin4 i ⊗ₜ complexCoBasisFin4 j) = @@ -108,9 +101,7 @@ lemma contrCoContraction_basis' (i j : Fin 1 ⊕ Fin 3) : if i = j then (1 : ℂ) else 0 := by rw [contrCoContraction_hom_tmul] simp only [complexContrBasis_toFin13ℂ, complexCoBasis_toFin13ℂ, dotProduct_single, mul_one] - rw [Pi.single_apply] - refine ite_congr ?h₁ (congrFun rfl) (congrFun rfl) - exact Eq.propIntro (fun a => id (Eq.symm a)) fun a => id (Eq.symm a) + simp [Pi.single_apply, eq_comm] /-- The linear map from complexCo ⊗ complexContr to ℂ given by summing over components of covariant Lorentz vector and @@ -128,8 +119,7 @@ def coContrContraction : (CoℂModule.SL2CRep.tprod ContrℂModule.SL2CRep).Inte simp lemma coContrContraction_hom_tmul (φ : CoℂModule) (ψ : ContrℂModule) : - coContrContraction (φ ⊗ₜ ψ) = φ.toFin13ℂ ⬝ᵥ ψ.toFin13ℂ := by - rfl + coContrContraction (φ ⊗ₜ ψ) = φ.toFin13ℂ ⬝ᵥ ψ.toFin13ℂ := by rfl lemma coContrContraction_basis (i j : Fin 4) : coContrContraction (complexCoBasisFin4 i ⊗ₜ complexContrBasisFin4 j) = diff --git a/Physlib/Relativity/Tensors/ComplexTensor/Vector/Pre/Modules.lean b/Physlib/Relativity/Tensors/ComplexTensor/Vector/Pre/Modules.lean index ff5bf5b72..9a1a24891 100644 --- a/Physlib/Relativity/Tensors/ComplexTensor/Vector/Pre/Modules.lean +++ b/Physlib/Relativity/Tensors/ComplexTensor/Vector/Pre/Modules.lean @@ -164,8 +164,7 @@ def lorentzGroupRep : Representation ℂ (LorentzGroup 3) CoℂModule where LinearEquiv.apply_symm_apply, mulVec_mulVec, EmbeddingLike.apply_eq_iff_eq] refine (congrFun (congrArg _ ?_) _) simp only [_root_.map_mul] - rw [Matrix.mul_inv_rev] - exact transpose_mul _ _ + simp [Matrix.mul_inv_rev] /-- The representation of the SL(2, ℂ) on `ContrℂModule` induced by the representation of the Lorentz group. -/ diff --git a/Physlib/Relativity/Tensors/ComplexTensor/Weyl/Basic.lean b/Physlib/Relativity/Tensors/ComplexTensor/Weyl/Basic.lean index 0a3c356a8..12c5b0c2e 100644 --- a/Physlib/Relativity/Tensors/ComplexTensor/Weyl/Basic.lean +++ b/Physlib/Relativity/Tensors/ComplexTensor/Weyl/Basic.lean @@ -92,8 +92,7 @@ def dualLeftHandedRep : Representation ℂ SL(2,ℂ) DualLeftHandedWeyl where simp only [SpecialLinearGroup.coe_mul, LinearMap.coe_mk, AddHom.coe_mk, Module.End.mul_apply, LinearEquiv.apply_symm_apply, mulVec_mulVec, EmbeddingLike.apply_eq_iff_eq] refine (congrFun (congrArg _ ?_) _) - rw [Matrix.mul_inv_rev] - exact transpose_mul _ _ + simp [Matrix.mul_inv_rev] /-- The standard basis on dual-left-handed Weyl fermions. -/ def dualLeftBasis : Basis (Fin 2) ℂ DualLeftHandedWeyl := Basis.ofEquivFun @@ -207,8 +206,7 @@ def leftHandedToDual : leftHandedRep.IntertwiningMap dualLeftHandedRep where simp only [mulVec_add, LinearEquiv.map_add] map_smul' := by intro a ψ - simp only [mulVec_smul, LinearEquiv.map_smul] - rfl + simp only [mulVec_smul, LinearEquiv.map_smul, RingHom.id_apply] isIntertwining' := by intro M refine LinearMap.ext (fun ψ => ?_) @@ -237,9 +235,7 @@ def leftHandedDualTo : dualLeftHandedRep.IntertwiningMap leftHandedRep where rw [mulVec_add, LinearEquiv.map_add] map_smul' := by intro a ψ - simp only [LinearEquiv.map_smul] - rw [mulVec_smul, LinearEquiv.map_smul] - rfl + simp only [mulVec_smul, LinearEquiv.map_smul, RingHom.id_apply] isIntertwining' := by intro M refine LinearMap.ext (fun ψ => ?_) @@ -267,16 +263,14 @@ def leftHandedDualEquiv : leftHandedRep.Equiv dualLeftHandedRep := by rw [leftHandedDualTo_hom_apply, leftHandedToDual_hom_apply] rw [DualLeftHandedWeyl.toFin2ℂ, LinearEquiv.apply_symm_apply, mulVec_mulVec] rw [show (!![0, -1; (1 : ℂ), 0] * !![0, 1; -1, 0]) = 1 by simpa using Eq.symm one_fin_two] - rw [one_mulVec] - rfl + simp · intro ψ simp only [AddHom.toFun_eq_coe, LinearMap.coe_toAddHom, Representation.IntertwiningMap.coe_toLinearMap] rw [leftHandedDualTo_hom_apply, leftHandedToDual_hom_apply, LeftHandedWeyl.toFin2ℂ, LinearEquiv.apply_symm_apply, mulVec_mulVec] rw [show (!![0, (1 : ℂ); -1, 0] * !![0, -1; 1, 0]) = 1 by simpa using Eq.symm one_fin_two] - rw [one_mulVec] - rfl + simp /-- `leftHandedDualEquiv` acting on an element `ψ : leftHanded` corresponds to multiplying `ψ` by the matrix `!![0, 1; -1, 0]`. -/ diff --git a/Physlib/Relativity/Tensors/ComplexTensor/Weyl/Contraction.lean b/Physlib/Relativity/Tensors/ComplexTensor/Weyl/Contraction.lean index 4748e2992..69a6f5724 100644 --- a/Physlib/Relativity/Tensors/ComplexTensor/Weyl/Contraction.lean +++ b/Physlib/Relativity/Tensors/ComplexTensor/Weyl/Contraction.lean @@ -42,18 +42,15 @@ def leftDualBi : LeftHandedWeyl →ₗ[ℂ] DualLeftHandedWeyl →ₗ[ℂ] ℂ w rw [dotProduct_add] map_smul' := by intro r φ - simp only [LinearEquiv.map_smul] - rw [dotProduct_smul] - rfl} + simp only [LinearEquiv.map_smul, dotProduct_smul, RingHom.id_apply]} map_add' ψ ψ':= by refine LinearMap.ext (fun φ => ?_) simp only [map_add, LinearMap.coe_mk, AddHom.coe_mk, LinearMap.add_apply] rw [add_dotProduct] map_smul' r ψ := by refine LinearMap.ext (fun φ => ?_) - simp only [LinearEquiv.map_smul, LinearMap.coe_mk, AddHom.coe_mk] - rw [smul_dotProduct] - rfl + simp only [LinearEquiv.map_smul, LinearMap.coe_mk, AddHom.coe_mk, smul_dotProduct, + LinearMap.smul_apply, RingHom.id_apply] /-- The bi-linear map corresponding to contraction of a dual-left-handed Weyl fermion with a left-handed Weyl fermion. -/ @@ -66,9 +63,7 @@ def dualLeftBi : DualLeftHandedWeyl →ₗ[ℂ] LeftHandedWeyl →ₗ[ℂ] ℂ w rw [dotProduct_add] map_smul' := by intro r φ - simp only [LinearEquiv.map_smul] - rw [dotProduct_smul] - rfl} + simp only [LinearEquiv.map_smul, dotProduct_smul, RingHom.id_apply]} map_add' ψ ψ':= by refine LinearMap.ext (fun φ => ?_) simp only [map_add, add_dotProduct, vec2_dotProduct, Fin.isValue, LinearMap.coe_mk, @@ -89,18 +84,15 @@ def rightDualBi : RightHandedWeyl →ₗ[ℂ] DualRightHandedWeyl →ₗ[ℂ] rw [dotProduct_add] map_smul' := by intro r φ - simp only [LinearEquiv.map_smul] - rw [dotProduct_smul] - rfl} + simp only [LinearEquiv.map_smul, dotProduct_smul, RingHom.id_apply]} map_add' ψ ψ':= by refine LinearMap.ext (fun φ => ?_) simp only [map_add, LinearMap.coe_mk, AddHom.coe_mk, LinearMap.add_apply] rw [add_dotProduct] map_smul' r ψ := by refine LinearMap.ext (fun φ => ?_) - simp only [LinearEquiv.map_smul, LinearMap.coe_mk, AddHom.coe_mk] - rw [smul_dotProduct] - rfl + simp only [LinearEquiv.map_smul, LinearMap.coe_mk, AddHom.coe_mk, smul_dotProduct, + LinearMap.smul_apply, RingHom.id_apply] /-- The bi-linear map corresponding to contraction of a dual-right-handed Weyl fermion with a right-handed Weyl fermion. -/ @@ -113,9 +105,7 @@ def dualRightBi : DualRightHandedWeyl →ₗ[ℂ] RightHandedWeyl →ₗ[ℂ] rw [dotProduct_add] map_smul' := by intro r φ - simp only [LinearEquiv.map_smul] - rw [dotProduct_smul] - rfl} + simp only [LinearEquiv.map_smul, dotProduct_smul, RingHom.id_apply]} map_add' ψ ψ':= by refine LinearMap.ext (fun φ => ?_) simp only [map_add, add_dotProduct, vec2_dotProduct, Fin.isValue, LinearMap.coe_mk, @@ -140,8 +130,7 @@ def leftDualContraction : (leftHandedRep.tprod dualLeftHandedRep).IntertwiningMa lemma leftDualContraction_hom_tmul (ψ : LeftHandedWeyl) (φ : DualLeftHandedWeyl) : - leftDualContraction (ψ ⊗ₜ φ) = ψ.toFin2ℂ ⬝ᵥ φ.toFin2ℂ := by - rfl + leftDualContraction (ψ ⊗ₜ φ) = ψ.toFin2ℂ ⬝ᵥ φ.toFin2ℂ := by rfl lemma leftDualContraction_basis (i j : Fin 2) : leftDualContraction (leftBasis i ⊗ₜ dualLeftBasis j) = if i.1 = j.1 then (1 : ℂ) else 0 := by @@ -166,8 +155,7 @@ def dualLeftContraction : (dualLeftHandedRep.tprod leftHandedRep).IntertwiningMa simp lemma dualLeftContraction_hom_tmul (φ : DualLeftHandedWeyl) (ψ : LeftHandedWeyl) : - dualLeftContraction (φ ⊗ₜ ψ) = φ.toFin2ℂ ⬝ᵥ ψ.toFin2ℂ := by - rfl + dualLeftContraction (φ ⊗ₜ ψ) = φ.toFin2ℂ ⬝ᵥ ψ.toFin2ℂ := by rfl lemma dualLeftContraction_basis (i j : Fin 2) : dualLeftContraction (dualLeftBasis i ⊗ₜ leftBasis j) = if i.1 = j.1 then (1 : ℂ) else 0 := by @@ -206,8 +194,7 @@ def rightDualContraction : (rightHandedRep.tprod dualRightHandedRep).Intertwinin lemma rightDualContraction_hom_tmul (ψ : RightHandedWeyl) (φ : DualRightHandedWeyl) : - rightDualContraction (ψ ⊗ₜ φ) = ψ.toFin2ℂ ⬝ᵥ φ.toFin2ℂ := by - rfl + rightDualContraction (ψ ⊗ₜ φ) = ψ.toFin2ℂ ⬝ᵥ φ.toFin2ℂ := by rfl lemma rightDualContraction_basis (i j : Fin 2) : rightDualContraction (rightBasis i ⊗ₜ dualRightBasis j) = @@ -247,8 +234,7 @@ def dualRightContraction : (dualRightHandedRep.tprod rightHandedRep).Intertwinin lemma dualRightContraction_hom_tmul (φ : DualRightHandedWeyl) (ψ : RightHandedWeyl) : - dualRightContraction (φ ⊗ₜ ψ) = φ.toFin2ℂ ⬝ᵥ ψ.toFin2ℂ := by - rfl + dualRightContraction (φ ⊗ₜ ψ) = φ.toFin2ℂ ⬝ᵥ ψ.toFin2ℂ := by rfl lemma dualRightContraction_basis (i j : Fin 2) : dualRightContraction (dualRightBasis i ⊗ₜ rightBasis j) = diff --git a/Physlib/Relativity/Tensors/ComplexTensor/Weyl/Metric.lean b/Physlib/Relativity/Tensors/ComplexTensor/Weyl/Metric.lean index 60f8174b6..216bb7fa2 100644 --- a/Physlib/Relativity/Tensors/ComplexTensor/Weyl/Metric.lean +++ b/Physlib/Relativity/Tensors/ComplexTensor/Weyl/Metric.lean @@ -33,8 +33,7 @@ def metricRaw : Matrix (Fin 2) (Fin 2) ℂ := !![0, 1; -1, 0] /-- Multiplying an element of `SL(2, ℂ)` on the left with the metric `𝓔` is equivalent to multiplying the inverse-transpose of that element on the right with the metric. -/ lemma comm_metricRaw (M : SL(2,ℂ)) : M.1 * metricRaw = metricRaw * (M.1⁻¹)ᵀ := by - rw [metricRaw] - rw [Lorentz.SL2C.inverse_coe, eta_fin_two M.1] + rw [metricRaw, Lorentz.SL2C.inverse_coe, eta_fin_two M.1] rw [SpecialLinearGroup.coe_inv, Matrix.adjugate_fin_two, Matrix.mul_fin_two, eta_fin_two !![M.1 1 1, -M.1 0 1; -M.1 1 0, M.1 0 0]ᵀ] simp only [Fin.isValue, mul_zero, mul_neg, mul_one, zero_add, add_zero, transpose_apply, of_apply, @@ -43,8 +42,7 @@ lemma comm_metricRaw (M : SL(2,ℂ)) : M.1 * metricRaw = metricRaw * (M.1⁻¹) empty_vecMul, neg_smul, neg_cons, neg_neg, neg_empty, empty_mul, Equiv.symm_apply_apply] lemma metricRaw_comm (M : SL(2,ℂ)) : metricRaw * M.1 = (M.1⁻¹)ᵀ * metricRaw := by - rw [metricRaw] - rw [Lorentz.SL2C.inverse_coe, eta_fin_two M.1] + rw [metricRaw, Lorentz.SL2C.inverse_coe, eta_fin_two M.1] rw [SpecialLinearGroup.coe_inv, Matrix.adjugate_fin_two, Matrix.mul_fin_two, eta_fin_two !![M.1 1 1, -M.1 0 1; -M.1 1 0, M.1 0 0]ᵀ] simp only [Fin.isValue, zero_mul, one_mul, zero_add, neg_mul, add_zero, transpose_apply, of_apply, @@ -54,16 +52,14 @@ lemma metricRaw_comm (M : SL(2,ℂ)) : metricRaw * M.1 = (M.1⁻¹)ᵀ * metricR empty_vecMul, add_cons, empty_add_empty, empty_mul, Equiv.symm_apply_apply] lemma star_comm_metricRaw (M : SL(2,ℂ)) : M.1.map star * metricRaw = metricRaw * ((M.1)⁻¹)ᴴ := by - rw [metricRaw] - rw [Lorentz.SL2C.inverse_coe, eta_fin_two M.1] + rw [metricRaw, Lorentz.SL2C.inverse_coe, eta_fin_two M.1] rw [SpecialLinearGroup.coe_inv, Matrix.adjugate_fin_two, eta_fin_two !![M.1 1 1, -M.1 0 1; -M.1 1 0, M.1 0 0]ᴴ] rw [eta_fin_two (!![M.1 0 0, M.1 0 1; M.1 1 0, M.1 1 1].map star)] simp lemma metricRaw_comm_star (M : SL(2,ℂ)) : metricRaw * M.1.map star = ((M.1)⁻¹)ᴴ * metricRaw := by - rw [metricRaw] - rw [Lorentz.SL2C.inverse_coe, eta_fin_two M.1] + rw [metricRaw, Lorentz.SL2C.inverse_coe, eta_fin_two M.1] rw [SpecialLinearGroup.coe_inv, Matrix.adjugate_fin_two, eta_fin_two !![M.1 1 1, -M.1 0 1; -M.1 1 0, M.1 0 0]ᴴ] rw [eta_fin_two (!![M.1 0 0, M.1 0 1; M.1 1 0, M.1 1 1].map star)] @@ -96,9 +92,7 @@ def leftMetric : (Representation.trivial ℂ SL(2,ℂ) ℂ).IntertwiningMap a' • leftMetricVal map_add' := fun x y => by simp only [add_smul] - map_smul' := fun m x => by - simp only [smul_smul] - rfl + map_smul' := fun m x => by simp only [smul_eq_mul, smul_smul, RingHom.id_apply] isIntertwining' M := by refine LinearMap.ext fun x : ℂ => ?_ change x • leftMetricVal = @@ -112,9 +106,7 @@ def leftMetric : (Representation.trivial ℂ SL(2,ℂ) ℂ).IntertwiningMap simp only [SpecialLinearGroup.det_coe, isUnit_iff_ne_zero, ne_eq, one_ne_zero, not_false_eq_true, mul_nonsing_inv, transpose_one, mul_one] -lemma leftMetric_apply_one : leftMetric (1 : ℂ) = leftMetricVal := by - change (1 : ℂ) • leftMetricVal = leftMetricVal - simp only [one_smul] +lemma leftMetric_apply_one : leftMetric (1 : ℂ) = leftMetricVal := by simp [leftMetric] /-- The metric `εₐₐ` as an element of `(dualLeftHanded ⊗ dualLeftHanded).V`. -/ def dualLeftMetricVal : (DualLeftHandedWeyl ⊗[ℂ] DualLeftHandedWeyl) := @@ -139,9 +131,7 @@ def dualLeftMetric : (Representation.trivial ℂ SL(2,ℂ) ℂ).IntertwiningMap a' • dualLeftMetricVal map_add' := fun x y => by simp only [add_smul] - map_smul' := fun m x => by - simp only [smul_smul] - rfl + map_smul' := fun m x => by simp only [smul_eq_mul, smul_smul, RingHom.id_apply] isIntertwining' M := by refine LinearMap.ext fun x : ℂ => ?_ change x • dualLeftMetricVal = @@ -156,8 +146,7 @@ def dualLeftMetric : (Representation.trivial ℂ SL(2,ℂ) ℂ).IntertwiningMap not_false_eq_true, mul_nonsing_inv, mul_one] lemma dualLeftMetric_apply_one : dualLeftMetric (1 : ℂ) = dualLeftMetricVal := by - change (1 : ℂ) • dualLeftMetricVal = dualLeftMetricVal - simp only [one_smul] + simp [dualLeftMetric] /-- The metric `ε^{dot a}^{dot a}` as an element of `(rightHanded ⊗ rightHanded).V`. -/ def rightMetricVal : (RightHandedWeyl ⊗[ℂ] RightHandedWeyl) := @@ -186,9 +175,7 @@ def rightMetric : (Representation.trivial ℂ SL(2,ℂ) ℂ).IntertwiningMap a' • rightMetricVal map_add' := fun x y => by simp only [add_smul] - map_smul' := fun m x => by - simp only [smul_smul] - rfl + map_smul' := fun m x => by simp only [smul_eq_mul, smul_smul, RingHom.id_apply] isIntertwining' M := by refine LinearMap.ext fun x : ℂ => ?_ change x • rightMetricVal = @@ -209,9 +196,7 @@ def rightMetric : (Representation.trivial ℂ SL(2,ℂ) ℂ).IntertwiningMap simp · rw [← rightRightToMatrix_ρ_symm metricRaw M] -lemma rightMetric_apply_one : rightMetric (1 : ℂ) = rightMetricVal := by - change (1 : ℂ) • rightMetricVal = rightMetricVal - simp only [one_smul] +lemma rightMetric_apply_one : rightMetric (1 : ℂ) = rightMetricVal := by simp [rightMetric] /-- The metric `ε_{dot a}_{dot a}` as an element of `(dualRightHanded ⊗ dualRightHanded).V`. -/ def dualRightMetricVal : DualRightHandedWeyl ⊗[ℂ] DualRightHandedWeyl := @@ -237,9 +222,7 @@ def dualRightMetric : (Representation.trivial ℂ SL(2,ℂ) ℂ).IntertwiningMap a' • dualRightMetricVal map_add' := fun x y => by simp only [add_smul] - map_smul' := fun m x => by - simp only [smul_smul] - rfl + map_smul' := fun m x => by simp only [smul_eq_mul, smul_smul, RingHom.id_apply] isIntertwining' M := by refine LinearMap.ext fun x : ℂ => ?_ change x • dualRightMetricVal = @@ -263,8 +246,7 @@ def dualRightMetric : (Representation.trivial ℂ SL(2,ℂ) ℂ).IntertwiningMap rfl lemma dualRightMetric_apply_one : dualRightMetric (1 : ℂ) = dualRightMetricVal := by - change (1 : ℂ) • dualRightMetricVal = dualRightMetricVal - simp only [one_smul] + simp [dualRightMetric] /-! diff --git a/Physlib/Relativity/Tensors/ComplexTensor/Weyl/Two.lean b/Physlib/Relativity/Tensors/ComplexTensor/Weyl/Two.lean index 3f638348d..d6ef3db03 100644 --- a/Physlib/Relativity/Tensors/ComplexTensor/Weyl/Two.lean +++ b/Physlib/Relativity/Tensors/ComplexTensor/Weyl/Two.lean @@ -742,9 +742,8 @@ lemma dualLeftDualRightToMatrix_ρ_symm_selfAdjoint (v : Matrix (Fin 2) (Fin 2) lemma leftRightToMatrix_ρ_symm_selfAdjoint (v : Matrix (Fin 2) (Fin 2) ℂ) (hv : IsSelfAdjoint v) (M : SL(2,ℂ)) : TensorProduct.map (leftHandedRep M) (rightHandedRep M) (leftRightToMatrix.symm v) = - leftRightToMatrix.symm (SL2C.toSelfAdjointMap M ⟨v, hv⟩) := by - rw [leftRightToMatrix_ρ_symm] - rfl + leftRightToMatrix.symm (SL2C.toSelfAdjointMap M ⟨v, hv⟩) := + leftRightToMatrix_ρ_symm v M end end Fermion diff --git a/Physlib/Relativity/Tensors/ComplexTensor/Weyl/Unit.lean b/Physlib/Relativity/Tensors/ComplexTensor/Weyl/Unit.lean index 244f4e7d2..7390a73c3 100644 --- a/Physlib/Relativity/Tensors/ComplexTensor/Weyl/Unit.lean +++ b/Physlib/Relativity/Tensors/ComplexTensor/Weyl/Unit.lean @@ -47,9 +47,7 @@ def leftDualLeftUnit : (Representation.trivial ℂ SL(2,ℂ) ℂ).IntertwiningMa a' • leftDualLeftUnitVal map_add' := fun x y => by simp only [add_smul] - map_smul' := fun m x => by - simp only [smul_smul] - rfl + map_smul' := fun m x => by simp only [smul_eq_mul, smul_smul, RingHom.id_apply] isIntertwining' M := by refine LinearMap.ext fun x : ℂ => ?_ change x • leftDualLeftUnitVal = @@ -62,8 +60,7 @@ def leftDualLeftUnit : (Representation.trivial ℂ SL(2,ℂ) ℂ).IntertwiningMa simp lemma leftDualLeftUnit_apply_one : leftDualLeftUnit (1 : ℂ) = leftDualLeftUnitVal := by - change (1 : ℂ) • leftDualLeftUnitVal = leftDualLeftUnitVal - simp only [one_smul] + simp [leftDualLeftUnit] /-- The dual-left-left unit `δₐᵃ` as an element of `(dualLeftHanded ⊗ leftHanded).V`. -/ def dualLeftLeftUnitVal : (DualLeftHandedWeyl ⊗[ℂ] LeftHandedWeyl) := @@ -87,9 +84,7 @@ def dualLeftLeftUnit : a' • dualLeftLeftUnitVal map_add' := fun x y => by simp only [add_smul] - map_smul' := fun m x => by - simp only [smul_smul] - rfl + map_smul' := fun m x => by simp only [smul_eq_mul, smul_smul, RingHom.id_apply] isIntertwining' M := by refine LinearMap.ext fun x : ℂ => ?_ change x • dualLeftLeftUnitVal = @@ -104,8 +99,7 @@ def dualLeftLeftUnit : /-- Applying the morphism `dualLeftLeftUnit` to `1` returns `dualLeftLeftUnitVal`. -/ lemma dualLeftLeftUnit_apply_one : dualLeftLeftUnit (1 : ℂ) = dualLeftLeftUnitVal := by - change (1 : ℂ) • dualLeftLeftUnitVal = dualLeftLeftUnitVal - simp only [one_smul] + simp [dualLeftLeftUnit] /-- The right-dual-right unit `δ^{dot a}_{dot a}` as an element of `(rightHanded ⊗ dualRightHanded).V`. -/ @@ -130,9 +124,7 @@ def rightDualRightUnit : (Representation.trivial ℂ SL(2,ℂ) ℂ).Intertwining a' • rightDualRightUnitVal map_add' := fun x y => by simp only [add_smul] - map_smul' := fun m x => by - simp only [smul_smul] - rfl + map_smul' := fun m x => by simp only [smul_eq_mul, smul_smul, RingHom.id_apply] isIntertwining' M := by refine LinearMap.ext fun x : ℂ => ?_ change x • rightDualRightUnitVal = @@ -151,8 +143,7 @@ def rightDualRightUnit : (Representation.trivial ℂ SL(2,ℂ) ℂ).Intertwining simp lemma rightDualRightUnit_apply_one : rightDualRightUnit (1 : ℂ) = rightDualRightUnitVal := by - change (1 : ℂ) • rightDualRightUnitVal = rightDualRightUnitVal - simp only [one_smul] + simp [rightDualRightUnit] /-- The dual-right-right unit `δ_{dot a}^{dot a}` as an element of `(rightHanded ⊗ dualRightHanded).V`. -/ @@ -177,9 +168,7 @@ def dualRightRightUnit : (Representation.trivial ℂ SL(2,ℂ) ℂ).Intertwining a' • dualRightRightUnitVal map_add' := fun x y => by simp only [add_smul] - map_smul' := fun m x => by - simp only [smul_smul] - rfl + map_smul' := fun m x => by simp only [smul_eq_mul, smul_smul, RingHom.id_apply] isIntertwining' M := by refine LinearMap.ext fun x : ℂ => ?_ change x • dualRightRightUnitVal = @@ -196,8 +185,7 @@ def dualRightRightUnit : (Representation.trivial ℂ SL(2,ℂ) ℂ).Intertwining simp lemma dualRightRightUnit_apply_one : dualRightRightUnit (1 : ℂ) = dualRightRightUnitVal := by - change (1 : ℂ) • dualRightRightUnitVal = dualRightRightUnitVal - simp only [one_smul] + simp [dualRightRightUnit] /-! @@ -259,30 +247,26 @@ open CategoryTheory lemma dualLeftLeftUnit_symm : dualLeftLeftUnit (1 : ℂ) = LinearMap.lTensor _ (LinearEquiv.refl _ _).toLinearMap (TensorProduct.comm ℂ _ _ (leftDualLeftUnit (1 : ℂ))) := by - rw [dualLeftLeftUnit_apply_one, dualLeftLeftUnitVal_expand_tmul] - rw [leftDualLeftUnit_apply_one, leftDualLeftUnitVal_expand_tmul] - rfl + simp [dualLeftLeftUnit_apply_one, dualLeftLeftUnitVal_expand_tmul, + leftDualLeftUnit_apply_one, leftDualLeftUnitVal_expand_tmul] lemma leftDualLeftUnit_symm : leftDualLeftUnit (1 : ℂ) = LinearMap.lTensor _ (LinearEquiv.refl _ _).toLinearMap (TensorProduct.comm ℂ _ _ (dualLeftLeftUnit (1 : ℂ))) := by - rw [dualLeftLeftUnit_apply_one, dualLeftLeftUnitVal_expand_tmul] - rw [leftDualLeftUnit_apply_one, leftDualLeftUnitVal_expand_tmul] - rfl + simp [dualLeftLeftUnit_apply_one, dualLeftLeftUnitVal_expand_tmul, + leftDualLeftUnit_apply_one, leftDualLeftUnitVal_expand_tmul] lemma dualRightRightUnit_symm : dualRightRightUnit (1 : ℂ) = LinearMap.lTensor _ (LinearEquiv.refl _ _).toLinearMap (TensorProduct.comm ℂ _ _ (rightDualRightUnit (1 : ℂ))) := by - rw [dualRightRightUnit_apply_one, dualRightRightUnitVal_expand_tmul] - rw [rightDualRightUnit_apply_one, rightDualRightUnitVal_expand_tmul] - rfl + simp [dualRightRightUnit_apply_one, dualRightRightUnitVal_expand_tmul, + rightDualRightUnit_apply_one, rightDualRightUnitVal_expand_tmul] lemma rightDualRightUnit_symm : rightDualRightUnit (1 : ℂ) = LinearMap.lTensor _ (LinearEquiv.refl _ _).toLinearMap (TensorProduct.comm ℂ _ _ (dualRightRightUnit (1 : ℂ))) := by - rw [dualRightRightUnit_apply_one, dualRightRightUnitVal_expand_tmul] - rw [rightDualRightUnit_apply_one, rightDualRightUnitVal_expand_tmul] - rfl + simp [dualRightRightUnit_apply_one, dualRightRightUnitVal_expand_tmul, + rightDualRightUnit_apply_one, rightDualRightUnitVal_expand_tmul] end end Fermion diff --git a/Physlib/Relativity/Tensors/ComponentIdx/Contraction.lean b/Physlib/Relativity/Tensors/ComponentIdx/Contraction.lean index b09c2f539..0b4ebea8f 100644 --- a/Physlib/Relativity/Tensors/ComponentIdx/Contraction.lean +++ b/Physlib/Relativity/Tensors/ComponentIdx/Contraction.lean @@ -98,8 +98,7 @@ lemma mem_iff_apply_succSuccAbove_eq {n : ℕ} {c : Fin (n + 1 + 1) → C} lemma mem_self_of_dropPair {n : ℕ} {c : Fin (n + 1 + 1) → C} {i j : Fin (n + 1 + 1)} (b : ComponentIdx (c)) : - b ∈ DropPairSection (S := S) (b.dropPair i j) := by - simp [DropPairSection] + b ∈ DropPairSection (S := S) (b.dropPair i j) := by simp [DropPairSection] /-- Given a `b` in `ComponentIdx (c ∘ Fin.succSuccAbove i j))` and an `x` in `Fin (S.repDim (c i)) × Fin (S.repDim (c j))`, the corresponding @@ -118,8 +117,7 @@ def ofFin {n : ℕ} {c : Fin (n + 1 + 1) → C} lemma ofFin_apply_fst {n : ℕ} {c : Fin (n + 1 + 1) → C} {i j : Fin (n + 1 + 1)} (hij : i ≠ j) (b : ComponentIdx (c ∘ Fin.succSuccAbove i j)) (x : basisIdx (c i) × basisIdx (c j)) : - ofFin (S := S) hij b x i = x.1 := by - simp [ofFin] + ofFin (S := S) hij b x i = x.1 := by simp [ofFin] @[simp] lemma ofFin_apply_snd {n : ℕ} {c : Fin (n + 1 + 1) → C} @@ -163,22 +161,19 @@ def ofFinEquiv {n : ℕ} {c : Fin n.succ.succ → C} symm apply ComponentIdx.congr_right simp - left_inv x := by - simp + left_inv x := by simp @[simp] lemma ofFinEquiv_apply_fst {n : ℕ} {c : Fin (n + 1 + 1) → C} {i j : Fin (n + 1 + 1)} (hij : i ≠ j) (b : ComponentIdx (c ∘ Fin.succSuccAbove i j)) (x : basisIdx (c i) × basisIdx (c j)) : - (ofFinEquiv (S := S) hij b x).1 i = x.1 := by - simp [ofFinEquiv] + (ofFinEquiv (S := S) hij b x).1 i = x.1 := by simp [ofFinEquiv] @[simp] lemma ofFinEquiv_apply_snd {n : ℕ} {c : Fin (n + 1 + 1) → C} {i j : Fin (n + 1 + 1)} (hij : i ≠ j) (b : ComponentIdx (c ∘ Fin.succSuccAbove i j)) (x : basisIdx (c i) × basisIdx (c j)) : - (ofFinEquiv (S := S) hij b x).1 j = x.2 := by - simp [ofFinEquiv] + (ofFinEquiv (S := S) hij b x).1 j = x.2 := by simp [ofFinEquiv] end DropPairSection diff --git a/Physlib/Relativity/Tensors/ComponentIdx/Single.lean b/Physlib/Relativity/Tensors/ComponentIdx/Single.lean index cb521a7ad..42773a904 100644 --- a/Physlib/Relativity/Tensors/ComponentIdx/Single.lean +++ b/Physlib/Relativity/Tensors/ComponentIdx/Single.lean @@ -61,10 +61,8 @@ def ComponentIdx.single {c : C} : left_inv b := by ext i cases Fin.fin_one_eq_zero i - simp [basisIdxCongr] rfl right_inv b := by - simp [basisIdxCongr] rfl @[simp] diff --git a/Physlib/Relativity/Tensors/Constructors.lean b/Physlib/Relativity/Tensors/Constructors.lean index b37d9ddf6..b57ae0e9c 100644 --- a/Physlib/Relativity/Tensors/Constructors.lean +++ b/Physlib/Relativity/Tensors/Constructors.lean @@ -126,8 +126,7 @@ noncomputable def fromPairT {c1 c2 : C} : lemma fromPairT_tmul {c1 c2 : C} (x : V c1) (y : V c2) : fromPairT (x ⊗ₜ[k] y) = permT id (And.intro Function.bijective_id (fun i => by fin_cases i <;> rfl)) - (prodT (fromSingleT (S := S) x) (fromSingleT y)) := by - rfl + (prodT (fromSingleT (S := S) x) (fromSingleT y)) := rfl lemma fromPairT_eq_pure {c1 c2 : C} (x : V c1) (y : V c2) : fromPairT (S := S) (x ⊗ₜ[k] y) = Pure.toTensor (fun | 0 => x | 1 => y) := by @@ -413,8 +412,7 @@ lemma fromPairT_basis_repr {c c1 : C} rw [prodT_pure, permT_pure] rw [basis_repr_pure] simp [Pure.component] - rw [mul_comm] - rfl + exact mul_comm _ _ · intro x y hx hy simp_all [P] @@ -476,17 +474,14 @@ noncomputable def fromTripleT {c1 c2 c3 : C} : let x2 := TensorProduct.lift prodT (TensorProduct.map LinearMap.id (TensorProduct.lift prodT) x1) permT id (And.intro Function.bijective_id (fun i => by fin_cases i <;> rfl)) x2 - map_add' x y := by - simp - map_smul' r x := by - simp + map_add' x y := by simp + map_smul' r x := by simp lemma fromTripleT_tmul {c1 c2 c3 : C} (x : V c1) (y : V c2) (z : V c3) : fromTripleT (x ⊗ₜ[k] (y ⊗ₜ[k] z)) = permT id (And.intro Function.bijective_id (fun i => by fin_cases i <;> rfl)) - (prodT (fromSingleT (S := S) x) (prodT (fromSingleT y) (fromSingleT z))) := by - rfl + (prodT (fromSingleT (S := S) x) (prodT (fromSingleT y) (fromSingleT z))) := rfl lemma actionT_fromTripleT {c1 c2 c3 : C} (x : V c1 ⊗[k] (V c2 ⊗[k] V c3)) (g : G) : @@ -539,11 +534,7 @@ lemma fromTripleT_basis_repr {c c1 c2 : C} rw [prodT_pure, prodT_pure, permT_pure] rw [basis_repr_pure] simp [Pure.component, Fin.prod_univ_three] - conv_rhs => - rw [mul_assoc, mul_comm] - enter [1] - rw [mul_comm] - rfl + ac_rfl · intro y1 y2 hx hy simp only [Nat.succ_eq_add_one, Nat.reduceAdd, Fin.isValue, Basis.tensorProduct_repr_tmul_apply, smul_eq_mul, P1, P] at hx hy diff --git a/Physlib/Relativity/Tensors/Contraction/Products.lean b/Physlib/Relativity/Tensors/Contraction/Products.lean index 0d95a6abb..2451026a3 100644 --- a/Physlib/Relativity/Tensors/Contraction/Products.lean +++ b/Physlib/Relativity/Tensors/Contraction/Products.lean @@ -133,8 +133,7 @@ lemma prodT_contrT_snd {n n1 : ℕ} {c : Fin (n + 1 + 1) → C} apply induction_on_pure · intro p1 simp only [Nat.add_eq, finSumFinEquiv_apply_right, contrT_pure, P2, P] - rw [Pure.prodP_contrP_snd, prodT_pure, contrT_pure] - rfl + simp [Pure.prodP_contrP_snd, prodT_pure, contrT_pure] · intro r t h1 simp_all only [map_smul, LinearMap.smul_apply, P2, P] · intro t1 t2 h1 h2 diff --git a/Physlib/Relativity/Tensors/Contraction/Pure.lean b/Physlib/Relativity/Tensors/Contraction/Pure.lean index 87e256b57..1f39f39e0 100644 --- a/Physlib/Relativity/Tensors/Contraction/Pure.lean +++ b/Physlib/Relativity/Tensors/Contraction/Pure.lean @@ -52,7 +52,6 @@ lemma dropPair_equivariant {n : ℕ} {c : Fin (n + 1 + 1) → C} (i j : Fin (n + 1 + 1)) (hij : i ≠ j) (p : Pure S c) (g : G) : dropPair i j hij (g • p) = g • dropPair i j hij p := by ext m - simp only [dropPair, actionP_eq] rfl lemma dropPair_symm (i j : Fin (n + 1 + 1)) (hij : i ≠ j) @@ -88,8 +87,7 @@ lemma dropPair_update_fst {n : ℕ} [inst : DecidableEq (Fin (n + 1 +1))] {c : F dropPair i j hij (p.update i x) = dropPair i j hij p := by ext m simp only [Function.comp_apply, dropPair, update] - rw [Function.update_of_ne] - exact Ne.symm (fst_ne_succSuccAbove_pre i j m) + simp [Function.update_of_ne, Ne.symm (fst_ne_succSuccAbove_pre i j m)] @[simp] lemma dropPair_update_snd {n : ℕ} [inst : DecidableEq (Fin (n + 1 +1))] {c : Fin (n + 1 + 1) → C} diff --git a/Physlib/Relativity/Tensors/Contraction/SuccSuccAbove.lean b/Physlib/Relativity/Tensors/Contraction/SuccSuccAbove.lean index 8b6eefa7a..eab20821b 100644 --- a/Physlib/Relativity/Tensors/Contraction/SuccSuccAbove.lean +++ b/Physlib/Relativity/Tensors/Contraction/SuccSuccAbove.lean @@ -169,8 +169,7 @@ lemma succSuccAbove_symm (i j : Fin (n + 1 + 1)) : set_option warning.simp.varHead false in @[simp, nolint simpVarHead] lemma apply_succSuccAbove_symm {c : Fin (n + 1 + 1) → C} (i j : Fin (n + 1 + 1)) - (k : Fin n) : c (succSuccAbove i j k) = c (succSuccAbove j i k) := by - rw [succSuccAbove_symm] + (k : Fin n) : c (succSuccAbove i j k) = c (succSuccAbove j i k) := by rw [succSuccAbove_symm] lemma succSuccAbove_apply_eq_orderIsoOfFin {i j : Fin (n + 1 + 1)} (hij : i ≠ j) (m : Fin n) : (succSuccAbove i j) m = (Finset.orderIsoOfFin {i, j}ᶜ @@ -199,8 +198,7 @@ lemma succSuccAbove_ne_fst (i j : Fin (n + 1 + 1)) (m : Fin n) : @[simp] lemma snd_ne_succSuccAbove_pre (i j : Fin (n + 1 + 1)) (m : Fin n) : ¬ j = (succSuccAbove i j) m := by - rw [succSuccAbove_symm] - exact fst_ne_succSuccAbove_pre j i m + simpa [succSuccAbove_symm] using fst_ne_succSuccAbove_pre j i m @[simp] lemma succSuccAbove_ne_snd (i j : Fin (n + 1 + 1)) (m : Fin n) : @@ -344,9 +342,7 @@ lemma succSuccAbove_comm_apply (i1 j1 : Fin (n + 1 + 1 + 1 + 1)) (i2 j2 : Fin (n succSuccAbove i2' j2' (succSuccAbove i1' j1' m) = succSuccAbove i1 j1 (succSuccAbove i2 j2 m) := by intro i2' j2' hi2j2' i1' j1' - change _ = (succSuccAbove i1 j1 ∘ succSuccAbove i2 j2) m - rw [succSuccAbove_comm i1 j1 i2 j2 hij1 hij2] - rfl + exact (congr_fun (succSuccAbove_comm i1 j1 i2 j2 hij1 hij2) m).symm /-! diff --git a/Physlib/Relativity/Tensors/Dual.lean b/Physlib/Relativity/Tensors/Dual.lean index eecf2559b..3cf8f940c 100644 --- a/Physlib/Relativity/Tensors/Dual.lean +++ b/Physlib/Relativity/Tensors/Dual.lean @@ -30,15 +30,12 @@ namespace Tensor noncomputable def fromDualMap {c : C} : S.Tensor ![S.τ c] →ₗ[k] S.Tensor ![c] where toFun t := permT id (by simp; rfl) (contrT 1 1 2 (by simp; rfl) (prodT (metricTensor c) t)) - map_add' t1 t2 := by - simp - map_smul' r t := by - simp + map_add' t1 t2 := by simp + map_smul' r t := by simp lemma fromDualMap_apply {c : C} (t : S.Tensor ![S.τ c]) : fromDualMap t = permT id (by simp; rfl) - (contrT 1 1 2 (by simp; rfl) (prodT (metricTensor c) t)) := by - rfl + (contrT 1 1 2 (by simp; rfl) (prodT (metricTensor c) t)) := rfl /-- The linear map taking a tensor based on the color `c` to a tensor based on the color `S.τ c`, defined by contraction with the metric tensor. -/ @@ -47,17 +44,14 @@ noncomputable def toDualMap {c : C} : S.Tensor ![c] →ₗ[k] S.Tensor ![S.τ c] simp; rfl) (contrT 1 1 2 (by change _ ∧ S.τ (S.τ c) = c simp) (prodT (metricTensor (S.τ c)) t)) - map_add' t1 t2 := by - simp - map_smul' r t := by - simp + map_add' t1 t2 := by simp + map_smul' r t := by simp lemma toDualMap_apply {c : C} (t : S.Tensor ![c]) : toDualMap t = permT id (by simp; rfl) (contrT 1 1 2 (by change _ ∧ S.τ (S.τ c) = c - simp) (prodT (metricTensor (S.τ c)) t)) := by - rfl + simp) (prodT (metricTensor (S.τ c)) t)) := rfl set_option backward.isDefEq.respectTransparency false in @[simp] @@ -109,8 +103,7 @@ lemma fromDualMap_eq_permT_toDualMap {c : C} (t : S.Tensor ![S.τ c]) : lemma toDualMap_eq_permT_fromDualMap {c : C} (t : S.Tensor ![c]) : toDualMap t = (fromDualMap (permT id (by simp) t)) := by - rw [fromDualMap_eq_permT_toDualMap] - rw [toDualMap_apply, toDualMap_apply] + rw [fromDualMap_eq_permT_toDualMap, toDualMap_apply, toDualMap_apply] conv_rhs => enter [2, 2] rw [prodT_permT_right] diff --git a/Physlib/Relativity/Tensors/Evaluation.lean b/Physlib/Relativity/Tensors/Evaluation.lean index f29006d19..d618a2f80 100644 --- a/Physlib/Relativity/Tensors/Evaluation.lean +++ b/Physlib/Relativity/Tensors/Evaluation.lean @@ -45,16 +45,14 @@ noncomputable def evalPCoeff (i : Fin (n + 1)) (φ : basisIdx (c i)) (p : Pure S lemma evalPCoeff_update_self (i : Fin (n + 1)) [inst : DecidableEq (Fin (n + 1))] (φ : basisIdx (c i)) (p : Pure S c) (x : V (c i)) : - evalPCoeff i φ (p.update i x) = (b (c i)).repr x φ := by - simp [evalPCoeff] + evalPCoeff i φ (p.update i x) = (b (c i)).repr x φ := by simp [evalPCoeff] @[simp] lemma evalPCoeff_update_succAbove (i : Fin (n + 1)) [inst : DecidableEq (Fin (n + 1))] (j : Fin n) (φ : basisIdx (c i)) (p : Pure S c) (x : V (c (i.succAbove j))) : - evalPCoeff i φ (p.update (i.succAbove j) x) = evalPCoeff i φ p := by - simp [evalPCoeff] + evalPCoeff i φ (p.update (i.succAbove j) x) = evalPCoeff i φ p := by simp [evalPCoeff] lemma evalPCoeff_basisVector (i : Fin (n + 1)) (φ : basisIdx (c i)) (b' : ComponentIdx (S := S) c) : evalPCoeff i φ (Pure.basisVector c b') = if b' i = φ then (1 : k) else 0 := by diff --git a/Physlib/Relativity/Tensors/LeviCivita/Basic.lean b/Physlib/Relativity/Tensors/LeviCivita/Basic.lean index f3e60002c..76361fe20 100644 --- a/Physlib/Relativity/Tensors/LeviCivita/Basic.lean +++ b/Physlib/Relativity/Tensors/LeviCivita/Basic.lean @@ -50,8 +50,7 @@ scoped[realLorentzTensor] notation "ε4" => leviCivita lemma leviCivita_eq_ofInt : ε4 = TensorInt.toTensor (S := realLorentzTensor 3) (c := ![Color.up, Color.up, Color.up, Color.up]) fun f => - generalizedKroneckerDelta (fun i => finSumFinEquiv (f i)) (id : Fin 4 → Fin 4) := - rfl + generalizedKroneckerDelta (fun i => finSumFinEquiv (f i)) (id : Fin 4 → Fin 4) := rfl /-- The components of the Levi-Civita tensor in the standard basis are the generalized Kronecker delta of the multi-index against the identity. -/ diff --git a/Physlib/Relativity/Tensors/MetricTensor.lean b/Physlib/Relativity/Tensors/MetricTensor.lean index e9e1a9678..f8f6159f7 100644 --- a/Physlib/Relativity/Tensors/MetricTensor.lean +++ b/Physlib/Relativity/Tensors/MetricTensor.lean @@ -36,25 +36,21 @@ lemma metricTensor_congr {c c1 : C} (h : c = c1) : @[simp] lemma metricTensor_invariant {c : C} (g : G) : - g • S.metricTensor c = metricTensor c := by - rw [metricTensor, actionT_fromConstPair] + g • S.metricTensor c = metricTensor c := by rw [metricTensor, actionT_fromConstPair] lemma permT_fromPairTContr_metric_metric {c : C} : permT ![1, 0] (And.intro (by decide) (fun i => by fin_cases i <;> rfl)) (fromPairTContr ((S.metric c) (1 : k)) ((S.metric ((S.τ c))) (1 : k))) = (unitTensor c) := by rw [fromPairTContr, ← fromPairT_comm] - change _ = fromPairT ((S.unit c) (1 : k)) - rw [← S.contr_metric] - rfl + exact congr_arg fromPairT (S.contr_metric c) lemma fromPairTContr_metric_metric_eq_permT_unit {c : C} : fromPairTContr ((S.metric c) (1 : k)) ((S.metric (S.τ c)) (1 : k)) = permT ![1, 0] (And.intro (by decide) (fun i => by fin_cases i <;> rfl)) (unitTensor c) := by - rw [← permT_fromPairTContr_metric_metric] - rw [permT_permT] + rw [← permT_fromPairTContr_metric_metric, permT_permT] symm apply permT_congr_eq_id decide @@ -69,20 +65,16 @@ lemma contrT_metricTensor_metricTensor {c : C} : rw [metricTensor, metricTensor, fromConstPair, fromConstPair] rw [fromPairT_contr_fromPairT_eq_fromPairTContr] erw [fromPairTContr_metric_metric_eq_permT_unit] - rw [permT_permT] - rfl + simp [permT_permT] lemma contrT_metricTensor_metricTensor_eq_dual_unit {c : C} : contrT 2 1 2 (by simp; rfl) (prodT (metricTensor c) (metricTensor (S.τ c))) = permT ![0, 1] (And.intro (by decide) (fun i => by fin_cases i - · change S.τ (S.τ c) = c - simp + · exact S.τ_involution c · rfl)) (unitTensor (S := S) (S.τ c)) := by - rw [contrT_metricTensor_metricTensor] - rw [unitTensor_eq_permT_dual] - rw [permT_permT] + rw [contrT_metricTensor_metricTensor, unitTensor_eq_permT_dual, permT_permT] apply permT_congr · decide · rfl diff --git a/Physlib/Relativity/Tensors/OfInt.lean b/Physlib/Relativity/Tensors/OfInt.lean index b50bf4139..c0a0b1e27 100644 --- a/Physlib/Relativity/Tensors/OfInt.lean +++ b/Physlib/Relativity/Tensors/OfInt.lean @@ -41,9 +41,7 @@ noncomputable def toTensor {n : ℕ} {c : Fin n → C} (f : TensorInt S c) : lemma basis_repr_apply {n : ℕ} {c : Fin n → C} (f : TensorInt S c) (b : ComponentIdx c) : - (Tensor.basis c).repr (toTensor f) b = Int.cast (f b) := by - simp only [toTensor, Basis.repr_symm_apply, Basis.repr_linearCombination] - rfl + (Tensor.basis c).repr (toTensor f) b = Int.cast (f b) := by simp [toTensor] end TensorInt diff --git a/Physlib/Relativity/Tensors/Product.lean b/Physlib/Relativity/Tensors/Product.lean index 16c405c4b..d6d14d281 100644 --- a/Physlib/Relativity/Tensors/Product.lean +++ b/Physlib/Relativity/Tensors/Product.lean @@ -121,15 +121,13 @@ def Pure.prodP {n1 n2} {c : Fin n1 → C} {c1 : Fin n2 → C} lemma Pure.prodP_apply_castAdd {n1 n2} {c : Fin n1 → C} {c1 : Fin n2 → C} (p1 : Pure S c) (p2 : Pure S c1) (i : Fin n1) : Pure.prodP p1 p2 (Fin.castAdd n2 i) = - LinearEquiv.cast (R := k) (by simp) (p1 i) := by - simp [Pure.prodP] + LinearEquiv.cast (R := k) (by simp) (p1 i) := by simp [Pure.prodP] @[simp] lemma Pure.prodP_apply_natAdd {n1 n2} {c : Fin n1 → C} {c1 : Fin n2 → C} (p1 : Pure S c) (p2 : Pure S c1) (i : Fin n2) : Pure.prodP p1 p2 (Fin.natAdd n1 i) = - LinearEquiv.cast (R := k) (by simp) (p2 i) := by - simp [Pure.prodP] + LinearEquiv.cast (R := k) (by simp) (p2 i) := by simp [Pure.prodP] lemma Pure.prodP_apply_finSumFinEquiv {n1 n2} {c : Fin n1 → C} {c1 : Fin n2 → C} (p1 : Pure S c) (p2 : Pure S c1) (i : Fin n1 ⊕ Fin n2) : @@ -445,8 +443,7 @@ noncomputable def prodT {n1 n2} {c : Fin n1 → C} {c1 : Fin n2 → C} : lemma prodT_pure {n1 n2} {c : Fin n1 → C} {c1 : Fin n2 → C} (t : Pure S c) (t1 : Pure S c1) : - (t.toTensor).prodT (t1.toTensor) = (Pure.prodP t t1).toTensor := by - simp [prodT, Pure.toTensor] + (t.toTensor).prodT (t1.toTensor) = (Pure.prodP t t1).toTensor := by simp [prodT, Pure.toTensor] /-! diff --git a/Physlib/Relativity/Tensors/RealTensor/Basic.lean b/Physlib/Relativity/Tensors/RealTensor/Basic.lean index b95714532..152b69768 100644 --- a/Physlib/Relativity/Tensors/RealTensor/Basic.lean +++ b/Physlib/Relativity/Tensors/RealTensor/Basic.lean @@ -136,13 +136,11 @@ These re-express fields of `realLorentzTensor d` in terms of `Lorentz` data. @[simp] lemma basisIdxCongr_eq_refl {d : ℕ} {c1 c2 : realLorentzTensor.Color} (h : c1 = c2) : - TensorSpecies.basisIdxCongr (basisIdx := fun _ => Fin 1 ⊕ Fin d) h = Equiv.refl _ := by - rfl + TensorSpecies.basisIdxCongr (basisIdx := fun _ => Fin 1 ⊕ Fin d) h = Equiv.refl _ := rfl lemma basisIdxCongr_apply {d : ℕ} {c1 c2 : realLorentzTensor.Color} (h : c1 = c2) (i : Fin 1 ⊕ Fin d) : - TensorSpecies.basisIdxCongr (basisIdx := fun _ => Fin 1 ⊕ Fin d) h i = i := by - simp + TensorSpecies.basisIdxCongr (basisIdx := fun _ => Fin 1 ⊕ Fin d) h i = i := by simp /-! @@ -224,8 +222,7 @@ lemma contrT_toField {d} (c : Fin 2 → Color) rw [contrT_eq_sum_evalT, map_sum] congr ext μ - simp only [toField_permT] - rfl + exact toField_permT _ _ _ open ComponentIdx in lemma contrT_basis_repr_apply_eq_fin {n d: ℕ} {c : Fin (n + 1 + 1) → realLorentzTensor.Color} diff --git a/Physlib/Relativity/Tensors/RealTensor/CoVector/Basic.lean b/Physlib/Relativity/Tensors/RealTensor/CoVector/Basic.lean index e9636635c..ffe5c83d2 100644 --- a/Physlib/Relativity/Tensors/RealTensor/CoVector/Basic.lean +++ b/Physlib/Relativity/Tensors/RealTensor/CoVector/Basic.lean @@ -79,8 +79,7 @@ instance isNormedAddCommGroup (d : ℕ) : NormedAddCommGroup (CoVector d) where instance isNormedSpace (d : ℕ) : NormedSpace ℝ (CoVector d) where norm_smul_le c v := by - simp only [norm_eq_equivEuclid, map_smul] - exact norm_smul_le c (equivEuclid d v) + simpa only [norm_eq_equivEuclid, map_smul] using norm_smul_le c (equivEuclid d v) open InnerProductSpace diff --git a/Physlib/Relativity/Tensors/RealTensor/CoVector/Representation.lean b/Physlib/Relativity/Tensors/RealTensor/CoVector/Representation.lean index a79c5cbc6..094fa9566 100644 --- a/Physlib/Relativity/Tensors/RealTensor/CoVector/Representation.lean +++ b/Physlib/Relativity/Tensors/RealTensor/CoVector/Representation.lean @@ -52,8 +52,7 @@ lemma rep_apply_eq_sum (d : ℕ) (Λ : LorentzGroup d) (v : CoVector d) (k : Fin rep Λ v k = ∑ j, (Λ⁻¹).1 j k • v j := rfl lemma rep_apply_eq_sum_coe (d : ℕ) (Λ : LorentzGroup d) (v : CoVector d) (k : Fin 1 ⊕ Fin d) : - rep Λ v k = ∑ j, Λ.1⁻¹ j k • v j := by - rw [rep_apply_eq_sum, LorentzGroup.coe_inv] + rep Λ v k = ∑ j, Λ.1⁻¹ j k • v j := by rw [rep_apply_eq_sum, LorentzGroup.coe_inv] lemma rep_apply_basis {d} (μ : Fin 1 ⊕ Fin d) (Λ : LorentzGroup d) : rep Λ (basis μ) = ∑ j, Λ.1⁻¹ μ j • basis j := by diff --git a/Physlib/Relativity/Tensors/RealTensor/CoVector/Tensorial.lean b/Physlib/Relativity/Tensors/RealTensor/CoVector/Tensorial.lean index 5a5c6537f..9d3241f95 100644 --- a/Physlib/Relativity/Tensors/RealTensor/CoVector/Tensorial.lean +++ b/Physlib/Relativity/Tensors/RealTensor/CoVector/Tensorial.lean @@ -173,13 +173,11 @@ lemma smul_sub {d : ℕ} (Λ : LorentzGroup d) (p q : CoVector d) : set_option backward.isDefEq.respectTransparency false in lemma smul_zero {d : ℕ} (Λ : LorentzGroup d) : - Λ • (0 : CoVector d) = 0 := by - rw [smul_eq_mulVec, Matrix.mulVec_zero] + Λ • (0 : CoVector d) = 0 := by rw [smul_eq_mulVec, Matrix.mulVec_zero] set_option backward.isDefEq.respectTransparency false in lemma smul_neg {d : ℕ} (Λ : LorentzGroup d) (p : CoVector d) : - Λ • (-p) = - (Λ • p) := by - rw [smul_eq_mulVec, smul_eq_mulVec, Matrix.mulVec_neg] + Λ • (-p) = - (Λ • p) := by rw [smul_eq_mulVec, smul_eq_mulVec, Matrix.mulVec_neg] /-- The Lorentz action on vectors as a continuous linear map. -/ def actionCLM {d : ℕ} (Λ : LorentzGroup d) : diff --git a/Physlib/Relativity/Tensors/RealTensor/Matrix/Pre.lean b/Physlib/Relativity/Tensors/RealTensor/Matrix/Pre.lean index 7162b8956..bc0ecb84c 100644 --- a/Physlib/Relativity/Tensors/RealTensor/Matrix/Pre.lean +++ b/Physlib/Relativity/Tensors/RealTensor/Matrix/Pre.lean @@ -35,8 +35,7 @@ lemma contrContrToMatrixRe_symm_expand_tmul (M : Matrix (Fin 1 ⊕ Fin d) (Fin 1 rw [Finsupp.linearCombination_apply_of_mem_supported ℝ (s := Finset.univ)] · rw [Fintype.sum_prod_type] refine Finset.sum_congr rfl (fun i _ => Finset.sum_congr rfl (fun j _ => ?_)) - erw [Basis.tensorProduct_apply (contrBasis d) (contrBasis d) i j] - rfl + exact congrArg₂ (· • ·) rfl (Basis.tensorProduct_apply (contrBasis d) (contrBasis d) i j) · simp /-- Equivalence of `CoMod ⊗ CoMod` to `(1 + d) x (1 + d)` real matrices. -/ @@ -53,8 +52,7 @@ lemma coCoToMatrixRe_symm_expand_tmul (M : Matrix (Fin 1 ⊕ Fin d) (Fin 1 ⊕ F rw [Finsupp.linearCombination_apply_of_mem_supported ℝ (s := Finset.univ)] · rw [Fintype.sum_prod_type] refine Finset.sum_congr rfl (fun i _ => Finset.sum_congr rfl (fun j _ => ?_)) - erw [Basis.tensorProduct_apply (coBasis d) (coBasis d) i j] - rfl + exact congrArg₂ (· • ·) rfl (Basis.tensorProduct_apply (coBasis d) (coBasis d) i j) · simp /-- Equivalence of `ContrMod d ⊗ CoMod d` to `(1 + d) x (1 + d)` real matrices. -/ @@ -72,8 +70,7 @@ lemma contrCoToMatrixRe_symm_expand_tmul (M : Matrix (Fin 1 ⊕ Fin d) (Fin 1 rw [Finsupp.linearCombination_apply_of_mem_supported ℝ (s := Finset.univ)] · rw [Fintype.sum_prod_type] refine Finset.sum_congr rfl (fun i _ => Finset.sum_congr rfl (fun j _ => ?_)) - erw [Basis.tensorProduct_apply _ _ i j] - rfl + exact congrArg₂ (· • ·) rfl (Basis.tensorProduct_apply _ _ i j) · simp /-- Equivalence of `CoMod d ⊗ ContrMod d` to `(1 + d) x (1 + d)` real matrices. -/ @@ -91,8 +88,7 @@ lemma coContrToMatrixRe_symm_expand_tmul (M : Matrix (Fin 1 ⊕ Fin d) (Fin 1 rw [Finsupp.linearCombination_apply_of_mem_supported ℝ (s := Finset.univ)] · rw [Fintype.sum_prod_type] refine Finset.sum_congr rfl (fun i _ => Finset.sum_congr rfl (fun j _ => ?_)) - erw [Basis.tensorProduct_apply _ _ i j] - rfl + exact congrArg₂ (· • ·) rfl (Basis.tensorProduct_apply _ _ i j) · simp /-! @@ -117,8 +113,7 @@ lemma contrContrToMatrixRe_ρ {d : ℕ} (v : (ContrMod d ⊗[ℝ] ContrMod d)) ( have h1 := (LinearMap.toMatrix_mulVec_repr ((contrBasis d).tensorProduct (contrBasis d)) ((contrBasis d).tensorProduct (contrBasis d)) (TensorProduct.map (ContrMod.rep M) (ContrMod.rep M)) v) - erw [h1] - rfl + exact h1.symm rw [TensorProduct.toMatrix_map] funext i j change ∑ k, ((kroneckerMap (fun x1 x2 => x1 * x2) @@ -154,8 +149,7 @@ lemma coCoToMatrixRe_ρ {d : ℕ} (v : (CoMod d ⊗[ℝ] CoMod d)) (M : LorentzG have h1 := (LinearMap.toMatrix_mulVec_repr ((coBasis d).tensorProduct (coBasis d)) ((coBasis d).tensorProduct (coBasis d)) (TensorProduct.map (CoMod.rep M) (CoMod.rep M)) v) - erw [h1] - rfl + exact h1.symm rw [TensorProduct.toMatrix_map] funext i j change ∑ k, ((kroneckerMap (fun x1 x2 => x1 * x2) @@ -191,8 +185,7 @@ lemma contrCoToMatrixRe_ρ {d : ℕ} (v : (ContrMod d ⊗[ℝ] CoMod d)) (M : Lo have h1 := (LinearMap.toMatrix_mulVec_repr ((contrBasis d).tensorProduct (coBasis d)) ((contrBasis d).tensorProduct (coBasis d)) (TensorProduct.map (ContrMod.rep M) (CoMod.rep M)) v) - erw [h1] - rfl + exact h1.symm rw [TensorProduct.toMatrix_map] funext i j change ∑ k, ((kroneckerMap (fun x1 x2 => x1 * x2) @@ -228,8 +221,7 @@ lemma coContrToMatrixRe_ρ {d : ℕ} (v : (CoMod d ⊗[ℝ] ContrMod d)) (M : Lo have h1 := (LinearMap.toMatrix_mulVec_repr ((coBasis d).tensorProduct (contrBasis d)) ((coBasis d).tensorProduct (contrBasis d)) (TensorProduct.map (CoMod.rep M) (ContrMod.rep M)) v) - erw [h1] - rfl + exact h1.symm rw [TensorProduct.toMatrix_map] funext i j change ∑ k, ((kroneckerMap (fun x1 x2 => x1 * x2) diff --git a/Physlib/Relativity/Tensors/RealTensor/Metrics/Basic.lean b/Physlib/Relativity/Tensors/RealTensor/Metrics/Basic.lean index 61061f0d7..dddd3b1b1 100644 --- a/Physlib/Relativity/Tensors/RealTensor/Metrics/Basic.lean +++ b/Physlib/Relativity/Tensors/RealTensor/Metrics/Basic.lean @@ -60,13 +60,11 @@ open Tensor lemma coMetric_eq_fromConstPair {d : ℕ} : η' d = fromConstPair (S := realLorentzTensor d) (c1 := .down) (c2 := .down) - (Lorentz.preCoMetric d) := by - rfl + (Lorentz.preCoMetric d) := rfl lemma contrMetric_eq_fromConstPair {d : ℕ} : η d = fromConstPair (S := realLorentzTensor d) - (c1 := .up) (c2 := .up) (Lorentz.preContrMetric d) := by - rfl + (c1 := .up) (c2 := .up) (Lorentz.preContrMetric d) := rfl lemma coMetric_eq_fromPairT {d : ℕ} : η' d = fromPairT (S := realLorentzTensor d) (c1 := .down) (c2 := .down) @@ -87,8 +85,7 @@ lemma contrMetric_eq_fromPairT {d : ℕ} : /-- The tensor `coMetric` is invariant under the action of `LorentzGroup d`. -/ @[simp] lemma actionT_coMetric {d : ℕ} (g : LorentzGroup d) : - g • η' d = η' d:= by - erw [TensorSpecies.metricTensor_invariant] + g • η' d = η' d := TensorSpecies.metricTensor_invariant g /-- The tensor `contrMetric` is invariant under the action of `LorentzGroup d`. -/ @[simp] diff --git a/Physlib/Relativity/Tensors/RealTensor/ToComplex.lean b/Physlib/Relativity/Tensors/RealTensor/ToComplex.lean index 8ce430965..b73df9dd3 100644 --- a/Physlib/Relativity/Tensors/RealTensor/ToComplex.lean +++ b/Physlib/Relativity/Tensors/RealTensor/ToComplex.lean @@ -93,16 +93,14 @@ lemma colorToComplex_match_up {n} {c : Fin n → realLorentzTensor.Color} {j} (match c j with | .up => complexLorentzTensor.Color.up | .down => complexLorentzTensor.Color.down) - = complexLorentzTensor.Color.up := by - rw [hc] + = complexLorentzTensor.Color.up := by rw [hc] lemma colorToComplex_match_down {n} {c : Fin n → realLorentzTensor.Color} {j} (hc : c j = realLorentzTensor.Color.down) : (match c j with | .up => complexLorentzTensor.Color.up | .down => complexLorentzTensor.Color.down) - = complexLorentzTensor.Color.down := by - rw [hc] + = complexLorentzTensor.Color.down := by rw [hc] lemma colorToComplex_comp_eq_match {n} (c : Fin n → realLorentzTensor.Color) (j : Fin n) : (colorToComplex ∘ c) j = @@ -131,8 +129,7 @@ lemma ComponentIdx.complexify_apply {n} {c : Fin n → realLorentzTensor.Color} @[simp] lemma ComponentIdx.complexify_toFun_apply {n} {c : Fin n → realLorentzTensor.Color} (f : ComponentIdx (S := realLorentzTensor) c) (j : Fin n) : - (ComponentIdx.complexify.toFun f) j = (ComponentIdx.complexify f) j := - rfl + (ComponentIdx.complexify.toFun f) j = (ComponentIdx.complexify f) j := rfl /-! @@ -156,8 +153,7 @@ noncomputable def toComplex {n} {c : Fin n → realLorentzTensor.Color} : rw [Finset.smul_sum] congr funext i - rw [← smul_smul] - rfl + exact (smul_smul _ _ _).symm map_add' c v := by simp only [map_add, Finsupp.coe_add, Pi.add_apply] rw [← Finset.sum_add_distrib] @@ -313,14 +309,12 @@ noncomputable def toComplexVector (c : realLorentzTensor.Color) : simp only [map_add, Finsupp.coe_add, Pi.add_apply, Nat.reduceAdd, ← Finset.sum_add_distrib] congr funext x - rw [add_smul] - rfl + exact add_smul _ _ _ | Color.down => simp only [map_add, Finsupp.coe_add, Pi.add_apply, Nat.reduceAdd, ← Finset.sum_add_distrib] congr funext x - rw [add_smul] - rfl + exact add_smul _ _ _ map_smul' r v := by match c with | Color.up => @@ -329,16 +323,14 @@ noncomputable def toComplexVector (c : realLorentzTensor.Color) : rw [Finset.smul_sum] congr funext x - rw [← smul_smul] - rfl + exact (smul_smul _ _ _).symm | Color.down => simp only [map_smul, Finsupp.coe_smul, Pi.smul_apply, smul_eq_mul, Nat.reduceAdd, Complex.ofRealHom_eq_coe, Complex.coe_smul] rw [Finset.smul_sum] congr funext x - rw [← smul_smul] - rfl + exact (smul_smul _ _ _).symm lemma toComplexVector_up_eq_inclCongrRealLorentz (v : Lorentz.ContrMod 3) : toComplexVector Color.up v = Lorentz.inclCongrRealLorentz v := by @@ -349,14 +341,12 @@ lemma toComplexVector_up_eq_inclCongrRealLorentz (v : Lorentz.ContrMod 3) : Lorentz.complexContrBasisFin4, Lorentz.ContrMod.toFin1dℝ_eq_val] rfl _ = ∑ i, v.toFin1dℝ i • Lorentz.inclCongrRealLorentz - (Lorentz.ContrMod.stdBasis i) := by - simp only [Lorentz.complexContrBasis_of_real] + (Lorentz.ContrMod.stdBasis i) := by simp only [Lorentz.complexContrBasis_of_real] _ = Lorentz.inclCongrRealLorentz (∑ i, v.toFin1dℝ i • Lorentz.ContrMod.stdBasis i) := by rw [map_sum] simp only [LinearMap.map_smulₛₗ, Complex.ofRealHom_eq_coe, Complex.coe_smul] - _ = Lorentz.inclCongrRealLorentz v := by - rw [← Lorentz.ContrMod.stdBasis_decomp v] + _ = Lorentz.inclCongrRealLorentz v := by rw [← Lorentz.ContrMod.stdBasis_decomp v] lemma toComplexVector_down_eq_inclCoRealLorentz (v : Lorentz.CoMod 3) : toComplexVector Color.down v = Lorentz.inclCoRealLorentz v := by @@ -366,14 +356,12 @@ lemma toComplexVector_down_eq_inclCoRealLorentz (v : Lorentz.CoMod 3) : simp [toComplexVector, Lorentz.coBasis_repr_apply, Lorentz.complexCoBasisFin4] rfl _ = ∑ i, v.toFin1dℝ i • Lorentz.inclCoRealLorentz - (Lorentz.CoMod.stdBasis i) := by - simp only [Lorentz.complexCoBasis_of_real] + (Lorentz.CoMod.stdBasis i) := by simp only [Lorentz.complexCoBasis_of_real] _ = Lorentz.inclCoRealLorentz (∑ i, v.toFin1dℝ i • Lorentz.CoMod.stdBasis i) := by rw [map_sum] simp only [LinearMap.map_smulₛₗ, Complex.ofRealHom_eq_coe, Complex.coe_smul] - _ = Lorentz.inclCoRealLorentz v := by - rw [← Lorentz.CoMod.stdBasis_decomp v] + _ = Lorentz.inclCoRealLorentz v := by rw [← Lorentz.CoMod.stdBasis_decomp v] /-- The function which turns a real pure tensor into a complex one. -/ noncomputable def toComplexPure {c : Fin n → Color} (p : Pure realLorentzTensor c) : @@ -515,9 +503,7 @@ lemma toComplex_equivariant {n} {c : Fin n → realLorentzTensor.Color} · rw [actionT_pure, toComplex_pure, actionT_pure, actionP_toComplexPure, toComplex_pure] · simp rw [← h] - change Λ • (r : ℂ) • toComplex t = _ - rw [actionT_smul] - rfl + exact actionT_smul (g := Λ) (r := (r : ℂ)) (t := toComplex t) · simp_all /-! @@ -842,8 +828,7 @@ lemma contrT_toComplex {n : ℕ} (p := Pure.basisVector (colorToComplex ∘ c) (ComponentIdx.complexify b))] exact toComplex_contrP_basisVector h b · -- zero tensor - dsimp [P] - simp + simp [P] · -- scalar multiplication intro r t ht dsimp [P] at ht ⊢ diff --git a/Physlib/Relativity/Tensors/RealTensor/Units/Pre.lean b/Physlib/Relativity/Tensors/RealTensor/Units/Pre.lean index 605ae3f2c..04d3dcb45 100644 --- a/Physlib/Relativity/Tensors/RealTensor/Units/Pre.lean +++ b/Physlib/Relativity/Tensors/RealTensor/Units/Pre.lean @@ -53,9 +53,7 @@ def preContrCoUnit (d : ℕ := 3) : toFun := fun a => a • preContrCoUnitVal d map_add' := fun x y => by simp only [add_smul] - map_smul' := fun m x => by - simp only [smul_smul] - rfl + map_smul' := fun m x => by simp only [smul_eq_mul, smul_smul, RingHom.id_apply] isIntertwining' M := by refine LinearMap.ext fun x : ℝ => ?_ simp only [LinearMap.coe_comp, Function.comp_apply] @@ -69,8 +67,7 @@ def preContrCoUnit (d : ℕ := 3) : simp lemma preContrCoUnit_apply_one {d : ℕ} : (preContrCoUnit d) (1 : ℝ) = preContrCoUnitVal d := by - change (1 : ℝ) • preContrCoUnitVal d = preContrCoUnitVal d - rw [one_smul] + simp [preContrCoUnit] /-- The co-contra unit for complex lorentz vectors. Usually denoted `δᵢⁱ`. -/ def preCoContrUnitVal (d : ℕ := 3) : CoMod d ⊗[ℝ] ContrMod d := @@ -104,9 +101,7 @@ def preCoContrUnit (d : ℕ) : (Representation.trivial ℝ (LorentzGroup d) ℝ) toFun := fun a => a • preCoContrUnitVal d map_add' := fun x y => by simp only [add_smul] - map_smul' := fun m x => by - simp only [smul_smul] - rfl + map_smul' := fun m x => by simp only [smul_eq_mul, smul_smul, RingHom.id_apply] isIntertwining' M := by refine LinearMap.ext fun x : ℝ => ?_ simp only [LinearMap.coe_comp, Function.comp_apply] @@ -122,8 +117,7 @@ def preCoContrUnit (d : ℕ) : (Representation.trivial ℝ (LorentzGroup d) ℝ) simp lemma preCoContrUnit_apply_one {d : ℕ} : (preCoContrUnit d) (1 : ℝ) = preCoContrUnitVal d := by - change (1 : ℝ) • preCoContrUnitVal d = preCoContrUnitVal d - rw [one_smul] + simp [preCoContrUnit] /-! @@ -147,9 +141,7 @@ lemma contr_preContrCoUnit {d : ℕ} (x : CoMod d) : rfl rw [h1] have h2 : coContrContract.toLinearMap.rTensor _ (∑ i, (x ⊗ₜ[ℝ] contrBasis d i) ⊗ₜ[ℝ] coBasis d i) - = ∑ i, ((coContrContract) (x ⊗ₜ[ℝ] contrBasis d i)) ⊗ₜ[ℝ] coBasis d i := by - rw [map_sum] - rfl + = ∑ i, ((coContrContract) (x ⊗ₜ[ℝ] contrBasis d i)) ⊗ₜ[ℝ] coBasis d i := map_sum _ _ _ erw [h2] obtain ⟨c, rfl⟩ := (Submodule.mem_span_range_iff_exists_fun ℝ).mp (Basis.mem_span (coBasis d) x) have h3 (i : Fin 1 ⊕ Fin d) : (coContrContract) @@ -162,8 +154,7 @@ lemma contr_preContrCoUnit {d : ℕ} (x : CoMod d) : conv_lhs => enter [2, 2, i] rw [h3 i] - rw [map_sum] - rfl + exact map_sum _ _ _ /-- Contraction on the right with `coContrUnit`. -/ lemma contr_preCoContrUnit {d : ℕ} (x : ContrMod d) : @@ -181,9 +172,7 @@ lemma contr_preCoContrUnit {d : ℕ} (x : ContrMod d) : rfl rw [h1] have h2 :contrCoContract.toLinearMap.rTensor _ (∑ i, (x ⊗ₜ[ℝ] coBasis d i) ⊗ₜ[ℝ] contrBasis d i) - = ∑ i, ((contrCoContract) (x ⊗ₜ[ℝ] coBasis d i)) ⊗ₜ[ℝ] contrBasis d i := by - rw [map_sum] - rfl + = ∑ i, ((contrCoContract) (x ⊗ₜ[ℝ] coBasis d i)) ⊗ₜ[ℝ] contrBasis d i := map_sum _ _ _ erw [h2] obtain ⟨c, rfl⟩ := (Submodule.mem_span_range_iff_exists_fun ℝ).mp (Basis.mem_span (contrBasis d) x) @@ -197,8 +186,7 @@ lemma contr_preCoContrUnit {d : ℕ} (x : ContrMod d) : conv_lhs => enter [2, 2, i] rw [h3 i] - rw [map_sum] - rfl + exact map_sum _ _ _ /-! @@ -209,16 +197,14 @@ lemma contr_preCoContrUnit {d : ℕ} (x : ContrMod d) : lemma preContrCoUnit_symm {d : ℕ} : (preContrCoUnit d) (1 : ℝ) = LinearMap.lTensor _ (LinearEquiv.cast (by rfl)).toLinearMap (TensorProduct.comm ℝ _ _ ((preCoContrUnit d) (1 : ℝ))) := by - rw [preContrCoUnit_apply_one, preContrCoUnitVal_expand_tmul] - rw [preCoContrUnit_apply_one, preCoContrUnitVal_expand_tmul] - simp + simp [preContrCoUnit_apply_one, preContrCoUnitVal_expand_tmul, preCoContrUnit_apply_one, + preCoContrUnitVal_expand_tmul] lemma preCoContrUnit_symm {d : ℕ} : (preCoContrUnit d) (1 : ℝ) = LinearMap.lTensor _ (LinearEquiv.cast (by simp)).toLinearMap (TensorProduct.comm ℝ _ _ ((preContrCoUnit d) (1 : ℝ))) := by - rw [preContrCoUnit_apply_one, preContrCoUnitVal_expand_tmul] - rw [preCoContrUnit_apply_one, preCoContrUnitVal_expand_tmul] - simp + simp [preContrCoUnit_apply_one, preContrCoUnitVal_expand_tmul, preCoContrUnit_apply_one, + preCoContrUnitVal_expand_tmul] end Lorentz end diff --git a/Physlib/Relativity/Tensors/RealTensor/Vector/Basic.lean b/Physlib/Relativity/Tensors/RealTensor/Vector/Basic.lean index 529398ff4..f4f59992b 100644 --- a/Physlib/Relativity/Tensors/RealTensor/Vector/Basic.lean +++ b/Physlib/Relativity/Tensors/RealTensor/Vector/Basic.lean @@ -91,8 +91,7 @@ instance isNormedAddCommGroup (d : ℕ) : NormedAddCommGroup (Vector d) where instance isNormedSpace (d : ℕ) : NormedSpace ℝ (Vector d) where norm_smul_le c v := by - simp only [norm_eq_equivEuclid, map_smul] - exact norm_smul_le c (equivEuclid d v) + simpa only [norm_eq_equivEuclid, map_smul] using norm_smul_le c (equivEuclid d v) open InnerProductSpace instance (d : ℕ) : Inner ℝ (Vector d) where @@ -153,7 +152,6 @@ lemma apply_sum {d : ℕ} {ι : Type} [Fintype ι] (f : ι → Vector d) (i : Fi simp at h' rw [← @e.sum_comp, ← @e.sum_comp, h'] · intro f i - simp only [Finset.univ_eq_empty, Finset.sum_empty] rfl · intro ι _ h f i rw [Fintype.sum_option, apply_add, h, Fintype.sum_option] @@ -409,10 +407,8 @@ def ofTemporalComponent {d : ℕ} : ℝ →L[ℝ] Vector d where Lorentz Vector with only non-zero spatial components. -/ def ofSpatialComponent {d : ℕ} : EuclideanSpace ℝ (Fin d) →L[ℝ] Vector d where toFun xs := ∑ i, xs i • basis (Sum.inr i) - map_add' xs ys := by - simp [add_smul, Finset.sum_add_distrib] - map_smul' c xs := by - simp [smul_smul, Finset.smul_sum] + map_add' xs ys := by simp [add_smul, Finset.sum_add_distrib] + map_smul' c xs := by simp [smul_smul, Finset.smul_sum] /-! diff --git a/Physlib/Relativity/Tensors/RealTensor/Vector/Causality/Basic.lean b/Physlib/Relativity/Tensors/RealTensor/Vector/Causality/Basic.lean index 028fafe7d..d066f5eec 100644 --- a/Physlib/Relativity/Tensors/RealTensor/Vector/Causality/Basic.lean +++ b/Physlib/Relativity/Tensors/RealTensor/Vector/Causality/Basic.lean @@ -56,8 +56,7 @@ lemma spaceLike_iff_norm_sq_neg {d : ℕ} (p : Vector d) : simp only [reduceCtorEq, h, lt_self_iff_false] · split · rename_i h - simp only [reduceCtorEq, false_iff, not_lt] - exact le_of_lt h + simpa only [reduceCtorEq, false_iff, not_lt] using le_of_lt h · rename_i h1 h2 simp only [true_iff] rw [not_lt_iff_eq_or_lt] at h2 diff --git a/Physlib/Relativity/Tensors/RealTensor/Vector/Causality/LightLike.lean b/Physlib/Relativity/Tensors/RealTensor/Vector/Causality/LightLike.lean index c919ddf4f..3b39e714d 100644 --- a/Physlib/Relativity/Tensors/RealTensor/Vector/Causality/LightLike.lean +++ b/Physlib/Relativity/Tensors/RealTensor/Vector/Causality/LightLike.lean @@ -30,8 +30,7 @@ lemma lightLike_iff_norm_sq_zero {d : ℕ} (p : Vector d) : -- Zero vector has zero Minkowski norm squared @[simp] lemma causalCharacter_zero {d : ℕ} : causalCharacter (0 : Vector d) = - CausalCharacter.lightLike := by - simp [causalCharacter] + CausalCharacter.lightLike := by simp [causalCharacter] /-- Causally preceding is reflexive -/ @[simp] diff --git a/Physlib/Relativity/Tensors/RealTensor/Vector/Causality/TimeLike.lean b/Physlib/Relativity/Tensors/RealTensor/Vector/Causality/TimeLike.lean index 1febf830f..f157866d1 100644 --- a/Physlib/Relativity/Tensors/RealTensor/Vector/Causality/TimeLike.lean +++ b/Physlib/Relativity/Tensors/RealTensor/Vector/Causality/TimeLike.lean @@ -27,8 +27,7 @@ namespace Vector @[simp] lemma timelike_neg_time_component_product {d : ℕ} (v w : Vector d) (hv_neg : v (Sum.inl 0) < 0) (hw_neg : w (Sum.inl 0) < 0) : - v (Sum.inl 0) * w (Sum.inl 0) > 0 := by - exact mul_pos_of_neg_of_neg hv_neg hw_neg + v (Sum.inl 0) * w (Sum.inl 0) > 0 := mul_pos_of_neg_of_neg hv_neg hw_neg /-- For timelike vectors, the Minkowski inner product is positive -/ lemma timeLike_iff_norm_sq_pos {d : ℕ} (p : Vector d) : @@ -52,16 +51,14 @@ lemma timelike_time_dominates_space {d : ℕ} {v : Vector d} rw [minkowskiProduct_toCoord] at hv simp only [PiLp.inner_apply, RCLike.inner_apply, conj_trivial] have h_spatial_sum : ∑ x, spatialPart v x * spatialPart v x = - ∑ i, v (Sum.inr i) * v (Sum.inr i) := by - simp only + ∑ i, v (Sum.inr i) * v (Sum.inr i) := by simp only have h_time : timeComponent v = v (Sum.inl 0) := rfl rw [h_spatial_sum, h_time] have h_norm_pos : 0 < v (Sum.inl 0) * v (Sum.inl 0) - ∑ i, v (Sum.inr i) * v (Sum.inr i) := hv -- Rearrange the inequality have h : ∑ i, v (Sum.inr i) * v (Sum.inr i) < - v (Sum.inl 0) * v (Sum.inl 0) := by - exact lt_of_sub_pos h_norm_pos + v (Sum.inl 0) * v (Sum.inl 0) := lt_of_sub_pos h_norm_pos exact h /-- For nonzero timelike vectors, the time component is nonzero -/ @@ -102,8 +99,7 @@ lemma timeLike_iff_time_lt_space {d : ℕ} {v : Vector d} : @[simp] lemma timeComponent_squared_pos_of_timelike {d : ℕ} {v : Vector d} (hv : causalCharacter v = .timeLike) : - 0 < (timeComponent v)^2 := by - exact pow_two_pos_of_ne_zero (time_component_ne_zero_of_timelike hv) + 0 < (timeComponent v)^2 := pow_two_pos_of_ne_zero (time_component_ne_zero_of_timelike hv) /-- For timelike vectors, the spatial norm squared is strictly less than the time component squared -/ diff --git a/Physlib/Relativity/Tensors/RealTensor/Vector/MinkowskiProduct.lean b/Physlib/Relativity/Tensors/RealTensor/Vector/MinkowskiProduct.lean index 2dbe8d943..26261b0ce 100644 --- a/Physlib/Relativity/Tensors/RealTensor/Vector/MinkowskiProduct.lean +++ b/Physlib/Relativity/Tensors/RealTensor/Vector/MinkowskiProduct.lean @@ -76,8 +76,7 @@ lemma minkowskiProductMap_add_fst {d : ℕ} (p q r : Vector d) : @[simp] lemma minkowskiProductMap_add_snd {d : ℕ} (p q r : Vector d) : minkowskiProductMap p (q + r) = minkowskiProductMap p q + minkowskiProductMap p r := by - rw [minkowskiProductMap_symm, minkowskiProductMap_add_fst] - rw [minkowskiProductMap_symm q p, minkowskiProductMap_symm r p] + simpa [minkowskiProductMap_symm] using minkowskiProductMap_add_fst q r p @[simp] lemma minkowskiProductMap_smul_fst {d : ℕ} (c : ℝ) (p q : Vector d) : @@ -127,9 +126,8 @@ lemma minkowskiProduct_apply {d : ℕ} (p q : Vector d) : ⟪p, q⟫ₘ = minkowskiProductMap p q := rfl lemma minkowskiProduct_symm {d : ℕ} (p q : Vector d) : - ⟪p, q⟫ₘ = ⟪q, p⟫ₘ := by - rw [minkowskiProduct_apply, minkowskiProductMap_symm] - rfl + ⟪p, q⟫ₘ = ⟪q, p⟫ₘ := + minkowskiProductMap_symm p q lemma minkowskiProduct_toCoord {d : ℕ} (p q : Vector d) : ⟪p, q⟫ₘ = p (Sum.inl 0) * q (Sum.inl 0) - ∑ i, p (Sum.inr i) * q (Sum.inr i) := by @@ -255,8 +253,7 @@ def IsLorentz {d : ℕ} (f : Vector d →ₗ[ℝ] Vector d) : Prop := ∀ p q : Vector d, ⟪f p, f q⟫ₘ = ⟪p, q⟫ₘ lemma isLorentz_iff {d : ℕ} (f : Vector d →ₗ[ℝ] Vector d) : - IsLorentz f ↔ ∀ p q : Vector d, ⟪f p, f q⟫ₘ = ⟪p, q⟫ₘ := by - rfl + IsLorentz f ↔ ∀ p q : Vector d, ⟪f p, f q⟫ₘ = ⟪p, q⟫ₘ := Iff.rfl lemma isLorentz_iff_basis {d : ℕ} (f : Vector d →ₗ[ℝ] Vector d) : IsLorentz f ↔ ∀ μ ν : Fin 1 ⊕ Fin d, ⟪f (basis μ), f (basis ν)⟫ₘ = ⟪basis μ, basis ν⟫ₘ := by @@ -281,8 +278,7 @@ lemma isLorentz_iff_comp_adjoint_eq_id {d : ℕ} (f : Vector d →ₗ[ℝ] Vecto lemma isLorentz_iff_toMatrix_mem_lorentzGroup {d : ℕ} (f : Vector d →ₗ[ℝ] Vector d) : IsLorentz f ↔ LinearMap.toMatrix Vector.basis Vector.basis f ∈ LorentzGroup d := by - rw [isLorentz_iff_comp_adjoint_eq_id] - rw [LorentzGroup.mem_iff_dual_mul_self] + rw [isLorentz_iff_comp_adjoint_eq_id, LorentzGroup.mem_iff_dual_mul_self] trans LinearMap.toMatrix Vector.basis Vector.basis (adjoint f ∘ₗ f) = LinearMap.toMatrix Vector.basis Vector.basis (LinearMap.id : Vector d →ₗ[ℝ] Vector d) · exact Iff.symm (EmbeddingLike.apply_eq_iff_eq (LinearMap.toMatrix basis basis)) diff --git a/Physlib/Relativity/Tensors/RealTensor/Vector/Pre/Basic.lean b/Physlib/Relativity/Tensors/RealTensor/Vector/Pre/Basic.lean index f2f6c988c..edd564fa4 100644 --- a/Physlib/Relativity/Tensors/RealTensor/Vector/Pre/Basic.lean +++ b/Physlib/Relativity/Tensors/RealTensor/Vector/Pre/Basic.lean @@ -39,14 +39,10 @@ lemma contrBasis_ρ_apply {d : ℕ} (M : LorentzGroup d) (i j : Fin 1 ⊕ Fin d) @[simp] lemma contrBasis_toFin1dℝ {d : ℕ} (i : Fin 1 ⊕ Fin d) : - (contrBasis d i).toFin1dℝ = Pi.single i 1 := by - simp only [ContrMod.toFin1dℝ, contrBasis, Basis.coe_ofEquivFun] - rfl + (contrBasis d i).toFin1dℝ = Pi.single i 1 := by simp [ContrMod.toFin1dℝ, contrBasis] lemma contrBasis_repr_apply {d : ℕ} (p : ContrMod d) (i : Fin 1 ⊕ Fin d) : - (contrBasis d).repr p i = p.val i := by - simp only [contrBasis, Basis.ofEquivFun_repr_apply] - rfl + (contrBasis d).repr p i = p.val i := rfl /-- The standard basis of contravariant Lorentz vectors indexed by `Fin (1 + d)`. -/ def contrBasisFin (d : ℕ := 3) : Basis (Fin (1 + d)) ℝ (ContrMod d) := @@ -61,8 +57,7 @@ lemma contrBasisFin_repr_apply {d : ℕ} (p : ContrMod d) (i : Fin (1 + d)) : (contrBasisFin d).repr p i = p.val (finSumFinEquiv.symm i) := by rfl lemma continuous_contr {T : Type} [TopologicalSpace T] (f : T → ContrMod d) - (h : Continuous (fun i => (f i).toFin1dℝ)) : Continuous f := by - exact continuous_induced_rng.mpr h + (h : Continuous (fun i => (f i).toFin1dℝ)) : Continuous f := continuous_induced_rng.mpr h set_option backward.isDefEq.respectTransparency false in lemma contr_continuous {T : Type} [TopologicalSpace T] (f : ContrMod d → T) @@ -86,15 +81,11 @@ lemma coBasis_ρ_apply {d : ℕ} (M : LorentzGroup d) (i j : Fin 1 ⊕ Fin d) : simp [LorentzGroup.transpose, ← LorentzGroup.coe_inv] lemma coBasis_repr_apply {d : ℕ} (p : CoMod d) (i : Fin 1 ⊕ Fin d) : - (coBasis d).repr p i = p.val i := by - simp only [coBasis, Basis.ofEquivFun_repr_apply] - rfl + (coBasis d).repr p i = p.val i := rfl @[simp] lemma coBasis_toFin1dℝ {d : ℕ} (i : Fin 1 ⊕ Fin d) : - (coBasis d i).toFin1dℝ = Pi.single i 1 := by - simp only [coBasis, Basis.coe_ofEquivFun] - rfl + (coBasis d i).toFin1dℝ = Pi.single i 1 := by simp [coBasis] /-- The standard basis of covariant Lorentz vectors indexed by `Fin (1 + d)`. -/ def coBasisFin (d : ℕ := 3) : Basis (Fin (1 + d)) ℝ (CoMod d) := diff --git a/Physlib/Relativity/Tensors/RealTensor/Vector/Pre/Contraction.lean b/Physlib/Relativity/Tensors/RealTensor/Vector/Pre/Contraction.lean index 1d82b73a5..2fa2efe5c 100644 --- a/Physlib/Relativity/Tensors/RealTensor/Vector/Pre/Contraction.lean +++ b/Physlib/Relativity/Tensors/RealTensor/Vector/Pre/Contraction.lean @@ -38,18 +38,15 @@ def contrModCoModBi (d : ℕ) : ContrMod d →ₗ[ℝ] CoMod d →ₗ[ℝ] ℝ w rw [dotProduct_add] map_smul' := by intro r φ - simp only [LinearEquiv.map_smul] - rw [dotProduct_smul] - rfl} + simp only [LinearEquiv.map_smul, dotProduct_smul, RingHom.id_apply]} map_add' ψ ψ':= by refine LinearMap.ext (fun φ => ?_) simp only [map_add, LinearMap.coe_mk, AddHom.coe_mk, LinearMap.add_apply] rw [add_dotProduct] map_smul' r ψ := by refine LinearMap.ext (fun φ => ?_) - simp only [LinearEquiv.map_smul, LinearMap.coe_mk, AddHom.coe_mk] - rw [smul_dotProduct] - rfl + simp only [LinearEquiv.map_smul, LinearMap.coe_mk, AddHom.coe_mk, smul_dotProduct, + LinearMap.smul_apply, RingHom.id_apply] /-- The bi-linear map corresponding to contraction of a covariant Lorentz vector with a contravariant Lorentz vector. -/ @@ -62,18 +59,15 @@ def coModContrModBi (d : ℕ) : CoMod d →ₗ[ℝ] ContrMod d →ₗ[ℝ] ℝ w rw [dotProduct_add] map_smul' := by intro r ψ - simp only [LinearEquiv.map_smul] - rw [dotProduct_smul] - rfl} + simp only [LinearEquiv.map_smul, dotProduct_smul, RingHom.id_apply]} map_add' φ φ' := by refine LinearMap.ext (fun ψ => ?_) simp only [map_add, LinearMap.coe_mk, AddHom.coe_mk, LinearMap.add_apply] rw [add_dotProduct] map_smul' r φ := by refine LinearMap.ext (fun ψ => ?_) - simp only [LinearEquiv.map_smul, LinearMap.coe_mk, AddHom.coe_mk] - rw [smul_dotProduct] - rfl + simp only [LinearEquiv.map_smul, LinearMap.coe_mk, AddHom.coe_mk, smul_dotProduct, + LinearMap.smul_apply, RingHom.id_apply] /-- The linear map from ContrMod d ⊗ CoMod d to ℝ given by summing over components of contravariant Lorentz vector and @@ -91,15 +85,13 @@ def contrCoContract : ((ContrMod.rep).tprod (CoMod.rep)).IntertwiningMap change (Λ.1 *ᵥ ψ.toFin1dℝ) ⬝ᵥ ((LorentzGroup.transpose Λ⁻¹).1 *ᵥ φ.toFin1dℝ) = _ rw [dotProduct_mulVec, LorentzGroup.transpose_val, vecMul_transpose, mulVec_mulVec, LorentzGroup.coe_inv, inv_mul_of_invertible Λ.1] - simp only [one_mulVec] - rfl + simp [contrModCoModBi] /-- Notation for `contrCoContract` acting on a tmul. -/ local notation "⟪" ψ "," φ "⟫ₘ" => contrCoContract (ψ ⊗ₜ φ) lemma contrCoContract_hom_tmul (ψ : ContrMod d) (φ : CoMod d) : - ⟪ψ, φ⟫ₘ = ψ.toFin1dℝ ⬝ᵥ φ.toFin1dℝ := by - rfl + ⟪ψ, φ⟫ₘ = ψ.toFin1dℝ ⬝ᵥ φ.toFin1dℝ := rfl /-- The linear map from CoMod d ⊗ ContrMod d to ℝ given by summing over components of contravariant Lorentz vector and @@ -114,15 +106,13 @@ def coContrContract : ((CoMod.rep (d := d)).tprod (ContrMod.rep (d := d))).Inter change ((LorentzGroup.transpose Λ⁻¹).1 *ᵥ ψ.toFin1dℝ) ⬝ᵥ (Λ.1 *ᵥ φ.toFin1dℝ) = _ rw [dotProduct_mulVec, LorentzGroup.transpose_val, mulVec_transpose, vecMul_vecMul, LorentzGroup.coe_inv, inv_mul_of_invertible Λ.1] - simp only [vecMul_one] - rfl + simp [coModContrModBi] /-- Notation for `coContrContract` acting on a tmul. -/ local notation "⟪" φ "," ψ "⟫ₘ" => coContrContract (φ ⊗ₜ ψ) lemma coContrContract_hom_tmul (φ : CoMod d) (ψ : ContrMod d) : - ⟪φ, ψ⟫ₘ = φ.toFin1dℝ ⬝ᵥ ψ.toFin1dℝ := by - rfl + ⟪φ, ψ⟫ₘ = φ.toFin1dℝ ⬝ᵥ ψ.toFin1dℝ := rfl /-! @@ -159,10 +149,7 @@ def contrContrContractField : ContrMod d ⊗[ℝ] ContrMod d →ₗ[ℝ] ℝ := local notation "⟪" ψ "," φ "⟫ₘ" => contrContrContractField (ψ ⊗ₜ φ) lemma contrContrContract_hom_tmul (φ : ContrMod d) (ψ : ContrMod d) : - ⟪φ, ψ⟫ₘ = φ.toFin1dℝ ⬝ᵥ η *ᵥ ψ.toFin1dℝ:= by - simp only [contrContrContractField] - erw [contrCoContract_hom_tmul] - rfl + ⟪φ, ψ⟫ₘ = φ.toFin1dℝ ⬝ᵥ η *ᵥ ψ.toFin1dℝ := rfl /-- The linear map from CoMod d ⊗ CoMod d to ℝ induced by the homomorphism `Co.toContr` and the contraction `coContrContract`. -/ @@ -206,8 +193,7 @@ lemma as_sum_toSpace : ⟪x, y⟫ₘ = x.val (Sum.inl 0) * y.val (Sum.inl 0) - rw [as_sum] congr funext i - rw [mul_comm] - rfl + exact mul_comm _ _ lemma stdBasis_inl {d : ℕ} : ⟪@ContrMod.stdBasis d (Sum.inl 0), ContrMod.stdBasis (Sum.inl 0)⟫ₘ = (1 : ℝ) := by @@ -235,8 +221,7 @@ lemma dual_mulVec_right : ⟪x, dual Λ *ᵥ y⟫ₘ = ⟪Λ *ᵥ x, y⟫ₘ := simp only [dual, ← mul_assoc, minkowskiMatrix.sq, one_mul] rw [← mulVec_mulVec, dotProduct_mulVec, vecMul_transpose] -lemma dual_mulVec_left : ⟪dual Λ *ᵥ x, y⟫ₘ = ⟪x, Λ *ᵥ y⟫ₘ := by - rw [symm, dual_mulVec_right, symm] +lemma dual_mulVec_left : ⟪dual Λ *ᵥ x, y⟫ₘ = ⟪x, Λ *ᵥ y⟫ₘ := by rw [symm, dual_mulVec_right, symm] lemma right_parity : ⟪x, ContrMod.rep LorentzGroup.parity y⟫ₘ = ∑ i, x.val i * y.val i := by rw [as_sum] @@ -358,9 +343,8 @@ lemma inl_sq_eq (v : ContrMod d) : v.val (Sum.inl 0) ^ 2 = lemma le_inl_sq (v : ContrMod d) : ⟪v, v⟫ₘ ≤ v.val (Sum.inl 0) ^ 2 := by rw [inl_sq_eq] - apply (le_add_iff_nonneg_right _).mpr - refine Fintype.sum_nonneg ?hf - exact fun i => pow_two_nonneg (v.val (Sum.inr i)) + exact (le_add_iff_nonneg_right _).mpr + (Fintype.sum_nonneg fun i => pow_two_nonneg (v.val (Sum.inr i))) lemma ge_abs_inner_product (v w : ContrMod d) : v.val (Sum.inl 0) * w.val (Sum.inl 0) - ‖⟪v.toSpace, w.toSpace⟫_ℝ‖ ≤ ⟪v, w⟫ₘ := by diff --git a/Physlib/Relativity/Tensors/RealTensor/Vector/Pre/Modules.lean b/Physlib/Relativity/Tensors/RealTensor/Vector/Pre/Modules.lean index 72d7b7d89..c95ee408e 100644 --- a/Physlib/Relativity/Tensors/RealTensor/Vector/Pre/Modules.lean +++ b/Physlib/Relativity/Tensors/RealTensor/Vector/Pre/Modules.lean @@ -87,8 +87,7 @@ lemma stdBasis_toFin1dℝEquiv_apply_same (μ : Fin 1 ⊕ Fin d) : toFin1dℝEquiv (stdBasis μ) μ = 1 := by simp only [stdBasis, Basis.ofEquivFun, Basis.coe_ofRepr, LinearEquiv.trans_symm, LinearEquiv.symm_symm, LinearEquiv.trans_apply, Finsupp.linearEquivFunOnFinite_single] - rw [@LinearEquiv.apply_symm_apply] - exact Pi.single_eq_same μ 1 + simp @[simp] lemma stdBasis_apply_same (μ : Fin 1 ⊕ Fin d) : (stdBasis μ).val μ = 1 := @@ -98,8 +97,7 @@ lemma stdBasis_toFin1dℝEquiv_apply_ne {μ ν : Fin 1 ⊕ Fin d} (h : μ ≠ ν toFin1dℝEquiv (stdBasis μ) ν = 0 := by simp only [stdBasis, Basis.ofEquivFun, Basis.coe_ofRepr, LinearEquiv.trans_symm, LinearEquiv.symm_symm, LinearEquiv.trans_apply, Finsupp.linearEquivFunOnFinite_single] - rw [@LinearEquiv.apply_symm_apply] - exact Pi.single_eq_of_ne' h 1 + simpa using Pi.single_eq_of_ne' h 1 @[simp] lemma stdBasis_inl_apply_inr (i : Fin d) : (stdBasis (Sum.inl 0)).val (Sum.inr i) = 0 := by @@ -141,33 +139,27 @@ scoped[Lorentz] infixr:73 " *ᵥ " => ContrMod.mulVec @[simp] lemma mulVec_toFin1dℝ (M : Matrix (Fin 1 ⊕ Fin d) (Fin 1 ⊕ Fin d) ℝ) (v : ContrMod d) : - (M *ᵥ v).toFin1dℝ = M *ᵥ v.toFin1dℝ := by - rfl + (M *ᵥ v).toFin1dℝ = M *ᵥ v.toFin1dℝ := rfl @[simp] lemma mulVec_val (M : Matrix (Fin 1 ⊕ Fin d) (Fin 1 ⊕ Fin d) ℝ) (v : ContrMod d) : - (M *ᵥ v).val = M *ᵥ v.val := by - rfl + (M *ᵥ v).val = M *ᵥ v.val := rfl lemma mulVec_sub (M : Matrix (Fin 1 ⊕ Fin d) (Fin 1 ⊕ Fin d) ℝ) (v w : ContrMod d) : - M *ᵥ (v - w) = M *ᵥ v - M *ᵥ w := by - simp only [mulVec, LinearMap.map_sub] + M *ᵥ (v - w) = M *ᵥ v - M *ᵥ w := by simp only [mulVec, LinearMap.map_sub] lemma sub_mulVec (M N : Matrix (Fin 1 ⊕ Fin d) (Fin 1 ⊕ Fin d) ℝ) (v : ContrMod d) : - (M - N) *ᵥ v = M *ᵥ v - N *ᵥ v := by - simp only [mulVec, map_sub, LinearMap.sub_apply] + (M - N) *ᵥ v = M *ᵥ v - N *ᵥ v := by simp only [mulVec, map_sub, LinearMap.sub_apply] lemma mulVec_add (M : Matrix (Fin 1 ⊕ Fin d) (Fin 1 ⊕ Fin d) ℝ) (v w : ContrMod d) : - M *ᵥ (v + w) = M *ᵥ v + M *ᵥ w := by - simp only [mulVec, LinearMap.map_add] + M *ᵥ (v + w) = M *ᵥ v + M *ᵥ w := by simp only [mulVec, LinearMap.map_add] @[simp] lemma one_mulVec (v : ContrMod d) : (1 : Matrix (Fin 1 ⊕ Fin d) (Fin 1 ⊕ Fin d) ℝ) *ᵥ v = v := by simp [mulVec, _root_.map_one] lemma mulVec_mulVec (M N : Matrix (Fin 1 ⊕ Fin d) (Fin 1 ⊕ Fin d) ℝ) (v : ContrMod d) : - M *ᵥ (N *ᵥ v) = (M * N) *ᵥ v := by - simp [mulVec, _root_.map_mul] + M *ᵥ (N *ᵥ v) = (M * N) *ᵥ v := by simp [mulVec, _root_.map_mul] /-! @@ -201,12 +193,10 @@ def toSpace (v : ContrMod d) : EuclideanSpace ℝ (Fin d) := WithLp.toLp 2 (v.va def rep : Representation ℝ (LorentzGroup d) (ContrMod d) where toFun g := Matrix.toLinAlgEquiv stdBasis g map_one' := EmbeddingLike.map_eq_one_iff.mpr rfl - map_mul' x y := by - simp only [lorentzGroupIsGroup_mul_coe, _root_.map_mul] + map_mul' x y := by simp only [lorentzGroupIsGroup_mul_coe, _root_.map_mul] lemma rep_apply_toFin1dℝ (g : LorentzGroup d) (ψ : ContrMod d) : - (rep g ψ).toFin1dℝ = g.1 *ᵥ ψ.toFin1dℝ := by - rfl + (rep g ψ).toFin1dℝ = g.1 *ᵥ ψ.toFin1dℝ := rfl /-! @@ -241,9 +231,8 @@ lemma toSelfAdjoint_apply_coe (x : ContrMod 3) : (toSelfAdjoint x).1 = x.toFin1dℝ (Sum.inl 0) • PauliMatrix.pauliMatrix (Sum.inl 0) - x.toFin1dℝ (Sum.inr 0) • PauliMatrix.pauliMatrix (Sum.inr 0) - x.toFin1dℝ (Sum.inr 1) • PauliMatrix.pauliMatrix (Sum.inr 1) - - x.toFin1dℝ (Sum.inr 2) • PauliMatrix.pauliMatrix (Sum.inr 2) := by - rw [toSelfAdjoint_apply] - rfl + - x.toFin1dℝ (Sum.inr 2) • PauliMatrix.pauliMatrix (Sum.inr 2) := + congrArg Subtype.val (toSelfAdjoint_apply x) lemma toSelfAdjoint_stdBasis (i : Fin 1 ⊕ Fin 3) : toSelfAdjoint (stdBasis i) = PauliMatrix.pauliBasis' i := by @@ -290,8 +279,7 @@ instance : TopologicalSpace (ContrMod d) := TopologicalSpace.induced open Topology -lemma toFin1dℝEquiv_isInducing : IsInducing (@ContrMod.toFin1dℝEquiv d) := by - exact { eq_induced := rfl } +lemma toFin1dℝEquiv_isInducing : IsInducing (@ContrMod.toFin1dℝEquiv d) := { eq_induced := rfl } lemma toFin1dℝEquiv_symm_isInducing : IsInducing ((@ContrMod.toFin1dℝEquiv d).symm) := by let x := Equiv.toHomeomorphOfIsInducing (@ContrMod.toFin1dℝEquiv d).toEquiv @@ -353,8 +341,7 @@ lemma stdBasis_toFin1dℝEquiv_apply_same (μ : Fin 1 ⊕ Fin d) : toFin1dℝEquiv (stdBasis μ) μ = 1 := by simp only [stdBasis, Basis.ofEquivFun, Basis.coe_ofRepr, LinearEquiv.trans_symm, LinearEquiv.symm_symm, LinearEquiv.trans_apply, Finsupp.linearEquivFunOnFinite_single] - rw [@LinearEquiv.apply_symm_apply] - exact Pi.single_eq_same μ 1 + simp @[simp] lemma stdBasis_apply_same (μ : Fin 1 ⊕ Fin d) : (stdBasis μ).val μ = 1 := @@ -364,8 +351,7 @@ lemma stdBasis_toFin1dℝEquiv_apply_ne {μ ν : Fin 1 ⊕ Fin d} (h : μ ≠ ν toFin1dℝEquiv (stdBasis μ) ν = 0 := by simp only [stdBasis, Basis.ofEquivFun, Basis.coe_ofRepr, LinearEquiv.trans_symm, LinearEquiv.symm_symm, LinearEquiv.trans_apply, Finsupp.linearEquivFunOnFinite_single] - rw [@LinearEquiv.apply_symm_apply] - exact Pi.single_eq_of_ne' h 1 + simpa using Pi.single_eq_of_ne' h 1 lemma stdBasis_apply (μ ν : Fin 1 ⊕ Fin d) : (stdBasis μ).val ν = if μ = ν then 1 else 0 := by simp only [stdBasis, Basis.coe_ofEquivFun] @@ -402,13 +388,11 @@ scoped[Lorentz] infixr:73 " *ᵥ " => CoMod.mulVec @[simp] lemma mulVec_toFin1dℝ (M : Matrix (Fin 1 ⊕ Fin d) (Fin 1 ⊕ Fin d) ℝ) (v : CoMod d) : - (M *ᵥ v).toFin1dℝ = M *ᵥ v.toFin1dℝ := by - rfl + (M *ᵥ v).toFin1dℝ = M *ᵥ v.toFin1dℝ := rfl @[simp] lemma mulVec_val (M : Matrix (Fin 1 ⊕ Fin d) (Fin 1 ⊕ Fin d) ℝ) (v : CoMod d) : - (M *ᵥ v).val = M *ᵥ v.val := by - rfl + (M *ᵥ v).val = M *ᵥ v.val := rfl /-! ## The representation diff --git a/Physlib/Relativity/Tensors/RealTensor/Vector/Tensorial.lean b/Physlib/Relativity/Tensors/RealTensor/Vector/Tensorial.lean index 245f32c5f..bc57d3676 100644 --- a/Physlib/Relativity/Tensors/RealTensor/Vector/Tensorial.lean +++ b/Physlib/Relativity/Tensors/RealTensor/Vector/Tensorial.lean @@ -138,8 +138,7 @@ lemma smul_eq_sum {d : ℕ} (i : Fin 1 ⊕ Fin d) (Λ : LorentzGroup d) (p : Vec · intro p have toTensor_symm_pure_val : ∀ (q : Pure (realLorentzTensor d) ![.up]) (j : Fin 1 ⊕ Fin d), (toTensor (self := tensorial)).symm q.toTensor j = (q 0).val j := fun q j => by - rw [toTensor_symm_pure, contrBasis_repr_apply] - rfl + exact toTensor_symm_pure q j rw [actionT_pure] simp only [toTensor_symm_pure_val] show (Λ.1 *ᵥ (p 0)).val i = ∑ j, Λ.1 i j * (p 0).val j @@ -169,13 +168,11 @@ lemma smul_sub {d : ℕ} (Λ : LorentzGroup d) (p q : Vector d) : set_option backward.isDefEq.respectTransparency false in lemma smul_zero {d : ℕ} (Λ : LorentzGroup d) : - Λ • (0 : Vector d) = 0 := by - rw [smul_eq_mulVec, Matrix.mulVec_zero] + Λ • (0 : Vector d) = 0 := by rw [smul_eq_mulVec, Matrix.mulVec_zero] set_option backward.isDefEq.respectTransparency false in lemma smul_neg {d : ℕ} (Λ : LorentzGroup d) (p : Vector d) : - Λ • (-p) = - (Λ • p) := by - rw [smul_eq_mulVec, smul_eq_mulVec, Matrix.mulVec_neg] + Λ • (-p) = - (Λ • p) := by rw [smul_eq_mulVec, smul_eq_mulVec, Matrix.mulVec_neg] lemma neg_smul {d} (Λ : LorentzGroup d) (p : Vector d) : (-Λ) • p = - (Λ • p) := by diff --git a/Physlib/Relativity/Tensors/RealTensor/Velocity/Basic.lean b/Physlib/Relativity/Tensors/RealTensor/Velocity/Basic.lean index 0720cd529..661ca703b 100644 --- a/Physlib/Relativity/Tensors/RealTensor/Velocity/Basic.lean +++ b/Physlib/Relativity/Tensors/RealTensor/Velocity/Basic.lean @@ -35,11 +35,9 @@ variable {d : ℕ} noncomputable instance : TopologicalSpace (Velocity d) := instTopologicalSpaceSubtype @[ext] -lemma ext {v w : Velocity d} (h : v.1 = w.1) : v = w := by - exact SetCoe.ext h +lemma ext {v w : Velocity d} (h : v.1 = w.1) : v = w := SetCoe.ext h -lemma mem_iff {v : Vector d} : v ∈ Velocity d ↔ ⟪v, v⟫ₘ = (1 : ℝ) ∧ 0 < v.timeComponent := by - rfl +lemma mem_iff {v : Vector d} : v ∈ Velocity d ↔ ⟪v, v⟫ₘ = (1 : ℝ) ∧ 0 < v.timeComponent := Iff.rfl @[simp] lemma minkowskiProduct_self_eq_one (v : Velocity d) : ⟪v.1, v.1⟫ₘ = (1 : ℝ) := v.2.1 @@ -53,8 +51,7 @@ lemma timeComponent_nonneg (v : Velocity d) : 0 ≤ v.1.timeComponent := by @[simp] lemma timeComponent_abs (v : Velocity d) : - |v.1.timeComponent| = v.1.timeComponent := by - simp + |v.1.timeComponent| = v.1.timeComponent := by simp lemma norm_spatialPart_le_timeComponent (v : Velocity d) : ‖v.1.spatialPart‖ ≤ ‖v.1.timeComponent‖ := by @@ -68,8 +65,7 @@ lemma norm_spatialPart_le_timeComponent (v : Velocity d) : lemma norm_spatialPart_sq_eq (v : Velocity d) : ‖v.1.spatialPart‖ ^ 2 = (v.1 (Sum.inl 0))^2 - 1 := by - rw [← minkowskiProduct_self_eq_one v] - rw [minkowskiProduct_self_eq_timeComponent_spatialPart] + rw [← minkowskiProduct_self_eq_one v, minkowskiProduct_self_eq_timeComponent_spatialPart] simp [timeComponent] lemma zero_le_minkowskiProduct (u v : Velocity d) : @@ -87,12 +83,10 @@ lemma zero_le_minkowskiProduct (u v : Velocity d) : · exact real_inner_le_norm u.1.spatialPart v.1.spatialPart lemma one_add_minkowskiProduct_ne_zero (u v : Velocity d) : - 1 + ⟪u.1, v.1⟫ₘ ≠ 0 := by - linarith [zero_le_minkowskiProduct u v] + 1 + ⟪u.1, v.1⟫ₘ ≠ 0 := by linarith [zero_le_minkowskiProduct u v] lemma minkowskiProduct_continuous_snd (u : Vector d) : - Continuous fun (x : Velocity d) => ⟪u, x.1⟫ₘ := by - fun_prop + Continuous fun (x : Velocity d) => ⟪u, x.1⟫ₘ := by fun_prop @[fun_prop] lemma minkowskiProduct_continuous_fst (u : Vector d) : @@ -101,8 +95,7 @@ lemma minkowskiProduct_continuous_fst (u : Vector d) : (fun (x : Velocity d) => ⟪u, x.1⟫ₘ) := by ext x rw [minkowskiProduct_symm] - rw [h1] - exact minkowskiProduct_continuous_snd u + simpa [h1] using minkowskiProduct_continuous_snd u /-! @@ -155,10 +148,8 @@ noncomputable def pathFromZero (u : Velocity d) : Path zero u where · apply mul_nonneg · exact sq_nonneg _ · exact sq_nonneg _⟩ - continuous_toFun := by - fun_prop - source' := by - simp + continuous_toFun := by fun_prop + source' := by simp target' := by ext1 simp only [Set.Icc.coe_one, diff --git a/Physlib/Relativity/Tensors/Reindexing.lean b/Physlib/Relativity/Tensors/Reindexing.lean index 0997b6ca5..913bef1c8 100644 --- a/Physlib/Relativity/Tensors/Reindexing.lean +++ b/Physlib/Relativity/Tensors/Reindexing.lean @@ -72,8 +72,7 @@ lemma auto {n m : ℕ} {c : Fin n → C} {c1 : Fin m → C} @[simp] lemma on_id {n : ℕ} {c c1 : Fin n → C} : - IsReindexing c c1 (id : Fin n → Fin n) ↔ ∀ i, c i = c1 i := by - simp [IsReindexing] + IsReindexing c c1 (id : Fin n → Fin n) ↔ ∀ i, c i = c1 i := by simp [IsReindexing] lemma on_id_symm {n : ℕ} {c c1 : Fin n → C} (h : IsReindexing c1 c id) : IsReindexing c c1 (id : Fin n → Fin n) := by @@ -98,15 +97,11 @@ def toEquiv {n m : ℕ} {c : Fin n → C} {c1 : Fin m → C} lemma apply_inv_apply {n m : ℕ} {c : Fin n → C} {c1 : Fin m → C} (σ : Fin m → Fin n) (h : IsReindexing c c1 σ) (x : Fin m) : - h.inv σ (σ x) = x := by - change h.toEquiv (h.toEquiv.symm x) = x - simp + h.inv σ (σ x) = x := by simpa [inv, toEquiv] using h.toEquiv.apply_symm_apply x lemma inv_apply_apply {n m : ℕ} {c : Fin n → C} {c1 : Fin m → C} (σ : Fin m → Fin n) (h : IsReindexing c c1 σ) (x : Fin n) : - σ (h.inv σ x) = x := by - change h.toEquiv.symm (h.toEquiv x) = x - simp + σ (h.inv σ x) = x := by simpa [inv, toEquiv] using h.toEquiv.symm_apply_apply x lemma preserve_color {n m : ℕ} {c : Fin n → C} {c1 : Fin m → C} {σ : Fin m → Fin n} (h : IsReindexing c c1 σ) : @@ -124,8 +119,7 @@ lemma inv_perserve_color {n m : ℕ} {c : Fin n → C} {c1 : Fin m → C} obtain ⟨x, rfl⟩ := h.toEquiv.symm.surjective x change c1 (h.toEquiv _) = _ simp only [Equiv.apply_symm_apply] - rw [h.preserve_color] - rfl + exact h.preserve_color _ set_option warning.simp.varHead false in @[simp, nolint simpVarHead] @@ -133,8 +127,7 @@ lemma toEquiv_symm_perserve_color {n m : ℕ} {c : Fin n → C} {c1 : Fin m → {σ : Fin m → Fin n} (h : IsReindexing c c1 σ) (x : Fin m) : c (h.toEquiv.symm x) = c1 x := by obtain ⟨x, rfl⟩ := h.toEquiv.surjective x - rw [h.preserve_color] - rfl + exact (h.preserve_color (h.toEquiv x)).symm /-! diff --git a/Physlib/Relativity/Tensors/Tensorial.lean b/Physlib/Relativity/Tensors/Tensorial.lean index c301054f1..0ea6dc78a 100644 --- a/Physlib/Relativity/Tensors/Tensorial.lean +++ b/Physlib/Relativity/Tensors/Tensorial.lean @@ -108,9 +108,7 @@ noncomputable instance self {n : ℕ} (S : TensorSpecies k C G V basisIdx rep b) @[simp] lemma self_toTensor_apply {n : ℕ} (S : TensorSpecies k C G V basisIdx rep b) (c : Fin n → C) (t : S.Tensor c) : - Tensorial.toTensor t = t := by - rw [Tensorial.toTensor] - rfl + Tensorial.toTensor t = t := rfl /-! @@ -141,8 +139,7 @@ noncomputable instance mulAction [Tensorial S c M] : MulAction G M where mul_smul g h m := by change _ = toTensor.symm (g • toTensor (toTensor.symm (h • toTensor m))) simp only [LinearEquiv.apply_symm_apply] - rw [← mul_smul] - rfl + exact congrArg toTensor.symm (mul_smul g h (toTensor m)) /-! @@ -151,9 +148,7 @@ noncomputable instance mulAction [Tensorial S c M] : MulAction G M where -/ lemma smul_eq {g : G} {t : M} [Tensorial S c M] : - g • t = toTensor.symm (g • toTensor t) := by - rw [Tensorial.toTensor] - rfl + g • t = toTensor.symm (g • toTensor t) := rfl lemma toTensor_smul {g : G} {t : M} [Tensorial S c M] : toTensor (g • t) = g • toTensor t := by @@ -393,7 +388,6 @@ def toTensorCLM [IsTopologicalAddGroup M] continuous_toFun := by let e : M →L[k] (S.Tensor c) := LinearMap.toContinuousLinearMap (Tensorial.toTensor (M := M)) - change Continuous e exact ContinuousLinearMap.continuous e continuous_invFun := by apply IsModuleTopology.continuous_of_linearMap diff --git a/Physlib/Relativity/Tensors/UnitTensor.lean b/Physlib/Relativity/Tensors/UnitTensor.lean index 106246b89..7d7e10233 100644 --- a/Physlib/Relativity/Tensors/UnitTensor.lean +++ b/Physlib/Relativity/Tensors/UnitTensor.lean @@ -38,8 +38,7 @@ lemma unitTensor_congr {c c1 : C} (h : c = c1) : lemma unitTensor_eq_permT_dual (c : C) : S.unitTensor c = permT ![1, 0] (And.intro (by decide) (fun i => by fin_cases i <;> simp)) (unitTensor (S.τ c)) := by - rw [unitTensor, fromConstPair, S.unit_symm] - rw [unitTensor, fromConstPair] + rw [unitTensor, fromConstPair, S.unit_symm, unitTensor, fromConstPair] simp [fromPairT] generalize (S.unit (S.τ c)) 1 = u at * induction' u using TensorProduct.induction_on with x y @@ -65,15 +64,12 @@ lemma unitTensor_eq_permT_dual (c : C) : lemma dual_unitTensor_eq_permT_unitTensor (c : C) : S.unitTensor (S.τ c) = permT ![1, 0] (And.intro (by decide) (fun i => by fin_cases i <;> simp)) (unitTensor c) := by - rw [unitTensor_eq_permT_dual] - rw [unitTensor_congr (by simp : c = S.τ (S.τ c))] + rw [unitTensor_eq_permT_dual, unitTensor_congr (by simp : c = S.τ (S.τ c))] simp lemma unit_fromSingleTContrFromPairT_eq_fromSingleT {c : C} (x : V c) : fromSingleTContrFromPairT x ((S.unit c) (1 : k)) = - fromSingleT x := by - conv_rhs => rw [← S.contr_unit c x] - rfl + fromSingleT x := congrArg fromSingleT (S.contr_unit c x) /-- This lemma represents the de-categorification of `S.contr_unit`. -/ @[simp] @@ -89,12 +85,8 @@ set_option backward.isDefEq.respectTransparency false in lemma contrT_unitTensor_dual_single {c : C} (x : Tensor S ![S.τ c]) : contrT 1 1 2 (by simp; rfl) (prodT (unitTensor c) x) = permT id (by simp; rfl) x := by - rw [unitTensor_eq_permT_dual] - rw [prodT_permT_left] - rw [contrT_permT] - rw [prodT_swap] - rw [contrT_permT] - rw [permT_permT] + rw [unitTensor_eq_permT_dual, prodT_permT_left, contrT_permT, prodT_swap, contrT_permT, + permT_permT] conv_lhs => enter [2] change contrT 1 1 0 _ _ @@ -111,7 +103,6 @@ lemma contrT_unitTensor_dual_single {c : C} (x : Tensor S ![S.τ c]) : @[simp] lemma unitTensor_invariant {c : C} (g : G) : - g • S.unitTensor c = S.unitTensor c := by - rw [unitTensor, actionT_fromConstPair] + g • S.unitTensor c = S.unitTensor c := by rw [unitTensor, actionT_fromConstPair] end TensorSpecies diff --git a/Physlib/SpaceAndTime/Space/Basic.lean b/Physlib/SpaceAndTime/Space/Basic.lean index 794987c57..aad41c358 100644 --- a/Physlib/SpaceAndTime/Space/Basic.lean +++ b/Physlib/SpaceAndTime/Space/Basic.lean @@ -160,13 +160,8 @@ lemma vadd_transitive {d} (s1 s2 : Space d) : simp noncomputable instance : AddAction (EuclideanSpace ℝ (Fin d)) (Space d) where - zero_vadd s := by - ext i - simp - add_vadd v1 v2 s := by - ext i - simp only [vadd_apply, PiLp.add_apply] - ring + zero_vadd s := eq_of_apply fun i => by simp + add_vadd v1 v2 s := eq_of_apply fun i => by simp [add_assoc] /-! @@ -281,7 +276,6 @@ instance (d : ℕ) : IsManifold (𝓡 d) ⊤ (Space d) := lemma chartAt_eq (d : ℕ) (p : Space d) : chartAt (EuclideanSpace ℝ (Fin d)) p = - (homEuclideanSpaceSpace d).symm.toOpenPartialHomeomorph := - rfl + (homEuclideanSpaceSpace d).symm.toOpenPartialHomeomorph := rfl end Space diff --git a/Physlib/SpaceAndTime/Space/ConstantSliceDist.lean b/Physlib/SpaceAndTime/Space/ConstantSliceDist.lean index e1f7f1918..b8ea3bd4e 100644 --- a/Physlib/SpaceAndTime/Space/ConstantSliceDist.lean +++ b/Physlib/SpaceAndTime/Space/ConstantSliceDist.lean @@ -157,10 +157,8 @@ lemma schwartzMap_mul_iteratedFDeriv_integrable_slice_symm {d : ℕ} (n m : ℕ) · fun_prop apply Continuous.norm apply Continuous.comp' - apply ContDiff.continuous_iteratedFDeriv (n := (n + 1 : ℕ)) - exact Nat.cast_le.mpr (by omega) - have hη := η.smooth' - apply hη.of_le (ENat.LEInfty.out) + exact (η.smooth'.of_le (ENat.LEInfty.out)).continuous_iteratedFDeriv + (n := (n + 1 : ℕ)) (Nat.cast_le.mpr (by omega)) fun_prop · filter_upwards with t apply le_trans _ (hbound x t) @@ -210,8 +208,7 @@ lemma schwartzMap_fderiv_left_integrable_slice_symm {d : ℕ} (η : 𝓢(Space d simp only [Nat.succ_eq_add_one, one_mul] change fderiv ℝ (η ∘ fun r => ((slice i).symm (r, x))) r 1 rw [fderiv_comp _ (by - apply Differentiable.differentiableAt - exact η.smooth'.differentiable (by simp)) + exact (η.smooth'.differentiable (by simp)).differentiableAt) (by fun_prop)] simp only [Nat.succ_eq_add_one, ContinuousLinearMap.coe_comp, Function.comp_apply, fderiv_slice_symm_left_apply] @@ -236,10 +233,8 @@ lemma schwartzMap_iteratedFDeriv_slice_symm_integrable {n} {d : ℕ} (η : 𝓢( · fun_prop · apply Continuous.aestronglyMeasurable apply Continuous.comp' - apply ContDiff.continuous_iteratedFDeriv (n := (n + 1 : ℕ)) - exact Nat.cast_le.mpr (by omega) - have hη := η.smooth' - apply hη.of_le (ENat.LEInfty.out) + exact (η.smooth'.of_le (ENat.LEInfty.out)).continuous_iteratedFDeriv + (n := (n + 1 : ℕ)) (Nat.cast_le.mpr (by omega)) fun_prop /-! @@ -523,8 +518,7 @@ lemma schwartzMap_mul_pow_slice_integral_iteratedFDeriv_norm_le {d : ℕ} (n m : refine mul_le_mul_of_nonneg ?_ (by rfl) (by positivity) (by positivity) refine integral_mono ?_ ?_ ?_ · fun_prop - · apply Integrable.const_mul - exact hrt + · exact hrt.const_mul k · refine Pi.le_def.mpr ?_ intro t convert hbound x t using 1 @@ -576,8 +570,7 @@ def sliceSchwartz {d : ℕ} (i : Fin d.succ) : rfl lemma sliceSchwartz_apply {d : ℕ} (i : Fin d.succ) (η : 𝓢(Space d.succ, ℝ)) (x : Space d) : - sliceSchwartz i η x = ∫ (r : ℝ), η ((slice i).symm (r, x)) := by - rfl + sliceSchwartz i η x = ∫ (r : ℝ), η ((slice i).symm (r, x)) := rfl /-! ## B. Constant slice distribution @@ -598,8 +591,7 @@ def constantSliceDist {M : Type} [NormedAddCommGroup M] [NormedSpace ℝ M] {d : lemma constantSliceDist_apply {M : Type} [NormedAddCommGroup M] [NormedSpace ℝ M] {d : ℕ} (i : Fin d.succ) (f : (Space d) →d[ℝ] M) (η : 𝓢(Space d.succ, ℝ)) : - constantSliceDist i f η = f (sliceSchwartz i η) := by - rfl + constantSliceDist i f η = f (sliceSchwartz i η) := rfl /-! diff --git a/Physlib/SpaceAndTime/Space/Derivatives/Basic.lean b/Physlib/SpaceAndTime/Space/Derivatives/Basic.lean index b0b16689f..f8d3087a5 100644 --- a/Physlib/SpaceAndTime/Space/Derivatives/Basic.lean +++ b/Physlib/SpaceAndTime/Space/Derivatives/Basic.lean @@ -93,8 +93,7 @@ lemma deriv_eq_fderiv_basis [AddCommGroup M] [Module ℝ M] [TopologicalSpace M] lemma fderiv_eq_sum_deriv {M d} [AddCommGroup M] [Module ℝ M] [TopologicalSpace M] (f : Space d → M) (x y : Space d) : fderiv ℝ f x y = ∑ i : Fin d, y i • ∂[i] f x := by - have h1 : y = ∑ i, y i • basis i := by - exact Eq.symm (OrthonormalBasis.sum_repr basis y) + have h1 : y = ∑ i, y i • basis i := Eq.symm (OrthonormalBasis.sum_repr basis y) conv_lhs => rw [h1] simp [deriv_eq_fderiv_basis] @@ -139,8 +138,7 @@ lemma deriv_eq_mfderiv_manifoldStructure {M d} [NormedAddCommGroup M] [NormedSpa (modelDiffeo.mdifferentiable WithTop.top_ne_zero).mdifferentiableAt] simp only [Function.comp_apply, modelDiffeo_apply, mfderiv_eq_fderiv, ContinuousLinearMap.coe_comp] - rw [basis_eq_mfderiv_modelDiffeo_single] - rfl + exact congrArg (fun v => (fderiv ℝ f x) v) (basis_eq_mfderiv_modelDiffeo_single (d := d) μ x) · rw [deriv_eq, fderiv_zero_of_not_differentiableAt hf, mfderiv_zero_of_not_mdifferentiableAt <| mdifferentiable_manifoldStructure_iff_differentiable.mp.mt hf] @@ -171,9 +169,7 @@ lemma deriv_add [NormedAddCommGroup M] [NormedSpace ℝ M] ∂[u] (f1 + f2) = ∂[u] f1 + ∂[u] f2 := by rw [deriv_eq_fderiv_fun] ext x - rw [fderiv_add] - rfl - repeat fun_prop + exact congrArg (fun L => L (basis u)) (fderiv_add (hf1 x) (hf2 x)) /-- Derivatives on space distribute coordinate-wise over addition. -/ lemma deriv_coord_add (f1 f2 : Space d → EuclideanSpace ℝ (Fin d)) @@ -194,9 +190,7 @@ lemma deriv_sub [NormedAddCommGroup M] [NormedSpace ℝ M] ∂[u] (f1 - f2) = ∂[u] f1 - ∂[u] f2 := by rw [deriv_eq_fderiv_fun] ext x - rw [fderiv_sub] - rfl - repeat fun_prop + exact congrArg (fun L => L (basis u)) (fderiv_sub (hf1 x) (hf2 x)) /-! @@ -209,8 +203,7 @@ lemma deriv_smul [NormedAddCommGroup M] [NormedSpace ℝ M] [NontriviallyNormedF [NormedAlgebra ℝ 𝕜] [NormedSpace 𝕜 M] {c : Space d → 𝕜} {f : Space d → M} (hc : DifferentiableAt ℝ c x) (hf : DifferentiableAt ℝ f x) : ∂[u] (c • f) x = c x • ∂[u] f x + ∂[u] c x • f x := by - rw [deriv_eq_fderiv_basis, deriv_eq_fderiv_basis, deriv_eq_fderiv_basis, fderiv_smul hc hf] - rfl + simp [deriv_eq_fderiv_basis, fderiv_smul hc hf] /-- Space derivatives on scalar times function. -/ lemma deriv_const_smul [NormedAddCommGroup M] [NormedSpace ℝ M] [Semiring R] @@ -244,9 +237,8 @@ lemma deriv_commute [NormedAddCommGroup M] [NormedSpace ℝ M] simp only [fderiv_fun_const, Pi.ofNat_apply, ContinuousLinearMap.comp_zero, zero_add, ContinuousLinearMap.flip_apply] rw [IsSymmSndFDerivAt.eq] - apply ContDiffAt.isSymmSndFDerivAt - exact ContDiff.contDiffAt hf - simp only [minSmoothness_of_isRCLikeNormedField, le_refl] + exact (ContDiff.contDiffAt hf).isSymmSndFDerivAt + (by simp only [minSmoothness_of_isRCLikeNormedField, le_refl]) repeat fun_prop /-! @@ -292,8 +284,7 @@ lemma deriv_component (μ ν : Fin d) (x : Space d) : lemma deriv_component_sq {d : ℕ} {ν μ : Fin d} (x : Space d) : (deriv ν (fun x => (x μ) ^ 2) x) = if ν = μ then 2 * x μ else 0:= by - rw [deriv_eq_fderiv_basis] - rw [fderiv_fun_pow] + rw [deriv_eq_fderiv_basis, fderiv_fun_pow] simp only [Nat.add_one_sub_one, pow_one, nsmul_eq_mul, Nat.cast_ofNat, FunLike.coe_smul, Pi.smul_apply, smul_eq_mul] rw [← deriv_eq_fderiv_basis, deriv_component] @@ -324,7 +315,6 @@ lemma deriv_lorentz_vector {d ν μ} {f : Space d → Lorentz.Vector d} change fderiv ℝ (Lorentz.Vector.coordCLM μ ∘ fun x => f x) x (basis ν) = _ rw [fderiv_comp] · simp - rw [← deriv_eq_fderiv_basis] rfl · fun_prop · fun_prop @@ -438,8 +428,7 @@ lemma deriv_eq_inner_self (x : Space d) (i : Fin d) : @[simp] lemma deriv_inner_left {d} (x1 x2 : Space d) (i : Fin d) : deriv i (fun x => ⟪x, x2⟫_ℝ) x1 = x2 i := by - rw [deriv_eq_fderiv_basis] - rw [fderiv_inner_apply] + rw [deriv_eq_fderiv_basis, fderiv_inner_apply] simp only [fderiv_fun_const, Pi.zero_apply, _root_.zero_apply, inner_zero_right, fderiv_fun_id, ContinuousLinearMap.coe_id', id_eq, basis_inner, zero_add] · fun_prop @@ -448,8 +437,7 @@ lemma deriv_inner_left {d} (x1 x2 : Space d) (i : Fin d) : @[simp] lemma deriv_inner_right {d} (x1 x2 : Space d) (i : Fin d) : deriv i (fun x => ⟪x1, x⟫_ℝ) x2 = x1 i := by - rw [deriv_eq_fderiv_basis] - rw [fderiv_inner_apply] + rw [deriv_eq_fderiv_basis, fderiv_inner_apply] simp only [fderiv_fun_id, ContinuousLinearMap.coe_id', id_eq, inner_basis, fderiv_fun_const, Pi.ofNat_apply, _root_.zero_apply, inner_zero_left, add_zero] · fun_prop @@ -494,14 +482,11 @@ noncomputable def distDeriv {M d} [NormedAddCommGroup M] [NormedSpace ℝ M] toFun f := let ev : (Space d →L[ℝ] M) →L[ℝ] M := { toFun v := v (basis μ) - map_add' v1 v2 := by - simp only [_root_.add_apply] - map_smul' a v := by - simp + map_add' v1 v2 := by simp only [_root_.add_apply] + map_smul' a v := by simp } ev.comp (Distribution.fderivD ℝ f) - map_add' f1 f2 := by - simp + map_add' f1 f2 := by simp map_smul' a f := by simp @[inherit_doc distDeriv] @@ -515,8 +500,7 @@ macro "∂ᵈ[" i:term "]" : term => `(distDeriv $i) lemma distDeriv_apply {M d} [NormedAddCommGroup M] [NormedSpace ℝ M] (μ : Fin d) (f : (Space d) →d[ℝ] M) (ε : 𝓢(Space d, ℝ)) : - (∂ᵈ[μ] f) ε = fderivD ℝ f ε (basis μ) := by - simp [distDeriv, Distribution.fderivD] + (∂ᵈ[μ] f) ε = fderivD ℝ f ε (basis μ) := by simp [distDeriv, Distribution.fderivD] /-! @@ -541,8 +525,7 @@ lemma schwartMap_fderiv_comm {d} ContinuousLinearMap.flip_apply] rw [IsSymmSndFDerivAt.eq] apply ContDiffAt.isSymmSndFDerivAt (n := 2) - · refine ContDiff.contDiffAt ?_ - exact h2 + · exact h2.contDiffAt · simp · fun_prop · exact differentiableAt_const (basis μ) diff --git a/Physlib/SpaceAndTime/Space/Derivatives/Div.lean b/Physlib/SpaceAndTime/Space/Derivatives/Div.lean index 92f8daac2..765495193 100644 --- a/Physlib/SpaceAndTime/Space/Derivatives/Div.lean +++ b/Physlib/SpaceAndTime/Space/Derivatives/Div.lean @@ -71,9 +71,7 @@ lemma div_eq_sum_fderiv {d} (f : Space d → EuclideanSpace ℝ (Fin d)) congr funext i rw [← Space.deriv_eq] - rw [deriv_euclid] - rfl - fun_prop + exact deriv_euclid (ν := i) hf x /-! @@ -83,10 +81,8 @@ lemma div_eq_sum_fderiv {d} (f : Space d → EuclideanSpace ℝ (Fin d)) @[simp] lemma div_zero : ∇ ⬝ (0 : Space d → EuclideanSpace ℝ (Fin d)) = 0 := by - unfold div Space.deriv Finset.sum - simp only [Pi.ofNat_apply, fderiv_fun_const, _root_.zero_apply, Multiset.map_const', - Finset.card_val, Finset.card_univ, Fintype.card_fin, Multiset.sum_replicate, smul_zero] - rfl + ext x + simp [div, Space.deriv] /-! @@ -96,10 +92,8 @@ lemma div_zero : ∇ ⬝ (0 : Space d → EuclideanSpace ℝ (Fin d)) = 0 := by @[simp] lemma div_const : ∇ ⬝ (fun _ : Space d => v) = 0 := by - unfold div Space.deriv Finset.sum - simp only [fderiv_fun_const, Pi.ofNat_apply, _root_.zero_apply, Multiset.map_const', - Finset.card_val, Finset.card_univ, Fintype.card_fin, Multiset.sum_replicate, smul_zero] - rfl + ext x + simp [div, Space.deriv] /-! @@ -212,9 +206,7 @@ lemma distDiv_apply_eq_sum_fderivD {d} lemma distDiv_apply_eq_sum_distDeriv {d} (f : (Space d) →d[ℝ] EuclideanSpace ℝ (Fin d)) (η : 𝓢(Space d, ℝ)) : - (∇ᵈ ⬝ f) η = ∑ i, ∂ᵈ[i] f η i := by - rw [distDiv_apply_eq_sum_fderivD] - rfl + (∇ᵈ ⬝ f) η = ∑ i, ∂ᵈ[i] f η i := distDiv_apply_eq_sum_fderivD f η /-! diff --git a/Physlib/SpaceAndTime/Space/Derivatives/Grad.lean b/Physlib/SpaceAndTime/Space/Derivatives/Grad.lean index 38eb0f25c..174330d76 100644 --- a/Physlib/SpaceAndTime/Space/Derivatives/Grad.lean +++ b/Physlib/SpaceAndTime/Space/Derivatives/Grad.lean @@ -82,9 +82,8 @@ scoped[Space] notation "∇" => grad @[simp] lemma grad_zero : ∇ (0 : Space d → ℝ) = 0 := by - unfold grad Space.deriv - simp only [fderiv_zero, Pi.zero_apply, _root_.zero_apply] - rfl + ext x i + simp [grad, Space.deriv] /-! @@ -96,13 +95,8 @@ lemma grad_zero : ∇ (0 : Space d → ℝ) = 0 := by lemma grad_add (f1 f2 : Space d → ℝ) (hf1 : Differentiable ℝ f1) (hf2 : Differentiable ℝ f2) : ∇ (f1 + f2) = ∇ f1 + ∇ f2 := by - unfold grad ext x i - simp only [Pi.add_apply] - rw [deriv_add] - rfl - exact hf1 - exact hf2 + simp [grad, deriv_add f1 f2 hf1 hf2] @[simp] lemma grad_fun_add_const (f : Space d → ℝ) (c : ℝ) : @@ -118,9 +112,8 @@ lemma grad_fun_add_const (f : Space d → ℝ) (c : ℝ) : @[simp] lemma grad_const : ∇ (fun _ : Space d => c) = 0 := by - unfold grad Space.deriv - simp only [fderiv_fun_const, Pi.ofNat_apply, _root_.zero_apply] - rfl + ext x i + simp [grad, Space.deriv] /-! @@ -132,12 +125,8 @@ lemma grad_const : ∇ (fun _ : Space d => c) = 0 := by lemma grad_smul (f : Space d → ℝ) (k : ℝ) (hf : Differentiable ℝ f) : ∇ (k • f) = k • ∇ f := by - unfold grad ext x i - simp only [Pi.smul_apply] - rw [deriv_const_smul] - rfl - exact hf + simp [grad, deriv_const_smul k hf] /-! @@ -148,11 +137,8 @@ lemma grad_smul (f : Space d → ℝ) (k : ℝ) @[to_fun] lemma grad_neg (f : Space d → ℝ) : ∇ (- f) = - ∇ f := by - unfold grad ext x i - simp only [Pi.neg_apply] - rw [Space.deriv_eq, fderiv_neg] - rfl + simp [grad, Space.deriv, fderiv_neg] /-! @@ -183,13 +169,7 @@ lemma grad_eq_sum {d} (f : Space d → ℝ) (x : Space d) : -/ lemma grad_apply {d} (f : Space d → ℝ) (x : Space d) (i : Fin d) : - (∇ f x) i = ∂[i] f x := by - rw [grad_eq_sum] - change WithLp.linearEquiv 2 ℝ (Fin d → ℝ) (∑ x_1, (fderiv ℝ f x) (basis x_1) • - EuclideanSpace.single x_1 1) i = _ - rw [map_sum, Finset.sum_apply] - simp [Pi.single_apply] - rfl + (∇ f x) i = ∂[i] f x := rfl /-! @@ -201,9 +181,7 @@ open InnerProductSpace lemma grad_inner_single {d} (f : Space d → ℝ) (x : Space d) (i : Fin d) : ⟪∇ f x, EuclideanSpace.single i 1⟫_ℝ = ∂[i] f x := by - simp only [EuclideanSpace.inner_single_right, conj_trivial, - one_mul] - exact rfl + simpa only [EuclideanSpace.inner_single_right, conj_trivial, one_mul] using grad_apply f x i lemma grad_inner_eq {d} (f : Space d → ℝ) (x : Space d) (y : EuclideanSpace ℝ (Fin d)) : ⟪∇ f x, y⟫_ℝ = ∑ i, y i * ∂[i] f x:= by @@ -214,9 +192,7 @@ lemma grad_inner_eq {d} (f : Space d → ℝ) (x : Space d) (y : EuclideanSpace simp [inner_smul_right, grad_inner_single] lemma inner_grad_eq {d} (f : Space d → ℝ) (x : EuclideanSpace ℝ (Fin d)) (y : Space d) : - ⟪x, ∇ f y⟫_ℝ = ∑ i, x i * ∂[i] f y := by - rw [← grad_inner_eq] - exact real_inner_comm (∇ f y) x + ⟪x, ∇ f y⟫_ℝ = ∑ i, x i * ∂[i] f y := by simpa [← grad_inner_eq] using real_inner_comm (∇ f y) x lemma grad_inner_repr_eq {d} (f : Space d → ℝ) (x y : Space d) : ⟪∇ f x, (Space.basis).repr y⟫_ℝ = fderiv ℝ f x y := by @@ -261,8 +237,7 @@ lemma gradient_apply_eq_grad {d} (f : Space d → ℝ) (x : Space d) : simp lemma gradient_eq_sum {d} (f : Space d → ℝ) (x : Space d) : - gradient f x = ∑ i, ∂[i] f x • basis i := by - simp [gradient_eq_grad, grad_eq_sum f x] + gradient f x = ∑ i, ∂[i] f x • basis i := by simp [gradient_eq_grad, grad_eq_sum f x] lemma euclid_gradient_eq_sum {d} (f : EuclideanSpace ℝ (Fin d) → ℝ) (x : EuclideanSpace ℝ (Fin d)) : gradient f x = ∑ i, fderiv ℝ f x (EuclideanSpace.single i 1) • EuclideanSpace.single i 1 := by @@ -467,8 +442,7 @@ lemma integrable_isDistBounded_inner_grad_schwartzMap_spherical {d : ℕ} change Integrable ((fun x => ⟪f x, Space.grad η x⟫_ℝ) ∘ Subtype.val) (.comap (Subtype.val (p := fun x => x ∈ ({0}ᶜ : Set _))) volume) rw [← MeasureTheory.integrableOn_iff_comap_subtypeVal] - apply Integrable.integrableOn - exact integrable_isDistBounded_inner_grad_schwartzMap hf η + exact Integrable.integrableOn (integrable_isDistBounded_inner_grad_schwartzMap hf η) simp have he := (MeasureTheory.Measure.measurePreserving_homeomorphUnitSphereProd (volume (α := Space d))) diff --git a/Physlib/SpaceAndTime/Space/Derivatives/Iterated.lean b/Physlib/SpaceAndTime/Space/Derivatives/Iterated.lean index af9506c20..ecda75e79 100644 --- a/Physlib/SpaceAndTime/Space/Derivatives/Iterated.lean +++ b/Physlib/SpaceAndTime/Space/Derivatives/Iterated.lean @@ -91,8 +91,7 @@ private lemma iteratedDerivList_const_smul (L : List (Fin d)) (c : ℝ) {f : Spa @[simp] lemma iteratedDeriv_zero [AddCommGroup M] [Module ℝ M] [TopologicalSpace M] - (f : Space d → M) : ∂^[0] f = f := by - simp [iteratedDeriv, Physlib.MultiIndex.toList_zero] + (f : Space d → M) : ∂^[0] f = f := by simp [iteratedDeriv, Physlib.MultiIndex.toList_zero] @[simp] lemma iteratedDeriv_increment_zero [NeZero d] [AddCommGroup M] [Module ℝ M] [TopologicalSpace M] @@ -120,14 +119,12 @@ lemma iteratedDeriv_const_smul (I : MultiIndex d) (c : ℝ) {f : Space d → ℝ /-- Iterated spatial derivatives preserve smoothness for scalar-valued functions. -/ lemma iteratedDeriv_contDiff (I : MultiIndex d) {f : Space d → ℝ} (hf : ContDiff ℝ ∞ f) : - ContDiff ℝ ∞ (∂^[I] f) := by - simpa [iteratedDeriv] using iteratedDerivList_contDiff I.toList hf + ContDiff ℝ ∞ (∂^[I] f) := by simpa [iteratedDeriv] using iteratedDerivList_contDiff I.toList hf /-- The topological support of a spatial derivative is contained in that of the original function. -/ lemma tsupport_deriv_subset (i : Fin d) {f : Space d → ℝ} : - tsupport (deriv i f) ⊆ tsupport f := by - simpa [deriv_eq_fderiv_fun] using + tsupport (deriv i f) ⊆ tsupport f := by simpa [deriv_eq_fderiv_fun] using (tsupport_fderiv_apply_subset (𝕜 := ℝ) (f := fun x => f x) (v := basis i)) private lemma iteratedDerivList_commute_deriv (L : List (Fin d)) (i : Fin d) diff --git a/Physlib/SpaceAndTime/Space/Derivatives/Laplacian.lean b/Physlib/SpaceAndTime/Space/Derivatives/Laplacian.lean index dcdb7a4b6..a2a7abcb2 100644 --- a/Physlib/SpaceAndTime/Space/Derivatives/Laplacian.lean +++ b/Physlib/SpaceAndTime/Space/Derivatives/Laplacian.lean @@ -57,9 +57,7 @@ scoped[Space] notation "Δ" => laplacian -/ lemma laplacian_eq_sum_snd_deriv {d} (f : Space d → ℝ) : - Δ f = fun x => ∑ i, ∂[i] (∂[i] f) x := by - unfold laplacian div grad - simp + Δ f = fun x => ∑ i, ∂[i] (∂[i] f) x := rfl /-! @@ -100,7 +98,6 @@ scoped[Space] notation "Δᵈ" => distLaplacian @[simp] lemma distLaplacian_const {d : ℕ} (c : ℝ) : - Δᵈ (Distribution.const ℝ (Space d) c) = 0 := by - simp [distLaplacian, distGrad_const] + Δᵈ (Distribution.const ℝ (Space d) c) = 0 := by simp [distLaplacian, distGrad_const] end Space diff --git a/Physlib/SpaceAndTime/Space/Derivatives/MatrixDiv.lean b/Physlib/SpaceAndTime/Space/Derivatives/MatrixDiv.lean index c7a61b815..3899baae6 100644 --- a/Physlib/SpaceAndTime/Space/Derivatives/MatrixDiv.lean +++ b/Physlib/SpaceAndTime/Space/Derivatives/MatrixDiv.lean @@ -69,8 +69,7 @@ noncomputable def matrixDiv (d : ℕ) (T : Space d → Matrix (Fin d) (Fin d) @[simp] lemma matrixDiv_apply (d : ℕ) (T : Space d → Matrix (Fin d) (Fin d) ℝ) (x : Space d) (i : Fin d) : - matrixDiv d T x i = ∑ j, ∂[j] (fun x => T x i j) x := by - simp [matrixDiv, div] + matrixDiv d T x i = ∑ j, ∂[j] (fun x => T x i j) x := rfl /-! @@ -82,7 +81,6 @@ lemma matrixDiv_apply (d : ℕ) (T : Space d → Matrix (Fin d) (Fin d) ℝ) lemma matrixDiv_zero (d : ℕ) : matrixDiv d (0 : Space d → Matrix (Fin d) (Fin d) ℝ) = 0 := by ext x i - change (∑ j : Fin d, ∂[j] (fun _ : Space d => (0 : ℝ)) x) = 0 simp /-! @@ -95,7 +93,6 @@ lemma matrixDiv_zero (d : ℕ) : lemma matrixDiv_const (d : ℕ) (T : Matrix (Fin d) (Fin d) ℝ) : matrixDiv d (fun _ : Space d => T) = 0 := by ext x i - change (∑ j : Fin d, ∂[j] (fun _ : Space d => T i j) x) = 0 simp /-! diff --git a/Physlib/SpaceAndTime/Space/Derivatives/MultiIndex.lean b/Physlib/SpaceAndTime/Space/Derivatives/MultiIndex.lean index 999ac2613..9b8d358d4 100644 --- a/Physlib/SpaceAndTime/Space/Derivatives/MultiIndex.lean +++ b/Physlib/SpaceAndTime/Space/Derivatives/MultiIndex.lean @@ -97,17 +97,14 @@ lemma add_apply (I J : MultiIndex d) (i : Fin d) : (I + J) i = I i + J i := rfl @[simp] lemma increment_apply_same (I : MultiIndex d) (i : Fin d) : - increment I i i = I i + 1 := by - simp [increment] + increment I i i = I i + 1 := by simp [increment] @[simp] lemma increment_apply_ne (I : MultiIndex d) {i j : Fin d} (h : j ≠ i) : - increment I i j = I j := by - simp [increment, Pi.single_eq_of_ne h] + increment I i j = I j := by simp [increment, Pi.single_eq_of_ne h] @[simp] -lemma order_zero : order (0 : MultiIndex d) = 0 := by - simp [order] +lemma order_zero : order (0 : MultiIndex d) = 0 := by simp [order] lemma order_add (I J : MultiIndex d) : order (I + J) = order I + order J := by simp [order, Finset.sum_add_distrib] @@ -125,8 +122,7 @@ lemma order_single (i : Fin d) : order (⟨Pi.single i 1⟩ : MultiIndex d) = 1 @[simp] lemma order_increment (I : MultiIndex d) (i : Fin d) : - order (increment I i) = order I + 1 := by - simp [increment, order, Finset.sum_add_distrib] + order (increment I i) = order I + 1 := by simp [increment, order, Finset.sum_add_distrib] /-! ### A.3. Canonical ordered lists of directions @@ -142,9 +138,7 @@ def toList : {d : ℕ} → MultiIndex d → List (Fin d) | _ + 1, I => List.replicate (I 0) 0 ++ (toList (tail I)).map Fin.succ @[simp] -lemma tail_zero : tail (0 : MultiIndex d.succ) = 0 := by - ext i - rfl +lemma tail_zero : tail (0 : MultiIndex d.succ) = 0 := rfl @[simp] lemma tail_increment_zero (I : MultiIndex d.succ) : tail (increment I 0) = tail I := by @@ -193,8 +187,7 @@ lemma toList_single (i : Fin d) : toList (increment 0 i : MultiIndex d) = [i] := have htail : tail (increment (0 : MultiIndex d.succ) j.succ) = increment (0 : MultiIndex d) j := by rw [tail_increment_succ, tail_zero] - have hzero : increment (0 : MultiIndex d.succ) j.succ 0 = 0 := by - simp [increment] + have hzero : increment (0 : MultiIndex d.succ) j.succ 0 = 0 := by simp [increment] simp [toList, hzero, htail, ih j] end MultiIndex diff --git a/Physlib/SpaceAndTime/Space/EuclideanGroup/Action.lean b/Physlib/SpaceAndTime/Space/EuclideanGroup/Action.lean index 15950e40a..d1a5600c9 100644 --- a/Physlib/SpaceAndTime/Space/EuclideanGroup/Action.lean +++ b/Physlib/SpaceAndTime/Space/EuclideanGroup/Action.lean @@ -135,13 +135,10 @@ transport of `toAffineIsometryMulEquiv` acting on `EuclideanSpace`: `chart (g • p) = (toAffineIsometryMulEquiv g) (chart p)`. -/ lemma chartEuclidean_smul (g : EuclideanGroup d) (p : Space d) : Space.chartEuclidean d (g • p) = toAffineIsometryMulEquiv g (Space.chartEuclidean d p) := by - rw [Space.chartEuclidean_apply] - rw [toAffineIsometryMulEquiv_apply, toAffineIsometryHom_apply] - have h_left : g • p -ᵥ (0 : Space d) = g.linear • (p -ᵥ (0 : Space d)) + g.translation := by - exact - (eq_vadd_iff_vsub_eq (g • p) (g.linear • (p -ᵥ (0 : Space d)) + g.translation) - ((0 : Space d))).mp - rfl + rw [Space.chartEuclidean_apply, toAffineIsometryMulEquiv_apply, toAffineIsometryHom_apply] + have h_left : g • p -ᵥ (0 : Space d) = g.linear • (p -ᵥ (0 : Space d)) + g.translation := + (eq_vadd_iff_vsub_eq (g • p) (g.linear • (p -ᵥ (0 : Space d)) + g.translation) + ((0 : Space d))).mp rfl simp [h_left] exact add_comm' (g.linear • (p -ᵥ (0 : Space d))) g.translation end EuclideanGroup diff --git a/Physlib/SpaceAndTime/Space/EuclideanGroup/AffineGroup.lean b/Physlib/SpaceAndTime/Space/EuclideanGroup/AffineGroup.lean index 5e57a6106..bbffbfde9 100644 --- a/Physlib/SpaceAndTime/Space/EuclideanGroup/AffineGroup.lean +++ b/Physlib/SpaceAndTime/Space/EuclideanGroup/AffineGroup.lean @@ -76,12 +76,8 @@ noncomputable def toAffineIsometryHom : AffineIsometryEquiv ℝ (EuclideanSpace ℝ (Fin n)) (EuclideanSpace ℝ (Fin n)) where toFun A := AffineIsometryEquiv.constVAdd ℝ (EuclideanSpace ℝ (Fin n)) A.translation * (orthogonalToLinearIsometryEquiv A.linear).toAffineIsometryEquiv - map_one' := by - apply AffineIsometryEquiv.ext - intro x; simp - map_mul' A B := by - apply AffineIsometryEquiv.ext - intro x + map_one' := AffineIsometryEquiv.ext fun x => by simp + map_mul' A B := AffineIsometryEquiv.ext fun x => by simp [mul_smul, add_assoc] /-- Unfolds `toAffineIsometryHom` into its translation and linear factors. -/ @@ -96,10 +92,8 @@ noncomputable def _root_.AffineIsometryEquiv.toAffineEquivHom : AffineIsometryEquiv ℝ (EuclideanSpace ℝ (Fin n)) (EuclideanSpace ℝ (Fin n)) →* AffineEquiv ℝ (EuclideanSpace ℝ (Fin n)) (EuclideanSpace ℝ (Fin n)) where toFun e := e.toAffineEquiv - map_one' := by - apply AffineEquiv.ext; intro x; trivial - map_mul' e e' := by - apply AffineEquiv.ext; intro x; simp + map_one' := AffineEquiv.ext fun x => by trivial + map_mul' e e' := AffineEquiv.ext fun x => by simp /-- The inclusion of the Euclidean group into Mathlib's affine automorphism group: the composite of the two legs `toAffineIsometryHom` and `AffineIsometryEquiv.toAffineEquivHom`. -/ @@ -176,8 +170,7 @@ this proves `right_inv` of `toAffineIsometryMulEquiv`. -/ show Matrix.toLin _ _ (LinearMap.toMatrix _ _ (L.toLinearEquiv : EuclideanSpace ℝ (Fin n) →ₗ[ℝ] EuclideanSpace ℝ (Fin n))) x = L x - rw [Matrix.toLin_toMatrix] - rfl + exact LinearMap.congr_fun (Matrix.toLin_toMatrix _ _ _) x /-- `EuclideanGroup n ≃* AffineIsometryEquiv ℝ (EuclideanSpace ℝ (Fin n)) _`: the Euclidean group is the full group of affine isometries of Euclidean space. This upgrades `toAffineIsometryHom` to diff --git a/Physlib/SpaceAndTime/Space/EuclideanGroup/Basic.lean b/Physlib/SpaceAndTime/Space/EuclideanGroup/Basic.lean index cb378c177..30342bed7 100644 --- a/Physlib/SpaceAndTime/Space/EuclideanGroup/Basic.lean +++ b/Physlib/SpaceAndTime/Space/EuclideanGroup/Basic.lean @@ -142,8 +142,7 @@ lemma translationVector.incl_range : constructor · rintro ⟨v, hv⟩ show g.linear.val = 1 - rw [← hv] - rfl + exact congrArg (fun g : EuclideanGroup n => g.linear.val) hv.symm · intro h rw [Set.mem_range] refine ⟨g.translation, ?_⟩ @@ -154,8 +153,7 @@ lemma translationVector.incl_range : /-- The translation by the zero vector is the identity of the Euclidean group. -/ lemma translation_zero : translationVector.incl n - (Multiplicative.ofAdd (0 : EuclideanSpace ℝ (Fin n))) = 1 := by - simp + (Multiplicative.ofAdd (0 : EuclideanSpace ℝ (Fin n))) = 1 := by simp /-- The subgroup of `EuclideanGroup n` whose elements fix the origin (translation = 0). This is the copy of `O(n)` sitting inside `E(n)`. -/ @@ -248,9 +246,7 @@ lemma RotationsAbout.fromOrigin_comp_toOrigin : intro x apply Subtype.ext simp only [MonoidHom.coe_comp, Function.comp_apply, MonoidHom.id_apply, SetLike.coe_eq_coe] - unfold RotationsAbout.toOrigin - unfold RotationsAbout.fromOrigin - simp [mul_assoc] + simp [RotationsAbout.toOrigin, RotationsAbout.fromOrigin, mul_assoc] /-- `RotationsAbout.fromOrigin p` followed by `RotationsAbout.toOrigin p` is the identity; the backward leg of the isomorphism `RotationsAboutEquiv`. -/ @@ -261,9 +257,7 @@ lemma RotationsAbout.toOrigin_comp_fromOrigin : intro x apply Subtype.ext simp only [MonoidHom.coe_comp, Function.comp_apply, MonoidHom.id_apply, SetLike.coe_eq_coe] - unfold RotationsAbout.toOrigin - unfold RotationsAbout.fromOrigin - simp [mul_assoc] + simp [RotationsAbout.toOrigin, RotationsAbout.fromOrigin, mul_assoc] /-- API feature: conjugation by the translation `T(p)` exhibits the rotations about `p` as isomorphic to the rotations about the origin `RotationGroup n`. -/ @@ -355,10 +349,8 @@ noncomputable def specialOrthogonal.fromRotation (n : ℕ) : the forward leg of the isomorphism `specialOrthogonalEquiv`. -/ lemma specialOrthogonal.fromRotation_comp_toRotation : (specialOrthogonal.fromRotation n).comp (specialOrthogonal.toRotation n) = - MonoidHom.id (Matrix.specialOrthogonalGroup (Fin n) ℝ) := by - apply MonoidHom.ext - intro x - rfl + MonoidHom.id (Matrix.specialOrthogonalGroup (Fin n) ℝ) := + MonoidHom.ext fun _ => rfl /-- `specialOrthogonal.fromRotation n` followed by `specialOrthogonal.toRotation n` is the identity; the backward leg of the isomorphism `specialOrthogonalEquiv`. -/ diff --git a/Physlib/SpaceAndTime/Space/Integrals/Basic.lean b/Physlib/SpaceAndTime/Space/Integrals/Basic.lean index 1a957df94..411404d21 100644 --- a/Physlib/SpaceAndTime/Space/Integrals/Basic.lean +++ b/Physlib/SpaceAndTime/Space/Integrals/Basic.lean @@ -58,8 +58,7 @@ lemma volume_metricBall_three : lemma volume_metricBall_two : volume (Metric.ball (0 : Space 2) 1) = ENNReal.ofReal Real.pi := by rw [InnerProductSpace.volume_ball_of_dim_even (k := 1)] - simp [finrank_eq_dim] - simp [finrank_eq_dim] + all_goals simp [finrank_eq_dim] @[simp] lemma volume_metricBall_two_real : @@ -110,13 +109,11 @@ lemma integral_volume_eq_spherical (d : ℕ) [NeZero d] (f : Space d → F) rw [MeasureTheory.integral_subtype_comap (by simp), ← setIntegral_univ] simp [f'] refine integral_congr_ae ?_ - have h1 : ∀ᵐ x ∂(volume (α := Space d)), x ≠ 0 := by - exact Measure.ae_ne volume 0 + have h1 : ∀ᵐ x ∂(volume (α := Space d)), x ≠ 0 := Measure.ae_ne volume 0 filter_upwards [Measure.ae_ne volume 0] with x hx congr simp [smul_smul] - have hx : ‖x‖ ≠ 0 := by - simpa using hx + have hx : ‖x‖ ≠ 0 := by simpa using hx field_simp simp @@ -236,8 +233,7 @@ lemma lintegral_volume_eq_spherical (d : ℕ) [NeZero d] filter_upwards [Measure.ae_ne volume 0] with x hx congr simp [smul_smul] - have hx : ‖x‖ ≠ 0 := by - simpa using hx + have hx : ‖x‖ ≠ 0 := by simpa using hx field_simp rw [one_smul] diff --git a/Physlib/SpaceAndTime/Space/Integrals/NormPow.lean b/Physlib/SpaceAndTime/Space/Integrals/NormPow.lean index 20c0fb61e..7fa4215f5 100644 --- a/Physlib/SpaceAndTime/Space/Integrals/NormPow.lean +++ b/Physlib/SpaceAndTime/Space/Integrals/NormPow.lean @@ -60,12 +60,10 @@ lemma radial_jacobian_zpow_mul_self r ^ (d - 1) * (r ^ q * r) = r ^ (d - 1: ℤ) * (r ^ q * r ^ (1 : ℤ)) := by rw [← zpow_natCast, zpow_one, ← Nat.cast_pred (Nat.pos_of_neZero d)] - _ = r ^ ((d - 1: ℤ) + (q + 1)) := by - rw [← zpow_add₀ hz q 1, ← zpow_add₀ hz (d - 1: ℤ) (q + 1)] + _ = r ^ ((d - 1: ℤ) + (q + 1)) := by rw [← zpow_add₀ hz q 1, ← zpow_add₀ hz (d - 1: ℤ) (q + 1)] _ = r ^ (p : ℤ) := by congr 1; omega - _ = r ^ p := by - rw [zpow_natCast] + _ = r ^ p := by rw [zpow_natCast] private lemma radial_jacobian_zpow {d p : ℕ} [NeZero d] {q : ℤ} (hp_int : (p : ℤ) = q + (d : ℤ)) @@ -78,8 +76,7 @@ private lemma radial_jacobian_zpow rw [← Nat.cast_pred (Nat.pos_of_neZero d), ← zpow_natCast, ← zpow_add₀ hz] _ = r ^ ((p - 1 : ℕ) : ℤ) := by congr 1; omega - _ = r ^ (p - 1) := by - rw [zpow_natCast] + _ = r ^ (p - 1) := by rw [zpow_natCast] lemma radial_norm_power_spherical_integral_eq_space_integral {d p : ℕ} [NeZero d] {q : ℤ} (hp_int : (p : ℤ) = q + (d : ℤ)) diff --git a/Physlib/SpaceAndTime/Space/Integrals/RadialAngularMeasure.lean b/Physlib/SpaceAndTime/Space/Integrals/RadialAngularMeasure.lean index bfc387228..741c371fc 100644 --- a/Physlib/SpaceAndTime/Space/Integrals/RadialAngularMeasure.lean +++ b/Physlib/SpaceAndTime/Space/Integrals/RadialAngularMeasure.lean @@ -69,13 +69,11 @@ def radialAngularMeasure {d : ℕ} : Measure (Space d) := -/ lemma radialAngularMeasure_eq_volume_withDensity {d : ℕ} : radialAngularMeasure = - volume.withDensity (fun x : Space d => ENNReal.ofReal (1 / ‖x‖ ^ (d - 1))) := by - rfl + volume.withDensity (fun x : Space d => ENNReal.ofReal (1 / ‖x‖ ^ (d - 1))) := rfl @[simp] lemma radialAngularMeasure_zero_eq_volume : - radialAngularMeasure (d := 0) = volume := by - simp [radialAngularMeasure] + radialAngularMeasure (d := 0) = volume := by simp [radialAngularMeasure] /-! @@ -104,8 +102,7 @@ lemma integral_radialAngularMeasure {d : ℕ} (f : Space d → F) : lemma lintegral_radialMeasure {d : ℕ} (f : Space d → ENNReal) (hf : Measurable f) : ∫⁻ x, f x ∂radialAngularMeasure = ∫⁻ x, ENNReal.ofReal (1 / ‖x‖ ^ (d - 1)) * f x := by - dsimp [radialAngularMeasure] - rw [lintegral_withDensity_eq_lintegral_mul] + rw [radialAngularMeasure, lintegral_withDensity_eq_lintegral_mul] simp only [one_div, Pi.mul_apply] all_goals fun_prop diff --git a/Physlib/SpaceAndTime/Space/IsDistBounded.lean b/Physlib/SpaceAndTime/Space/IsDistBounded.lean index ac8f3095a..30963783f 100644 --- a/Physlib/SpaceAndTime/Space/IsDistBounded.lean +++ b/Physlib/SpaceAndTime/Space/IsDistBounded.lean @@ -115,14 +115,12 @@ lemma aestronglyMeasurable {d : ℕ} {f : Space d → F} (hf : IsDistBounded f) @[fun_prop] lemma aeStronglyMeasurable_schwartzMap_smul {d : ℕ} {f : Space d → F} (hf : IsDistBounded f) (η : 𝓢(Space d, ℝ)) : - AEStronglyMeasurable (fun x => η x • f x) := by - fun_prop + AEStronglyMeasurable (fun x => η x • f x) := by fun_prop @[fun_prop] lemma aeStronglyMeasurable_fderiv_schwartzMap_smul {d : ℕ} {f : Space d → F} (hf : IsDistBounded f) (η : 𝓢(Space d, ℝ)) (y : Space d) : - AEStronglyMeasurable (fun x => fderiv ℝ η x y • f x) := by - fun_prop + AEStronglyMeasurable (fun x => fderiv ℝ η x y • f x) := by fun_prop @[fun_prop] lemma aeStronglyMeasurable_inv_pow {d r : ℕ} {f : Space d → F} @@ -204,8 +202,7 @@ lemma integrable_space {d : ℕ} {f : Space d → F} (hf : IsDistBounded f) by_cases hp' : p = 0 · subst hp' simp only [zpow_zero, mul_one] - apply Integrable.norm - exact η.integrable + exact Integrable.norm η.integrable suffices h1 : Integrable (fun x => ‖η x‖ * ‖x‖ ^ (p + d)) (radialAngularMeasure (d := (d + 1))) by rw [integrable_radialAngularMeasure_iff] at h1 convert h1 using 1 @@ -221,8 +218,7 @@ lemma integrable_space {d : ℕ} {f : Space d → F} (hf : IsDistBounded f) simp [zero_pow_eq, zero_zpow_eq, hp'] omega field_simp - rw [zpow_add₀ hr] - rfl + exact (zpow_add₀ hr p d).symm convert integrable_pow_mul_iteratedFDeriv radialAngularMeasure η (p + d).toNat 0 using 1 funext x simp only [Real.norm_eq_abs, norm_iteratedFDeriv_zero] @@ -236,8 +232,7 @@ lemma integrable_space {d : ℕ} {f : Space d → F} (hf : IsDistBounded f) @[fun_prop] lemma integrable_space_mul {d : ℕ} {f : Space d → ℝ} (hf : IsDistBounded f) (η : 𝓢(Space d, ℝ)) : - Integrable (fun x : Space d => η x * f x) volume := by - exact hf.integrable_space η + Integrable (fun x : Space d => η x * f x) volume := hf.integrable_space η @[fun_prop] lemma integrable_space_fderiv {d : ℕ} {f : Space d → F} (hf : IsDistBounded f) @@ -635,8 +630,7 @@ lemma add {d : ℕ} {f g : Space d → F} @[fun_prop] lemma fun_add {d : ℕ} {f g : Space d → F} - (hf : IsDistBounded f) (hg : IsDistBounded g) : IsDistBounded (fun x => f x + g x) := by - exact hf.add hg + (hf : IsDistBounded f) (hg : IsDistBounded g) : IsDistBounded (fun x => f x + g x) := hf.add hg /-! @@ -905,8 +899,7 @@ lemma pow_shift {d : ℕ} (n : ℤ) · simp exact hn · intro x - simp - rfl + simp [sub_eq_add_neg] @[fun_prop] lemma inv_shift {d : ℕ} (g : Space d) (hd : 2 ≤ d := by omega) : @@ -916,8 +909,7 @@ lemma inv_shift {d : ℕ} (g : Space d) (hd : 2 ≤ d := by omega) : simp @[fun_prop] lemma nat_pow {d : ℕ} (n : ℕ) : - IsDistBounded (d := d) (fun x => ‖x‖ ^ n) := by - exact IsDistBounded.pow (d := d) (n : ℤ) (by omega) + IsDistBounded (d := d) (fun x => ‖x‖ ^ n) := IsDistBounded.pow (d := d) (n : ℤ) (by omega) @[fun_prop] lemma norm_add_nat_pow {d : ℕ} (n : ℕ) (a : ℝ) : @@ -1038,8 +1030,7 @@ lemma zpow_smul_self {d : ℕ} (n : ℤ) (hn : - (d - 1 : ℕ) - 1 ≤ n) : lemma zpow_smul_repr_self {d : ℕ} (n : ℤ) (hn : - (d - 1 : ℕ) - 1 ≤ n) : IsDistBounded (d := d) (fun x => ‖x‖ ^ n • basis.repr x) := by apply IsDistBounded.congr (f := fun x => ‖x‖ ^ n • x) - · apply zpow_smul_self - exact hn + · exact zpow_smul_self n hn · apply AEMeasurable.aestronglyMeasurable fun_prop · intro x @@ -1158,8 +1149,7 @@ lemma norm_smul_isDistBounded {d : ℕ} [NormedSpace ℝ F] {f : Space d → F} · apply IsDistBounded.congr (f := fun x => ∑ i, (c i * (‖x‖ * ‖x + g i‖ ^ (p i)))) · apply IsDistBounded.sum_fun intro i _ - apply IsDistBounded.const_mul_fun - exact norm_smul_zpow (p i) (g i) (p_bound i) + exact IsDistBounded.const_mul_fun (norm_smul_zpow (p i) (g i) (p_bound i)) (c i) · fun_prop · intro x congr @@ -1190,16 +1180,14 @@ lemma component_smul_isDistBounded {d : ℕ} [NormedSpace ℝ F] {f : Space d apply IsDistBounded.mono (f := fun x => ‖x‖ • f x) · fun_prop · apply AEStronglyMeasurable.smul - · have h1 : AEStronglyMeasurable (fun x => Space.coordCLM i x) := by - fun_prop + · have h1 : AEStronglyMeasurable (fun x => Space.coordCLM i x) := by fun_prop convert h1 using 1 funext i simp [coordCLM_apply, coord_apply] · fun_prop · intro x simp [norm_smul] - apply mul_le_mul ?_ (by rfl) (by positivity) (by positivity) - exact abs_eval_le_norm x i + exact mul_le_mul (abs_eval_le_norm x i) (by rfl) (by positivity) (by positivity) @[fun_prop] lemma component_mul_isDistBounded {d : ℕ} {f : Space d → ℝ} @@ -1260,8 +1248,7 @@ lemma isDistBounded_smul_inner_of_smul_norm {d : ℕ} [NormedSpace ℝ F] {f : S · fun_prop · intro x simp [norm_smul] - refine mul_le_mul_of_nonneg_right ?_ (by positivity) - exact abs_eval_le_norm x i + exact mul_le_mul_of_nonneg_right (abs_eval_le_norm x i) (by positivity) @[fun_prop] lemma isDistBounded_mul_inner {d : ℕ} {f : Space d → ℝ} @@ -1293,15 +1280,13 @@ lemma mul_inner_pow_neg_two {d : ℕ} (y : Space d) (hd : 2 ≤ d := by omega) : by_cases hx : x = 0 · subst hx simp - have hx' : ‖x‖ ≠ 0 := by - simpa using hx + have hx' : ‖x‖ ≠ 0 := by simpa using hx field_simp · apply AEMeasurable.aestronglyMeasurable fun_prop · intro x simp - apply mul_le_mul_of_nonneg _ (by rfl) (by positivity) (by positivity) - exact abs_real_inner_le_norm y x + exact mul_le_mul_of_nonneg (abs_real_inner_le_norm y x) (by rfl) (by positivity) (by positivity) end constructors end IsDistBounded diff --git a/Physlib/SpaceAndTime/Space/LengthUnit.lean b/Physlib/SpaceAndTime/Space/LengthUnit.lean index e4d32fea5..12741e552 100644 --- a/Physlib/SpaceAndTime/Space/LengthUnit.lean +++ b/Physlib/SpaceAndTime/Space/LengthUnit.lean @@ -36,8 +36,7 @@ structure LengthUnit where namespace LengthUnit @[simp] -lemma val_ne_zero (x : LengthUnit) : x.val ≠ 0 := by - exact Ne.symm (ne_of_lt x.property) +lemma val_ne_zero (x : LengthUnit) : x.val ≠ 0 := Ne.symm (ne_of_lt x.property) lemma val_pos (x : LengthUnit) : 0 < x.val := x.property @@ -72,9 +71,7 @@ lemma div_pos (x y : LengthUnit) : (0 : ℝ≥0) < x/ y := by @[simp] lemma div_self (x : LengthUnit) : - x / x = (1 : ℝ≥0) := by - simp [div_eq_val, x.val_ne_zero] - rfl + x / x = (1 : ℝ≥0) := NNReal.eq (_root_.div_self x.val_ne_zero) lemma div_symm (x y : LengthUnit) : x / y = (y / x)⁻¹ := NNReal.eq <| by @@ -100,19 +97,16 @@ def scale (r : ℝ) (x : LengthUnit) (hr : 0 < r := by norm_num) : LengthUnit := @[simp] lemma scale_div_self (x : LengthUnit) (r : ℝ) (hr : 0 < r) : - scale r x hr / x = (⟨r, le_of_lt hr⟩ : ℝ≥0) := by - simp [scale, div_eq_val] + scale r x hr / x = (⟨r, le_of_lt hr⟩ : ℝ≥0) := by simp [scale, div_eq_val] @[simp] lemma self_div_scale (x : LengthUnit) (r : ℝ) (hr : 0 < r) : x / scale r x hr = (⟨1/r, _root_.div_nonneg (by simp) (le_of_lt hr)⟩ : ℝ≥0) := by simp [scale, div_eq_val] - field_simp @[simp] -lemma scale_one (x : LengthUnit) : scale 1 x = x := by - simp [scale] +lemma scale_one (x : LengthUnit) : scale 1 x = x := by simp [scale] @[simp] lemma scale_div_scale (x1 x2 : LengthUnit) {r1 r2 : ℝ} (hr1 : 0 < r1) (hr2 : 0 < r2) : @@ -125,8 +119,7 @@ lemma scale_div_scale (x1 x2 : LengthUnit) {r1 r2 : ℝ} (hr1 : 0 < r1) (hr2 : 0 @[simp] lemma scale_scale (x : LengthUnit) (r1 r2 : ℝ) (hr1 : 0 < r1) (hr2 : 0 < r2) : scale r1 (scale r2 x hr2) hr1 = scale (r1 * r2) x (mul_pos hr1 hr2) := by - simp [scale] - ring + simp [scale, mul_assoc] /-! ## Specific choices of Length units diff --git a/Physlib/SpaceAndTime/Space/Module.lean b/Physlib/SpaceAndTime/Space/Module.lean index 94afdb17f..ee705c263 100644 --- a/Physlib/SpaceAndTime/Space/Module.lean +++ b/Physlib/SpaceAndTime/Space/Module.lean @@ -64,26 +64,13 @@ lemma add_val {d: ℕ} (x y : Space d) : @[simp] lemma add_apply {d : ℕ} (x y : Space d) (i : Fin d) : - (x + y) i = x i + y i := by - simp [add_val] + (x + y) i = x i + y i := by simp [add_val] instance {d} : AddCommMonoid (Space d) where - add_assoc a b c:= by - apply eq_of_val - simp only [add_val] - ring - zero_add a := by - apply eq_of_val - simp only [zero_val, add_val, add_eq_right] - rfl - add_zero a := by - apply eq_of_val - simp only [zero_val, add_val, add_eq_left] - rfl - add_comm a b := by - apply eq_of_val - simp only [add_val] - ring + add_assoc a b c := eq_of_apply fun i => by simp [add_assoc] + zero_add a := eq_of_apply fun i => by simp + add_zero a := eq_of_apply fun i => by simp + add_comm a b := eq_of_apply fun i => by simp [add_comm] nsmul n a := ⟨fun i => n • a.val i⟩ @[simp] @@ -102,9 +89,8 @@ lemma eq_vadd_zero {d} (s : Space d) : @[simp] lemma add_vadd_zero {d} (v1 v2 : EuclideanSpace ℝ (Fin d)) : - (v1 +ᵥ (0 : Space d)) + (v2 +ᵥ (0 : Space d)) = (v1 + v2) +ᵥ (0 : Space d) := by - ext i - simp + (v1 +ᵥ (0 : Space d)) + (v2 +ᵥ (0 : Space d)) = (v1 + v2) +ᵥ (0 : Space d) := + eq_of_apply fun i => by simp /-! @@ -125,32 +111,16 @@ lemma smul_apply {d : ℕ} (c : ℝ) (p : Space d) (i : Fin d) : @[simp] lemma smul_vadd_zero {d} (k : ℝ) (v : EuclideanSpace ℝ (Fin d)) : - k • (v +ᵥ (0 : Space d)) = (k • v) +ᵥ (0 : Space d) := by - ext i - simp + k • (v +ᵥ (0 : Space d)) = (k • v) +ᵥ (0 : Space d) := + eq_of_apply fun i => by simp instance {d} : Module ℝ (Space d) where - one_smul x := by - ext i - simp - mul_smul a b x := by - ext i - simp only [smul_apply] - ring - smul_add a x y := by - ext i - simp only [smul_apply, add_apply] - ring - smul_zero a := by - ext i - simp - add_smul a b x := by - ext i - simp only [smul_apply, add_apply] - ring - zero_smul x := by - ext i - simp + one_smul x := eq_of_apply fun i => by simp + mul_smul a b x := eq_of_apply fun i => by simp [mul_assoc] + smul_add a x y := eq_of_apply fun i => by simp [mul_add] + smul_zero a := eq_of_apply fun i => by simp + add_smul a b x := eq_of_apply fun i => by simp [add_mul] + zero_smul x := eq_of_apply fun i => by simp /-! @@ -161,8 +131,7 @@ instance {d} : Module ℝ (Space d) where noncomputable instance {d} : Norm (Space d) where norm p := √ (∑ i, (p i)^2) -lemma norm_eq {d} (p : Space d) : ‖p‖ = √ (∑ i, (p i) ^ 2) := by - rfl +lemma norm_eq {d} (p : Space d) : ‖p‖ = √ (∑ i, (p i) ^ 2) := rfl @[simp] lemma abs_eval_le_norm {d} (p : Space d) (i : Fin d) : @@ -179,14 +148,12 @@ lemma norm_sq_eq {d} (p : Space d) : refine Real.sq_sqrt ?_ positivity -lemma point_dim_zero_eq (p : Space 0) : p = 0 := by - ext i - fin_cases i +lemma point_dim_zero_eq (p : Space 0) : p = 0 := + eq_of_apply fun i => by fin_cases i @[simp] lemma norm_vadd_zero {d} (v : EuclideanSpace ℝ (Fin d)) : - ‖v +ᵥ (0 : Space d)‖ = ‖v‖ := by - simp [norm_eq, PiLp.norm_eq_of_L2] + ‖v +ᵥ (0 : Space d)‖ = ‖v‖ := by simp [norm_eq, PiLp.norm_eq_of_L2] instance : Neg (Space d) where neg p := ⟨fun i => - (p.val i)⟩ @@ -201,12 +168,8 @@ lemma neg_apply {d : ℕ} (p : Space d) (i : Fin d) : noncomputable instance {d} : AddCommGroup (Space d) where zsmul z p := ⟨fun i => z * p.val i⟩ - neg_add_cancel p := by - ext i - simp - zsmul_zero' p := by - ext i - simp + neg_add_cancel p := eq_of_apply fun i => by simp + zsmul_zero' p := eq_of_apply fun i => by simp zsmul_succ' n p := by ext i simp only [Nat.succ_eq_add_one, Nat.cast_add, Nat.cast_one, Int.cast_add, Int.cast_natCast, @@ -220,8 +183,7 @@ noncomputable instance {d} : AddCommGroup (Space d) where @[simp] lemma sub_apply {d} (p q : Space d) (i : Fin d) : - (p - q) i = p i - q i := by - simp [sub_eq_add_neg, neg_apply, add_apply] + (p - q) i = p i - q i := rfl @[simp] lemma sub_val {d} (p q : Space d) : @@ -229,9 +191,8 @@ lemma sub_val {d} (p q : Space d) : @[simp] lemma vadd_zero_sub_vadd_zero {d} (v1 v2 : EuclideanSpace ℝ (Fin d)) : - (v1 +ᵥ (0 : Space d)) - (v2 +ᵥ (0 : Space d)) = (v1 - v2) +ᵥ (0 : Space d) := by - ext i - simp [sub_apply, vadd_apply] + (v1 +ᵥ (0 : Space d)) - (v2 +ᵥ (0 : Space d)) = (v1 - v2) +ᵥ (0 : Space d) := + eq_of_apply fun i => by simp [sub_apply, vadd_apply] @[simp] lemma dist_eq_norm {d} (p q : Space d) : @@ -319,8 +280,7 @@ instance {d : ℕ} : BorelSpace (Space d) where -/ lemma inner_eq_sum {d} (p q : Space d) : - inner ℝ p q = ∑ i, p i * q i := by - simp [inner] + inner ℝ p q = ∑ i, p i * q i := inner_apply p q @[simp] lemma sum_apply {ι : Type} [Fintype ι] (f : ι → Space d) (i : Fin d) : @@ -362,30 +322,20 @@ noncomputable def basis {d} : OrthonormalBasis (Fin d) ℝ (Space d) where repr := { toFun p := WithLp.toLp 2 fun i => p i invFun := fun v => ⟨v⟩ - left_inv := by - intro p - rfl - right_inv := by - intro v - rfl - map_add' := by - intro v1 v2 - rfl - map_smul' := by - intro c v - rfl + left_inv := fun p => rfl + right_inv := fun v => rfl + map_add' := fun v1 v2 => rfl + map_smul' := fun c v => rfl norm_map' := by intro x simp [norm_eq, PiLp.norm_eq_of_L2]} lemma apply_eq_basis_repr_apply {d} (p : Space d) (i : Fin d) : - p i = basis.repr p i := by - simp [basis] + p i = basis.repr p i := rfl @[simp] lemma basis_repr_apply {d} (p : Space d) (i : Fin d) : - basis.repr p i = p i := by - simp [apply_eq_basis_repr_apply] + basis.repr p i = p i := rfl @[simp] lemma basis_repr_symm_apply {d} (v : EuclideanSpace ℝ (Fin d)) (i : Fin d) : @@ -398,18 +348,15 @@ lemma basis_apply {d} (i j : Fin d) : exact Lean.Grind.eq_congr' rfl rfl @[simp] -lemma basis_self {d} (i : Fin d) : basis i i = 1 := by - simp [basis_apply] +lemma basis_self {d} (i : Fin d) : basis i i = 1 := by simp [basis_apply] @[simp high] lemma inner_basis {d} (p : Space d) (i : Fin d) : - inner ℝ p (basis i) = p i := by - simp [inner_eq_sum, basis_apply] + inner ℝ p (basis i) = p i := by simp [inner_eq_sum, basis_apply] @[simp high] lemma basis_inner {d} (i : Fin d) (p : Space d) : - inner ℝ (basis i) p = p i := by - simp [inner_eq_sum, basis_apply] + inner ℝ (basis i) p = p i := by simp [inner_eq_sum, basis_apply] open InnerProductSpace @@ -475,8 +422,7 @@ noncomputable def coord (μ : Fin d) (p : Space d) : ℝ := inner ℝ p (basis μ) lemma coord_apply (μ : Fin d) (p : Space d) : - coord μ p = p μ := by - simp [coord] + coord μ p = p μ := by simp [coord] /-- The standard coordinate functions of Space based on `Fin d`, as a continuous linear map. -/ noncomputable def coordCLM {d} (μ : Fin d) : Space d →L[ℝ] ℝ where @@ -497,8 +443,7 @@ lemma coord_contDiff {i} : ContDiff ℝ ∞ (fun x : Space d => x.coord i) := by fun_prop lemma coordCLM_apply (μ : Fin d) (p : Space d) : - coordCLM μ p = coord μ p := by - rfl + coordCLM μ p = coord μ p := rfl @[inherit_doc coord] scoped notation "𝔁" => coord @@ -652,12 +597,10 @@ noncomputable def oneEquiv : Space 1 ≃ₗᵢ[ℝ] ℝ where exact Eq.symm (Real.sqrt_sq_eq_abs (x 0)) lemma oneEquiv_coe : - (oneEquiv : Space 1 → ℝ) = fun x => x 0 := by - rfl + (oneEquiv : Space 1 → ℝ) = fun x => x 0 := rfl lemma oneEquiv_symm_coe : - (oneEquiv.symm : ℝ → Space 1) = (fun x => ⟨fun _ => x⟩) := by - rfl + (oneEquiv.symm : ℝ → Space 1) = (fun x => ⟨fun _ => x⟩) := rfl lemma oneEquiv_symm_apply (x : ℝ) (i : Fin 1) : oneEquiv.symm x i = x := by diff --git a/Physlib/SpaceAndTime/Space/Norm/Basic.lean b/Physlib/SpaceAndTime/Space/Norm/Basic.lean index 99f6cb005..db6c0bd0d 100644 --- a/Physlib/SpaceAndTime/Space/Norm/Basic.lean +++ b/Physlib/SpaceAndTime/Space/Norm/Basic.lean @@ -159,8 +159,7 @@ open Space lemma deriv_normPowerSeries {d} (n : ℕ) (x : Space d) (i : Fin d) : ∂[i] (normPowerSeries n) x = x i * (normPowerSeries n x)⁻¹ := by - rw [deriv_eq_fderiv_basis] - rw [normPowerSeries_eq] + rw [deriv_eq_fderiv_basis, normPowerSeries_eq] rw [fderiv_sqrt] simp only [one_div, mul_inv_rev, fderiv_add_const, FunLike.coe_smul, Pi.smul_apply, smul_eq_mul] @@ -279,8 +278,7 @@ lemma normPowerSeries_zpow_le_norm_sq_add_one {d} (n : ℕ) (m : ℤ) (x : Space | .ofNat m => trans (‖x‖ + 1) ^ m · simp - refine pow_le_pow_left₀ (by simp) ?_ m - exact normPowerSeries_le_norm_sq_add_one n x + exact pow_le_pow_left₀ (by simp) (normPowerSeries_le_norm_sq_add_one n x) m · simp | .negSucc m => trans (‖x‖ ^ (m + 1))⁻¹; swap @@ -289,8 +287,7 @@ lemma normPowerSeries_zpow_le_norm_sq_add_one {d} (n : ℕ) (m : ℤ) (x : Space simp only [zpow_negSucc] refine inv_anti₀ ?_ ?_ · positivity - refine pow_le_pow_left₀ (by simp) ?_ (m + 1) - exact norm_le_normPowerSeries n x + exact pow_le_pow_left₀ (by simp) (norm_le_normPowerSeries n x) (m + 1) lemma normPowerSeries_inv_le {d} (n : ℕ) (x : Space d) (hx : x ≠ 0) : (normPowerSeries n x)⁻¹ ≤ ‖x‖⁻¹ := by @@ -448,8 +445,7 @@ lemma deriv_normPowerSeries_zpow {d : ℕ} {n : ℕ} (m : ℤ) (x : Space d) (i simp only [basis_inner] field_simp ring_nf - have h1 : normPowerSeries n x ^ (-1 + m) = normPowerSeries n x ^ ((-2 + m) + 1) := by - ring_nf + have h1 : normPowerSeries n x ^ (-1 + m) = normPowerSeries n x ^ ((-2 + m) + 1) := by ring_nf rw [h1, zpow_add₀] simp only [Int.reduceNeg, zpow_one] ring @@ -510,8 +506,7 @@ lemma gradient_dist_normPowerSeries_zpow {d : ℕ} {n : ℕ} (m : ℤ) : simp [distGrad_inner_eq] rw [Distribution.fderivD_apply, distOfFunction_apply, distOfFunction_inner] calc _ - _ = - ∫ (x : Space d), fderiv ℝ η x (basis.repr.symm y) * normPowerSeries n x ^ m := by - rfl + _ = - ∫ (x : Space d), fderiv ℝ η x (basis.repr.symm y) * normPowerSeries n x ^ m := rfl _ = ∫ (x : Space d), η x * fderiv ℝ (normPowerSeries n · ^ m) x (basis.repr.symm y) := by rw [integral_mul_fderiv_eq_neg_fderiv_mul_of_integrable] · fun_prop @@ -736,8 +731,7 @@ lemma gradient_dist_normPowerSeries_log {d : ℕ} {n : ℕ} : simp [distGrad_inner_eq] rw [Distribution.fderivD_apply, distOfFunction_apply, distOfFunction_inner] calc _ - _ = - ∫ (x : Space d), fderiv ℝ η x (basis.repr.symm y) * Real.log (normPowerSeries n x) := by - rfl + _ = - ∫ (x : Space d), fderiv ℝ η x (basis.repr.symm y) * Real.log (normPowerSeries n x) := rfl _ = ∫ (x : Space d), η x * fderiv ℝ (fun x => Real.log (normPowerSeries n x)) x (basis.repr.symm y) := by rw [integral_mul_fderiv_eq_neg_fderiv_mul_of_integrable] @@ -808,8 +802,7 @@ lemma gradient_dist_normPowerSeries_log_tendsTo_distGrad_norm {d : ℕ} (hd : 2 intro x hx simp at hx simp - apply mul_le_mul (by rfl) _ (by positivity) (by positivity) - exact normPowerSeries_log_le n x hx + exact mul_le_mul (by rfl) (normPowerSeries_log_le n x hx) (by positivity) (by positivity) · rw [Filter.eventually_iff_exists_mem] use {0}ᶜ constructor @@ -996,8 +989,7 @@ private lemma radial_power_deriv_integral_by_parts simp [fderiv_smul_const] rw [iteratedFDeriv_succ_const] rfl) (by use 1, 1; simp [norm_smul]) η - have hη'_apply (x : ℝ) : η' x = η (x • n.1) := by - simp [η'] + have hη'_apply (x : ℝ) : η' x = η (x • n.1) := by simp [η'] have hmul_iter_apply : ∀ k x, ((Physlib.Distribution.powOneMul ℝ)^[k] η') x = x ^ k * η' x := by intro k @@ -1028,8 +1020,7 @@ private lemma radial_power_deriv_integral_by_parts ∂(.comap Subtype.val volume) = ∫ (x : ℝ) in Set.Ioi (0 : ℝ), - x ^ (p - 1) * η (x • n.1) := by - exact MeasureTheory.integral_subtype_comap (μ := volume) + x ^ (p - 1) * η (x • n.1) := MeasureTheory.integral_subtype_comap (μ := volume) (s := Set.Ioi (0 : ℝ)) measurableSet_Ioi (fun x : ℝ => x ^ (p - 1) * η (x • n.1)) rw [hleft_subtype, hright_subtype] @@ -1074,9 +1065,7 @@ private lemma radial_power_deriv_integral_by_parts ring_nf simp [hη'_apply, mul_assoc]) measurableSet_Ioi - · have hcont : - ContinuousAt (fun x : ℝ => x ^ p * η (x • n.1)) (0 : ℝ) := by - fun_prop + · have hcont : ContinuousAt (fun x : ℝ => x ^ p * η (x • n.1)) (0 : ℝ) := by fun_prop have hlim := tendsto_nhdsWithin_of_tendsto_nhds (s := Set.Ioi (0 : ℝ)) hcont.tendsto simp only [ne_eq, hp.ne', not_false_eq_true, zero_pow, zero_smul, zero_mul] at hlim @@ -1121,8 +1110,7 @@ private lemma distDiv_norm_zpow_smul_repr_self_apply_eq_radial_deriv calc (∇ᵈ ⬝ (distOfFunction (fun x : Space d => ‖x‖ ^ q • basis.repr x) (IsDistBounded.zpow_smul_repr_self q (by omega)))) η - = - ∫ x, F x := by - rw [distDiv_ofFunction] + = - ∫ x, F x := by rw [distDiv_ofFunction] _ = - ∫ r, F (r.2.1 • r.1.1) ∂(volume (α := Space d).toSphere.prod (Measure.volumeIoiPow (Module.finrank ℝ (Space d) - 1))) := by @@ -1165,13 +1153,9 @@ lemma distDiv_norm_zpow_smul_repr_self_eq_smul (IsDistBounded.pow q (by omega))) := by ext η let p : ℕ := Int.toNat (q + (d : ℤ)) - have hp_int : (p : ℤ) = q + (d : ℤ) := by - dsimp [p] - exact Int.toNat_of_nonneg (le_of_lt hq) + have hp_int : (p : ℤ) = q + (d : ℤ) := by simpa [p] using Int.toNat_of_nonneg (le_of_lt hq) have hp_pos : 0 < p := by - have : (0 : ℤ) < (p : ℤ) := by - rw [hp_int] - exact hq + have : (0 : ℤ) < (p : ℤ) := by simpa [hp_int] using hq exact_mod_cast this have hcoef : (((q + d : ℤ) : ℝ)) = (p : ℝ) := by exact_mod_cast hp_int.symm @@ -1446,8 +1430,7 @@ lemma distLaplacian_fundamentalSolution_norm_zpow {d : ℕ} : ‖x‖ ^ (- (d : ℤ)) • basis.repr x) (IsDistBounded.zpow_smul_repr_self (- (d : ℤ)) (by omega))) = (d * (volume (α := Space d)).real - (Metric.ball 0 1)) • diracDelta ℝ 0 := by - exact distDiv_inv_pow_eq_dim (d := d) + (Metric.ball 0 1)) • diracDelta ℝ 0 := distDiv_inv_pow_eq_dim (d := d) rw [hdiv] rw [smul_smul] ring_nf diff --git a/Physlib/SpaceAndTime/Space/Origin.lean b/Physlib/SpaceAndTime/Space/Origin.lean index 360d10492..c50edaec0 100644 --- a/Physlib/SpaceAndTime/Space/Origin.lean +++ b/Physlib/SpaceAndTime/Space/Origin.lean @@ -33,8 +33,7 @@ lemma zero_val {d : ℕ} : (0 : Space d).val = fun _ => 0 := rfl @[simp] lemma zero_apply {d : ℕ} (i : Fin d) : - (0 : Space d) i = 0 := by - simp [zero_val] + (0 : Space d) i = 0 := rfl /-- A Euclidean vector, based at the chosen origin, viewed as a point of `Space d`. -/ noncomputable def vectorToSpace {d : ℕ} (v : EuclideanSpace ℝ (Fin d)) : Space d := @@ -42,14 +41,11 @@ noncomputable def vectorToSpace {d : ℕ} (v : EuclideanSpace ℝ (Fin d)) : Spa @[simp] lemma vectorToSpace_apply {d : ℕ} (v : EuclideanSpace ℝ (Fin d)) (i : Fin d) : - vectorToSpace v i = v i := by - simp [vectorToSpace] + vectorToSpace v i = v i := by simp [vectorToSpace] @[simp] lemma vectorToSpace_vsub_zero {d : ℕ} (v : EuclideanSpace ℝ (Fin d)) : - vectorToSpace v -ᵥ (0 : Space d) = v := by - ext i - simp [vectorToSpace] + vectorToSpace v -ᵥ (0 : Space d) = v := by simp [vectorToSpace] /-- The standard chart `Space d ≃ᵃⁱ[ℝ] EuclideanSpace ℝ (Fin d)`, `p ↦ p -ᵥ 0`, identifying a point with its coordinate vector relative to the origin (the vector-space zero `(0 : Space d)`). -/ diff --git a/Physlib/SpaceAndTime/Space/Slice.lean b/Physlib/SpaceAndTime/Space/Slice.lean index 4487e19d3..c0f1e181f 100644 --- a/Physlib/SpaceAndTime/Space/Slice.lean +++ b/Physlib/SpaceAndTime/Space/Slice.lean @@ -105,13 +105,11 @@ lemma slice_symm_apply {d : ℕ} (i : Fin d.succ) (r : ℝ) (x : Space d) : @[simp] lemma slice_symm_apply_self {d : ℕ} (i : Fin d.succ) (r : ℝ) (x : Space d) : - (slice i).symm (r, x) i = r := by - simp [slice_symm_apply] + (slice i).symm (r, x) i = r := by simp [slice_symm_apply] @[simp] lemma slice_symm_apply_succAbove {d : ℕ} (i : Fin d.succ) (r : ℝ) (x : Space d) (j : Fin d) : - (slice i).symm (r, x) (Fin.succAbove i j) = x j := by - simp [slice_symm_apply] + (slice i).symm (r, x) (Fin.succAbove i j) = x j := by simp [slice_symm_apply] /-! @@ -172,8 +170,7 @@ lemma norm_left_le_norm_slice_symm {d : ℕ} (i : Fin d.succ) (r : ℝ) (x : Spa @[simp] lemma fderiv_slice_symm {d : ℕ} (i : Fin d.succ) (p1 : ℝ × Space d) : - fderiv ℝ (slice i).symm p1 = (slice i).symm := by - rw [ContinuousLinearEquiv.fderiv] + fderiv ℝ (slice i).symm p1 = (slice i).symm := by rw [ContinuousLinearEquiv.fderiv] lemma fderiv_slice_symm_left_apply {d : ℕ} (i : Fin d.succ) (x : Space d) (r1 r2 : ℝ) : (fderiv ℝ (fun r => (slice i).symm (r, x))) r1 r2 = (slice i).symm (r2, 0) := by diff --git a/Physlib/SpaceAndTime/Space/Translations.lean b/Physlib/SpaceAndTime/Space/Translations.lean index 7ce7c116d..f42cb3d85 100644 --- a/Physlib/SpaceAndTime/Space/Translations.lean +++ b/Physlib/SpaceAndTime/Space/Translations.lean @@ -68,8 +68,7 @@ noncomputable def translateSchwartz {d : ℕ} (a : EuclideanSpace ℝ (Fin d)) : trans (1 + (‖x‖ + ‖a‖)) + ‖x‖ * ‖a‖ · simp positivity - ring_nf - rfl) (by + nlinarith) (by use 1, (1 + ‖a‖) intro x simp only [pow_one] @@ -79,8 +78,7 @@ noncomputable def translateSchwartz {d : ℕ} (a : EuclideanSpace ℝ (Fin d)) : trans (1 + (‖a‖ + ‖x - basis.repr.symm a‖)) + ‖a‖ * ‖x - basis.repr.symm a‖ · simp positivity - ring_nf - rfl) + nlinarith) @[simp] lemma translateSchwartz_apply {d : ℕ} (a : EuclideanSpace ℝ (Fin d)) @@ -89,9 +87,7 @@ lemma translateSchwartz_apply {d : ℕ} (a : EuclideanSpace ℝ (Fin d)) lemma translateSchwartz_coe_eq {d : ℕ} (a : EuclideanSpace ℝ (Fin d)) (η : 𝓢(Space d, X)) : - (translateSchwartz a η : Space d → X) = fun x => η (x - basis.repr.symm a) := by - ext - simp + (translateSchwartz a η : Space d → X) = fun x => η (x - basis.repr.symm a) := rfl /-- The continuous linear map translating distributions. -/ noncomputable def distTranslate {d : ℕ} (a : EuclideanSpace ℝ (Fin d)) : @@ -100,8 +96,7 @@ noncomputable def distTranslate {d : ℕ} (a : EuclideanSpace ℝ (Fin d)) : map_add' T1 T2 := by ext η simp - map_smul' c T := by - simp + map_smul' c T := by simp lemma distTranslate_apply {d : ℕ} (a : EuclideanSpace ℝ (Fin d)) (T : (Space d) →d[ℝ] X) (η : 𝓢(Space d, ℝ)) : diff --git a/Physlib/SpaceAndTime/SpaceTime/Basic.lean b/Physlib/SpaceAndTime/SpaceTime/Basic.lean index 3852a03a7..58d321fae 100644 --- a/Physlib/SpaceAndTime/SpaceTime/Basic.lean +++ b/Physlib/SpaceAndTime/SpaceTime/Basic.lean @@ -101,27 +101,21 @@ open TensorSpecies This is denoted `𝔁 μ p`, where `𝔁` is typed with `\MCx`. -/ def coord {d : ℕ} (μ : Fin (1 + d)) : SpaceTime d →ₗ[ℝ] ℝ where toFun x := x (finSumFinEquiv.symm μ) - map_add' x1 x2 := by - simp - map_smul' c x := by - simp + map_add' _ _ := rfl + map_smul' _ _ := rfl @[inherit_doc coord] scoped notation "𝔁" => coord lemma coord_apply {d : ℕ} (μ : Fin (1 + d)) (y : SpaceTime d) : - 𝔁 μ y = y (finSumFinEquiv.symm μ) := by - rfl + 𝔁 μ y = y (finSumFinEquiv.symm μ) := rfl /-- The continuous linear map from a point in space time to one of its coordinates. -/ def coordCLM (μ : Fin 1 ⊕ Fin d) : SpaceTime d →L[ℝ] ℝ where toFun x := x μ - map_add' x1 x2 := by - simp - map_smul' c x := by - simp - cont := by - fun_prop + map_add' _ _ := rfl + map_smul' _ _ := rfl + cont := by fun_prop /-! @@ -204,8 +198,7 @@ def space {d : ℕ} : SpaceTime d →L[ℝ] Space d where map_smul' c x := by ext i simp - cont := by - fun_prop + cont := by fun_prop /-! @@ -258,8 +251,7 @@ def time {d : ℕ} (c : SpeedOfLight := 1) : SpaceTime d →ₗ[ℝ] Time where @[simp] lemma time_val_toCoord_symm {d : ℕ} (c : SpeedOfLight) (f : Fin 1 ⊕ Fin d → ℝ) : - (time c f).val = f (Sum.inl 0) / c := by - simp [time, Lorentz.Vector.timeComponent] + (time c f).val = f (Sum.inl 0) / c := by simp [time, Lorentz.Vector.timeComponent] /-! @@ -295,8 +287,7 @@ def toTimeAndSpace {d : ℕ} (c : SpeedOfLight := 1) : SpaceTime d ≃L[ℝ] Tim simp ext i simp - map_smul' := by - simp + map_smul' := by simp } @[simp] @@ -448,15 +439,13 @@ def timeSpaceBasisEquiv {d : ℕ} (c : SpeedOfLight) : match μ with | Sum.inl 0 => field_simp - | Sum.inr i => - rfl + | Sum.inr i => rfl right_inv x := by funext μ match μ with | Sum.inl 0 => field_simp - | Sum.inr i => - rfl + | Sum.inr i => rfl map_add' x y := by funext μ match μ with @@ -584,8 +573,7 @@ lemma toTimeAndSpace_symm_measurePreserving {d : ℕ} (c : SpeedOfLight) : · fun_prop rw [Space.volume_eq_addHaar, Time.volume_eq_basis_addHaar, ← Module.Basis.prod_addHaar, Module.Basis.map_addHaar] - rw [← timeSpaceBasis_addHaar c] - rfl + exact timeSpaceBasis_addHaar c /-! @@ -604,10 +592,8 @@ lemma spaceTime_integral_eq_time_space_integral {M} [NormedAddCommGroup M] apply MeasureTheory.MeasurePreserving.integral_comp · refine { measurable := ?_, map_eq := ?_ } · fun_prop - have hs : volume (α := Space d) = Space.basis.toBasis.addHaar := by - exact Space.volume_eq_addHaar - have ht : volume (α := Time) = Time.basis.toBasis.addHaar := by - exact Time.volume_eq_basis_addHaar + have hs : volume (α := Space d) = Space.basis.toBasis.addHaar := Space.volume_eq_addHaar + have ht : volume (α := Time) = Time.basis.toBasis.addHaar := Time.volume_eq_basis_addHaar rw [hs, ht] rw [← Module.Basis.prod_addHaar] rw [Module.Basis.map_addHaar] diff --git a/Physlib/SpaceAndTime/SpaceTime/Derivatives.lean b/Physlib/SpaceAndTime/SpaceTime/Derivatives.lean index d7de1137f..3e88e2bd0 100644 --- a/Physlib/SpaceAndTime/SpaceTime/Derivatives.lean +++ b/Physlib/SpaceAndTime/SpaceTime/Derivatives.lean @@ -88,8 +88,7 @@ scoped notation "∂_" => deriv lemma deriv_eq {M : Type} [AddCommGroup M] [Module ℝ M] [TopologicalSpace M] {d : ℕ} (μ : Fin 1 ⊕ Fin d) (f : SpaceTime d → M) (y : SpaceTime d) : ∂_ μ f y = - fderiv ℝ f y (Lorentz.Vector.basis μ) := by - rfl + fderiv ℝ f y (Lorentz.Vector.basis μ) := rfl /-- The derivative of a function from `SpaceTime d` to a manifold along the `μ` coordinate, as a tangent vector at the value of the function. -/ @@ -244,9 +243,8 @@ lemma deriv_commute {M : Type} [NormedAddCommGroup M] [NormedSpace ℝ M] {d : simp only [fderiv_fun_const, Pi.ofNat_apply, ContinuousLinearMap.comp_zero, zero_add, ContinuousLinearMap.flip_apply] rw [IsSymmSndFDerivAt.eq] - · apply ContDiffAt.isSymmSndFDerivAt - exact hf.contDiffAt - simp only [minSmoothness_of_isRCLikeNormedField, le_refl] + · exact hf.contDiffAt.isSymmSndFDerivAt + (by simp only [minSmoothness_of_isRCLikeNormedField, le_refl]) · have h1 := hf.differentiable (by norm_cast); fun_prop · fun_prop · have h1 := hf.differentiable (by norm_cast); fun_prop @@ -374,10 +372,8 @@ noncomputable def distDeriv {M d} [NormedAddCommGroup M] [NormedSpace ℝ M] toFun f := let ev : (SpaceTime d →L[ℝ] M) →L[ℝ] M := { toFun v := v (Lorentz.Vector.basis μ) - map_add' v1 v2 := by - simp only [_root_.add_apply] - map_smul' a v := by - simp + map_add' _ _ := rfl + map_smul' _ _ := rfl } ev.comp (Distribution.fderivD ℝ f) map_add' f1 f2 := by diff --git a/Physlib/SpaceAndTime/SpaceTime/LorentzAction.lean b/Physlib/SpaceAndTime/SpaceTime/LorentzAction.lean index a84380c9a..9ba4c507f 100644 --- a/Physlib/SpaceAndTime/SpaceTime/LorentzAction.lean +++ b/Physlib/SpaceAndTime/SpaceTime/LorentzAction.lean @@ -81,8 +81,7 @@ def schwartzAction {d} : LorentzGroup d →* 𝓢(SpaceTime d, ℝ) →L[ℝ] ext η x simp only [_root_.mul_inv_rev, compCLM_apply, Function.comp_apply, Lorentz.Vector.actionCLM_apply] - rw [SemigroupAction.mul_smul] - rfl + exact congr_arg η (SemigroupAction.mul_smul Λ₂⁻¹ Λ₁⁻¹ x) /-! @@ -93,8 +92,7 @@ def schwartzAction {d} : LorentzGroup d →* 𝓢(SpaceTime d, ℝ) →L[ℝ] lemma schwartzAction_mul_apply {d} (Λ₁ Λ₂ : LorentzGroup d) (η : 𝓢(SpaceTime d, ℝ)) : schwartzAction Λ₂ (schwartzAction (Λ₁) η) = - schwartzAction (Λ₂ * Λ₁) η := by - simp + schwartzAction (Λ₂ * Λ₁) η := by simp lemma schwartzAction_apply {d} (Λ : LorentzGroup d) (η : 𝓢(SpaceTime d, ℝ)) (x : SpaceTime d) : diff --git a/Physlib/SpaceAndTime/SpaceTime/TimeSlice.lean b/Physlib/SpaceAndTime/SpaceTime/TimeSlice.lean index 077a59bc5..e4efdaa9f 100644 --- a/Physlib/SpaceAndTime/SpaceTime/TimeSlice.lean +++ b/Physlib/SpaceAndTime/SpaceTime/TimeSlice.lean @@ -135,9 +135,8 @@ noncomputable def distTimeSlice {M d} [NormedAddCommGroup M] [NormedSpace ℝ M] congr ext x simp - map_add' f1 f2 := by - simp - map_smul' a f := by simp + map_add' _ _ := rfl + map_smul' _ _ := rfl continuous_toFun := ((compCLMOfContinuousLinearEquiv ℝ (toTimeAndSpace c)).precomp M).continuous continuous_invFun := ((compCLMOfContinuousLinearEquiv ℝ (toTimeAndSpace c).symm).precomp M).continuous @@ -179,8 +178,7 @@ lemma distTimeSlice_distDeriv_inl {M d} [NormedAddCommGroup M] [NormedSpace ℝ rw [toTimeAndSpace_basis_inl'] rw [map_smul] simp only [one_div, smul_eq_mul] - · apply Differentiable.differentiableAt - exact SchwartzMap.differentiable κ + · exact (SchwartzMap.differentiable κ).differentiableAt · fun_prop lemma distDeriv_inl_distTimeSlice_symm {M d} [NormedAddCommGroup M] [NormedSpace ℝ M] @@ -220,8 +218,7 @@ lemma distTimeSlice_distDeriv_inr {M d} [NormedAddCommGroup M] [NormedSpace ℝ simp only [toTimeAndSpace_fderiv, ContinuousLinearMap.coe_comp, ContinuousLinearEquiv.coe_coe, Function.comp_apply] rw [toTimeAndSpace_basis_inr] - · apply Differentiable.differentiableAt - exact SchwartzMap.differentiable κ + · exact (SchwartzMap.differentiable κ).differentiableAt · fun_prop lemma distDeriv_inr_distTimeSlice_symm {M d} [NormedAddCommGroup M] [NormedSpace ℝ M] diff --git a/Physlib/SpaceAndTime/Time/Basic.lean b/Physlib/SpaceAndTime/Time/Basic.lean index 20e3fbe16..d3fe73bfe 100644 --- a/Physlib/SpaceAndTime/Time/Basic.lean +++ b/Physlib/SpaceAndTime/Time/Basic.lean @@ -80,10 +80,8 @@ structure Time where namespace Time -lemma val_injective : Function.Injective val := by - intro t1 t2 h - ext - exact h +lemma val_injective : Function.Injective val := + fun _ _ h => Time.ext h /-! @@ -128,8 +126,7 @@ lemma zero_val : val 0 = 0 := by norm_cast @[simp] -lemma eq_zero_iff (t : Time) : t = 0 ↔ t.val = 0 := by - aesop +lemma eq_zero_iff (t : Time) : t = 0 ↔ t.val = 0 := by aesop @[simp] lemma one_val : val 1 = 1 := by @@ -137,8 +134,7 @@ lemma one_val : val 1 = 1 := by norm_cast @[simp] -lemma eq_one_iff (t : Time) : t = 1 ↔ t.val = 1 := by - aesop +lemma eq_one_iff (t : Time) : t = 1 ↔ t.val = 1 := by aesop /-! @@ -188,14 +184,7 @@ instance : PartialOrder Time where le_antisymm t1 t2 h1 h2 := by simp_all [le_def]; ext; exact le_antisymm h1 h2 lemma lt_def (t1 t2 : Time) : - t1 < t2 ↔ t1.val < t2.val := by - constructor - · intro h - exact lt_iff_le_not_ge.mpr h - · intro h - apply lt_iff_le_not_ge.mpr - simp_all [le_def] - apply le_of_lt h + t1 < t2 ↔ t1.val < t2.val := Iff.symm lt_iff_le_not_ge /-! @@ -371,9 +360,7 @@ noncomputable def basis : OrthonormalBasis (Fin 1) ℝ Time where repr := { toFun := fun x => WithLp.toLp 2 (fun _ => x) invFun := fun f => ⟨f 0⟩ - left_inv := by - intro x - rfl + left_inv := fun _ => rfl right_inv := by intro f ext i @@ -395,8 +382,7 @@ noncomputable def basis : OrthonormalBasis (Fin 1) ℝ Time where rw [@PiLp.norm_eq_of_L2] simp only [Finset.univ_unique, Fin.default_eq_zero, Fin.isValue, Real.norm_eq_abs, sq_abs, Finset.sum_const, Finset.card_singleton, one_smul] - rw [Real.sqrt_sq_eq_abs] - rfl + exact Real.sqrt_sq_eq_abs _ } @[simp] @@ -428,13 +414,11 @@ lemma finRank_eq_one : Module.finrank ℝ Time = 1 := by ext simp [one_val] -instance : FiniteDimensional ℝ Time := by - refine Module.finite_of_rank_eq_one ?_ - simp +instance : FiniteDimensional ℝ Time := + Module.finite_of_rank_eq_one rank_eq_one lemma volume_eq_basis_addHaar : - (volume (α := Time)) = basis.toBasis.addHaar := by - exact (OrthonormalBasis.addHaar_eq_volume _).symm + (volume (α := Time)) = basis.toBasis.addHaar := (OrthonormalBasis.addHaar_eq_volume _).symm /-! @@ -468,14 +452,10 @@ noncomputable def toRealLIE : Time ≃ₗᵢ[ℝ] ℝ where right_inv x := by rfl map_add' := by simp map_smul' := by simp - norm_map' x := by - simp - rfl + norm_map' _ := rfl lemma eq_one_smul (t : Time) : - t = t.val • 1 := by - ext - simp [one_val] + t = t.val • 1 := Time.ext (by simp [one_val]) @[fun_prop] lemma val_measurable : Measurable Time.val := by diff --git a/Physlib/SpaceAndTime/Time/Derivatives.lean b/Physlib/SpaceAndTime/Time/Derivatives.lean index 00c2dd385..5f3eb6b6e 100644 --- a/Physlib/SpaceAndTime/Time/Derivatives.lean +++ b/Physlib/SpaceAndTime/Time/Derivatives.lean @@ -100,16 +100,14 @@ lemma deriv_eq_mfderiv [NormedAddCommGroup M] [NormedSpace ℝ M] open Manifold in lemma deriv_eq_manifoldDeriv [NormedAddCommGroup M] [NormedSpace ℝ M] (f : Time → M) (t : Time) : - deriv f t = manifoldDeriv 𝓘(ℝ, M) f t := by - rw [deriv_eq_mfderiv, manifoldDeriv_eq] + deriv f t = manifoldDeriv 𝓘(ℝ, M) f t := by rw [deriv_eq_mfderiv, manifoldDeriv_eq] open Manifold in @[simp] lemma manifoldDeriv_const {E H N : Type} [NormedAddCommGroup E] [NormedSpace ℝ E] [TopologicalSpace H] (I : ModelWithCorners ℝ E H) [TopologicalSpace N] [ChartedSpace H N] (n : N) : - manifoldDeriv I (fun _ : Time => n) t = 0 := by - simp [manifoldDeriv] + manifoldDeriv I (fun _ : Time => n) t = 0 := by simp [manifoldDeriv] /-! @@ -120,14 +118,10 @@ lemma manifoldDeriv_const {E H N : Type} [NormedAddCommGroup E] [NormedSpace ℝ lemma deriv_smul (f : Time → EuclideanSpace ℝ (Fin d)) (k : ℝ) (hf : Differentiable ℝ f) : ∂ₜ (fun t => k • f t) t = k • ∂ₜ (fun t => f t) t := by - rw [deriv, fderiv_fun_const_smul] - rfl - fun_prop + exact congrArg (fun g => g 1) (fderiv_fun_const_smul (c := k) hf.differentiableAt) lemma deriv_neg [NormedAddCommGroup M] [NormedSpace ℝ M] (f : Time → M) : - ∂ₜ (-f) t = -∂ₜ f t := by - rw [deriv, fderiv_neg] - rfl + ∂ₜ (-f) t = -∂ₜ f t := by simp [deriv, fderiv_neg] /-- Quotient rule for `Time.deriv` on real-valued functions: if `c` and `g` are differentiable at `t` and `g t ≠ 0`, then @@ -229,7 +223,6 @@ lemma deriv_lorentzVector {d : ℕ} {f : Time → Lorentz.Vector d} change fderiv ℝ (Lorentz.Vector.coordCLM i ∘ fun x => f x) t 1 = _ rw [fderiv_comp] · simp - rw [← deriv_eq] rfl · fun_prop · fun_prop diff --git a/Physlib/SpaceAndTime/Time/TimeMan.lean b/Physlib/SpaceAndTime/Time/TimeMan.lean index 772d26586..bf94d4044 100644 --- a/Physlib/SpaceAndTime/Time/TimeMan.lean +++ b/Physlib/SpaceAndTime/Time/TimeMan.lean @@ -71,8 +71,7 @@ lemma val_injective : Function.Injective TimeMan.val := by lemma val_isOpenEmbedding : Topology.IsOpenEmbedding TimeMan.val where eq_induced := rfl - isOpen_range := by - simp + isOpen_range := by simp injective := val_injective lemma isOpen_iff {s : Set TimeMan} : @@ -83,13 +82,8 @@ lemma isOpen_iff {s : Set TimeMan} : def valHomeomorphism : TimeMan ≃ₜ ℝ where toFun := TimeMan.val invFun := fun t => { val := t } - left_inv := by - intro t - cases t - rfl - right_inv := by - intro t - rfl + left_inv := fun ⟨_⟩ => rfl + right_inv := fun _ => rfl continuous_toFun := by fun_prop continuous_invFun := by refine { isOpen_preimage := ?_ } @@ -112,8 +106,7 @@ def valHomeomorphism : TimeMan ≃ₜ ℝ where instance : ChartedSpace ℝ TimeMan where atlas := { valHomeomorphism.toOpenPartialHomeomorph } chartAt _ := valHomeomorphism.toOpenPartialHomeomorph - mem_chart_source := by - simp + mem_chart_source := by simp chart_mem_atlas := by intro x simp @@ -128,17 +121,14 @@ instance : IsManifold 𝓘(ℝ, ℝ) ω TimeMan where subst h1 h2 exact symm_trans_mem_contDiffGroupoid valHomeomorphism.toOpenPartialHomeomorph -lemma val_contDiff : ContMDiff 𝓘(ℝ, ℝ) 𝓘(ℝ, ℝ) ω TimeMan.val := by - refine contMDiffOn_univ.mp ?_ - exact contMDiffOn_chart (x := (⟨0⟩ : TimeMan)) +lemma val_contDiff : ContMDiff 𝓘(ℝ, ℝ) 𝓘(ℝ, ℝ) ω TimeMan.val := + contMDiffOn_univ.mp (contMDiffOn_chart (x := (⟨0⟩ : TimeMan))) /-- The choice of map `Time.val` from `TimeMan` to `ℝ` as a diffeomorphism. -/ noncomputable def valDiffeomorphism : TimeMan ≃ₘ^ω⟮𝓘(ℝ, ℝ), 𝓘(ℝ, ℝ)⟯ ℝ where toEquiv := valHomeomorphism.toEquiv contMDiff_toFun := val_contDiff - contMDiff_invFun := by - refine contMDiffOn_univ.mp ?_ - exact contMDiffOn_chart_symm (x := (⟨0⟩ : TimeMan)) + contMDiff_invFun := contMDiffOn_univ.mp (contMDiffOn_chart_symm (x := (⟨0⟩ : TimeMan))) /-! diff --git a/Physlib/SpaceAndTime/Time/TimeTransMan.lean b/Physlib/SpaceAndTime/Time/TimeTransMan.lean index 9dd46be15..1d9d5a054 100644 --- a/Physlib/SpaceAndTime/Time/TimeTransMan.lean +++ b/Physlib/SpaceAndTime/Time/TimeTransMan.lean @@ -84,16 +84,12 @@ lemma val_range : Set.range val = Set.univ := by lemma val_inducing : Topology.IsInducing TimeTransMan.val where eq_induced := rfl -lemma val_injective : Function.Injective TimeTransMan.val := by - intro t1 t2 h - cases t1 - cases t2 - simp_all +lemma val_injective : Function.Injective TimeTransMan.val := + fun _ _ h => ext_of h lemma val_isOpenEmbedding : Topology.IsOpenEmbedding TimeTransMan.val where eq_induced := rfl - isOpen_range := by - simp + isOpen_range := by simp injective := val_injective lemma isOpen_iff {s : Set TimeTransMan} : @@ -104,13 +100,8 @@ lemma isOpen_iff {s : Set TimeTransMan} : def valHomeomorphism : TimeTransMan ≃ₜ ℝ where toFun := TimeTransMan.val invFun := fun t => { val := t } - left_inv := by - intro t - cases t - rfl - right_inv := by - intro t - rfl + left_inv := fun ⟨_⟩ => rfl + right_inv := fun _ => rfl continuous_toFun := by fun_prop continuous_invFun := by refine { isOpen_preimage := ?_ } @@ -133,8 +124,7 @@ def valHomeomorphism : TimeTransMan ≃ₜ ℝ where instance : ChartedSpace ℝ TimeTransMan where atlas := { valHomeomorphism.toOpenPartialHomeomorph } chartAt _ := valHomeomorphism.toOpenPartialHomeomorph - mem_chart_source := by - simp + mem_chart_source := by simp chart_mem_atlas := by intro x simp @@ -149,17 +139,14 @@ instance : IsManifold 𝓘(ℝ, ℝ) ω TimeTransMan where subst h1 h2 exact symm_trans_mem_contDiffGroupoid valHomeomorphism.toOpenPartialHomeomorph -lemma val_contDiff : ContMDiff 𝓘(ℝ, ℝ) 𝓘(ℝ, ℝ) ω TimeTransMan.val := by - refine contMDiffOn_univ.mp ?_ - exact contMDiffOn_chart (x := (⟨0⟩ : TimeTransMan)) +lemma val_contDiff : ContMDiff 𝓘(ℝ, ℝ) 𝓘(ℝ, ℝ) ω TimeTransMan.val := + contMDiffOn_univ.mp (contMDiffOn_chart (x := (⟨0⟩ : TimeTransMan))) /-- The choice of map `Time.val` from `TimeTransMan` to `ℝ` as a diffeomorphism. -/ noncomputable def valDiffeomorphism : TimeTransMan ≃ₘ^ω⟮𝓘(ℝ, ℝ), 𝓘(ℝ, ℝ)⟯ ℝ where toEquiv := valHomeomorphism.toEquiv contMDiff_toFun := val_contDiff - contMDiff_invFun := by - refine contMDiffOn_univ.mp ?_ - exact contMDiffOn_chart_symm (x := (⟨0⟩ : TimeTransMan)) + contMDiff_invFun := contMDiffOn_univ.mp (contMDiffOn_chart_symm (x := (⟨0⟩ : TimeTransMan))) /-! @@ -175,14 +162,8 @@ lemma vadd_val (p : ℝ) (t : TimeTransMan) : (p +ᵥ t).val = p + t.val := rfl instance : AddAction ℝ TimeTransMan where - zero_vadd t := by - cases t - ext - simp - add_vadd p1 p2 t := by - ext - simp only [vadd_val] - ring + zero_vadd t := ext_of (by simp) + add_vadd p1 p2 t := ext_of (by simp [add_assoc]) /-! @@ -235,8 +216,7 @@ lemma diff_eq_val (x : TimeUnit) (t1 t2 : TimeTransMan) : @[simp] lemma diff_self (x : TimeUnit) (t : TimeTransMan) : - diff x t t = 0 := by - simp [diff_eq_val] + diff x t t = 0 := by simp [diff_eq_val] lemma diff_fst_injective (x : TimeUnit) (t : TimeTransMan) : Function.Injective (diff x · t) := by intro t1 t2 h @@ -307,8 +287,7 @@ lemma addTime_eq_val (x : TimeUnit) (r : ℝ) (t : TimeTransMan) : simp [diff_eq_val] lemma addTime_val (x : TimeUnit) (r : ℝ) (t : TimeTransMan) : - (addTime x r t).val = x.1 * r + t.val := by - rw [addTime_eq_val] + (addTime x r t).val = x.1 * r + t.val := by rw [addTime_eq_val] /-! @@ -329,10 +308,8 @@ noncomputable def neg (zero : TimeTransMan) (t : TimeTransMan) : TimeTransMan := negMetric zero default t lemma neg_eq_negMetric (zero : TimeTransMan) (x : TimeUnit) (t : TimeTransMan) : - neg zero t = negMetric zero x t := by - simp [neg, negMetric] - ext - simp [addTime_val, diff_eq_val] + neg zero t = negMetric zero x t := + ext_of (by simp [neg, negMetric, addTime_val, diff_eq_val]) /-! @@ -375,23 +352,18 @@ noncomputable def toTime (zero : TimeTransMan) (x : TimeUnit) : TimeTransMan ≃ @[simp] lemma toTime_zero (zero : TimeTransMan) (x : TimeUnit) : - toTime zero x zero = 0 := by - ext - simp [toTime, diff_eq_val] + toTime zero x zero = 0 := Time.ext (by simp [toTime, diff_eq_val]) @[simp] lemma toTime_symm_zero_add (zero : TimeTransMan) (x : TimeUnit) : - (toTime zero x).symm 0 = zero := by - ext - simp [toTime, addTime_val, diff_eq_val] + (toTime zero x).symm 0 = zero := + ext_of (by simp [toTime, addTime_val, diff_eq_val]) lemma toTime_val (zero : TimeTransMan) (x : TimeUnit) (t : TimeTransMan) : (toTime zero x t).val = diff x t zero := by rfl lemma toTime_symm_val (zero : TimeTransMan) (x : TimeUnit) (r : Time) : - (toTime zero x).symm r = addTime x r zero := by - ext - simp [toTime, addTime_val, diff_eq_val] + (toTime zero x).symm r = addTime x r zero := rfl @[simp] lemma toTime_addTime (zero : TimeTransMan) (x : TimeUnit) (r : ℝ) (τ : TimeTransMan) : @@ -430,9 +402,8 @@ lemma toTime_neg (zero : TimeTransMan) (x : TimeUnit) (t : TimeTransMan) : ring lemma toTime_symm_neg (zero : TimeTransMan) (x : TimeUnit) (t : Time) : - (toTime zero x).symm (- t) = neg zero ((toTime zero x).symm t) := by - ext - simp [toTime_symm_val, addTime_val, diff_eq_val, neg, negMetric] + (toTime zero x).symm (- t) = neg zero ((toTime zero x).symm t) := + ext_of (by simp [toTime_symm_val, addTime_val, diff_eq_val, neg, negMetric]) lemma toTime_symm_sub (zero : TimeTransMan) (x : TimeUnit) (t1 t2 : Time) : (toTime zero x).symm (t1 - t2) = diff --git a/Physlib/SpaceAndTime/Time/TimeUnit.lean b/Physlib/SpaceAndTime/Time/TimeUnit.lean index 2da8bd01b..e88c95027 100644 --- a/Physlib/SpaceAndTime/Time/TimeUnit.lean +++ b/Physlib/SpaceAndTime/Time/TimeUnit.lean @@ -41,8 +41,7 @@ structure TimeUnit : Type where namespace TimeUnit @[simp] -lemma val_ne_zero (x : TimeUnit) : x.val ≠ 0 := by - exact Ne.symm (ne_of_lt x.property) +lemma val_ne_zero (x : TimeUnit) : x.val ≠ 0 := Ne.symm (ne_of_lt x.property) lemma val_pos (x : TimeUnit) : 0 < x.val := x.property @@ -75,9 +74,7 @@ lemma div_pos (x y : TimeUnit) : (0 : ℝ≥0) < x/ y := by @[simp] lemma div_self (x : TimeUnit) : - x / x = (1 : ℝ≥0) := by - simp [div_eq_val, x.val_ne_zero] - rfl + x / x = (1 : ℝ≥0) := NNReal.eq (_root_.div_self x.val_ne_zero) lemma div_symm (x y : TimeUnit) : x / y = (y / x)⁻¹ := NNReal.eq <| by @@ -103,12 +100,10 @@ def scale (r : ℝ) (x : TimeUnit) (hr : 0 < r := by norm_num) : TimeUnit := @[simp] lemma scale_div_self (x : TimeUnit) (r : ℝ) (hr : 0 < r) : - scale r x hr / x = (⟨r, le_of_lt hr⟩ : ℝ≥0) := by - simp [scale, div_eq_val] + scale r x hr / x = (⟨r, le_of_lt hr⟩ : ℝ≥0) := by simp [scale, div_eq_val] @[simp] -lemma scale_one (x : TimeUnit) : scale 1 x = x := by - simp [scale] +lemma scale_one (x : TimeUnit) : scale 1 x = x := by simp [scale] @[simp] lemma scale_div_scale (x1 x2 : TimeUnit) {r1 r2 : ℝ} (hr1 : 0 < r1) (hr2 : 0 < r2) : @@ -127,8 +122,7 @@ lemma self_div_scale (x : TimeUnit) (r : ℝ) (hr : 0 < r) : @[simp] lemma scale_scale (x : TimeUnit) (r1 r2 : ℝ) (hr1 : 0 < r1) (hr2 : 0 < r2) : scale r1 (scale r2 x hr2) hr1 = scale (r1 * r2) x (mul_pos hr1 hr2) := by - simp [scale] - ring + simp [scale, mul_assoc] /-! ## Specific choices of time units diff --git a/Physlib/SpaceAndTime/TimeAndSpace/Basic.lean b/Physlib/SpaceAndTime/TimeAndSpace/Basic.lean index 480e656a9..cae49e6df 100644 --- a/Physlib/SpaceAndTime/TimeAndSpace/Basic.lean +++ b/Physlib/SpaceAndTime/TimeAndSpace/Basic.lean @@ -97,14 +97,12 @@ lemma space_apply (tx : TimeAndSpace d) : /-- The time projection is nonexpanding for the product metric. -/ lemma dist_time_le (tx ty : TimeAndSpace d) : dist (time tx) (time ty) ≤ dist tx ty := by - change dist tx.1 ty.1 ≤ dist tx ty rw [Prod.dist_eq] exact le_max_left (dist tx.1 ty.1) (dist tx.2 ty.2) /-- The spatial projection is nonexpanding for the product metric. -/ lemma dist_space_le (tx ty : TimeAndSpace d) : dist (space tx) (space ty) ≤ dist tx ty := by - change dist tx.2 ty.2 ≤ dist tx ty rw [Prod.dist_eq] exact le_max_right (dist tx.1 ty.1) (dist tx.2 ty.2) @@ -373,33 +371,27 @@ noncomputable def distTimeDeriv {M d} [NormedAddCommGroup M] [NormedSpace ℝ M] toFun f := let ev : ((Time × Space d) →L[ℝ] M) →L[ℝ] M := { toFun v := v (1, 0) - map_add' v1 v2 := by - simp only [_root_.add_apply] - map_smul' a v := by - simp + map_add' _ _ := rfl + map_smul' _ _ := rfl } ev.comp (Distribution.fderivD ℝ f) - map_add' f1 f2 := by - simp + map_add' f1 f2 := by simp map_smul' a f := by simp lemma distTimeDeriv_apply {M d} [NormedAddCommGroup M] [NormedSpace ℝ M] (f : (Time × Space d) →d[ℝ] M) (ε : 𝓢(Time × Space d, ℝ)) : - (distTimeDeriv f) ε = fderivD ℝ f ε (1, 0) := by - simp [distTimeDeriv] + (distTimeDeriv f) ε = fderivD ℝ f ε (1, 0) := by simp [distTimeDeriv] lemma distTimeDeriv_apply' {M d} [NormedAddCommGroup M] [NormedSpace ℝ M] (f : (Time × Space d) →d[ℝ] M) (ε : 𝓢(Time × Space d, ℝ)) : (distTimeDeriv f) ε = -f (SchwartzMap.evalCLM ℝ (Time × Space d) ℝ (1, 0) - ((fderivCLM ℝ (Time × Space d) ℝ) ε)) := by - rw [distTimeDeriv_apply, fderivD_apply] + ((fderivCLM ℝ (Time × Space d) ℝ) ε)) := by rw [distTimeDeriv_apply, fderivD_apply] lemma apply_fderiv_eq_distTimeDeriv {M d} [NormedAddCommGroup M] [NormedSpace ℝ M] (f : (Time × Space d) →d[ℝ] M) (ε : 𝓢(Time × Space d, ℝ)) : f (SchwartzMap.evalCLM ℝ (Time × Space d) ℝ (1, 0) ((fderivCLM ℝ (Time × Space d) ℝ) ε)) = - - (distTimeDeriv f) ε := by - simp [distTimeDeriv_apply'] + - (distTimeDeriv f) ε := by simp [distTimeDeriv_apply'] /-! @@ -425,34 +417,28 @@ noncomputable def distSpaceDeriv {M d} [NormedAddCommGroup M] [NormedSpace ℝ M toFun f := let ev : (Time × Space d →L[ℝ] M) →L[ℝ] M := { toFun v := v (0, basis i) - map_add' v1 v2 := by - simp only [_root_.add_apply] - map_smul' a v := by - simp + map_add' _ _ := rfl + map_smul' _ _ := rfl } ev.comp (Distribution.fderivD ℝ f) - map_add' f1 f2 := by - simp + map_add' f1 f2 := by simp map_smul' a f := by simp lemma distSpaceDeriv_apply {M d} [NormedAddCommGroup M] [NormedSpace ℝ M] (i : Fin d) (f : (Time × Space d) →d[ℝ] M) (ε : 𝓢(Time × Space d, ℝ)) : - (distSpaceDeriv i f) ε = fderivD ℝ f ε (0, basis i) := by - simp [distSpaceDeriv] + (distSpaceDeriv i f) ε = fderivD ℝ f ε (0, basis i) := by simp [distSpaceDeriv] lemma distSpaceDeriv_apply' {M d} [NormedAddCommGroup M] [NormedSpace ℝ M] (i : Fin d) (f : (Time × Space d) →d[ℝ] M) (ε : 𝓢(Time × Space d, ℝ)) : (distSpaceDeriv i f) ε = - f ((SchwartzMap.evalCLM ℝ (Time × Space d) ℝ (0, basis i)) - ((fderivCLM ℝ (Time × Space d) ℝ) ε)) := by - rw [distSpaceDeriv_apply, fderivD_apply] + ((fderivCLM ℝ (Time × Space d) ℝ) ε)) := by rw [distSpaceDeriv_apply, fderivD_apply] lemma apply_fderiv_eq_distSpaceDeriv {M d} [NormedAddCommGroup M] [NormedSpace ℝ M] (i : Fin d) (f : (Time × Space d) →d[ℝ] M) (ε : 𝓢(Time × Space d, ℝ)) : f ((SchwartzMap.evalCLM ℝ (Time × Space d) ℝ (0, basis i)) ((fderivCLM ℝ (Time × Space d) ℝ) ε)) = - - (distSpaceDeriv i f) ε := by - simp [distSpaceDeriv_apply'] + - (distSpaceDeriv i f) ε := by simp [distSpaceDeriv_apply'] /-! @@ -537,8 +523,7 @@ noncomputable def distSpaceGrad {d} : simp lemma distSpaceGrad_apply {d} (f : (Time × Space d) →d[ℝ] ℝ) (ε : 𝓢(Time × Space d, ℝ)) : - distSpaceGrad f ε = fun i => distSpaceDeriv i f ε := by - rfl + distSpaceGrad f ε = fun i => distSpaceDeriv i f ε := rfl /-! diff --git a/Physlib/SpaceAndTime/TimeAndSpace/ConstantTimeDist.lean b/Physlib/SpaceAndTime/TimeAndSpace/ConstantTimeDist.lean index 3cb0daf08..56358bdbe 100644 --- a/Physlib/SpaceAndTime/TimeAndSpace/ConstantTimeDist.lean +++ b/Physlib/SpaceAndTime/TimeAndSpace/ConstantTimeDist.lean @@ -152,7 +152,6 @@ lemma time_integral_hasFDerivAt {d : ℕ} (η : 𝓢(Time × Space d, ℝ)) (x fun x₀ t => fderiv ℝ (fun x : Space d => η (t, x)) x₀ have hF : ∀ t, ∀ x, HasFDerivAt (F · t) (F' x t) x := by intro t x - dsimp [F, F'] refine DifferentiableAt.hasFDerivAt ?_ have hf := η.smooth' apply Differentiable.differentiableAt @@ -210,8 +209,7 @@ lemma time_integral_hasFDerivAt {d : ℕ} (η : 𝓢(Time × Space d, ℝ)) (x · filter_upwards with x fun_prop · simp [F] - have hf : Integrable η (volume.prod volume) := by - exact η.integrable + have hf : Integrable η (volume.prod volume) := η.integrable apply MeasureTheory.Integrable.comp_measurable · haveI : (Measure.map (fun t => (t, x₀)) (volume (α := Time))).HasTemperateGrowth := by refine { exists_integrable := ?_ } @@ -273,8 +271,7 @@ lemma time_integral_hasFDerivAt {d : ℕ} (η : 𝓢(Time × Space d, ℝ)) (x · rfl fun_prop fun_prop - · apply Differentiable.differentiableAt - exact η.smooth'.differentiable (by simp) + · exact (η.smooth'.differentiable (by simp)).differentiableAt fun_prop · apply Integrable.const_mul convert hrt using 1 @@ -380,8 +377,7 @@ lemma integrable_fderiv_space {d : ℕ} (η : 𝓢(Time × Space d, ℝ)) (x : S · exact hx x t · fun_prop · fun_prop - · apply Differentiable.differentiableAt - exact η.smooth'.differentiable (by simp) + · exact (η.smooth'.differentiable (by simp)).differentiableAt · fun_prop rw [← MeasureTheory.integrable_norm_iff] apply Integrable.mono' (g := fun t => k * ‖ContinuousLinearMap.prod (0 : Space d →L[ℝ] Time) @@ -449,8 +445,7 @@ lemma time_integral_contDiff {d : ℕ} (n : ℕ) (η : 𝓢(Time × Space d, ℝ ContinuousLinearMap.coe_id', id_eq, SchwartzMap.lineDerivOp_apply_eq_fderiv] fun_prop fun_prop - · apply Differentiable.differentiableAt - exact η.smooth'.differentiable (by simp) + · exact (η.smooth'.differentiable (by simp)).differentiableAt fun_prop rw [hl2] apply ih @@ -755,9 +750,7 @@ lemma time_integral_iteratedFDeriv_eq {d : ℕ} (n : ℕ) (η : 𝓢(Time × Spa (ContinuousLinearMap.id ℝ (Space d)))) := by ext y rw [time_integral_iteratedFDeriv_apply] - rw [← ContinuousMultilinearMap.integral_apply] - rfl - exact iteratedFDeriv_integrable η x + exact (ContinuousMultilinearMap.integral_apply (iteratedFDeriv_integrable η x) _).symm /-! @@ -812,8 +805,7 @@ lemma time_integral_mul_pow_iteratedFDeriv_norm_le {d : ℕ} (n m : ℕ) : ‖((0 : Space d →L[ℝ] Time).prod (.id ℝ (Space d)))‖ ^ n := by refine mul_le_mul_of_nonneg ?_ (by rfl) (by positivity) (by positivity) refine integral_mono ?_ ?_ ?_ - · apply Integrable.const_mul - exact iteratedFDeriv_norm_integrable η x + · exact (iteratedFDeriv_norm_integrable η x).const_mul (‖x‖ ^ m) · exact iteratedFDeriv_norm_mul_pow_integrable n m η x · refine Pi.le_def.mpr ?_ intro t @@ -825,8 +817,7 @@ lemma time_integral_mul_pow_iteratedFDeriv_norm_le {d : ℕ} (n m : ℕ) : refine mul_le_mul_of_nonneg ?_ (by rfl) (by positivity) (by positivity) refine integral_mono ?_ ?_ ?_ · exact iteratedFDeriv_norm_mul_pow_integrable n m η x - · apply Integrable.const_mul - exact hrt + · exact hrt.const_mul k · refine Pi.le_def.mpr ?_ intro t convert! hbound t using 1 @@ -934,8 +925,7 @@ lemma constantTime_distSpaceDeriv {M : Type} {d : ℕ} [NormedAddCommGroup M] [N ContinuousLinearMap.coe_id', id_eq] · fun_prop · fun_prop - · apply Differentiable.differentiableAt - exact η.smooth'.differentiable (by simp) + · exact (η.smooth'.differentiable (by simp)).differentiableAt · fun_prop /-! @@ -965,8 +955,7 @@ lemma constantTime_distSpaceDiv {d : ℕ} (f : (Space d) →d[ℝ] EuclideanSpac rw [Space.distSpaceDiv_apply_eq_sum_distSpaceDeriv, Space.distDiv_apply_eq_sum_distDeriv] congr funext i - rw [constantTime_distSpaceDeriv] - rfl + exact congrArg (fun g => (g η).ofLp i) (constantTime_distSpaceDeriv i f) /-! @@ -1013,8 +1002,7 @@ lemma constantTime_distTimeDeriv {M : Type} [NormedAddCommGroup M] [NormedSpace ContinuousLinearMap.coe_id', id_eq, _root_.zero_apply] · fun_prop · fun_prop - · apply Differentiable.differentiableAt - exact η.smooth'.differentiable (by simp) + · exact (η.smooth'.differentiable (by simp)).differentiableAt · fun_prop _ = ∫ (t : Time), (fun t => 1) t * fderiv ℝ (fun t => η (t, x)) t 1 := by simp _ = - ∫ (t : Time), fderiv ℝ (fun t => 1) t 1 * (fun t => η (t, x)) t := by @@ -1025,8 +1013,7 @@ lemma constantTime_distTimeDeriv {M : Type} [NormedAddCommGroup M] [NormedSpace simp only [one_mul] change (fderiv ℝ (η ∘ fun t => (t, x)) t) 1 rw [fderiv_comp _ (by - apply Differentiable.differentiableAt - exact η.smooth'.differentiable (by simp)) + exact (η.smooth'.differentiable (by simp)).differentiableAt) (by fun_prop), DifferentiableAt.fderiv_prodMk (by fun_prop) (by fun_prop)] simp only [fderiv_fun_id, fderiv_fun_const, Pi.ofNat_apply, ContinuousLinearMap.comp_apply, ContinuousLinearMap.prod_apply, diff --git a/Physlib/SpaceAndTime/TimeAndSpace/EuclideanGroup/Action.lean b/Physlib/SpaceAndTime/TimeAndSpace/EuclideanGroup/Action.lean index a7e4575c9..e77aade77 100644 --- a/Physlib/SpaceAndTime/TimeAndSpace/EuclideanGroup/Action.lean +++ b/Physlib/SpaceAndTime/TimeAndSpace/EuclideanGroup/Action.lean @@ -82,13 +82,11 @@ lemma snd_smul (g : EuclideanGroup d) (tx : TimeAndSpace d) : /-- The Euclidean-group action fixes the time projection. -/ lemma time_smul (g : EuclideanGroup d) (tx : TimeAndSpace d) : - time (g • tx) = time tx := by - simp [time] + time (g • tx) = time tx := by simp [time] /-- The Euclidean-group action applies to the space projection. -/ lemma space_smul (g : EuclideanGroup d) (tx : TimeAndSpace d) : - space (g • tx) = g • space tx := by - simp [space] + space (g • tx) = g • space tx := by simp [space] /-- The Euclidean-group action on `TimeAndSpace d` preserves product distance. -/ lemma dist_smul (g : EuclideanGroup d) (tx ty : TimeAndSpace d) : diff --git a/Physlib/SpaceAndTime/TimeAndSpace/EuclideanGroup/SchwartzAction.lean b/Physlib/SpaceAndTime/TimeAndSpace/EuclideanGroup/SchwartzAction.lean index e4e3b76ef..db3528f69 100644 --- a/Physlib/SpaceAndTime/TimeAndSpace/EuclideanGroup/SchwartzAction.lean +++ b/Physlib/SpaceAndTime/TimeAndSpace/EuclideanGroup/SchwartzAction.lean @@ -70,8 +70,7 @@ noncomputable def schwartzEuclideanAction {d : ℕ} : ext η tx simp only [_root_.mul_inv_rev, SchwartzMap.compCLMOfAntilipschitz_apply, Function.comp_apply] - rw [mul_smul] - rfl + exact congrArg η (mul_smul _ _ _) /-- Pointwise formula for the monoid-homomorphism form of the Schwartz-map pullback action. -/ @[simp] diff --git a/Physlib/StatisticalMechanics/BoltzmannConstant.lean b/Physlib/StatisticalMechanics/BoltzmannConstant.lean index 9836dfe8b..212eabbb6 100644 --- a/Physlib/StatisticalMechanics/BoltzmannConstant.lean +++ b/Physlib/StatisticalMechanics/BoltzmannConstant.lean @@ -39,7 +39,6 @@ lemma kB_pos : 0 < kB := kBAx.2 lemma kB_nonneg : 0 ≤ kB := le_of_lt kBAx.2 /-- The Boltzmann constant is not equal to zero. -/ -lemma kB_ne_zero : kB ≠ 0 := by - linarith [kB_pos] +lemma kB_ne_zero : kB ≠ 0 := by linarith [kB_pos] end Constants diff --git a/Physlib/StatisticalMechanics/CanonicalEnsemble/Basic.lean b/Physlib/StatisticalMechanics/CanonicalEnsemble/Basic.lean index ff8e5c1aa..4a7f1aead 100644 --- a/Physlib/StatisticalMechanics/CanonicalEnsemble/Basic.lean +++ b/Physlib/StatisticalMechanics/CanonicalEnsemble/Basic.lean @@ -285,8 +285,7 @@ instance [NeZero 𝓒.μ] [NeZero 𝓒1.μ] : NeZero (𝓒 + 𝓒1).μ := by (𝓒.μ Set.univ) * (𝓒1.μ Set.univ) := by rw [← @Measure.prod_prod] simp - rw [h1] - exact NeZero.pos (𝓒.μ Set.univ * 𝓒1.μ Set.univ) + simpa [h1] using NeZero.pos (𝓒.μ Set.univ * 𝓒1.μ Set.univ) instance μ_neZero_congr [NeZero 𝓒.μ] (e : ι1 ≃ᵐ ι) : NeZero (𝓒.congr e).μ := by @@ -371,26 +370,21 @@ lemma μBolt_ne_zero_of_μ_ne_zero (T : Temperature) (h : 𝓒.μ ≠ 0) : simp only [Measure.coe_zero, Pi.zero_apply] have hs : {x | ENNReal.ofReal (rexp (-(↑T.β * 𝓒.energy x))) ≠ 0} = Set.univ := by ext i - simp only [ne_eq, ENNReal.ofReal_eq_zero, not_le, Set.mem_setOf_eq, Set.mem_univ, iff_true] - exact exp_pos _ + simp [ENNReal.ofReal_eq_zero, exp_pos] conv => enter [1, s] rw [MeasureTheory.withDensity_apply_eq_zero' (by fun_prop), hs] simp simpa using h -instance (T : Temperature) [NeZero 𝓒.μ] : NeZero (𝓒.μBolt T) := by - refine { out := ?_ } - apply μBolt_ne_zero_of_μ_ne_zero - exact Ne.symm (NeZero.ne' 𝓒.μ) +instance (T : Temperature) [NeZero 𝓒.μ] : NeZero (𝓒.μBolt T) := + ⟨μBolt_ne_zero_of_μ_ne_zero 𝓒 T (Ne.symm (NeZero.ne' 𝓒.μ))⟩ instance (T : Temperature) [IsFiniteMeasure (𝓒.μBolt T)] [IsFiniteMeasure (𝓒1.μBolt T)] : - IsFiniteMeasure ((𝓒 + 𝓒1).μBolt T) := by - simp only [μBolt_add]; infer_instance + IsFiniteMeasure ((𝓒 + 𝓒1).μBolt T) := by simp only [μBolt_add]; infer_instance instance (T : Temperature) [IsFiniteMeasure (𝓒.μBolt T)] (n : ℕ) : - IsFiniteMeasure ((nsmul n 𝓒).μBolt T) := by - simp [μBolt_nsmul]; infer_instance + IsFiniteMeasure ((nsmul n 𝓒).μBolt T) := by simp [μBolt_nsmul]; infer_instance /-! @@ -452,8 +446,7 @@ lemma mathematicalPartitionFunction_eq_zero_iff (T : Temperature) [IsFiniteMeasu let s : Set ι := {x | 0 < rexp (-(T.β * 𝓒.energy x))} have h : s = Set.univ := by ext i - simp [s] - exact exp_pos (-(T.β * 𝓒.energy i)) + simpa [s] using exp_pos (-(T.β * 𝓒.energy i)) change 𝓒.μ s = 0 ↔ 𝓒.μ = 0 rw [h] simp only [Measure.measure_univ_eq_zero] @@ -470,8 +463,7 @@ lemma mathematicalPartitionFunction_comp_ofβ_apply (β : ℝ≥0) : measure is non-zero and the Boltzmann measure is finite. -/ lemma mathematicalPartitionFunction_pos (T : Temperature) [IsFiniteMeasure (𝓒.μBolt T)] [NeZero 𝓒.μ] : - 0 < 𝓒.mathematicalPartitionFunction T := by - simp [mathematicalPartitionFunction] + 0 < 𝓒.mathematicalPartitionFunction T := by simp [mathematicalPartitionFunction] open NNReal Constants @@ -494,8 +486,7 @@ lemma probability_add {T : Temperature} (i : ι × ι1) : @[simp] lemma probability_congr (e : ι1 ≃ᵐ ι) (T : Temperature) (i : ι1) : - (𝓒.congr e).probability T i = 𝓒.probability T (e i) := by - simp [probability] + (𝓒.congr e).probability T i = 𝓒.probability T (e i) := by simp [probability] lemma probability_nsmul (n : ℕ) (T : Temperature) (f : Fin n → ι) : (nsmul n 𝓒).probability T f = ∏ i, 𝓒.probability T (f i) := by @@ -603,8 +594,7 @@ lemma integrable_energy_congr (T : Temperature) (e : ι1 ≃ᵐ ι) Integrable (𝓒.congr e).energy ((𝓒.congr e).μProd T) := by simp [μProd_congr] refine (integrable_map_equiv e.symm (𝓒.congr e).energy).mpr ?_ - simp only [congr_energy_comp_symmm] - exact h + simpa only [congr_energy_comp_symmm] using h @[fun_prop] lemma integrable_energy_nsmul (n : ℕ) (T : Temperature) @@ -656,8 +646,7 @@ lemma meanEnergy_add {T : Temperature} simp rw [integral_add h1 (integrable_const _)] rw [integral_const] - simp - rfl + simp [meanEnergy] · have h1 := integrable_energy_add 𝓒 𝓒1 T h1 h2 simp_all only [μProd_add] exact h1 @@ -725,9 +714,7 @@ lemma differentialEntropy_nonneg_of_prob_le_one intro i have hpos := probability_pos (𝓒:=𝓒) (T:=T) i have hle := hP_le_one i - have hle' : 𝓒.probability T i ≤ Real.exp 0 := by - simpa [Real.exp_zero] using hle - exact (log_le_iff_le_exp hpos).mpr hle' + exact (log_le_iff_le_exp hpos).mpr (by simpa [Real.exp_zero] using hle) have hInt0 : Integrable (fun _ : ι => (0 : ℝ)) (𝓒.μProd T) := integrable_const _ have hIntLe : (∫ i, Real.log (𝓒.probability T i) ∂𝓒.μProd T) ≤ (∫ _i, (0 : ℝ) ∂𝓒.μProd T) := @@ -772,8 +759,7 @@ lemma partitionFunction_pos lemma partitionFunction_congr (𝓒 : CanonicalEnsemble ι) (e : ι1 ≃ᵐ ι) (T : Temperature) : - (𝓒.congr e).partitionFunction T = 𝓒.partitionFunction T := by - simp [partitionFunction] + (𝓒.congr e).partitionFunction T = 𝓒.partitionFunction T := by simp [partitionFunction] lemma partitionFunction_add (𝓒 : CanonicalEnsemble ι) (𝓒1 : CanonicalEnsemble ι1) @@ -794,13 +780,11 @@ lemma partitionFunction_nsmul lemma partitionFunction_dof_zero (𝓒 : CanonicalEnsemble ι) (T : Temperature) (h : 𝓒.dof = 0) : - 𝓒.partitionFunction T = 𝓒.mathematicalPartitionFunction T := by - simp [partitionFunction, h] + 𝓒.partitionFunction T = 𝓒.mathematicalPartitionFunction T := by simp [partitionFunction, h] lemma partitionFunction_phase_space_unit_one (𝓒 : CanonicalEnsemble ι) (T : Temperature) (h : 𝓒.phaseSpaceunit = 1) : - 𝓒.partitionFunction T = 𝓒.mathematicalPartitionFunction T := by - simp [partitionFunction, h] + 𝓒.partitionFunction T = 𝓒.mathematicalPartitionFunction T := by simp [partitionFunction, h] lemma log_partitionFunction (𝓒 : CanonicalEnsemble ι) (T : Temperature) @@ -812,8 +796,7 @@ lemma log_partitionFunction have hden : 0 < 𝓒.phaseSpaceunit ^ 𝓒.dof := pow_pos 𝓒.hPos _ have hlogpow : Real.log (𝓒.phaseSpaceunit ^ 𝓒.dof) - = (𝓒.dof : ℝ) * Real.log 𝓒.phaseSpaceunit := by - simp + = (𝓒.dof : ℝ) * Real.log 𝓒.phaseSpaceunit := by simp simp [partitionFunction, Real.log_div hZ.ne' hden.ne', hlogpow, sub_eq_add_neg] @@ -846,8 +829,7 @@ lemma helmholtzFreeEnergy_def lemma helmholtzFreeEnergy_congr (𝓒 : CanonicalEnsemble ι) (e : ι1 ≃ᵐ ι) (T : Temperature) : - (𝓒.congr e).helmholtzFreeEnergy T = 𝓒.helmholtzFreeEnergy T := by - simp [helmholtzFreeEnergy] + (𝓒.congr e).helmholtzFreeEnergy T = 𝓒.helmholtzFreeEnergy T := by simp [helmholtzFreeEnergy] lemma helmholtzFreeEnergy_dof_zero (𝓒 : CanonicalEnsemble ι) (T : Temperature) (h : 𝓒.dof = 0) : @@ -874,14 +856,12 @@ lemma helmholtzFreeEnergy_add calc (𝓒 + 𝓒1).helmholtzFreeEnergy T = -kB * T.val * Real.log ((𝓒 + 𝓒1).partitionFunction T) := rfl - _ = -kB * T.val * Real.log (𝓒.partitionFunction T * 𝓒1.partitionFunction T) := by - rw [hPF] + _ = -kB * T.val * Real.log (𝓒.partitionFunction T * 𝓒1.partitionFunction T) := by rw [hPF] _ = -kB * T.val * (Real.log (𝓒.partitionFunction T) + Real.log (𝓒1.partitionFunction T)) := by rw [Real.log_mul hpf₁.ne' hpf₂.ne'] _ = (-kB * T.val) * Real.log (𝓒.partitionFunction T) - + (-kB * T.val) * Real.log (𝓒1.partitionFunction T) := by - ring + + (-kB * T.val) * Real.log (𝓒1.partitionFunction T) := by ring _ = 𝓒.helmholtzFreeEnergy T + 𝓒1.helmholtzFreeEnergy T := by simp [helmholtzFreeEnergy, mul_comm, mul_assoc] @@ -898,10 +878,8 @@ lemma helmholtzFreeEnergy_nsmul calc (nsmul n 𝓒).helmholtzFreeEnergy T = -kB * T.val * Real.log ((nsmul n 𝓒).partitionFunction T) := rfl - _ = -kB * T.val * ((n : ℝ) * Real.log (𝓒.partitionFunction T)) := by - rw [hlog] - _ = (n : ℝ) * (-kB * T.val * Real.log (𝓒.partitionFunction T)) := by - ring + _ = -kB * T.val * ((n : ℝ) * Real.log (𝓒.partitionFunction T)) := by rw [hlog] + _ = (n : ℝ) * (-kB * T.val * Real.log (𝓒.partitionFunction T)) := by ring _ = n * 𝓒.helmholtzFreeEnergy T := by simp [helmholtzFreeEnergy, mul_comm, mul_left_comm, mul_assoc] @@ -998,18 +976,15 @@ lemma integral_physicalProbability_base lemma physicalProbability_dof_zero (T : Temperature) (h : 𝓒.dof = 0) (i : ι) : - 𝓒.physicalProbability T i = 𝓒.probability T i := by - simp [physicalProbability, h] + 𝓒.physicalProbability T i = 𝓒.probability T i := by simp [physicalProbability, h] lemma physicalProbability_phase_space_unit_one (T : Temperature) (h : 𝓒.phaseSpaceunit = 1) (i : ι) : - 𝓒.physicalProbability T i = 𝓒.probability T i := by - simp [physicalProbability, h] + 𝓒.physicalProbability T i = 𝓒.probability T i := by simp [physicalProbability, h] lemma physicalProbability_congr (e : ι1 ≃ᵐ ι) (T : Temperature) (i : ι1) : (𝓒.congr e).physicalProbability T i - = 𝓒.physicalProbability T (e i) := by - simp [physicalProbability, probability] + = 𝓒.physicalProbability T (e i) := by simp [physicalProbability, probability] lemma physicalProbability_add {ι1} [MeasurableSpace ι1] diff --git a/Physlib/StatisticalMechanics/CanonicalEnsemble/Finite.lean b/Physlib/StatisticalMechanics/CanonicalEnsemble/Finite.lean index f1f80ed17..1b3b04e0d 100644 --- a/Physlib/StatisticalMechanics/CanonicalEnsemble/Finite.lean +++ b/Physlib/StatisticalMechanics/CanonicalEnsemble/Finite.lean @@ -81,10 +81,8 @@ instance [IsFinite 𝓒] [IsFinite 𝓒1] : IsFinite (𝓒 + 𝓒1) where · exact ht · exact hs · exact MeasurableSet.prod hs ht - dof_eq_zero := by - simp [IsFinite.dof_eq_zero (𝓒:=𝓒), IsFinite.dof_eq_zero (𝓒:=𝓒1)] - phase_space_unit_eq_one := by - simp [IsFinite.phase_space_unit_eq_one (𝓒:=𝓒)] + dof_eq_zero := by simp [IsFinite.dof_eq_zero (𝓒:=𝓒), IsFinite.dof_eq_zero (𝓒:=𝓒1)] + phase_space_unit_eq_one := by simp [IsFinite.phase_space_unit_eq_one (𝓒:=𝓒)] instance [IsFinite 𝓒] (e : ι1 ≃ᵐ ι) : IsFinite (congr 𝓒 e) where μ_eq_count := by @@ -104,10 +102,8 @@ instance [IsFinite 𝓒] (e : ι1 ≃ᵐ ι) : IsFinite (congr 𝓒 e) where · exact Set.toFinite (⇑e '' s) · exact hs · exact (MeasurableEquiv.measurableSet_preimage e.symm).mpr hs - dof_eq_zero := by - simp [IsFinite.dof_eq_zero (𝓒:=𝓒)] - phase_space_unit_eq_one := by - simp [IsFinite.phase_space_unit_eq_one (𝓒:=𝓒)] + dof_eq_zero := by simp [IsFinite.dof_eq_zero (𝓒:=𝓒)] + phase_space_unit_eq_one := by simp [IsFinite.phase_space_unit_eq_one (𝓒:=𝓒)] instance [IsFinite 𝓒] (n : ℕ) : IsFinite (nsmul n 𝓒) where μ_eq_count := by @@ -126,8 +122,7 @@ instance [IsFinite 𝓒] (n : ℕ) : IsFinite (nsmul n 𝓒) where | succ n ih => haveI : IsFinite (nsmul n 𝓒) := { μ_eq_count := ih - dof_eq_zero := by - simp [CanonicalEnsemble.dof_nsmul, IsFinite.dof_eq_zero (𝓒:=𝓒)] + dof_eq_zero := by simp [CanonicalEnsemble.dof_nsmul, IsFinite.dof_eq_zero (𝓒:=𝓒)] phase_space_unit_eq_one := by simp [CanonicalEnsemble.phase_space_unit_nsmul, IsFinite.phase_space_unit_eq_one (𝓒:=𝓒)] @@ -138,8 +133,7 @@ instance [IsFinite 𝓒] (n : ℕ) : IsFinite (nsmul n 𝓒) where (MeasurableEquiv.piFinSuccAbove (fun _ => ι) 0)).μ = Measure.count := by erw [IsFinite.μ_eq_count]; aesop rw [← h]; rw [← @nsmul_succ] - dof_eq_zero := by - simp [CanonicalEnsemble.dof_nsmul, IsFinite.dof_eq_zero (𝓒:=𝓒)] + dof_eq_zero := by simp [CanonicalEnsemble.dof_nsmul, IsFinite.dof_eq_zero (𝓒:=𝓒)] phase_space_unit_eq_one := by simp [CanonicalEnsemble.phase_space_unit_nsmul, IsFinite.phase_space_unit_eq_one (𝓒:=𝓒)] @@ -153,8 +147,7 @@ instance [IsFinite 𝓒] [Nonempty ι] : NeZero 𝓒.μ := by refine ⟨?_⟩ intro hμ obtain ⟨i₀⟩ := (inferInstance : Nonempty ι) - have hone : 𝓒.μ {i₀} = 1 := by - simp [IsFinite.μ_eq_count (𝓒:=𝓒)] + have hone : 𝓒.μ {i₀} = 1 := by simp [IsFinite.μ_eq_count (𝓒:=𝓒)] simp_all only [Measure.coe_zero, Pi.zero_apply, zero_ne_one] /-- The Shannon entropy of a finite canonical ensemble. @@ -168,8 +161,7 @@ lemma mathematicalPartitionFunction_of_fintype [IsFinite 𝓒] (T : Temperature) 𝓒.mathematicalPartitionFunction T = ∑ i, exp (- β T * 𝓒.energy i) := by rw [mathematicalPartitionFunction_eq_integral, MeasureTheory.integral_fintype] simp [IsFinite.μ_eq_count] - · rw [IsFinite.μ_eq_count] - exact Integrable.of_finite + · simp [IsFinite.μ_eq_count] lemma partitionFunction_of_fintype [IsFinite 𝓒] (T : Temperature) : 𝓒.partitionFunction T = ∑ i, exp (- T.β * 𝓒.energy i) := by @@ -182,21 +174,17 @@ lemma μBolt_of_fintype (T : Temperature) [IsFinite 𝓒] (i : ι) : rw [μBolt] simp only [neg_mul] rw [@measureReal_def] - simp [IsFinite.μ_eq_count] - exact Real.exp_nonneg _ + simpa [IsFinite.μ_eq_count] using Real.exp_nonneg _ instance {T} [IsFinite 𝓒] : IsFiniteMeasure (𝓒.μBolt T) := by - rw [μBolt] - refine isFiniteMeasure_withDensity_ofReal ?_ - exact HasFiniteIntegral.of_finite + simpa [μBolt] using isFiniteMeasure_withDensity_ofReal HasFiniteIntegral.of_finite @[simp] lemma μProd_of_fintype (T : Temperature) [IsFinite 𝓒] (i : ι) : (𝓒.μProd T).real {i} = 𝓒.probability T i := by rw [μProd] simp [probability] - rw [inv_mul_eq_div] - rfl + rw [inv_mul_eq_div, mathematicalPartitionFunction, measureReal_def] lemma meanEnergy_of_fintype [IsFinite 𝓒] (T : Temperature) : 𝓒.meanEnergy T = ∑ i, 𝓒.energy i * 𝓒.probability T i := by @@ -270,8 +258,7 @@ lemma entropy_nonneg [MeasurableSingletonClass ι] [IsFinite 𝓒] [Nonempty ι] Fintype.sum_nonpos fun i => mul_nonpos_iff.2 <| Or.inl ⟨probability_nonneg_finite 𝓒 T i, Real.log_nonpos (probability_nonneg_finite 𝓒 T i) (probability_le_one 𝓒 T i)⟩ - rw [shannonEntropy, neg_mul, neg_nonneg] - exact mul_nonpos_iff.2 <| Or.inl ⟨kB_pos.le, hsum⟩ + simpa [shannonEntropy, neg_mul, neg_nonneg] using mul_nonpos_iff.2 <| Or.inl ⟨kB_pos.le, hsum⟩ lemma shannonEntropy_eq_differentialEntropy [MeasurableSingletonClass ι] [IsFinite 𝓒] (T : Temperature) : @@ -353,8 +340,7 @@ noncomputable def meanEnergyBetaReal (b : ℝ) : ℝ := lemma meanEnergy_Beta_eq_finite [MeasurableSingletonClass ι] [IsFinite 𝓒] (b : ℝ) (hb : 0 < b) : 𝓒.meanEnergyBeta b = 𝓒.meanEnergyBetaReal b := by let T := Temperature.ofβ (Real.toNNReal b) - have hT_beta : (T.β : ℝ) = b := by - simp [T, Real.toNNReal_of_nonneg hb.le] + have hT_beta : (T.β : ℝ) = b := by simp [T, Real.toNNReal_of_nonneg hb.le] rw [meanEnergyBeta, meanEnergy_of_fintype 𝓒 T, meanEnergyBetaReal] refine Finset.sum_congr rfl fun i _ => ?_ simp [CanonicalEnsemble.probability, probabilityBetaReal, @@ -393,8 +379,7 @@ lemma deriv_mathematicalPartitionFunctionBetaReal (b : ℝ) : unfold mathematicalPartitionFunctionBetaReal meanEnergyNumerator have hd : ∀ c : ℝ, HasDerivAt (fun x => Real.exp (-x * c)) (-c * Real.exp (-b * c)) b := by intro c - have h : HasDerivAt (fun x => -x * c) (-c) b := by - simpa using (hasDerivAt_id b).neg.mul_const c + have h : HasDerivAt (fun x => -x * c) (-c) b := by simpa using (hasDerivAt_id b).neg.mul_const c simpa [mul_comm] using h.exp have h_sum : HasDerivAt (fun x => ∑ i, Real.exp (-x * 𝓒.energy i)) (∑ i, -𝓒.energy i * Real.exp (-b * 𝓒.energy i)) b := @@ -407,8 +392,7 @@ lemma deriv_meanEnergyNumerator (b : ℝ) : unfold meanEnergyNumerator have hd : ∀ c : ℝ, HasDerivAt (fun x => Real.exp (-x * c)) (-c * Real.exp (-b * c)) b := by intro c - have h : HasDerivAt (fun x => -x * c) (-c) b := by - simpa using (hasDerivAt_id b).neg.mul_const c + have h : HasDerivAt (fun x => -x * c) (-c) b := by simpa using (hasDerivAt_id b).neg.mul_const c simpa [mul_comm] using h.exp have h_sum : HasDerivAt (fun x => ∑ i, 𝓒.energy i * Real.exp (-x * 𝓒.energy i)) (∑ i, -(𝓒.energy i)^2 * Real.exp (-b * 𝓒.energy i)) b := by diff --git a/Physlib/StatisticalMechanics/CanonicalEnsemble/Lemmas.lean b/Physlib/StatisticalMechanics/CanonicalEnsemble/Lemmas.lean index f08cee5bf..aa8b9ceaf 100644 --- a/Physlib/StatisticalMechanics/CanonicalEnsemble/Lemmas.lean +++ b/Physlib/StatisticalMechanics/CanonicalEnsemble/Lemmas.lean @@ -80,8 +80,7 @@ lemma helmholtzFreeEnergy_eq_helmholtzMathematicalFreeEnergy_add_correction (T : simp_rw [helmholtzFreeEnergy, mathematicalHelmholtzFreeEnergy, partitionFunction, Real.log_div hZ_pos.ne' h_pow_pos.ne'] have h_log_pow : Real.log (𝓒.phaseSpaceunit ^ 𝓒.dof) - = (𝓒.dof : ℝ) * Real.log 𝓒.phaseSpaceunit := by - simp + = (𝓒.dof : ℝ) * Real.log 𝓒.phaseSpaceunit := by simp simp [sub_eq_add_neg, h_log_pow, mul_add, add_comm, mul_comm, mul_left_comm, mul_assoc] /-- General identity: S_diff = kB β ⟨E⟩ + kB log Z_math. @@ -122,8 +121,7 @@ lemma log_probability Real.log (𝓒.probability T i) = - (β T) * 𝓒.energy i - Real.log (𝓒.mathematicalPartitionFunction T) := by have hZpos := mathematicalPartitionFunction_pos (𝓒:=𝓒) (T:=T) - unfold probability - simp [Real.log_div, hZpos.ne', Real.log_exp, sub_eq_add_neg] + simp [probability, Real.log_div, hZpos.ne', Real.log_exp, sub_eq_add_neg] /-- Auxiliary identity: `kB · β = 1 / T`. `β` is defined as `1 / (kB · T)` (see `Temperature.β`). -/ @@ -155,8 +153,7 @@ lemma thermodynamicEntropy_eq_differentialEntropy_sub_correction - Real.log (𝓒.mathematicalPartitionFunction T) := by intro i have : 0 < 𝓒.mathematicalPartitionFunction T := hZpos - unfold probability - simp [Real.log_div (Real.exp_pos _).ne' this.ne', Real.log_exp, sub_eq_add_neg] + simp [probability, Real.log_div (Real.exp_pos _).ne' this.ne', Real.log_exp, sub_eq_add_neg] have h_log_phys_pt : ∀ i, Real.log (𝓒.physicalProbability T i) = Real.log (𝓒.probability T i) @@ -190,8 +187,7 @@ lemma thermodynamicEntropy_eq_differentialEntropy_sub_correction simp_all only [neg_mul, physicalProbability_def] have h_int_const_eval : ∫ _i, (𝓒.dof : ℝ) * Real.log 𝓒.phaseSpaceunit ∂ 𝓒.μProd T - = (𝓒.dof : ℝ) * Real.log 𝓒.phaseSpaceunit := by - simp [integral_const] + = (𝓒.dof : ℝ) * Real.log 𝓒.phaseSpaceunit := by simp [integral_const] unfold thermodynamicEntropy differentialEntropy rw [h_int_rewrite, integral_add h_int_log_prob h_int_const, @@ -201,8 +197,7 @@ lemma thermodynamicEntropy_eq_differentialEntropy_sub_correction (𝓒.dof : ℝ) * Real.log 𝓒.phaseSpaceunit) = (-kB * ∫ i, Real.log (𝓒.probability T i) ∂ 𝓒.μProd T) - - kB * (𝓒.dof : ℝ) * Real.log 𝓒.phaseSpaceunit := by - ring + - kB * (𝓒.dof : ℝ) * Real.log 𝓒.phaseSpaceunit := by ring simp [this, sub_eq_add_neg, mul_assoc] /-- No semiclassical correction when `dof = 0`. -/ @@ -251,8 +246,7 @@ theorem helmholtzFreeEnergy_eq_meanEnergy_sub_temp_mul_thermodynamicEntropy have hZpos := 𝓒.mathematicalPartitionFunction_pos T have hhpos : 0 < 𝓒.phaseSpaceunit ^ 𝓒.dof := pow_pos 𝓒.hPos _ have hTne : (T.val : ℝ) ≠ 0 := by exact_mod_cast hT.ne' - have hkβT : T.val * (kB * (T.β : ℝ)) = 1 := by - rw [kB_mul_beta T hT, mul_one_div, div_self hTne] + have hkβT : T.val * (kB * (T.β : ℝ)) = 1 := by rw [kB_mul_beta T hT, mul_one_div, div_self hTne] rw [helmholtzFreeEnergy_def, partitionFunction_def, Real.log_div hZpos.ne' hhpos.ne', Real.log_pow, 𝓒.thermodynamicEntropy_eq_differentialEntropy_sub_correction (T := T) hE, 𝓒.differentialEntropy_eq_kB_beta_meanEnergy_add_kB_log_mathZ (T := T) hE] @@ -312,8 +306,7 @@ theorem differentialEntropy_eq_meanEnergy_sub_helmholtz_div_temp_add_correction have hy : 0 < 𝓒.phaseSpaceunit ^ 𝓒.dof := hpow_pos have hlog_pow : Real.log (𝓒.phaseSpaceunit ^ 𝓒.dof) - = (𝓒.dof : ℝ) * Real.log 𝓒.phaseSpaceunit := by - simp + = (𝓒.dof : ℝ) * Real.log 𝓒.phaseSpaceunit := by simp calc Real.log Zmath = Real.log (Zphys * 𝓒.phaseSpaceunit ^ 𝓒.dof) := by simp [hZdef] @@ -339,8 +332,7 @@ theorem differentialEntropy_eq_meanEnergy_sub_helmholtz_div_temp_add_correction + kB * (𝓒.dof : ℝ) * Real.log 𝓒.phaseSpaceunit := by simp [hS_phys, add_comm, add_left_comm] _ = (E - 𝓒.helmholtzFreeEnergy T) / T.val - + kB * 𝓒.dof * Real.log 𝓒.phaseSpaceunit := by - rw [hEF] + + kB * 𝓒.dof * Real.log 𝓒.phaseSpaceunit := by rw [hEF] /-- Discrete / normalized specialization of the previous theorem. If either `dof = 0` (no semiclassical correction) or `phaseSpaceUnit = 1` @@ -384,10 +376,8 @@ lemma integral_bolt_eq_integral_mul_exp = ∫ x, φ x * Real.exp (-T.β * 𝓒.energy x) ∂ 𝓒.μ := by unfold μBolt set f : ι → ℝ≥0∞ := fun x => ENNReal.ofReal (Real.exp (-T.β * 𝓒.energy x)) - have hf_meas : Measurable f := by - fun_prop - have hf_lt_top : ∀ᵐ x ∂ 𝓒.μ, f x < ∞ := by - simp [f] + have hf_meas : Measurable f := by fun_prop + have hf_lt_top : ∀ᵐ x ∂ 𝓒.μ, f x < ∞ := by simp [f] have h := integral_withDensity_eq_integral_toReal_smul (μ := 𝓒.μ) hf_meas hf_lt_top φ @@ -420,8 +410,7 @@ lemma meanEnergy_eq_ratio_of_integrals unfold meanEnergy μProd have h_scale : ∫ x, 𝓒.energy x ∂ ((𝓒.μBolt T Set.univ)⁻¹ • 𝓒.μBolt T) - = ((𝓒.μBolt T Set.univ)⁻¹).toReal * ∫ x, 𝓒.energy x ∂ 𝓒.μBolt T := by - simp + = ((𝓒.μBolt T Set.univ)⁻¹).toReal * ∫ x, 𝓒.energy x ∂ 𝓒.μBolt T := by simp have h_energy_bolt_raw := integral_energy_bolt (𝓒:=𝓒) (T:=T) have h_den : @@ -430,20 +419,16 @@ lemma meanEnergy_eq_ratio_of_integrals exact (mathematicalPartitionFunction_eq_integral (𝓒:=𝓒) (T:=T)) have h_inv_toReal : ((𝓒.μBolt T Set.univ)⁻¹).toReal - = 1 / (𝓒.μBolt T Set.univ).toReal := by - simp [one_div, ENNReal.toReal_inv] + = 1 / (𝓒.μBolt T Set.univ).toReal := by simp [one_div, ENNReal.toReal_inv] calc ∫ x, 𝓒.energy x ∂ ((𝓒.μBolt T Set.univ)⁻¹ • 𝓒.μBolt T) = ((𝓒.μBolt T Set.univ)⁻¹).toReal * ∫ x, 𝓒.energy x ∂ 𝓒.μBolt T := h_scale _ = ((𝓒.μBolt T Set.univ)⁻¹).toReal * - (∫ x, 𝓒.energy x * Real.exp (- T.β * 𝓒.energy x) ∂ 𝓒.μ) := by - simp [h_energy_bolt_raw] + (∫ x, 𝓒.energy x * Real.exp (- T.β * 𝓒.energy x) ∂ 𝓒.μ) := by simp [h_energy_bolt_raw] _ = (1 / (𝓒.μBolt T Set.univ).toReal) * - (∫ x, 𝓒.energy x * Real.exp (- T.β * 𝓒.energy x) ∂ 𝓒.μ) := by - simp [h_inv_toReal] + (∫ x, 𝓒.energy x * Real.exp (- T.β * 𝓒.energy x) ∂ 𝓒.μ) := by simp [h_inv_toReal] _ = (∫ x, 𝓒.energy x * Real.exp (- T.β * 𝓒.energy x) ∂ 𝓒.μ) / - (∫ x, Real.exp (- T.β * 𝓒.energy x) ∂ 𝓒.μ) := by - simp [h_den, div_eq_mul_inv, mul_comm] + (∫ x, Real.exp (- T.β * 𝓒.energy x) ∂ 𝓒.μ) := by simp [h_den, div_eq_mul_inv, mul_comm] /-- The mean energy is the negative derivative of the logarithm of the (mathematical) partition function with respect to β = 1/(kB T). @@ -509,8 +494,7 @@ lemma meanEnergy_eq_neg_deriv_log_mathZ_of_beta (- ∫ i, 𝓒.energy i * Real.exp (-(T.β : ℝ) * 𝓒.energy i) ∂𝓒.μ)) := by ring _ = - (derivWithin (fun β : ℝ => Real.log (∫ i, Real.exp (-β * 𝓒.energy i) ∂𝓒.μ)) - (Set.Ioi 0) (T.β : ℝ)) := by - rw [h_deriv_log] + (Set.Ioi 0) (T.β : ℝ)) := by rw [h_deriv_log] section Ratios @@ -538,8 +522,7 @@ lemma log_phys_eq_log_math_sub_const_on_Ioi (Set.Ioi (0 : ℝ)) := by intro β hβ have hβpos : 0 < β := hβ - have hβnn : Real.toNNReal β = β := by - simp [Real.toNNReal, hβpos.le] + have hβnn : Real.toNNReal β = β := by simp [Real.toNNReal, hβpos.le] have _inst : IsFiniteMeasure (𝓒.μBolt (Temperature.ofβ (Real.toNNReal β))) := h_fin β hβpos have hZpos : @@ -550,16 +533,14 @@ lemma log_phys_eq_log_math_sub_const_on_Ioi have h_pow_pos : 0 < 𝓒.phaseSpaceunit ^ 𝓒.dof := pow_pos 𝓒.hPos _ have h_log_pow : Real.log (𝓒.phaseSpaceunit ^ 𝓒.dof) - = (𝓒.dof : ℝ) * Real.log 𝓒.phaseSpaceunit := by - simp + = (𝓒.dof : ℝ) * Real.log 𝓒.phaseSpaceunit := by simp have : Real.log (𝓒.partitionFunction (Temperature.ofβ (Real.toNNReal β))) = -((𝓒.dof : ℝ) * Real.log 𝓒.phaseSpaceunit) + Real.log (∫ i, Real.exp (-β * 𝓒.energy i) ∂ 𝓒.μ) := by have h_integral_pos : 0 < ∫ i, Real.exp (-β * 𝓒.energy i) ∂ 𝓒.μ := by have h_eq : ∫ i, Real.exp (-β * 𝓒.energy i) ∂ 𝓒.μ = - ∫ i, Real.exp (-(Real.toNNReal β).val * 𝓒.energy i) ∂ 𝓒.μ := by - simp [hβnn] + ∫ i, Real.exp (-(Real.toNNReal β).val * 𝓒.energy i) ∂ 𝓒.μ := by simp [hβnn] rw [h_eq] simp [mathematicalPartitionFunction_eq_integral (𝓒:=𝓒) (T:=Temperature.ofβ (Real.toNNReal β))] at hZpos @@ -674,8 +655,7 @@ theorem energyVariance_eq_meanSquareEnergy_sub_meanEnergy_sq rw [integral_const_mul] rw [integral_const] have hμProb : (𝓒.μProd T) Set.univ = 1 := by simp - have hμReal : (𝓒.μProd T).real Set.univ = 1 := by - simp [measureReal_def, hμProb] + have hμReal : (𝓒.μProd T).real Set.univ = 1 := by simp [measureReal_def, hμProb] calc ∫ i, (𝓒.energy i)^2 ∂𝓒.μProd T - 2 * U * ∫ i, 𝓒.energy i ∂𝓒.μProd T @@ -716,8 +696,7 @@ lemma heatCapacity_eq_deriv_meanEnergyBeta unfold heatCapacity meanEnergy_T have h_U_eq_comp : (𝓒.meanEnergy_T) = fun t : ℝ => (𝓒.meanEnergyBeta) (betaFromReal t) := by funext t - dsimp [meanEnergy_T, meanEnergyBeta, betaFromReal] - simp + simp [meanEnergy_T, meanEnergyBeta, betaFromReal] let dUdβ := derivWithin (𝓒.meanEnergyBeta) (Set.Ioi 0) (T.β : ℝ) have h_chain := chain_rule_T_beta (F:=𝓒.meanEnergyBeta) (F':=dUdβ) T hT_pos hU_deriv have h_UD : diff --git a/Physlib/StatisticalMechanics/CanonicalEnsemble/TwoState.lean b/Physlib/StatisticalMechanics/CanonicalEnsemble/TwoState.lean index b67dc0c5b..e249ba004 100644 --- a/Physlib/StatisticalMechanics/CanonicalEnsemble/TwoState.lean +++ b/Physlib/StatisticalMechanics/CanonicalEnsemble/TwoState.lean @@ -50,12 +50,10 @@ lemma twoState_partitionFunction_apply_eq_cosh (E₀ E₁ : ℝ) (T : Temperatur ring_nf @[simp] -lemma twoState_energy_fst (E₀ E₁ : ℝ) : (twoState E₀ E₁).energy 0 = E₀ := by - rfl +lemma twoState_energy_fst (E₀ E₁ : ℝ) : (twoState E₀ E₁).energy 0 = E₀ := rfl @[simp] -lemma twoState_energy_snd (E₀ E₁ : ℝ) : (twoState E₀ E₁).energy 1 = E₁ := by - rfl +lemma twoState_energy_snd (E₀ E₁ : ℝ) : (twoState E₀ E₁).energy 1 = E₁ := rfl /-- Probability of the first state (energy `E₀`) in closed form. -/ lemma twoState_probability_fst (E₀ E₁ : ℝ) (T : Temperature) : diff --git a/Physlib/StatisticalMechanics/MicroCanonicalEnsemble/IdealGas.lean b/Physlib/StatisticalMechanics/MicroCanonicalEnsemble/IdealGas.lean index ddef990f3..4713b123c 100644 --- a/Physlib/StatisticalMechanics/MicroCanonicalEnsemble/IdealGas.lean +++ b/Physlib/StatisticalMechanics/MicroCanonicalEnsemble/IdealGas.lean @@ -90,9 +90,8 @@ lemma partitionZ_eq (hV : 0 < V) (hβ : 0 < β) : simp_rw [show ∀ (x y i p_i), eq_pm (x, y) (i, Sum.inl p_i) = x (i, p_i) from fun _ _ _ _ => rfl, show ∀ (x y i m_i), eq_pm (x, y) (i, Sum.inr m_i) = y (i, m_i) from fun _ _ _ _ => rfl] have h_measurable_box : Measurable fun (a : (Fin n × Fin 3 → ℝ)) - => ∃ x_1 x_2, V ^ (3⁻¹:ℝ) / 2 < |a (x_1, x_2)| := by - refine Measurable.exists fun i => Measurable.exists fun j => ?_ - exact measurable_const.lt (by fun_prop) + => ∃ x_1 x_2, V ^ (3⁻¹:ℝ) / 2 < |a (x_1, x_2)| := + Measurable.exists fun i => Measurable.exists fun j => measurable_const.lt (by fun_prop) have h_measurability : Measurable fun x : (Fin n × Fin 3 → ℝ) × (Fin n × Fin 3 → ℝ) => if ∃ x_1 x_2, V ^ (3⁻¹:ℝ) / 2 < |x.1 (x_1, x_2)| then 0 else Real.exp (-(β * ∑ x_1 : Fin n × Fin 3, x.2 (x_1.1, x_1.2) ^ 2 / 2)) := by @@ -196,8 +195,7 @@ theorem ideal_gas_law (hV : 0 < V) (hT : 0 < T) : let P := IdealGas.pressure (n,V) T; let R := 1; P * V = n * R * T := by - dsimp [pressure] - rw [← derivWithin_of_isOpen (s := Set.Ioi 0) isOpen_Ioi hV] + rw [pressure, ← derivWithin_of_isOpen (s := Set.Ioi 0) isOpen_Ioi hV] rw [derivWithin_congr (f := fun V' ↦ -n * T * (Real.log V' + (3/2) * Real.log (2 * Real.pi * T))) ?_ ?_] rw [derivWithin_of_isOpen (s := Set.Ioi 0) isOpen_Ioi hV] diff --git a/Physlib/StringTheory/FTheory/SU5/Fluxes/NoExotics/Completeness.lean b/Physlib/StringTheory/FTheory/SU5/Fluxes/NoExotics/Completeness.lean index 986e2a3b2..d27a05f0f 100644 --- a/Physlib/StringTheory/FTheory/SU5/Fluxes/NoExotics/Completeness.lean +++ b/Physlib/StringTheory/FTheory/SU5/Fluxes/NoExotics/Completeness.lean @@ -272,10 +272,9 @@ lemma mem_elemsNoExotics_of_noExotics (F : FluxesFive) (hNE : F.NoExotics) (hnZ which obeys `NoExotics` is an element of `elemsNoExotics`, and every element of `elemsNoExotics` obeys `NoExotics`. -/ lemma noExotics_iff_mem_elemsNoExotics (F : FluxesFive) : - F.NoExotics ∧ F.HasNoZero ↔ F ∈ elemsNoExotics := by - constructor - · exact fun ⟨h1, h2⟩ => mem_elemsNoExotics_of_noExotics F h1 h2 - · exact fun h => ⟨noExotics_of_mem_elemsNoExotics F h, hasNoZero_of_mem_elemsNoExotics F h⟩ + F.NoExotics ∧ F.HasNoZero ↔ F ∈ elemsNoExotics := + ⟨fun ⟨h1, h2⟩ => mem_elemsNoExotics_of_noExotics F h1 h2, + fun h => ⟨noExotics_of_mem_elemsNoExotics F h, hasNoZero_of_mem_elemsNoExotics F h⟩⟩ end FluxesFive @@ -444,10 +443,9 @@ lemma mem_elemsNoExotics_of_noExotics (F : FluxesTen) (hNE : F.NoExotics) (hnZ : which obeys `NoExotics` is an element of `elemsNoExotics`, and every element of `elemsNoExotics` obeys `NoExotics`. -/ lemma noExotics_iff_mem_elemsNoExotics (F : FluxesTen) : - F.NoExotics ∧ F.HasNoZero ↔ F ∈ elemsNoExotics := by - constructor - · exact fun h => mem_elemsNoExotics_of_noExotics F h.1 h.2 - · exact fun h => ⟨noExotics_of_mem_elemsNoExotics F h, hasNoZero_of_mem_elemsNoExotics F h⟩ + F.NoExotics ∧ F.HasNoZero ↔ F ∈ elemsNoExotics := + ⟨fun h => mem_elemsNoExotics_of_noExotics F h.1 h.2, + fun h => ⟨noExotics_of_mem_elemsNoExotics F h, hasNoZero_of_mem_elemsNoExotics F h⟩⟩ end FluxesTen end SU5 diff --git a/Physlib/StringTheory/FTheory/SU5/Quanta/FiveQuanta.lean b/Physlib/StringTheory/FTheory/SU5/Quanta/FiveQuanta.lean index 69f125ad4..6ea02abd0 100644 --- a/Physlib/StringTheory/FTheory/SU5/Quanta/FiveQuanta.lean +++ b/Physlib/StringTheory/FTheory/SU5/Quanta/FiveQuanta.lean @@ -252,8 +252,7 @@ lemma reduce_sum_eq_sum_toCharges {M} [AddCommMonoid M] (x : FiveQuanta 𝓩) (f (((x.filter (fun f => f.1 = q5)).map (fun y => f q5 y.2))).sum := by congr funext q5 - rw [AddMonoidHom.map_multiset_sum, Multiset.map_map] - rfl + simp [AddMonoidHom.map_multiset_sum, Multiset.map_map] _ = (x.toCharges.dedup.bind fun q5 => ((x.filter (fun f => f.1 = q5)).map (fun y => f q5 y.2))).sum := by rw [Multiset.sum_bind] @@ -290,8 +289,7 @@ lemma reduce_sum_eq_sum_toCharges {M} [AddCommMonoid M] (x : FiveQuanta 𝓩) (f · rw [Multiset.sum_eq_zero] refine Eq.symm (Multiset.count_eq_zero_of_notMem ?_) intro h - have h_mem : p.1 ∈ Multiset.map Prod.fst x := by - simp_all + have h_mem : p.1 ∈ Multiset.map Prod.fst x := by simp_all (expose_names; exact h_mem_1 h_mem) intro p' hp simp at hp @@ -370,8 +368,7 @@ lemma mem_powerset_sum_of_mem_reduce_toFluxesFive {F : FiveQuanta 𝓩} use (Multiset.map (fun x => x.2) (Multiset.filter (fun x => x.1 = q) F)) simp only [and_true] rw [toFluxesFive] - refine Multiset.map_le_map ?_ - exact Multiset.filter_le (fun x => x.1 = q) F + exact Multiset.map_le_map (Multiset.filter_le (fun x => x.1 = q) F) lemma mem_powerset_sum_of_mem_reduce_toFluxesFive_filter {F : FiveQuanta 𝓩} {f : Fluxes} (hf : f ∈ F.reduce.toFluxesFive) : @@ -388,8 +385,7 @@ lemma mem_powerset_sum_of_mem_reduce_toFluxesFive_filter {F : FiveQuanta 𝓩} apply And.intro simp only [Multiset.mem_powerset] rw [toFluxesFive] - refine Multiset.map_le_map ?_ - exact Multiset.filter_le (fun x => x.1 = q) F + exact Multiset.map_le_map (Multiset.filter_le (fun x => x.1 = q) F) simp [Multiset.empty_eq_zero, ne_eq, Multiset.map_eq_zero, Multiset.filter_eq_nil, Prod.forall, not_forall, Decidable.not_not] rw [toCharges, Multiset.mem_map] at hq @@ -566,8 +562,7 @@ def decompose (x : FiveQuanta 𝓩) : FiveQuanta 𝓩 := -/ lemma decompose_add (x y : FiveQuanta 𝓩) : - (x + y).decompose = x.decompose + y.decompose := by - simp [decompose] + (x + y).decompose = x.decompose + y.decompose := by simp [decompose] /-! diff --git a/Physlib/StringTheory/FTheory/SU5/Quanta/TenQuanta.lean b/Physlib/StringTheory/FTheory/SU5/Quanta/TenQuanta.lean index c0b4841c6..544a5085c 100644 --- a/Physlib/StringTheory/FTheory/SU5/Quanta/TenQuanta.lean +++ b/Physlib/StringTheory/FTheory/SU5/Quanta/TenQuanta.lean @@ -215,8 +215,7 @@ lemma reduce_filter (x : TenQuanta 𝓩) (q : 𝓩) (h : q ∈ x.toCharges) : simp only [Function.comp_apply] have hx : (Multiset.filter (fun x => x = q) x.toCharges.dedup) = {q} := by refine (Multiset.Nodup.ext ?_ ?_).mpr ?_ - · refine Multiset.Nodup.filter (fun x => x = q) ?_ - exact Multiset.nodup_dedup x.toCharges + · exact Multiset.Nodup.filter (fun x => x = q) (Multiset.nodup_dedup x.toCharges) · exact Multiset.nodup_singleton q intro a simp only [Multiset.mem_filter, Multiset.mem_dedup, Multiset.mem_singleton, @@ -267,8 +266,7 @@ lemma reduce_sum_eq_sum_toCharges {M} [AddCommMonoid M] (x : TenQuanta 𝓩) (f (((x.filter (fun f => f.1 = q)).map (fun y => f q y.2))).sum := by congr funext q5 - rw [AddMonoidHom.map_multiset_sum, Multiset.map_map] - rfl + simp [AddMonoidHom.map_multiset_sum, Multiset.map_map] _ = (x.toCharges.dedup.bind fun q => ((x.filter (fun f => f.1 = q)).map (fun y => f q y.2))).sum := by rw [Multiset.sum_bind] @@ -305,8 +303,7 @@ lemma reduce_sum_eq_sum_toCharges {M} [AddCommMonoid M] (x : TenQuanta 𝓩) (f · rw [Multiset.sum_eq_zero] refine Eq.symm (Multiset.count_eq_zero_of_notMem ?_) intro h - have h_mem : p.1 ∈ Multiset.map Prod.fst x := by - simp_all + have h_mem : p.1 ∈ Multiset.map Prod.fst x := by simp_all (expose_names; exact h_mem_1 h_mem) intro p' hp simp at hp @@ -386,8 +383,7 @@ lemma mem_powerset_sum_of_mem_reduce_toFluxesTen {F : TenQuanta 𝓩} use (Multiset.map (fun x => x.2) (Multiset.filter (fun x => x.1 = q) F)) simp only [and_true] rw [toFluxesTen] - refine Multiset.map_le_map ?_ - exact Multiset.filter_le (fun x => x.1 = q) F + exact Multiset.map_le_map (Multiset.filter_le (fun x => x.1 = q) F) lemma mem_powerset_sum_of_mem_reduce_toFluxesTen_filter {F : TenQuanta 𝓩} {f : Fluxes} (hf : f ∈ F.reduce.toFluxesTen) : @@ -403,8 +399,7 @@ lemma mem_powerset_sum_of_mem_reduce_toFluxesTen_filter {F : TenQuanta 𝓩} Multiset.filter_eq_nil, Prod.forall, not_forall, Decidable.not_not, and_true] apply And.intro rw [toFluxesTen] - refine Multiset.map_le_map ?_ - exact Multiset.filter_le (fun x => x.1 = q) F + exact Multiset.map_le_map (Multiset.filter_le (fun x => x.1 = q) F) simpa [toCharges] using hq /-! @@ -642,8 +637,7 @@ def decompose (x : TenQuanta 𝓩) : TenQuanta 𝓩 := -/ lemma decompose_add (x y : TenQuanta 𝓩) : - (x + y).decompose = x.decompose + y.decompose := by - simp [decompose] + (x + y).decompose = x.decompose + y.decompose := by simp [decompose] /-! @@ -953,8 +947,7 @@ lemma mem_liftCharge_of_exists_toCharges_toFluxesTen (c : Finset 𝓩) {x : TenQ refine (Multiset.cons_le_of_notMem ?_).mpr ⟨?_, ?_⟩ · simp · rw [← hp2_2] - apply Multiset.erase_subset p1 x - exact hp2 + exact Multiset.erase_subset p1 x hp2 simp only [Multiset.singleton_le] rw [← hp3_2] apply Multiset.erase_subset p1 x @@ -973,10 +966,9 @@ lemma mem_liftCharge_iff_exists (c : Finset 𝓩) {x : TenQuanta 𝓩} : x ∈ liftCharge c ↔ ∃ a : TenQuanta 𝓩, a.reduce = x ∧ a.toCharges.toFinset = c ∧ (a.toFluxesTen = {⟨1, 0⟩, ⟨1, 0⟩, ⟨1, 0⟩} - ∨ a.toFluxesTen = {⟨1, 1⟩, ⟨1, -1⟩, ⟨1, 0⟩}) := by - constructor - · exact exists_toCharges_toFluxesTen_of_mem_liftCharge c - · exact mem_liftCharge_of_exists_toCharges_toFluxesTen c + ∨ a.toFluxesTen = {⟨1, 1⟩, ⟨1, -1⟩, ⟨1, 0⟩}) := + ⟨exists_toCharges_toFluxesTen_of_mem_liftCharge c, + mem_liftCharge_of_exists_toCharges_toFluxesTen c⟩ /-! diff --git a/Physlib/Thermodynamics/Temperature/Basic.lean b/Physlib/Thermodynamics/Temperature/Basic.lean index 4cf0db442..d28ece09f 100644 --- a/Physlib/Thermodynamics/Temperature/Basic.lean +++ b/Physlib/Thermodynamics/Temperature/Basic.lean @@ -69,8 +69,7 @@ lemma ofβ_eq : ofβ = fun β => ⟨⟨1 / (kB * β), by · exact zero_le_one · apply mul_nonneg · exact kB_nonneg - · exact β.2⟩⟩ := by - rfl + · exact β.2⟩⟩ := rfl @[simp] lemma β_ofβ (β' : ℝ≥0) : β (ofβ β') = β' := by @@ -192,9 +191,8 @@ lemma beta_fun_T_formula (t : ℝ) (ht : 0 < t) : /-- On `Ioi 0`, `Beta_fun_T t` equals `1 / (kB * t)`. -/ lemma beta_fun_T_eq_on_Ioi : - EqOn betaFromReal (fun t : ℝ => 1 / (kB * t)) (Set.Ioi 0) := by - intro t ht - exact beta_fun_T_formula t ht + EqOn betaFromReal (fun t : ℝ => 1 / (kB * t)) (Set.Ioi 0) := + fun t ht => beta_fun_T_formula t ht lemma deriv_beta_wrt_T (T : Temperature) (hT_pos : 0 < T.val) : HasDerivWithinAt betaFromReal (-1 / (kB * (T.val : ℝ)^2)) (Set.Ioi 0) (T.val : ℝ) := by @@ -225,11 +223,9 @@ lemma chain_rule_T_beta {F : ℝ → ℝ} {F' : ℝ} rw [beta_fun_T_eq_on_Ioi ht] exact one_div_pos.mpr (mul_pos kB_pos ht) have h_beta_at_T : betaFromReal (T.val : ℝ) = (T.β : ℝ) := by - rw [beta_fun_T_eq_on_Ioi (show (T.val : ℝ) ∈ Set.Ioi 0 from hT_pos), β_toReal] - rfl + exact (beta_fun_T_eq_on_Ioi (show (T.val : ℝ) ∈ Set.Ioi 0 from hT_pos)).trans (β_toReal T).symm have hF_deriv' : HasDerivWithinAt F F' (Set.Ioi 0) (betaFromReal (T.val : ℝ)) := by - rw [h_beta_at_T] - exact hF_deriv + simpa [h_beta_at_T] using hF_deriv exact hF_deriv'.comp (T.val : ℝ) (deriv_beta_wrt_T (T := T) hT_pos) h_map end Temperature diff --git a/Physlib/Thermodynamics/Temperature/TemperatureUnits.lean b/Physlib/Thermodynamics/Temperature/TemperatureUnits.lean index 0b61fad11..fc27fab5d 100644 --- a/Physlib/Thermodynamics/Temperature/TemperatureUnits.lean +++ b/Physlib/Thermodynamics/Temperature/TemperatureUnits.lean @@ -40,8 +40,7 @@ structure TemperatureUnit where namespace TemperatureUnit @[simp] -lemma val_ne_zero (x : TemperatureUnit) : x.val ≠ 0 := by - exact Ne.symm (ne_of_lt x.property) +lemma val_ne_zero (x : TemperatureUnit) : x.val ≠ 0 := Ne.symm (ne_of_lt x.property) lemma val_pos (x : TemperatureUnit) : 0 < x.val := x.property @@ -74,9 +73,7 @@ lemma div_pos (x y : TemperatureUnit) : (0 : ℝ≥0) < x/ y := by @[simp] lemma div_self (x : TemperatureUnit) : - x / x = (1 : ℝ≥0) := by - simp [div_eq_val, x.val_ne_zero] - rfl + x / x = (1 : ℝ≥0) := NNReal.eq (_root_.div_self x.val_ne_zero) lemma div_symm (x y : TemperatureUnit) : x / y = (y / x)⁻¹ := NNReal.eq <| by @@ -102,8 +99,7 @@ def scale (r : ℝ) (x : TemperatureUnit) (hr : 0 < r := by norm_num) : Temperat @[simp] lemma scale_div_self (x : TemperatureUnit) (r : ℝ) (hr : 0 < r) : - scale r x hr / x = (⟨r, le_of_lt hr⟩ : ℝ≥0) := by - simp [scale, div_eq_val] + scale r x hr / x = (⟨r, le_of_lt hr⟩ : ℝ≥0) := by simp [scale, div_eq_val] @[simp] lemma self_div_scale (x : TemperatureUnit) (r : ℝ) (hr : 0 < r) : @@ -113,8 +109,7 @@ lemma self_div_scale (x : TemperatureUnit) (r : ℝ) (hr : 0 < r) : field_simp @[simp] -lemma scale_one (x : TemperatureUnit) : scale 1 x = x := by - simp [scale] +lemma scale_one (x : TemperatureUnit) : scale 1 x = x := by simp [scale] @[simp] lemma scale_div_scale (x1 x2 : TemperatureUnit) {r1 r2 : ℝ} (hr1 : 0 < r1) (hr2 : 0 < r2) : @@ -127,8 +122,7 @@ lemma scale_div_scale (x1 x2 : TemperatureUnit) {r1 r2 : ℝ} (hr1 : 0 < r1) (hr @[simp] lemma scale_scale (x : TemperatureUnit) (r1 r2 : ℝ) (hr1 : 0 < r1) (hr2 : 0 < r2) : scale r1 (scale r2 x hr2) hr1 = scale (r1 * r2) x (mul_pos hr1 hr2) := by - simp [scale] - ring + simp [scale, mul_assoc] /-! diff --git a/Physlib/Units/Basic.lean b/Physlib/Units/Basic.lean index b604f276d..aeb71166e 100644 --- a/Physlib/Units/Basic.lean +++ b/Physlib/Units/Basic.lean @@ -105,8 +105,7 @@ noncomputable def dimScale (u1 u2 : UnitChoices) :Dimension →* ℝ≥0 where (u1.mass / u2.mass) ^ (d.mass : ℝ) * (u1.charge / u2.charge) ^ (d.charge : ℝ) * (u1.temperature / u2.temperature) ^ (d.temperature : ℝ) - map_one' := by - simp + map_one' := by simp map_mul' d1 d2 := by simp only [Dimension.length_mul, Rat.cast_add, Dimension.time_mul, Dimension.mass_mul, Dimension.charge_mul, Dimension.temperature_mul] @@ -125,13 +124,11 @@ lemma dimScale_apply (u1 u2 : UnitChoices) (d : Dimension) : @[simp] lemma dimScale_self (u : UnitChoices) (d : Dimension) : - dimScale u u d = 1 := by - simp [dimScale] + dimScale u u d = 1 := by simp [dimScale] @[simp] lemma dimScale_one (u1 u2 : UnitChoices) : - dimScale u1 u2 1 = 1 := by - simp [dimScale] + dimScale u1 u2 1 = 1 := by simp [dimScale] lemma dimScale_transitive (u1 u2 u3 : UnitChoices) (d : Dimension) : dimScale u1 u2 d * dimScale u2 u3 d = dimScale u1 u3 d := by @@ -152,8 +149,7 @@ lemma dimScale_transitive (u1 u2 u3 : UnitChoices) (d : Dimension) : @[simp] lemma dimScale_mul_symm (u1 u2 : UnitChoices) (d : Dimension) : - dimScale u1 u2 d * dimScale u2 u1 d = 1 := by - rw [dimScale_transitive, dimScale_self] + dimScale u1 u2 d * dimScale u2 u1 d = 1 := by rw [dimScale_transitive, dimScale_self] @[simp] lemma dimScale_coe_mul_symm (u1 u2 : UnitChoices) (d : Dimension) : @@ -164,8 +160,7 @@ lemma dimScale_coe_mul_symm (u1 u2 : UnitChoices) (d : Dimension) : @[simp] lemma dimScale_ne_zero (u1 u2 : UnitChoices) (d : Dimension) : - dimScale u1 u2 d ≠ 0 := by - simp [dimScale] + dimScale u1 u2 d ≠ 0 := by simp [dimScale] lemma dimScale_symm (u1 u2 : UnitChoices) (d : Dimension) : dimScale u1 u2 d = (dimScale u2 u1 d)⁻¹ := by @@ -179,8 +174,7 @@ lemma dimScale_symm (u1 u2 : UnitChoices) (d : Dimension) : lemma dimScale_of_inv_eq_swap (u1 u2 : UnitChoices) (d : Dimension) : dimScale u1 u2 d⁻¹ = dimScale u2 u1 d := by - simp only [map_inv] - conv_rhs => rw[dimScale_symm] + simpa only [map_inv] using (dimScale_symm u2 u1 d).symm @[simp] lemma smul_dimScale_injective {M : Type} [MulAction ℝ≥0 M] (u1 u2 : UnitChoices) (d : Dimension) @@ -309,8 +303,7 @@ def HasDimension {M : Type} [CarriesDimension M] (f : UnitChoices → M) : Prop lemma hasDimension_iff {M : Type} [CarriesDimension M] (f : UnitChoices → M) : HasDimension f ↔ ∀ u1 u2 : UnitChoices, f u2 = - UnitChoices.dimScale u1 u2 (dim M) • f u1 := by - rfl + UnitChoices.dimScale u1 u2 (dim M) • f u1 := Iff.rfl /-- The subtype of functions `UnitChoices → M`, for which `M` carries a dimension, which `HasDimension`. -/ @@ -333,12 +326,10 @@ instance {M : Type} [CarriesDimension M] : MulAction ℝ≥0 (Dimensionful M) wh rw [smul_comm]⟩ one_smul f := by ext u - change (1 : ℝ≥0) • f.1 u = f.1 u - simp + exact one_smul ℝ≥0 (f.1 u) mul_smul a b f := by ext u - change (a * b) • f.1 u = a • (b • f.1 u) - rw [smul_smul] + exact (smul_smul a b (f.1 u)).symm @[simp] lemma Dimensionful.smul_apply {M : Type} [CarriesDimension M] @@ -356,8 +347,7 @@ noncomputable def CarriesDimension.toDimensionful {M : Type} [CarriesDimension M simp [smul_smul] rw [mul_comm, UnitChoices.dimScale_transitive]} invFun f := f.1 u - left_inv m := by - simp + left_inv m := by simp right_inv f := by simp only ext u1 diff --git a/Physlib/Units/Dimension.lean b/Physlib/Units/Dimension.lean index 3b59e8a3b..4e5b4da29 100644 --- a/Physlib/Units/Dimension.lean +++ b/Physlib/Units/Dimension.lean @@ -100,9 +100,7 @@ lemma one_temperature : (1 : Dimension).temperature = 0 := rfl instance : CommGroup Dimension where mul_assoc a b c := by ext - all_goals - simp only [length_mul, time_mul, mass_mul, charge_mul, temperature_mul] - ring + all_goals simp [add_assoc] one_mul a := by ext all_goals @@ -117,9 +115,7 @@ instance : CommGroup Dimension where all_goals simp mul_comm a b := by ext - all_goals - simp only [length_mul, time_mul, mass_mul, charge_mul, temperature_mul] - ring + all_goals simp [add_comm] @[simp] lemma inv_length (d : Dimension) : d⁻¹.length = -d.length := rfl diff --git a/Physlib/Units/FDeriv.lean b/Physlib/Units/FDeriv.lean index f015b8ebe..eeb028d08 100644 --- a/Physlib/Units/FDeriv.lean +++ b/Physlib/Units/FDeriv.lean @@ -42,8 +42,7 @@ lemma fderiv_apply_scaleUnit (u1 u2 : UnitChoices) (x dm : M1) change (fderiv ℝ ((u2.dimScale u1 (dim M2)).1 • fun mx => f ((u1.dimScale u2 (dim M1)).1 • mx)) ((u2.dimScale u1 (dim M1)).1 • x)) dm = _ rw [fderiv_const_smul (by fun_prop), fderiv_comp_smul] - simp [smul_smul] - rfl + simp [smul_smul, NNReal.smul_def] open ContinuousLinearUnitDependent in /-- If a function is dimensionally valid then so is it's derivative. -/ diff --git a/Physlib/Units/Integral.lean b/Physlib/Units/Integral.lean index ae28cffb6..083ce84ce 100644 --- a/Physlib/Units/Integral.lean +++ b/Physlib/Units/Integral.lean @@ -44,10 +44,8 @@ noncomputable instance (M : Type) simp [HasDim.scaleUnit_apply] · exact measurable_const_smul (α := M) ↑(u1.dimScale u2 (dim M)).1 · exact measurable_const_smul (α := M) ↑(u2.dimScale u3 (dim M)).1 - scaleUnit_id u μ := by - simp [scaleUnit_id] - scaleUnit_mul u1 u2 r μ := by - simp + scaleUnit_id u μ := by simp [scaleUnit_id] + scaleUnit_mul u1 u2 r μ := by simp variable {M : Type} [NormedAddCommGroup M] [NormedSpace ℝ M] [HasDim M] [MeasurableSpace M] [MeasurableConstSMul ℝ M] @@ -83,8 +81,7 @@ lemma integral_isDimensionallyCorrect (d : Dimension) : then do the integral, and then we take the result back to `u2`. If the integral is dimensionally correct, this should be the same as just doing the original integral in `u2` units i.e. `∫ x, f x ∂μ`. -/ - _ = scaleUnit u1 u2 (∫ x, (scaleUnit u2 u1 f) x ∂(scaleUnit u2 u1 μ)) := by - simp + _ = scaleUnit u1 u2 (∫ x, (scaleUnit u2 u1 f) x ∂(scaleUnit u2 u1 μ)) := by simp /- Since we have assumed `μ` has dimension `d`, `(scaleUnit u2 μ u1)` is equal to `(u2.dimScale u1 d) • μ` -/ _ = scaleUnit u1 u2 (u2.dimScale u1 d • ∫ (x : M), scaleUnit u2 u1 f x ∂ μ) := by @@ -95,8 +92,7 @@ lemma integral_isDimensionallyCorrect (d : Dimension) : u2.dimScale u1 (dim G * d⁻¹) • ∫ (x : M), f x ∂ μ) := by rw [hf] congr - erw [MeasureTheory.integral_smul] - rfl + exact MeasureTheory.integral_smul _ _ /- What remains is a simple cancellation of the dimensional scales. -/ _ = (u1.dimScale u2 (dim G)) • ((u2.dimScale u1 d) • u2.dimScale u1 (dim G * d⁻¹) • ∫ (x : M), f x ∂ μ) := by diff --git a/Physlib/Units/UnitDependent.lean b/Physlib/Units/UnitDependent.lean index 735268ecf..a90342013 100644 --- a/Physlib/Units/UnitDependent.lean +++ b/Physlib/Units/UnitDependent.lean @@ -84,8 +84,7 @@ class ContinuousLinearUnitDependent (M : Type) [AddCommMonoid M] [Module ℝ M] @[simp] lemma UnitDependent.scaleUnit_symm_apply {M : Type} [UnitDependent M] (u1 u2 : UnitChoices) (m : M) : - scaleUnit u2 u1 (scaleUnit u1 u2 m) = m := by - rw [scaleUnit_trans, scaleUnit_id] + scaleUnit u2 u1 (scaleUnit u1 u2 m) = m := by rw [scaleUnit_trans, scaleUnit_id] @[simp] lemma UnitDependent.scaleUnit_injective {M : Type} [UnitDependent M] @@ -246,8 +245,7 @@ noncomputable instance {M1 : Type} [CarriesDimension M1] : MulUnitDependent M1 w rw [smul_smul, mul_comm, UnitChoices.dimScale_transitive] scaleUnit_trans' u1 u2 u3 m := by simp [toDimensionful, smul_smul, UnitChoices.dimScale_transitive] - scaleUnit_id u m := by - simp [toDimensionful, UnitChoices.dimScale_self] + scaleUnit_id u m := by simp [toDimensionful, UnitChoices.dimScale_self] scaleUnit_mul u1 u2 r m := by simp [toDimensionful] exact smul_comm (u1.dimScale u2 (dim M1)) r m @@ -262,13 +260,11 @@ noncomputable instance {M : Type} [AddCommMonoid M] [Module ℝ M] [HasDim M] : scaleUnit_add u1 u2 m1 m2 := by change (toDimensionful u1 (m1 + m2)).1 u2 = _ rw [toDimensionful_apply_apply] - simp - rfl + exact smul_add _ _ _ scaleUnit_smul u1 u2 r m := by change (toDimensionful u1 (r • m)).1 u2 = _ rw [toDimensionful_apply_apply] - rw [smul_comm] - rfl + exact smul_comm _ _ _ noncomputable instance {M : Type} [AddCommMonoid M] [Module ℝ M] [HasDim M] [TopologicalSpace M] @@ -278,9 +274,7 @@ noncomputable instance {M : Type} [AddCommMonoid M] [Module ℝ M] conv => enter [1, m] rw [toDimensionful_apply_apply] - change Continuous fun m => (u1.dimScale u2 (dim M)).1 • m - apply Continuous.const_smul - exact continuous_id' + exact Continuous.const_smul continuous_id' (u1.dimScale u2 (dim M)).1 /-! @@ -291,15 +285,11 @@ noncomputable instance {M : Type} [AddCommMonoid M] [Module ℝ M] noncomputable instance {M1 M2 : Type} [UnitDependent M2] : UnitDependent (M1 → M2) where scaleUnit u1 u2 f := fun m1 => scaleUnit u1 u2 (f m1) - scaleUnit_trans u1 u2 u3 f := by - funext m1 - exact scaleUnit_trans u1 u2 u3 (f m1) - scaleUnit_trans' u1 u2 u3 f := by - funext m1 - exact scaleUnit_trans' u1 u2 u3 (f m1) - scaleUnit_id u f := by - funext m1 - exact scaleUnit_id u (f m1) + scaleUnit_trans u1 u2 u3 f := funext fun m1 => + scaleUnit_trans u1 u2 u3 (f m1) + scaleUnit_trans' u1 u2 u3 f := funext fun m1 => + scaleUnit_trans' u1 u2 u3 (f m1) + scaleUnit_id u f := funext fun m1 => scaleUnit_id u (f m1) @[simp] lemma UnitDependent.scaleUnit_apply_fun_right {M1 M2 : Type} [UnitDependent M2] @@ -314,21 +304,15 @@ noncomputable instance {M1 M2 : Type} [AddCommMonoid M1] [Module ℝ M1] toFun m1 := scaleUnit u1 u2 (f m1) map_add' m1 m2 := by simp [scaleUnit_add] map_smul' := by simp [scaleUnit_smul]} - scaleUnit_trans u1 u2 u3 f := by - ext m1 - exact scaleUnit_trans u1 u2 u3 (f m1) - scaleUnit_trans' u1 u2 u3 f := by - ext m1 - exact scaleUnit_trans' u1 u2 u3 (f m1) - scaleUnit_id u f := by - ext m1 - exact scaleUnit_id u (f m1) - scaleUnit_add u1 u2 f1 f2 := by - ext m - simp [scaleUnit_add] - scaleUnit_smul u1 u2 r f := by - ext m - simp [scaleUnit_smul] + scaleUnit_trans u1 u2 u3 f := LinearMap.ext fun m1 => + scaleUnit_trans u1 u2 u3 (f m1) + scaleUnit_trans' u1 u2 u3 f := LinearMap.ext fun m1 => + scaleUnit_trans' u1 u2 u3 (f m1) + scaleUnit_id u f := LinearMap.ext fun m1 => scaleUnit_id u (f m1) + scaleUnit_add u1 u2 f1 f2 := LinearMap.ext fun m => + scaleUnit_add u1 u2 (f1 m) (f2 m) + scaleUnit_smul u1 u2 r f := LinearMap.ext fun m => + scaleUnit_smul u1 u2 r (f m) open LinearUnitDependent ContinuousLinearUnitDependent in noncomputable instance {M1 M2 : Type} [AddCommGroup M1] [Module ℝ M1] @@ -340,15 +324,11 @@ noncomputable instance {M1 M2 : Type} [AddCommGroup M1] [Module ℝ M1] scaleUnit u1 u2 f := ContinuousLinearEquiv.arrowCongr (ContinuousLinearEquiv.refl ℝ _) (scaleUnitContLinearEquiv u1 u2) f - scaleUnit_trans u1 u2 u3 f := by - ext m1 - exact scaleUnit_trans u1 u2 u3 (f m1) - scaleUnit_trans' u1 u2 u3 f := by - ext m1 - exact scaleUnit_trans' u1 u2 u3 (f m1) - scaleUnit_id u f := by - ext m1 - exact scaleUnit_id u (f m1) + scaleUnit_trans u1 u2 u3 f := ContinuousLinearMap.ext fun m1 => + scaleUnit_trans u1 u2 u3 (f m1) + scaleUnit_trans' u1 u2 u3 f := ContinuousLinearMap.ext fun m1 => + scaleUnit_trans' u1 u2 u3 (f m1) + scaleUnit_id u f := ContinuousLinearMap.ext fun m1 => scaleUnit_id u (f m1) scaleUnit_add u1 u2 f1 f2 := by simp scaleUnit_smul u1 u2 r f := by simp scaleUnit_cont u1 u2 := ContinuousLinearEquiv.continuous @@ -357,15 +337,11 @@ noncomputable instance {M1 M2 : Type} [AddCommGroup M1] [Module ℝ M1] noncomputable instance {M1 M2 : Type} [UnitDependent M1] : UnitDependent (M1 → M2) where scaleUnit u1 u2 f := fun m1 => f (scaleUnit u2 u1 m1) - scaleUnit_trans u1 u2 u3 f := by - funext m1 - simp [scaleUnit_trans] - scaleUnit_trans' u1 u2 u3 f := by - funext m1 - simp [scaleUnit_trans'] - scaleUnit_id u f := by - funext m1 - simp [scaleUnit_id] + scaleUnit_trans u1 u2 u3 f := funext fun m1 => + congrArg f (scaleUnit_trans u3 u2 u1 m1) + scaleUnit_trans' u1 u2 u3 f := funext fun m1 => + congrArg f (scaleUnit_trans' u3 u2 u1 m1) + scaleUnit_id u f := funext fun m1 => congrArg f (scaleUnit_id u m1) @[simp] lemma UnitDependent.scaleUnit_apply_fun_left {M1 M2 : Type} [UnitDependent M1] @@ -404,9 +380,8 @@ noncomputable instance instUnitDependentTwoSidedMul scaleUnit_id u f := by funext m1 simp [scaleUnit_id] - scaleUnit_mul u1 u2 r f := by - funext m1 - simp [MulUnitDependent.scaleUnit_mul] + scaleUnit_mul u1 u2 r f := funext fun m1 => + MulUnitDependent.scaleUnit_mul u1 u2 r (f (scaleUnit u2 u1 m1)) open LinearUnitDependent ContinuousLinearUnitDependent in noncomputable instance instContinuousLinearUnitDependentMap @@ -472,24 +447,21 @@ lemma isDimensionallyCorrect_fun_iff {M1 M2 : Type} [UnitDependent M1] [UnitDepe {f : M1 → M2} : IsDimensionallyCorrect f ↔ ∀ u1 u2 : UnitChoices, ∀ m, scaleUnit u1 u2 (f (scaleUnit u2 u1 m)) = f m := by - simp only [IsDimensionallyCorrect, funext_iff] - rfl + simp [IsDimensionallyCorrect, funext_iff] @[simp] lemma isDimensionallyCorrect_fun_left {M1 M2 : Type} [UnitDependent M1] {f : M1 → M2} : IsDimensionallyCorrect f ↔ ∀ u1 u2 : UnitChoices, ∀ m, (f (scaleUnit u2 u1 m)) = f m := by - simp only [IsDimensionallyCorrect, funext_iff] - rfl + simp [IsDimensionallyCorrect, funext_iff] @[simp] lemma isDimensionallyCorrect_fun_right {M1 M2 : Type} [UnitDependent M2] {f : M1 → M2} : IsDimensionallyCorrect f ↔ ∀ u1 u2 : UnitChoices, ∀ m, scaleUnit u1 u2 (f m) = f m := by - simp only [IsDimensionallyCorrect, funext_iff] - rfl + simp [IsDimensionallyCorrect, funext_iff] /-! ## Some type classes to help track dimensions @@ -532,14 +504,8 @@ instance (M : Type) [MulAction ℝ≥0 M] [MulUnitDependent M] (d : Dimension) : smul a f := ⟨a • f.1, fun u1 u2 => by rw [smul_comm, ← f.2] rw [MulUnitDependent.scaleUnit_mul]⟩ - one_smul f := by - ext - change (1 : ℝ≥0) • f.1 = f.1 - simp - mul_smul a b f := by - ext - change (a * b) • f.1 = a • (b • f.1) - rw [smul_smul] + one_smul f := Subtype.ext (one_smul ℝ≥0 f.1) + mul_smul a b f := Subtype.ext (mul_smul a b f.1) instance (M : Type) [MulAction ℝ≥0 M] [MulUnitDependent M] (d : Dimension) : CarriesDimension (DimSet M d) where @@ -548,9 +514,7 @@ instance (M : Type) [MulAction ℝ≥0 M] [MulUnitDependent M] (d : Dimension) : @[simp] lemma scaleUnit_dimSet_val {M : Type} [MulAction ℝ≥0 M] [MulUnitDependent M] (d : Dimension) (m : DimSet M d) (u1 u2 : UnitChoices) : - (scaleUnit u1 u2 m).1 = scaleUnit u1 u2 m.1 := by - rw [HasDim.scaleUnit_apply, m.2] - rfl + (scaleUnit u1 u2 m).1 = scaleUnit u1 u2 m.1 := (m.2 u1 u2).symm lemma DimSet.mem_iff {M : Type} [MulAction ℝ≥0 M] [MulUnitDependent M] (d : Dimension) (m : M) : m ∈ DimSet M d ↔ ∀ u1 u2, scaleUnit u1 u2 m = (UnitChoices.dimScale u1 u2 d) • m := by rfl diff --git a/Physlib/Units/WithDim/Basic.lean b/Physlib/Units/WithDim/Basic.lean index 5f9687c67..8ab69e863 100644 --- a/Physlib/Units/WithDim/Basic.lean +++ b/Physlib/Units/WithDim/Basic.lean @@ -75,47 +75,31 @@ lemma val_sub {d : Dimension} {M : Type} [Sub M] (m1 m2 : WithDim d M) : instance (d : Dimension) (M : Type) [AddSemigroup M] : AddSemigroup (WithDim d M) where - add_assoc m1 m2 m3 := by - ext - simp [add_assoc] + add_assoc m1 m2 m3 := WithDim.ext _ _ (add_assoc m1.val m2.val m3.val) instance (d : Dimension) (M : Type) [AddCommSemigroup M] : AddCommSemigroup (WithDim d M) where - add_comm m1 m2 := by - ext - simp [add_comm] + add_comm m1 m2 := WithDim.ext _ _ (add_comm m1.val m2.val) instance (d : Dimension) (M : Type) [AddMonoid M] : AddMonoid (WithDim d M) where - zero_add m := by - ext - simp [zero_add] - add_zero m := by - ext - simp [add_zero] + zero_add m := WithDim.ext _ _ (zero_add m.val) + add_zero m := WithDim.ext _ _ (add_zero m.val) nsmul := nsmulRec instance (d : Dimension) (M : Type) [AddCommMonoid M] : AddCommMonoid (WithDim d M) where - add_comm m1 m2 := by - ext - simp [add_comm] + add_comm m1 m2 := WithDim.ext _ _ (add_comm m1.val m2.val) instance (d : Dimension) (M : Type) [AddGroup M] : AddGroup (WithDim d M) where - sub_eq_add_neg m1 m2 := by - ext - simp [sub_eq_add_neg] - neg_add_cancel m := by - ext - simp [neg_add_cancel] + sub_eq_add_neg m1 m2 := WithDim.ext _ _ (sub_eq_add_neg m1.val m2.val) + neg_add_cancel m := WithDim.ext _ _ (neg_add_cancel m.val) zsmul := zsmulRec instance (d : Dimension) (M : Type) [AddCommGroup M] : AddCommGroup (WithDim d M) where - add_comm m1 m2 := by - ext - simp [add_comm] + add_comm m1 m2 := WithDim.ext _ _ (add_comm m1.val m2.val) instance (d : Dimension) (M : Type) [LE M] : LE (WithDim d M) where le m1 m2 := m1.val ≤ m2.val @@ -133,27 +117,18 @@ lemma lt_def {d : Dimension} {M : Type} [LT M] (m1 m2 : WithDim d M) : instance (d : Dimension) (M : Type) [Preorder M] : Preorder (WithDim d M) where - le_refl m := by - exact le_refl m.val - le_trans m1 m2 m3 h12 h23 := by - change m1.val ≤ m3.val - exact le_trans h12 h23 - lt_iff_le_not_ge m1 m2 := by - change m1.val < m2.val ↔ m1.val ≤ m2.val ∧ ¬ m2.val ≤ m1.val - exact lt_iff_le_not_ge + le_refl m := le_refl m.val + le_trans _ _ _ h12 h23 := le_trans h12 h23 + lt_iff_le_not_ge _ _ := lt_iff_le_not_ge instance (d : Dimension) (M : Type) [PartialOrder M] : PartialOrder (WithDim d M) where - le_antisymm m1 m2 h12 h21 := by - ext - exact le_antisymm h12 h21 + le_antisymm _ _ h12 h21 := WithDim.ext _ _ (le_antisymm h12 h21) instance (d : Dimension) (M : Type) [MulAction ℝ≥0 M] : MulAction ℝ≥0 (WithDim d M) where smul a m := ⟨a • m.val⟩ one_smul m := ext _ _ (one_smul ℝ≥0 m.val) - mul_smul a b m := by - ext - exact mul_smul a b m.val + mul_smul a b m := WithDim.ext _ _ (mul_smul a b m.val) @[simp] lemma smul_val {d : Dimension} {M : Type} [MulAction ℝ≥0 M] (a : ℝ≥0) (m : WithDim d M) : @@ -182,21 +157,17 @@ open UnitDependent @[simp] lemma val_mul_eq_mul {d1 d2 : Dimension} (m1 : WithDim d1 ℝ) (m2 : WithDim d2 ℝ) : - m1.val * m2.val = (m1 * m2).val := by - simp only [withDim_hMul_val] + m1.val * m2.val = (m1 * m2).val := rfl @[simp] lemma val_pow_two_eq_mul {d1 : Dimension} (m1 : WithDim d1 ℝ) : - m1.val ^ 2 = (m1 * m1).val := by - rw [sq] - rfl + m1.val ^ 2 = (m1 * m1).val := by simp [sq] @[simp] lemma scaleUnit_val_eq_scaleUnit_val {d : Dimension} (M : Type) [MulAction ℝ≥0 M] (u1 u2 : UnitChoices) (m1 m2 : WithDim d M) : (scaleUnit u1 u2 m1).val = (scaleUnit u1 u2 m2).val ↔ m1.val = m2.val := by - rw [← WithDim.ext_iff] - simp only [scaleUnit_injective] + rw [← WithDim.ext_iff, scaleUnit_injective] exact WithDim.ext_iff lemma scaleUnit_val_eq_scaleUnit_val_of_dim_eq {d1 d2 : Dimension} {M : Type} [MulAction ℝ≥0 M] diff --git a/QuantumInfo/Capacity/Capacity.lean b/QuantumInfo/Capacity/Capacity.lean index 0cf72a267..5a9a9f509 100644 --- a/QuantumInfo/Capacity/Capacity.lean +++ b/QuantumInfo/Capacity/Capacity.lean @@ -166,8 +166,7 @@ end AristotleLemmas theorem not_achievesRate_gt_log_dim_out (Λ : CPTPMap d₁ d₂) {R : ℝ} (hR : Real.logb 2 (Fintype.card d₂) < R): ¬Λ.AchievesRate R := by intro h; -- We show that the identity channel on the output space `d₂` emulates `Λ`. Since capacity is monotonic under emulation, `Q(Λ) ≤ Q(id_{d₂})`. - have h_emulate : (CPTPMap.id (dIn := d₂)).Emulates Λ := by - exact ⟨Λ, CPTPMap.id, by simp⟩ + have h_emulate : (CPTPMap.id (dIn := d₂)).Emulates Λ := ⟨Λ, CPTPMap.id, by simp⟩ -- If `Λ` achieves rate `R`, then `id_{d₂}` achieves rate `R`. This follows because if `Λ^{\otimes n}` emulates `B`, and `id^{\otimes n}` emulates `Λ^{\otimes n}` (by functoriality of tensor product), then `id^{\otimes n}` emulates `B`. have h_id_achieves : (CPTPMap.id (dIn := d₂)).AchievesRate R := by intro ε hε_pos diff --git a/QuantumInfo/Channels/Bundled.lean b/QuantumInfo/Channels/Bundled.lean index 63676a449..170a87735 100644 --- a/QuantumInfo/Channels/Bundled.lean +++ b/QuantumInfo/Channels/Bundled.lean @@ -176,9 +176,8 @@ variable [Fintype dIn] [Fintype dOut] namespace PMap @[ext] -theorem ext {Λ₁ Λ₂ : PMap dIn dOut 𝕜} (h : Λ₁.map = Λ₂.map) : Λ₁ = Λ₂ := by - rw [PMap.mk.injEq] - exact HPMap.ext h +theorem ext {Λ₁ Λ₂ : PMap dIn dOut 𝕜} (h : Λ₁.map = Λ₂.map) : Λ₁ = Λ₂ := + (mk.injEq _ _ _ _).mpr (HPMap.ext h) theorem injective_toHPMap : (PMap.toHPMap (dIn := dIn) (dOut := dOut) (𝕜 := 𝕜)).Injective := fun _ _ ↦ (mk.injEq _ _ _ _).mpr @@ -230,9 +229,8 @@ end CPMap namespace PTPMap @[ext] -theorem ext {Λ₁ Λ₂ : PTPMap dIn dOut 𝕜} (h : Λ₁.map = Λ₂.map) : Λ₁ = Λ₂ := by - rw [PTPMap.mk.injEq] - exact PMap.ext h +theorem ext {Λ₁ Λ₂ : PTPMap dIn dOut 𝕜} (h : Λ₁.map = Λ₂.map) : Λ₁ = Λ₂ := + (mk.injEq _ _ _ _).mpr (PMap.ext h) theorem injective_toPMap : (PTPMap.toPMap (dIn := dIn) (dOut := dOut) (𝕜 := 𝕜)).Injective := fun _ _ ↦ (mk.injEq _ _ _ _).mpr @@ -288,8 +286,7 @@ instance instMContinuousMapClass [DecidableEq dIn] [DecidableEq dOut] : -- @[norm_cast] theorem val_apply_MState [DecidableEq dIn] (M : PTPMap dIn dOut) (ρ : MState dIn) : - (M ρ : HermitianMat dOut ℂ) = (instFunLike.coe M) ρ := by - rfl + (M ρ : HermitianMat dOut ℂ) = (instFunLike.coe M) ρ := rfl --If we have a PTPMap, the input and output dimensions are always both nonempty (otherwise --we can't preserve trace) - or they're both empty. So `[Nonempty dIn]` will always suffice. @@ -317,9 +314,8 @@ variable [DecidableEq dIn] /-- Two `CPTPMap`s are equal if their `MatrixMap`s are equal. -/ @[ext] -theorem ext {Λ₁ Λ₂ : CPTPMap dIn dOut 𝕜} (h : Λ₁.map = Λ₂.map) : Λ₁ = Λ₂ := by - rw [CPTPMap.mk.injEq] - exact PTPMap.ext h +theorem ext {Λ₁ Λ₂ : CPTPMap dIn dOut 𝕜} (h : Λ₁.map = Λ₂.map) : Λ₁ = Λ₂ := + (mk.injEq _ _ _ _).mpr (PTPMap.ext h) theorem injective_toPTPMap : (CPTPMap.toPTPMap (dIn := dIn) (dOut := dOut) (𝕜 := 𝕜)).Injective := fun _ _ ↦ (mk.injEq _ _ _ _).mpr @@ -375,13 +371,11 @@ namespace PUMap variable [DecidableEq dIn] [DecidableEq dOut] @[ext] -theorem ext {Λ₁ Λ₂ : PUMap dIn dOut 𝕜} (h : Λ₁.map = Λ₂.map) : Λ₁ = Λ₂ := by - rw [PUMap.mk.injEq] - exact PMap.ext h +theorem ext {Λ₁ Λ₂ : PUMap dIn dOut 𝕜} (h : Λ₁.map = Λ₂.map) : Λ₁ = Λ₂ := + (mk.injEq _ _ _ _).mpr (PMap.ext h) -theorem injective_toPMap : (PUMap.toPMap (dIn := dIn) (dOut := dOut) (𝕜 := 𝕜)).Injective := by - intro _ _ _ - rwa [PUMap.mk.injEq] +theorem injective_toPMap : (PUMap.toPMap (dIn := dIn) (dOut := dOut) (𝕜 := 𝕜)).Injective := + fun _ _ ↦ (mk.injEq _ _ _ _).mpr /-- `PUMap`s are functions from `HermitianMat`s to `HermitianMat`s. -/ noncomputable instance instFunLike : FunLike (PUMap dIn dOut ℂ) (HermitianMat dIn ℂ) (HermitianMat dOut ℂ) where @@ -418,13 +412,11 @@ namespace CPUMap variable [DecidableEq dIn] [DecidableEq dOut] @[ext] -theorem ext {Λ₁ Λ₂ : CPUMap dIn dOut 𝕜} (h : Λ₁.map = Λ₂.map) : Λ₁ = Λ₂ := by - rw [CPUMap.mk.injEq, CPMap.mk.injEq] - exact PMap.ext h +theorem ext {Λ₁ Λ₂ : CPUMap dIn dOut 𝕜} (h : Λ₁.map = Λ₂.map) : Λ₁ = Λ₂ := + (mk.injEq _ _ _ _).mpr ((CPMap.mk.injEq _ _ _ _).mpr (PMap.ext h)) -theorem injective_toPMap : (CPMap.toPMap ∘ CPUMap.toCPMap (dIn := dIn) (dOut := dOut) (𝕜 := 𝕜)).Injective := by - intro _ _ _ - rwa [CPUMap.mk.injEq, CPMap.mk.injEq] +theorem injective_toPMap : (CPMap.toPMap ∘ CPUMap.toCPMap (dIn := dIn) (dOut := dOut) (𝕜 := 𝕜)).Injective := + fun _ _ h => (mk.injEq _ _ _ _).mpr ((CPMap.mk.injEq _ _ _ _).mpr h) /-- `CPUMap`s are functions from `HermitianMat`s to `HermitianMat`s. -/ noncomputable instance instFunLike : FunLike (CPUMap dIn dOut ℂ) (HermitianMat dIn ℂ) (HermitianMat dOut ℂ) where diff --git a/QuantumInfo/Channels/CPTP.lean b/QuantumInfo/Channels/CPTP.lean index 6e89dff55..e24ce945f 100644 --- a/QuantumInfo/Channels/CPTP.lean +++ b/QuantumInfo/Channels/CPTP.lean @@ -56,9 +56,8 @@ variable (Λ : CPTPMap dIn dOut) def choi := Λ.map.choi_matrix /-- Two CPTPMaps are equal if their Choi matrices are equal. -/ -theorem choi_ext {Λ₁ Λ₂ : CPTPMap dIn dOut} (h : Λ₁.choi = Λ₂.choi) : Λ₁ = Λ₂ := by - ext1 - exact MatrixMap.choi_equiv.injective h +theorem choi_ext {Λ₁ Λ₂ : CPTPMap dIn dOut} (h : Λ₁.choi = Λ₂.choi) : Λ₁ = Λ₂ := + CPTPMap.ext (MatrixMap.choi_equiv.injective h) /-- The Choi matrix of a channel is PSD. -/ theorem choi_PSD_of_CPTP : Λ.map.choi_matrix.PosSemidef := @@ -81,12 +80,10 @@ def CPTP_of_choi_PSD_Tr {M : Matrix (dOut × dIn) (dOut × dIn) ℂ} (h₁ : M.P @[simp] theorem choi_of_CPTP_of_choi (M : Matrix (dOut × dIn) (dOut × dIn) ℂ) {h₁} {h₂} : - (CPTP_of_choi_PSD_Tr (M := M) h₁ h₂).choi = M := by - simp only [choi, CPTP_of_choi_PSD_Tr] - rw [MatrixMap.map_choi_inv] + (CPTP_of_choi_PSD_Tr (M := M) h₁ h₂).choi = M := + MatrixMap.map_choi_inv M -theorem mat_coe_eq_apply_mat [DecidableEq dOut] (ρ : MState dIn) : (Λ ρ).m = Λ.map ρ.m := - rfl +theorem mat_coe_eq_apply_mat [DecidableEq dOut] (ρ : MState dIn) : (Λ ρ).m = Λ.map ρ.m := rfl @[ext] theorem funext [DecidableEq dOut] {Λ₁ Λ₂ : CPTPMap dIn dOut} (h : ∀ ρ, Λ₁ ρ = Λ₂ ρ) : Λ₁ = Λ₂ := @@ -154,15 +151,13 @@ def id : CPTPMap dIn dIn where /-- The map `CPTPMap.id` leaves any matrix unchanged. -/ @[simp] -theorem id_map : (id (dIn := dIn)).map = LinearMap.id := by - rfl +theorem id_map : (id (dIn := dIn)).map = LinearMap.id := rfl /-- The map `CPTPMap.id` leaves the input state unchanged. -/ @[simp] theorem id_MState (ρ : MState dIn) : CPTPMap.id (dIn := dIn) ρ = ρ := by - apply MState.ext_m - rw [mat_coe_eq_apply_mat] - simp + ext + rfl /-- The map `CPTPMap.id` composed with any map is the same map. -/ @[simp] @@ -190,8 +185,7 @@ def ofEquiv (σ : dIn ≃ dOut) : CPTPMap dIn dOut where @[simp] theorem ofEquiv_apply (σ : dIn ≃ dOut) (ρ : MState dIn) : - ofEquiv σ ρ = ρ.relabel σ.symm := by - rfl + ofEquiv σ ρ = ρ.relabel σ.symm := rfl @[simp] theorem equiv_inverse (σ : dIn ≃ dOut) : (ofEquiv σ) ∘ (ofEquiv σ.symm) = id (dIn := dOut) := by @@ -216,8 +210,7 @@ def assoc' : CPTPMap (d₁ × d₂ × d₃) ((d₁ × d₂) × d₃) := ofEquiv (Equiv.prodAssoc d₁ d₂ d₃).symm @[simp] -theorem SWAP_eq_MState_SWAP (ρ : MState (d₁ × d₂)) : SWAP (d₁ := d₁) (d₂ := d₂) ρ = ρ.SWAP := - rfl +theorem SWAP_eq_MState_SWAP (ρ : MState (d₁ × d₂)) : SWAP (d₁ := d₁) (d₂ := d₂) ρ = ρ.SWAP := rfl @[simp] theorem assoc_eq_MState_assoc (ρ : MState ((d₁ × d₂) × d₃)) : assoc (d₁ := d₁) (d₂ := d₂) (d₃ := d₃) ρ = ρ.assoc := @@ -243,12 +236,8 @@ def traceLeft : CPTPMap (d₁ × d₂) d₂ := --TODO: make Matrix.traceLeft a linear map, a `MatrixMap`. letI f (d) [Fintype d] [DecidableEq d]: Matrix (d₁ × d) (d₁ × d) ℂ →ₗ[ℂ] Matrix d d ℂ := { toFun x := Matrix.traceLeft x - map_add' := by - intros; ext - simp [Matrix.traceLeft, Finset.sum_add_distrib] - map_smul' := by - intros; ext - simp [Matrix.traceLeft, Finset.mul_sum] + map_add' x y := Matrix.traceLeft_add + map_smul' r x := Matrix.traceLeft_smul r } { toLinearMap := f d₂ @@ -277,13 +266,11 @@ def traceRight : CPTPMap (d₁ × d₂) d₁ := @[simp] theorem traceLeft_eq_MState_traceLeft (ρ : MState (d₁ × d₂)) : - traceLeft (d₁ := d₁) (d₂ := d₂) ρ = ρ.traceLeft := by - rfl + traceLeft (d₁ := d₁) (d₂ := d₂) ρ = ρ.traceLeft := rfl @[simp] theorem traceRight_eq_MState_traceRight (ρ : MState (d₁ × d₂)) : - traceRight (d₁ := d₁) (d₂ := d₂) ρ = ρ.traceRight := by - rfl --It's actually pretty crazy that this is a definitional equality, cool + traceRight (d₁ := d₁) (d₂ := d₂) ρ = ρ.traceRight := rfl end trace @@ -361,10 +348,8 @@ infixl:70 "⊗ᶜᵖ" => CPTPMap.prod @[simp] theorem prod_apply_prod (Λ₁ : CPTPMap dI₁ dO₁) (Λ₂ : CPTPMap dI₂ dO₂) (ρ₁ : MState dI₁) (ρ₂ : MState dI₂) : - (Λ₁ ⊗ᶜᵖ Λ₂) (ρ₁ ⊗ᴹ ρ₂) = (Λ₁ ρ₁) ⊗ᴹ (Λ₂ ρ₂) := by - apply MState.ext_m - exact - MatrixMap.kron_map_of_kron_state Λ₁.map Λ₂.map ρ₁.m ρ₂.m + (Λ₁ ⊗ᶜᵖ Λ₂) (ρ₁ ⊗ᴹ ρ₂) = (Λ₁ ρ₁) ⊗ᴹ (Λ₂ ρ₂) := + MState.ext_m (MatrixMap.kron_map_of_kron_state Λ₁.map Λ₂.map ρ₁.m ρ₂.m) end prod @@ -436,16 +421,14 @@ def ofUnitary (U : 𝐔[dIn]) : CPTPMap dIn dIn where /-- The unitary channel U conjugated by U. -/ theorem ofUnitary_eq_conj (U : 𝐔[dIn]) (ρ : MState dIn) : - (ofUnitary U) ρ = ρ.U_conj U := - rfl + (ofUnitary U) ρ = ρ.U_conj U := rfl /-- A channel is unitary iff it is `ofUnitary U`. -/ def IsUnitary (Λ : CPTPMap dIn dIn) : Prop := ∃ U, Λ = ofUnitary U /-- A channel is unitary iff it can be written as conjugation by a unitary. -/ -theorem IsUnitary_iff_U_conj (Λ : CPTPMap dIn dIn) : IsUnitary Λ ↔ ∃ U, ∀ ρ, Λ ρ = ρ.U_conj U := by - simp_rw [IsUnitary, ← ofUnitary_eq_conj, CPTPMap.funext_iff] +theorem IsUnitary_iff_U_conj (Λ : CPTPMap dIn dIn) : IsUnitary Λ ↔ ∃ U, ∀ ρ, Λ ρ = ρ.U_conj U := by simp_rw [IsUnitary, ← ofUnitary_eq_conj, CPTPMap.funext_iff] theorem IsUnitary_equiv (σ : dIn ≃ dIn) : IsUnitary (ofEquiv σ) := by have h_unitary : ∃ U : Matrix dIn dIn ℂ, U * U.conjTranspose = 1 ∧ U.conjTranspose * U = 1 ∧ ∀ x : dIn, (∀ y : dIn, (U y x = 1) ↔ (y = σ x)) ∧ ∀ y : dIn, (U y x = 0) ↔ (y ≠ σ x) := by @@ -571,9 +554,8 @@ private lemma exists_unitary_extending_isometry refine ⟨⟨Matrix.of (fun i j ↦ b j i), ?_⟩, ?_⟩ · simp only [Matrix.mem_unitaryGroup_iff] ext1 i j - have := b.sum_inner_mul_inner (EuclideanSpace.single i 1) (EuclideanSpace.single j 1) - simp_all [inner] - exact this + simpa [Matrix.mul_apply, Matrix.one_apply, Matrix.star_apply, inner] using + b.sum_inner_mul_inner (EuclideanSpace.single i 1) (EuclideanSpace.single j 1) · simp [hb, u] omit [DecidableEq dOut] [Inhabited dOut] in @@ -787,8 +769,7 @@ theorem prep_append_map_entry (X : Matrix dIn dIn ℂ) let prep := (id ⊗ᶜᵖ zero_prep) let append : CPTPMap dIn (dIn × Unit) := CPTPMap.ofEquiv (Equiv.prodPUnit dIn).symm (prep ∘ₘ append).map X (a₁, b₁c₁) (a₂, b₂c₂) = - X a₁ a₂ * τ.m b₁c₁ b₂c₂ := by - simp [purify_prep_append_entry] + X a₁ a₂ * τ.m b₁c₁ b₂c₂ := by simp [purify_prep_append_entry] /-- The complementary channel comes from tracing out the other half (the right half) of the purified channel `purify`. -/ def complementary (Λ : CPTPMap dIn dOut) : CPTPMap dIn (dIn × dOut) := diff --git a/QuantumInfo/Channels/Dual.lean b/QuantumInfo/Channels/Dual.lean index b9e38a470..acb18f0ba 100644 --- a/QuantumInfo/Channels/Dual.lean +++ b/QuantumInfo/Channels/Dual.lean @@ -137,11 +137,9 @@ theorem IsPositive.dual {M : MatrixMap dIn dOut ℂ} (h : M.IsPositive) : M.dual intro v have h_dual_pos : 0 ≤ (M (Matrix.vecMulVec v (star v)) * x).trace := by --TODO Cleanup. Should be all in terms of HermitianMat - apply Matrix.PosSemidef.trace_mul_nonneg; - · apply h; - exact Matrix.posSemidef_vecMulVec_self_star v; - · rw [← Matrix.posSemidef_iff_dotProduct_mulVec] at hx - exact hx; + exact Matrix.PosSemidef.trace_mul_nonneg + (h (Matrix.posSemidef_vecMulVec_self_star v)) + (by rwa [← Matrix.posSemidef_iff_dotProduct_mulVec] at hx) convert h_dual_pos using 1; rw [ MatrixMap.Dual.trace_eq ]; simp [ Matrix.vecMulVec, Matrix.mul_apply, Matrix.trace ]; @@ -170,13 +168,9 @@ lemma dual_unique (h : ∀ A B, (M A * B).trace = (A * M' B).trace) : M.dual = M' := by -- By definition of dual, we know that for any A and B, the trace of (M A) * B equals the trace of -- A * (M.dual B). - have h_dual : ∀ A : Matrix dIn dIn 𝕜, ∀ B : Matrix dOut dOut 𝕜, (M A * B).trace = (A * M.dual B).trace := by - exact fun A B => Dual.trace_eq M A B; - -- Since these two linear maps agree on all bases, they must be equal. - have h_eq : ∀ A : Matrix dIn dIn 𝕜, ∀ B : Matrix dOut dOut 𝕜, (A * M.dual B).trace = (A * M' B).trace := by - exact fun A B => h_dual A B ▸ h A B; - refine' LinearMap.ext fun B => _; - exact Matrix.ext_iff_trace_mul_left.mpr fun x => h_eq x B + refine LinearMap.ext fun B => ?_ + exact Matrix.ext_iff_trace_mul_left.mpr fun A => + (Dual.trace_eq M A B).symm.trans (h A B) /-- The Choi matrix of the dual map is the transpose of the reindexed Choi matrix of the original map. @@ -206,10 +200,8 @@ positive semidefinite. -/ lemma dual_choi_matrix_posSemidef_of_posSemidef (M : MatrixMap dIn dOut 𝕜) (h : M.choi_matrix.PosSemidef) : M.dual.choi_matrix.PosSemidef := by - rw [ dual_choi_matrix ]; - simp +zetaDelta at *; - apply_rules [ Matrix.PosSemidef.submatrix ]; - convert h.transpose using 1 + rw [dual_choi_matrix] + simpa +zetaDelta using Matrix.PosSemidef.submatrix h.transpose (Equiv.prodComm dIn dOut) /-- The dual of the identity map is the identity map. @@ -327,8 +319,7 @@ def dual (M : CPTPMap dIn dOut) : CPUMap dOut dIn where cp := .dual M.cp theorem dual_pos (M : CPTPMap dIn dOut) {T : HermitianMat dOut ℂ} (hT : 0 ≤ T) : - 0 ≤ M.dual T := by - exact M.dual.pos_Hermitian hT + 0 ≤ M.dual T := M.dual.pos_Hermitian hT /-- The dual of a CPTP map preserves POVMs. Stated here just for two-element POVMs, that is, an operator `T` between 0 and 1. -/ @@ -428,8 +419,7 @@ def HPMap.hermDual : HPMap dOut dIn := HPMap.ofHermitianMat (LinearMapClass.linearMap f).adjoint @[simp] -theorem HPMap.hermDual_hermDual : f.hermDual.hermDual = f := by - simp [hermDual] +theorem HPMap.hermDual_hermDual : f.hermDual.hermDual = f := by simp [hermDual] open RealInnerProductSpace @@ -466,8 +456,7 @@ theorem MatrixMap.IsPositive.hermDual (h : MatrixMap.IsPositive f.map) : f.hermD theorem HPMap.hermDual_Unital [DecidableEq dIn] [DecidableEq dOut] (h : MatrixMap.IsTracePreserving f.map) : f.hermDual.map.Unital := by suffices f.hermDual 1 = 1 by --todo: make this is an accessible 'constructor' for Unital - rw [HermitianMat.ext_iff] at this - exact this + rwa [HermitianMat.ext_iff] at this open RealInnerProductSpace in apply ext_inner_left ℝ intro v @@ -487,8 +476,7 @@ def hermDual (M : PTPMap dIn dOut) : PUMap dOut dIn where unital := M.TP.hermDual theorem hermDual_pos (M : PTPMap dIn dOut) {T : HermitianMat dOut ℂ} (hT : 0 ≤ T) : - 0 ≤ M.hermDual T := by - exact M.hermDual.pos_Hermitian hT + 0 ≤ M.hermDual T := M.hermDual.pos_Hermitian hT /-- The dual of a PTP map preserves POVMs. Stated here just for two-element POVMs, that is, an operator `T` between 0 and 1. -/ diff --git a/QuantumInfo/Channels/MatrixMap.lean b/QuantumInfo/Channels/MatrixMap.lean index c5eea82a5..ba94eb425 100644 --- a/QuantumInfo/Channels/MatrixMap.lean +++ b/QuantumInfo/Channels/MatrixMap.lean @@ -163,8 +163,7 @@ theorem exists_kraus (Φ : MatrixMap A B R) : (M₀ ∘ e) x * Matrix.single i₁ i₂ (1 : R) * ((N₀ ∘ e) x).conjTranspose) j₁ j₂ = ∑ y : K, (M₀ y * Matrix.single i₁ i₂ (1 : R) * (N₀ y).conjTranspose) j₁ j₂ := by - rw [Matrix.sum_apply] - exact e.sum_comp + simpa [Matrix.sum_apply] using e.sum_comp (fun y : K => (M₀ y * Matrix.single i₁ i₂ (1 : R) * (N₀ y).conjTranspose) j₁ j₂) rw [hsum_reindex, Fintype.sum_prod_type, Fintype.sum_prod_type, Fintype.sum_prod_type] simp [M₀, N₀, Matrix.mul_apply, Matrix.single, ite_and] @@ -192,13 +191,11 @@ def submatrix (f : B → A) : MatrixMap A B R where map_smul' := by simp [Matrix.submatrix_smul] @[simp] -theorem submatrix_id : submatrix R _root_.id = id A R := by - ext1; simp +theorem submatrix_id : submatrix R _root_.id = id A R := rfl @[simp] theorem submatrix_comp (f : C → B) (g : B → A) : - submatrix R f ∘ₗ submatrix R g = submatrix R (g ∘ f) := by - ext1; simp + submatrix R f ∘ₗ submatrix R g = submatrix R (g ∘ f) := rfl end submatrix @@ -285,37 +282,29 @@ theorem kron_def [CommSemiring R] (M₁ : MatrixMap A B R) (M₂ : MatrixMap C D section kron_lemmas variable [CommSemiring R] -theorem add_kron (ML₁ ML₂ : MatrixMap A B R) (MR : MatrixMap C D R) : (ML₁ + ML₂) ⊗ₖₘ MR = ML₁ ⊗ₖₘ MR + ML₂ ⊗ₖₘ MR := by - simp [kron, TensorProduct.map_add_left, Matrix.submatrix_add] +theorem add_kron (ML₁ ML₂ : MatrixMap A B R) (MR : MatrixMap C D R) : (ML₁ + ML₂) ⊗ₖₘ MR = ML₁ ⊗ₖₘ MR + ML₂ ⊗ₖₘ MR := by simp [kron, TensorProduct.map_add_left, Matrix.submatrix_add] -theorem kron_add (ML : MatrixMap A B R) (MR₁ MR₂ : MatrixMap C D R) : ML ⊗ₖₘ (MR₁ + MR₂) = ML ⊗ₖₘ MR₁ + ML ⊗ₖₘ MR₂ := by - simp [kron, TensorProduct.map_add_right, Matrix.submatrix_add] +theorem kron_add (ML : MatrixMap A B R) (MR₁ MR₂ : MatrixMap C D R) : ML ⊗ₖₘ (MR₁ + MR₂) = ML ⊗ₖₘ MR₁ + ML ⊗ₖₘ MR₂ := by simp [kron, TensorProduct.map_add_right, Matrix.submatrix_add] -theorem smul_kron (r : R) (ML : MatrixMap A B R) (MR : MatrixMap C D R) : (r • ML) ⊗ₖₘ MR = r • (ML ⊗ₖₘ MR) := by - simp [kron, TensorProduct.map_smul_left, Matrix.submatrix_smul] +theorem smul_kron (r : R) (ML : MatrixMap A B R) (MR : MatrixMap C D R) : (r • ML) ⊗ₖₘ MR = r • (ML ⊗ₖₘ MR) := by simp [kron, TensorProduct.map_smul_left, Matrix.submatrix_smul] -theorem kron_smul (r : R) (ML : MatrixMap A B R) (MR : MatrixMap C D R) : ML ⊗ₖₘ (r • MR) = r • (ML ⊗ₖₘ MR) := by - simp [kron, TensorProduct.map_smul_right, Matrix.submatrix_smul] +theorem kron_smul (r : R) (ML : MatrixMap A B R) (MR : MatrixMap C D R) : ML ⊗ₖₘ (r • MR) = r • (ML ⊗ₖₘ MR) := by simp [kron, TensorProduct.map_smul_right, Matrix.submatrix_smul] @[simp] -theorem zero_kron (MR : MatrixMap C D R) : (0 : MatrixMap A B R) ⊗ₖₘ MR = 0 := by - simp [kron] +theorem zero_kron (MR : MatrixMap C D R) : (0 : MatrixMap A B R) ⊗ₖₘ MR = 0 := by simp [kron] @[simp] -theorem kron_zero (ML : MatrixMap A B R) : ML ⊗ₖₘ (0 : MatrixMap C D R) = 0 := by - simp [kron] +theorem kron_zero (ML : MatrixMap A B R) : ML ⊗ₖₘ (0 : MatrixMap C D R) = 0 := by simp [kron] variable [DecidableEq B] in -theorem kron_id_id : (id A R ⊗ₖₘ id B R) = id (A × B) R := by - simp [kron] +theorem kron_id_id : (id A R ⊗ₖₘ id B R) = id (A × B) R := by simp [kron] variable {Dl₁ Dl₂ Dl₃ Dr₁ Dr₂ Dr₃ : Type*} [Fintype Dl₁] [Fintype Dl₂] [Fintype Dl₃] [Fintype Dr₁] [Fintype Dr₂] [Fintype Dr₃] [DecidableEq Dl₁] [DecidableEq Dl₂] [DecidableEq Dr₁] [DecidableEq Dr₂] in /-- For maps L₁, L₂, R₁, and R₂, the product (L₂ ∘ₗ L₁) ⊗ₖₘ (R₂ ∘ₗ R₁) = (L₂ ⊗ₖₘ R₂) ∘ₗ (L₁ ⊗ₖₘ R₁) -/ theorem kron_comp_distrib (L₁ : MatrixMap Dl₁ Dl₂ R) (L₂ : MatrixMap Dl₂ Dl₃ R) (R₁ : MatrixMap Dr₁ Dr₂ R) - (R₂ : MatrixMap Dr₂ Dr₃ R) : (L₂ ∘ₗ L₁) ⊗ₖₘ (R₂ ∘ₗ R₁) = (L₂ ⊗ₖₘ R₂) ∘ₗ (L₁ ⊗ₖₘ R₁) := by - simp [kron, TensorProduct.map_comp, ← Matrix.toLin_mul, Matrix.submatrix_mul_equiv, ← LinearMap.toMatrix_comp] + (R₂ : MatrixMap Dr₂ Dr₃ R) : (L₂ ∘ₗ L₁) ⊗ₖₘ (R₂ ∘ₗ R₁) = (L₂ ⊗ₖₘ R₂) ∘ₗ (L₁ ⊗ₖₘ R₁) := by simp [kron, TensorProduct.map_comp, ← Matrix.toLin_mul, Matrix.submatrix_mul_equiv, ← LinearMap.toMatrix_comp] end kron_lemmas @@ -340,9 +329,8 @@ theorem kron_map_of_kron_state [CommRing R] (M₁ : MatrixMap A B R) (M₂ : Mat congr --TODO: Cleanup, these two branches are nearly identical (separate lemma?) · have h_linear : M₁ MA = ∑ i : A, ∑ i_1 : A, MA i i_1 • M₁ (Matrix.single i i_1 1) := by - have h_linear : M₁ MA = M₁ (∑ i : A, ∑ i_1 : A, Matrix.single i i_1 (MA i i_1)) := by - congr; - exact Matrix.matrix_eq_sum_single MA + have h_linear : M₁ MA = M₁ (∑ i : A, ∑ i_1 : A, Matrix.single i i_1 (MA i i_1)) := + congrArg M₁ (Matrix.matrix_eq_sum_single MA) simp [ h_linear, Matrix.single] congr! 2 with i _ j _ convert M₁.map_smul (MA i j) (Matrix.of fun i' j' ↦ if i = i' ∧ j = j' then 1 else 0) using 2 @@ -350,10 +338,8 @@ theorem kron_map_of_kron_state [CommRing R] (M₁ : MatrixMap A B R) (M₂ : Mat simp simp [h_linear, mul_comm, Matrix.sum_apply] · have h_expand : M₂ MC = ∑ i : C, ∑ j : C, MC i j • M₂ (Matrix.single i j 1) := by - have h_expand : MC = ∑ i : C, ∑ j : C, MC i j • Matrix.single i j 1 := by - ext i j - simp [Matrix.sum_apply, Matrix.single] - rw [ Finset.sum_eq_single i ] <;> aesop + have h_expand : MC = ∑ i : C, ∑ j : C, Matrix.single i j (MC i j) := + Matrix.matrix_eq_sum_single MC conv_lhs => rw [ h_expand ]; simp [map_sum] congr! 2 with i _ j _ @@ -394,12 +380,10 @@ theorem submatrix_kron_submatrix [CommSemiring R] (f : B → A) (g : D → C) : simp [Prod.map, Matrix.single, ite_and] theorem submatrix_kron_id [CommSemiring R] (f : B → A) : - submatrix R f ⊗ₖₘ id C R = submatrix R (Prod.map f _root_.id) := by - simp [← submatrix_kron_submatrix] + submatrix R f ⊗ₖₘ id C R = submatrix R (Prod.map f _root_.id) := submatrix_kron_submatrix f _root_.id theorem id_kron_submatrix [CommSemiring R] (f : B → A) : - id C R ⊗ₖₘ submatrix R f = submatrix R (Prod.map _root_.id f) := by - simp [← submatrix_kron_submatrix] + id C R ⊗ₖₘ submatrix R f = submatrix R (Prod.map _root_.id f) := submatrix_kron_submatrix _root_.id f end kron @@ -453,8 +437,7 @@ theorem piProd_comp [∀ i, Fintype (d₂ i)] [∀ i, DecidableEq (d₂ i)] [∀ i, Fintype (d₃ i)] [∀ i, DecidableEq (d₃ i)] (Λ₁ : ∀ i, MatrixMap (d₁ i) (d₂ i) R) (Λ₂ : ∀ i, MatrixMap (d₂ i) (d₃ i) R) : - piProd (fun i ↦ (Λ₂ i) ∘ₗ (Λ₁ i)) = (piProd Λ₂) ∘ₗ (piProd Λ₁) := by - simp [piProd, PiTensorProduct.map_comp, ← Matrix.toLin_mul, ← LinearMap.toMatrix_comp] + piProd (fun i ↦ (Λ₂ i) ∘ₗ (Λ₁ i)) = (piProd Λ₂) ∘ₗ (piProd Λ₁) := by simp [piProd, PiTensorProduct.map_comp, ← Matrix.toLin_mul, ← LinearMap.toMatrix_comp] @[simp] theorem piProd_id : diff --git a/QuantumInfo/Channels/Pinching.lean b/QuantumInfo/Channels/Pinching.lean index d734407a7..07b5d2dc1 100644 --- a/QuantumInfo/Channels/Pinching.lean +++ b/QuantumInfo/Channels/Pinching.lean @@ -103,8 +103,7 @@ def pinching_map (ρ : MState d) : CPTPMap d d ℂ := theorem pinchingMap_apply_M (σ ρ : MState d) : (pinching_map σ ρ).M = ⟨_, (MatrixMap.of_kraus_isCompletelyPositive - (HermitianMat.mat ∘ pinching_kraus σ)).IsPositive.IsHermitianPreserving ρ.M.H⟩ := by - rfl + (HermitianMat.mat ∘ pinching_kraus σ)).IsPositive.IsHermitianPreserving ρ.M.H⟩ := rfl theorem pinching_eq_sum_conj (σ ρ : MState d) : (pinching_map σ ρ).M = ∑ k, (pinching_kraus σ k).mat * ρ.M * (pinching_kraus σ k).mat := by @@ -191,7 +190,7 @@ theorem pinching_bound (ρ σ : MState d) : ρ.M ≤ (↑(Fintype.card (spectrum simp only [HermitianMat.mat_finset_sum] simp only [Matrix.mul_sum, Matrix.sum_mul, Matrix.sum_mulVec, dotProduct_sum] simp only [MState.pure] - dsimp [MState.m] + dsimp only [MState.m] --This out to be Cauchy-Schwarz. have hschwarz := inner_mul_inner_self_le (𝕜 := ℂ) (E := EuclideanSpace ℂ (↑(spectrum ℝ σ.m))) (x := .toLp 2 fun i ↦ 1) (y := .toLp 2 fun k ↦ ( @@ -240,8 +239,7 @@ theorem ker_le_ker_pinching_of_PosDef (ρ σ : MState d) (hpos : σ.m.PosDef) : simp [LinearMap.ker_eq_bot', HermitianMat.ker] at this ⊢ intro m hm simpa only [WithLp.ofLp_eq_zero] using this m congr($hm) - rw [h_ker] - exact bot_le + simp [h_ker] theorem pinching_idempotent (ρ σ : MState d) : (pinching_map σ) (pinching_map σ ρ) = (pinching_map σ ρ) := by @@ -325,10 +323,9 @@ theorem pinching_map_ker_le (ρ σ : MState d) : (pinching_map σ ρ).M.ker ≤ simp only [WithLp.toLp_sum, WithLp.toLp_ofLp] at hv_sum rw [← hv_sum] exact Submodule.sum_mem _ fun k _ ↦ by - have h1 := hv k; - simp only [HermitianMat.ker_conj ρ.nonneg, HermitianMat.conjTranspose_mat, - Submodule.mem_comap] at h1 ⊢ - exact h1 + change Matrix.toEuclideanLin (pinching_kraus σ k).mat v ∈ ρ.M.ker + simpa only [HermitianMat.ker_conj ρ.nonneg, HermitianMat.conjTranspose_mat, + Submodule.mem_comap] using hv k noncomputable section AristotleLemmas diff --git a/QuantumInfo/Channels/Unbundled.lean b/QuantumInfo/Channels/Unbundled.lean index 8cf0b84ef..df0315d23 100644 --- a/QuantumInfo/Channels/Unbundled.lean +++ b/QuantumInfo/Channels/Unbundled.lean @@ -86,8 +86,7 @@ theorem comp (h₁ : M.IsTracePreserving) (h₂ : M₂.IsTracePreserving) : /-- The identity MatrixMap IsTracePreserving. -/ @[simp] -theorem id : (id A R).IsTracePreserving := by - simp [IsTracePreserving, MatrixMap.id] +theorem id : (id A R).IsTracePreserving := fun _ => rfl variable {R : Type*} [CommSemiring R] in /-- Unit linear combinations of IsTracePreserving maps are IsTracePreserving. -/ @@ -202,8 +201,7 @@ theorem map_1 (h : M.Unital) : M 1 = 1 := /-- The identity `MatrixMap` is `Unital`. -/ @[simp] -theorem id : (id A R).Unital := by - simp [Unital, MatrixMap.id] +theorem id : (id A R).Unital := rfl --TODO: Closed under composition, kronecker products, it's iff M.choi_matrix.traceLeft = 1... @@ -308,13 +306,11 @@ theorem of_Fintype {M : MatrixMap A B R} (h : IsCompletelyPositive M) simp only [EmbeddingLike.apply_eq_iff_eq, Equiv.symm_apply_apply] constructor · intro h₂ - simp [MatrixMap.IsPositive] - exact h n + simpa [MatrixMap.IsPositive] using h n · intro h x hx specialize h (hx.submatrix (fun p : A × Fin n => (p.1, e.symm p.2))) rw [h_submatrix] - simp only [LinearMap.coe_comp, Function.comp_apply, submatrix_apply] - exact h.submatrix _ + simpa only [LinearMap.coe_comp, Function.comp_apply, submatrix_apply] using h.submatrix _ /- Every `MatrixMap` that `IsCompletelyPositive` also `IsPositiveMap`. -/ theorem IsPositive {M : MatrixMap A B R} @@ -365,15 +361,13 @@ theorem id : (id A R).IsCompletelyPositive := by theorem add {M₁ M₂ : MatrixMap A B R} (h₁ : M₁.IsCompletelyPositive) (h₂ : M₂.IsCompletelyPositive) : (M₁ + M₂).IsCompletelyPositive := fun n _ h ↦ by - simp only [add_kron, LinearMap.add_apply] - exact Matrix.PosSemidef.add (h₁ n h) (h₂ n h) + simpa only [add_kron, LinearMap.add_apply] using Matrix.PosSemidef.add (h₁ n h) (h₂ n h) /-- Nonnegative scalings of `IsCompletelyPositive` maps are `IsCompletelyPositive`. -/ theorem smul {M : MatrixMap A B R} (hM : M.IsCompletelyPositive) {x : R} (hx : 0 ≤ x) : (x • M).IsCompletelyPositive := - fun n ρ h ↦ by - rw [MatrixMap.smul_kron] - exact (hM n h).smul hx + fun n _ h ↦ by + simpa only [smul_kron, LinearMap.smul_apply] using (hM n h).smul hx variable (A B) in /-- The zero map `IsCompletelyPositive`. -/ @@ -482,9 +476,7 @@ omit [DecidableEq A] in theorem of_kraus_isPositive (K : κ → Matrix B A ℂ) : (of_kraus K K).IsPositive := by rw [of_kraus] - apply IsPositive_sum - intro k - exact conj_isPositive (K k) + exact IsPositive_sum _ fun k => conj_isPositive (K k) theorem conj_kron (M : Matrix B A 𝕜) (N : Matrix D C 𝕜) [DecidableEq C] : conj M ⊗ₖₘ conj N = conj (M ⊗ₖ N) := by @@ -552,14 +544,11 @@ theorem of_kraus_eq_sum_conj (K : κ → Matrix B A 𝕜) : theorem of_kraus_CP (K : κ → Matrix B A 𝕜) : (of_kraus K K).IsCompletelyPositive := by -- By definition of `MatrixMap.of_kraus`, we know that it is a sum of congruence maps. - have h_sum_congruence : MatrixMap.of_kraus K K = ∑ k, conj (K k) := by - -- By definition of `MatrixMap.of_kraus`, we know that it is equal to the sum of the congruence maps of each Kraus operator. - apply of_kraus_eq_sum_conj - have h_congruence_CP : ∀ k, (conj (K k)).IsCompletelyPositive := by - intro k; exact (by - convert congruence_CP ( K k ) using 1; - -- Since B is a finite type, we can use the fact that finite types have decidable equality. - apply Classical.decEq); + have h_sum_congruence : MatrixMap.of_kraus K K = ∑ k, conj (K k) := + of_kraus_eq_sum_conj K + have h_congruence_CP : ∀ k, (conj (K k)).IsCompletelyPositive := fun k => by + convert congruence_CP (K k) using 1 + exact Classical.decEq _ exact h_sum_congruence.symm ▸ IsCompletelyPositive.finset_sum h_congruence_CP theorem exists_kraus_of_choi_PSD @@ -598,8 +587,7 @@ theorem choi_PSD_iff_CP_map (M : MatrixMap A B R) : exact this ( Matrix.PosSemidef.outer_self_conj _ ) · intro h_psd obtain ⟨K, hK⟩ := exists_kraus_of_choi_PSD M.choi_matrix h_psd - rw [choi_matrix_inj hK] - exact of_kraus_CP K + exact (choi_matrix_inj hK) ▸ of_kraus_CP K omit [Fintype B] [DecidableEq A] in theorem conj_eq_mulRightLinearMap_comp_mulRightLinearMap (y : Matrix B A R) : diff --git a/QuantumInfo/ClassicalInfo/Distribution.lean b/QuantumInfo/ClassicalInfo/Distribution.lean index 7ec3fd2f0..ac1ab7088 100644 --- a/QuantumInfo/ClassicalInfo/Distribution.lean +++ b/QuantumInfo/ClassicalInfo/Distribution.lean @@ -46,8 +46,7 @@ sum is 1. The fact that the values are at most 1 is derived as a consequence. -/ def mk' (f : α → ℝ) (h₁ : ∀i, 0 ≤ f i) (hN : ∑ i, f i = 1) : ProbDistribution α := have h₃ : ∀x, f x ≤ 1 := by intro x - simp [← hN, Fintype.sum_eq_sum_compl_add x] - exact Finset.sum_nonneg' h₁ + simpa [← hN, Fintype.sum_eq_sum_compl_add x] using Finset.sum_nonneg' h₁ ⟨ fun i ↦ ⟨f i, ⟨h₁ i, h₃ i⟩⟩, hN⟩ instance instFunLikeProb : FunLike (ProbDistribution α) α Prob where @@ -63,13 +62,11 @@ theorem normalized (d : ProbDistribution α) : Finset.sum Finset.univ (fun i ↦ abbrev prob (d : ProbDistribution α) := (d : α → Prob) @[simp] -theorem fun_eq_val (d : ProbDistribution α) : d.val = d := - rfl +theorem fun_eq_val (d : ProbDistribution α) : d.val = d := rfl @[simp] theorem funlike_apply (d : α → Prob) (h : _) (x : α) : - DFunLike.coe (self := instFunLikeProb) ⟨d, h⟩ x = d x := - rfl + DFunLike.coe (self := instFunLikeProb) ⟨d, h⟩ x = d x := rfl @[ext] theorem ext {p q : ProbDistribution α} (h : ∀ x, p x = q x) : p = q := @@ -87,12 +84,10 @@ def constant (x : α) : ProbDistribution α := ⟨fun y ↦ if x = y then 1 else 0, by simp [apply_ite]⟩ -theorem constant_def (x : α) : (constant x : α → Prob) = fun y ↦ if x = y then 1 else 0 := by - rfl +theorem constant_def (x : α) : (constant x : α → Prob) = fun y ↦ if x = y then 1 else 0 := rfl @[simp] -theorem constant_eq (x : α) : constant x y = if x = y then 1 else 0 := by - rfl +theorem constant_eq (x : α) : constant x y = if x = y then 1 else 0 := rfl @[simp] theorem constant_def' (x y : α) : (constant x : α → Prob) y = if x = y then 1 else 0 := by @@ -136,8 +131,7 @@ def prod (d1 : ProbDistribution α) (d2 : ProbDistribution β) : ProbDistributio simp [← Finset.mul_sum, Fintype.sum_prod_type]⟩ @[simp] -theorem prod_def (x : α) (y : β) : prod d1 d2 ⟨x, y⟩ = (d1 x) * (d2 y) := - rfl +theorem prod_def (x : α) (y : β) : prod d1 d2 ⟨x, y⟩ = (d1 x) * (d2 y) := rfl /-- Given a distribution on α, extend it to a distribution on `Sum α β` by giving it no support on `β`. -/ @@ -172,23 +166,19 @@ def congr (σ : α ≃ β) : ProbDistribution α ≃ ProbDistribution β := by case left_inv => intro d ext i - unfold relabel - simp only [← fun_eq_val, Equiv.symm_apply_apply, Subtype.coe_eta] + simp only [relabel, ← fun_eq_val, Equiv.symm_apply_apply, Subtype.coe_eta] case right_inv => intro d ext i - unfold relabel - simp only [← fun_eq_val, Equiv.apply_symm_apply, Subtype.coe_eta] + simp only [relabel, ← fun_eq_val, Equiv.apply_symm_apply, Subtype.coe_eta] @[simp] -theorem congr_apply (σ : α ≃ β) (d : ProbDistribution α) (j : β): (congr σ d) j = d (σ.symm j) := by - rfl +theorem congr_apply (σ : α ≃ β) (d : ProbDistribution α) (j : β): (congr σ d) j = d (σ.symm j) := rfl /-- The inverse and congruence operations for distributions commute -/ @[simp] theorem congr_symm_apply (σ : α ≃ β) : - (ProbDistribution.congr σ).symm = ProbDistribution.congr σ.symm := by - rfl + (ProbDistribution.congr σ).symm = ProbDistribution.congr σ.symm := rfl /-- The distribution on Fin 2 corresponding to a coin with probability p. Chance p of 1, 1-p of 0. -/ @@ -196,12 +186,10 @@ def coin (p : Prob) : ProbDistribution (Fin 2) := ⟨(if · = 0 then p else 1 - p), by simp⟩ @[simp] -theorem coin_val_zero (p : Prob) : coin p 0 = p := by - simp [coin] +theorem coin_val_zero (p : Prob) : coin p 0 = p := rfl @[simp] -theorem coin_val_one (p : Prob) : coin p 1 = 1 - p := by - simp [coin] +theorem coin_val_one (p : Prob) : coin p 1 = 1 - p := rfl /-- Every distribution on two variable is some coin. -/ theorem fin_two_eq_coin (d : ProbDistribution (Fin 2)) : d = coin (d 0) := by @@ -260,10 +248,8 @@ theorem expect_val_eq_mixable_mix (d : ProbDistribution (Fin 2)) (x₁ x₂ : T) simp only [Mixable.mix, expect_val, DFunLike.coe, Mixable.to_U_of_mkT] calc ∑ i : Fin (Nat.succ 0).succ, (d i : ℝ) • Mixable.to_U (![x₁, x₂] i) = - ∑ i, (d i : ℝ) • Mixable.to_U (![x₁, x₂] i) := by - simp - _ = (d 0 : ℝ) • Mixable.to_U (![x₁, x₂] 0) + (d 1 : ℝ) • Mixable.to_U (![x₁, x₂] 1) := by - simp + ∑ i, (d i : ℝ) • Mixable.to_U (![x₁, x₂] i) := by simp + _ = (d 0 : ℝ) • Mixable.to_U (![x₁, x₂] 0) + (d 1 : ℝ) • Mixable.to_U (![x₁, x₂] 1) := by simp _ = (d 0 : ℝ) • Mixable.to_U x₁ + (1 - d 0).val • Mixable.to_U x₂ := by congr simpa only [Subtype.ext_iff, Prob.coe_one_minus, eq_sub_iff_add_eq, add_comm, diff --git a/QuantumInfo/ClassicalInfo/Entropy.lean b/QuantumInfo/ClassicalInfo/Entropy.lean index c7f579ad7..3c9e381a1 100644 --- a/QuantumInfo/ClassicalInfo/Entropy.lean +++ b/QuantumInfo/ClassicalInfo/Entropy.lean @@ -31,13 +31,11 @@ def H₁ : Prob → ℝ := /-- H₁ of 0 is zero.-/ @[simp] -def H₁_zero_eq_zero : H₁ 0 = 0 := by - simp [H₁] +def H₁_zero_eq_zero : H₁ 0 = 0 := Real.negMulLog_zero /-- H₁ of 1 is zero.-/ @[simp] -def H₁_one_eq_zero : H₁ 1 = 0 := by - simp [H₁] +def H₁_one_eq_zero : H₁ 1 = 0 := Real.negMulLog_one /-- Entropy is nonnegative. -/ theorem H₁_nonneg (p : Prob) : 0 ≤ H₁ p := by @@ -112,17 +110,14 @@ theorem Hₛ_le_log_d (d : ProbDistribution α) : Hₛ d ≤ Real.log (Fintype.c /-- The shannon entropy of a constant variable is zero. -/ @[simp] -theorem Hₛ_constant_eq_zero {i : α} : Hₛ (ProbDistribution.constant i) = 0 := by - simp [Hₛ, apply_ite] +theorem Hₛ_constant_eq_zero {i : α} : Hₛ (ProbDistribution.constant i) = 0 := by simp [Hₛ, apply_ite] /-- Shannon entropy of a uniform distribution is ln d. -/ theorem Hₛ_uniform [Nonempty α] : - Hₛ (ProbDistribution.uniform (α := α)) = Real.log (Finset.univ.card (α := α)) := by - simp [Hₛ, ProbDistribution.prob, H₁, Real.negMulLog] + Hₛ (ProbDistribution.uniform (α := α)) = Real.log (Finset.univ.card (α := α)) := by simp [Hₛ, ProbDistribution.prob, H₁, Real.negMulLog] /-- Shannon entropy of two-event distribution. -/ -theorem Hₛ_coin (p : Prob) : Hₛ (ProbDistribution.coin p) = Real.binEntropy p := by - simp [Hₛ, H₁, ProbDistribution.coin, Real.binEntropy_eq_negMulLog_add_negMulLog_one_sub] +theorem Hₛ_coin (p : Prob) : Hₛ (ProbDistribution.coin p) = Real.binEntropy p := by simp [Hₛ, H₁, ProbDistribution.coin, Real.binEntropy_eq_negMulLog_add_negMulLog_one_sub] lemma Hₛ_eq_of_multiset_map_eq (d₁ : ProbDistribution α) (d₂ : ProbDistribution β) (h : Multiset.map d₁.prob Finset.univ.val = Multiset.map d₂.prob Finset.univ.val) : diff --git a/QuantumInfo/ClassicalInfo/Prob.lean b/QuantumInfo/ClassicalInfo/Prob.lean index ab934e428..b401b43fe 100644 --- a/QuantumInfo/ClassicalInfo/Prob.lean +++ b/QuantumInfo/ClassicalInfo/Prob.lean @@ -53,24 +53,19 @@ instance instMul : Mul Prob := ⟨mul_nonneg x.2.1 y.2.1, mul_le_one₀ x.2.2 y.2.1 y.2.2⟩⟩⟩ @[simp, norm_cast] -theorem coe_zero : (0 : Prob).val = 0 := - rfl +theorem coe_zero : (0 : Prob).val = 0 := rfl @[simp, norm_cast] -theorem coe_one : (1 : Prob).val = 1 := - rfl +theorem coe_one : (1 : Prob).val = 1 := rfl @[simp, norm_cast] -theorem coe_mul (x y : Prob) : (x * y).val = x.val * y.val := - rfl +theorem coe_mul (x y : Prob) : (x * y).val = x.val * y.val := rfl @[simp, norm_cast] -theorem coe_inf (x y : Prob) : (x ⊓ y).val = x.val ⊓ y.val := - rfl +theorem coe_inf (x y : Prob) : (x ⊓ y).val = x.val ⊓ y.val := rfl @[simp, norm_cast] -theorem coe_sup (x y : Prob) : (x ⊔ y).val = x.val ⊔ y.val := - rfl +theorem coe_sup (x y : Prob) : (x ⊔ y).val = x.val ⊔ y.val := rfl instance instCommMonoidWithZero : CommMonoidWithZero Prob where mul_assoc := by intros; ext; simp [mul_assoc] @@ -120,16 +115,14 @@ theorem ne_iff {x y : Prob} : (x : ℝ) ≠ (y : ℝ) ↔ x ≠ y := not_congr <| Prob.ext_iff.symm @[simp, norm_cast] -theorem toReal_mul (x y : Prob) : (x * y : Prob) = (x : ℝ) * (y : ℝ) := by - simp only [coe_mul] +theorem toReal_mul (x y : Prob) : (x * y : Prob) = (x : ℝ) * (y : ℝ) := rfl /-- Coercion `Prob → ℝ≥0`. -/ @[coe] def toNNReal : Prob → ℝ≥0 := fun p ↦ ⟨p.val, zero_le_coe⟩ @[simp] -theorem toNNReal_mk : toNNReal { val := x, property := hx} = { val := x, property := hx.1 } := - rfl +theorem toNNReal_mk : toNNReal { val := x, property := hx} = { val := x, property := hx.1 } := rfl instance : Coe Prob ℝ≥0 := ⟨toNNReal⟩ @@ -142,12 +135,10 @@ protected theorem eq_iff_nnreal (n m : Prob) : (n : ℝ≥0) = (m : ℝ≥0) ↔ simp only [toNNReal_mk, Subtype.mk.injEq, NNReal] @[simp, norm_cast] -theorem toNNReal_zero : (0 : Prob) = (0 : ℝ≥0) := - rfl +theorem toNNReal_zero : (0 : Prob) = (0 : ℝ≥0) := rfl @[simp, norm_cast] -theorem toNNReal_one : (1 : Prob) = (1 : ℝ≥0) := - rfl +theorem toNNReal_one : (1 : Prob) = (1 : ℝ≥0) := rfl theorem ofNNReal_toNNReal : ENNReal.ofNNReal (toNNReal p) = ENNReal.ofReal (p : ℝ) := by simp [toNNReal, ENNReal.ofReal_eq_coe_nnreal] @@ -170,15 +161,12 @@ instance instSub : Sub Prob where simpa using le_add_of_le_of_nonneg p.2.2 q.2.1 ⟩ -theorem coe_sub (p q : Prob) : (p - q : Prob) = (p.val - q.val) ⊔ (0 : ℝ) := by - rfl +theorem coe_sub (p q : Prob) : (p - q : Prob) = (p.val - q.val) ⊔ (0 : ℝ) := rfl @[simp, norm_cast] -theorem coe_one_minus (p : Prob) : (1 - p : Prob) = 1 - (p : ℝ) := by - simp [coe_sub] +theorem coe_one_minus (p : Prob) : (1 - p : Prob) = 1 - (p : ℝ) := by simp [coe_sub] -theorem add_one_minus (p : Prob) : p.val + (1 - p).val = 1 := by - simp +theorem add_one_minus (p : Prob) : p.val + (1 - p).val = 1 := by simp @[simp] theorem one_minus_inv (p : Prob) : 1 - (1 - p) = p := by @@ -200,8 +188,7 @@ instance : Nontrivial Prob where exists_pair_ne := ⟨0, 1, by simp [← Prob.ne_iff]⟩ @[simp] -theorem top_eq_one : (⊤ : Prob) = 1 := by - rfl +theorem top_eq_one : (⊤ : Prob) = 1 := rfl @[simp] theorem sub_zero (p : Prob) : p - 0 = p := by @@ -291,12 +278,10 @@ instance instUniv [AddCommMonoid T] [Module ℝ T] : Mixable T T where @[simp] theorem mkT_instUniv [AddCommMonoid T] [Module ℝ T] {t : T} (h : ∃ t', to_U t' = t) : - instUniv.mkT h = ⟨t, rfl⟩ := - rfl + instUniv.mkT h = ⟨t, rfl⟩ := rfl @[simp] -theorem to_U_instUniv [AddCommMonoid T] [Module ℝ T] {t : T} : instUniv.to_U t = t := - rfl +theorem to_U_instUniv [AddCommMonoid T] [Module ℝ T] {t : T} : instUniv.to_U t = t := rfl section pi @@ -325,13 +310,11 @@ instance instPi : Mixable ((i:D) → U i) ((i:D) → T i) where @[simp] theorem val_mkT_instPi (D : Type*) [inst : Mixable U T] {u : D → U} (h : ∃ t, to_U t = u) : - (instPi.mkT h).val = fun d ↦ (inst.mkT (instPi.lem_1 h d)).val := - rfl + (instPi.mkT h).val = fun d ↦ (inst.mkT (instPi.lem_1 h d)).val := rfl @[simp] theorem to_U_instPi (D : Type*) [inst : Mixable U T] {t : D → T} : - (instPi).to_U t = fun d ↦ inst.to_U (t d) := - rfl + (instPi).to_U t = fun d ↦ inst.to_U (t d) := rfl end pi @@ -379,13 +362,11 @@ instance instMixable : Mixable ℝ Prob where · nlinarith @[simp] -theorem to_U_mixable [AddCommMonoid T] [SMul ℝ T] (t : Prob) : instMixable.to_U t = t.val := - rfl +theorem to_U_mixable [AddCommMonoid T] [SMul ℝ T] (t : Prob) : instMixable.to_U t = t.val := rfl @[simp] theorem mkT_mixable (u : ℝ) (h : ∃ t : Prob, Mixable.to_U t = u) : Mixable.mkT h = - ⟨⟨u,Exists.casesOn h fun t ht ↦ ht ▸ t.2⟩, rfl⟩ := - rfl + ⟨⟨u,Exists.casesOn h fun t ht ↦ ht ▸ t.2⟩, rfl⟩ := rfl /-- `Prob.mix` is an alias of `Mixable.mix` so it can be accessed from a probability with dot notation, e.g. `p.mix x y`. -/ @@ -423,20 +404,16 @@ theorem negLog_Antitone : Antitone negLog := by <;> exact lt_of_le_of_ne zero_le (unitInterval.coe_ne_zero.mpr (by assumption)).symm @[simp] -theorem negLog_zero : —log (0 : Prob) = ⊤ := by - simp [negLog] +theorem negLog_zero : —log (0 : Prob) = ⊤ := by simp [negLog] @[simp] -theorem negLog_one : —log 1 = 0 := by - simp [negLog]; rfl +theorem negLog_one : —log 1 = 0 := by simp [negLog]; rfl @[simp] -theorem negLog_eq_top_iff {p : Prob} : —log p = ⊤ ↔ p = 0 := by - simp [negLog] +theorem negLog_eq_top_iff {p : Prob} : —log p = ⊤ ↔ p = 0 := by simp [negLog] theorem negLog_pos_ENNReal {p : Prob} (hp : p ≠ 0) : —log p = .ofNNReal ⟨-Real.log p, - Left.nonneg_neg_iff.mpr (Real.log_nonpos p.2.1 p.2.2)⟩ := by - simp [negLog, hp] + Left.nonneg_neg_iff.mpr (Real.log_nonpos p.2.1 p.2.2)⟩ := by simp [negLog, hp] @[simp] theorem negLog_pos_Real {p : Prob} : (—log p).toReal = -Real.log p := by diff --git a/QuantumInfo/Entropy/DPI.lean b/QuantumInfo/Entropy/DPI.lean index a85a22508..de8febf8a 100644 --- a/QuantumInfo/Entropy/DPI.lean +++ b/QuantumInfo/Entropy/DPI.lean @@ -267,8 +267,7 @@ Proof: f_α(H_hat, ρ, σ) = α · Tr[(σ^γ ρ σ^γ)^α] - (α-1) · Tr[(σ^γ -/ theorem f_alpha_at_optimizer (hα : 1 < α) (ρ σ : MState d) : f_alpha α (H_hat α ρ σ) ρ σ = Q̃_ α(ρ‖σ) := by - have h_inner : ⟪ρ.M, H_hat α ρ σ⟫_ℝ = ((ρ.M.conj (σ.M ^ ((1 - α) / (2 * α))).mat) ^ α).trace := by - exact inner_rho_H_hat hα ρ σ + have h_inner : ⟪ρ.M, H_hat α ρ σ⟫_ℝ = ((ρ.M.conj (σ.M ^ ((1 - α) / (2 * α))).mat) ^ α).trace := inner_rho_H_hat hα ρ σ have h_conj : (H_hat α ρ σ).conj (σ.M ^ ((α - 1) / (2 * α))).mat = (ρ.M.conj (σ.M ^ ((1 - α) / (2 * α))).mat) ^ (α - 1) := by convert H_hat_conj_sigma (hα := hα) (ρ := ρ) (σ := σ) using 1 @@ -317,8 +316,7 @@ lemma supportProj_mul_of_ker_le {A B : HermitianMat d ℂ} simp [add_comm] simp [← Matrix.ext_iff] intro i j; exact (by - have h_support : A.kerProj + A.supportProj = 1 := by - exact kerProj_add_supportProj A + have h_support : A.kerProj + A.supportProj = 1 := kerProj_add_supportProj A convert! congr_arg (fun f => f i j) h_support using 1) rw [← Matrix.add_mulVec, h_support, Matrix.one_mulVec] have hsup : B.mat *ᵥ (A.kerProj.mat *ᵥ x.ofLp) = 0 := by @@ -326,8 +324,7 @@ lemma supportProj_mul_of_ker_le {A B : HermitianMat d ℂ} have h_support : A.mat * A.kerProj.mat = 0 := by have h_support : A.mat * A.kerProj.mat = A.mat * (1 - A.supportProj.mat) := by congr - have h_support : A.kerProj + A.supportProj = 1 := by - exact kerProj_add_supportProj A + have h_support : A.kerProj + A.supportProj = 1 := kerProj_add_supportProj A exact eq_sub_of_add_eq <| congr_arg Subtype.val h_support rw [h_support, mul_sub, mul_one, sub_eq_zero] exact Eq.symm (mul_supportProj_of_ker_le fun ⦃x⦄ a => a) @@ -342,8 +339,7 @@ lemma supportProj_mul_of_ker_le {A B : HermitianMat d ℂ} · simp [Matrix.mulVec, dotProduct] · simp [Matrix.mulVec, dotProduct] rfl - have h_support : B.mat = B.mat.conjTranspose := by - exact B.2.symm + have h_support : B.mat = B.mat.conjTranspose := B.2.symm have h_support : (B.mat * A.supportProj.mat).conjTranspose = A.supportProj.mat * B.mat := by simp [Matrix.conjTranspose_mul] lia @@ -435,8 +431,7 @@ theorem traceFunctional_eq_iSup_f_alpha (hα : 1 < α) (ρ σ : MState d) (hker Q̃_ α(ρ‖σ) = ⨆ (H : {H : HermitianMat d ℂ // 0 ≤ H}), f_alpha α H.1 ρ σ := by rw [@ciSup_eq_of_forall_le_of_forall_lt_exists_gt] · intro i - rw [← f_alpha_at_optimizer hα ρ σ] - exact f_alpha_le_at_optimizer hα ρ σ i i.2 hker + simpa [← f_alpha_at_optimizer hα ρ σ] using f_alpha_le_at_optimizer hα ρ σ i i.2 hker · intro w hw exact ⟨⟨H_hat α ρ σ, H_hat_nonneg ρ σ⟩, hw.trans_le (f_alpha_at_optimizer hα ρ σ ▸ le_rfl)⟩ @@ -535,9 +530,8 @@ theorem iSup_f_alpha_jointly_convex (hα : 1 < α) ∑ i, w i * (⨆ (H : {H : HermitianMat d ℂ // 0 ≤ H}), f_alpha α H.1 (ρs i) (σs i)) := by apply ciSup_le intro H - have h_sum : f_alpha α H.1 ρ_mix σ_mix ≤ ∑ i, w i * (f_alpha α H.1 (ρs i) (σs i)) := by - apply f_alpha_jointly_convex hα H.1 H.2 w hw_nonneg hw_sum ρs σs ρ_mix σ_mix hρ_mix hσ_mix - exact h_sum.trans (Finset.sum_le_sum fun i _ => mul_le_mul_of_nonneg_left + exact (f_alpha_jointly_convex hα H.1 H.2 w hw_nonneg hw_sum ρs σs ρ_mix σ_mix + hρ_mix hσ_mix).trans (Finset.sum_le_sum fun i _ => mul_le_mul_of_nonneg_left (le_ciSup (f_alpha_bddAbove hα (ρs i) (σs i) (hker i)) H) (hw_nonneg i)) /-- If for all i, ker(σs i) ≤ ker(ρs i), then ker(∑ w i • σs i) ≤ ker(∑ w i • ρs i), @@ -849,9 +843,7 @@ theorem sandwichedTraceFunctional_self (hα : 0 < α) (ρ : MState d) : · exact div_ne_zero (sub_ne_zero_of_ne (Ne.symm h)) (mul_ne_zero two_ne_zero hα.ne') · nlinarith [mul_div_cancel₀ (1 - α) (by positivity : (2 * α) ≠ 0)] have h_simp : (ρ.M ^ (1 + 2 * ((1 - α) / (2 * α)))) ^ α = - ρ.M ^ ((1 + 2 * ((1 - α) / (2 * α))) * α) := by - rw [← rpow_mul] - exact le_of_lt this + ρ.M ^ ((1 + 2 * ((1 - α) / (2 * α))) * α) := (HermitianMat.rpow_mul (le_of_lt this)).symm field_simp at * simp_all only [add_sub_cancel, one_div, rpow_one, MState.tr] @@ -877,8 +869,7 @@ def MState.conjTensorUnitary (ρ : MState (dA × dB)) (V : Matrix.unitaryGroup d the twirling set gives `ρ_A ⊗ uniform_B`. We state the HermitianMat-level equality needed for the joint convexity argument. -/ theorem MState.conjTensorUnitary_M (ρ : MState (dA × dB)) (V : Matrix.unitaryGroup dB ℂ) : - (ρ.conjTensorUnitary V).M = ρ.M.conj ((1 : Matrix.unitaryGroup dA ℂ) ⊗ᵤ V).val := by - rfl + (ρ.conjTensorUnitary V).M = ρ.M.conj ((1 : Matrix.unitaryGroup dA ℂ) ⊗ᵤ V).val := rfl /-- The trace functional is invariant under `1_A ⊗ V` conjugation. -/ theorem sandwichedTraceFunctional_conj_tensorUnitary @@ -1065,8 +1056,7 @@ This follows from `ker_conj` (which expresses `(A.conj B).ker` as a `comap`) and lemma ker_conj_le_of_ker_le {n : Type*} [Fintype n] [DecidableEq n] {A B : HermitianMat n ℂ} (hA : 0 ≤ A) (hB : 0 ≤ B) (h : A.ker ≤ B.ker) (C : Matrix n n ℂ) : (A.conj C).ker ≤ (B.conj C).ker := by - rw [ker_conj hA, ker_conj hB] - exact Submodule.comap_mono h + simpa [ker_conj hA, ker_conj hB] using Submodule.comap_mono h /-- Unitary conjugation preserves the kernel ordering between MStates. If `σ.M.ker ≤ ρ.M.ker`, then `(σ.conjTensorUnitary V).M.ker ≤ (ρ.conjTensorUnitary V).M.ker`. -/ @@ -1099,8 +1089,7 @@ theorem sandwichedTraceFunctional_mono_traceRight [Nonempty dB] field_simp -- Step 3: By joint convexity (α > 1) have hw_sum : ∑ i : κ, (Fintype.card κ : ℝ)⁻¹ = 1 := by - rw [Finset.sum_const, Finset.card_univ, nsmul_eq_mul] - exact mul_inv_cancel₀ hcard_ne + simp [Finset.sum_const, Finset.card_univ, nsmul_eq_mul, hcard_ne] set ρ_mix := ρ.traceRight ⊗ᴹ MState.uniform (d := dB) set σ_mix := σ.traceRight ⊗ᴹ MState.uniform (d := dB) have hρ_mix : ρ_mix.M = ∑ i : κ, (Fintype.card κ : ℝ)⁻¹ • (ρ.conjTensorUnitary (V i)).M := @@ -1241,8 +1230,7 @@ theorem sandwichedRenyiEntropy_conj_unitary (hα : 0 < α) (ρ σ : MState d) · use (U.val.conjTranspose.toEuclideanLin x) simp_all [ker, Matrix.toEuclideanLin] simp_all [lin, Matrix.toLpLin] - have h_unitary : (U.val * U.val.conjTranspose) = 1 := by - exact U.2.2 + have h_unitary : (U.val * U.val.conjTranspose) = 1 := U.2.2 generalize_proofs at *; ( apply_fun (U.val.conjTranspose *ᵥ ·) at hx simp_all [Matrix.mul_assoc, Matrix.mulVec_mulVec] @@ -1284,14 +1272,12 @@ The sandwiched Rényi divergence is invariant under tensoring with a fixed pure `D̃_α(ρ ⊗ |ψ⟩⟨ψ| ‖ σ ⊗ |ψ⟩⟨ψ|) = D̃_α(ρ ‖ σ)`. -/ theorem sandwichedRenyiEntropy_tensor_pure (hα : 0 < α) (ρ σ : MState d₁) (ψ : Ket d₂) : - D̃_ α(ρ ⊗ᴹ MState.pure ψ‖σ ⊗ᴹ MState.pure ψ) = D̃_ α(ρ‖σ) := by - simp [hα] + D̃_ α(ρ ⊗ᴹ MState.pure ψ‖σ ⊗ᴹ MState.pure ψ) = D̃_ α(ρ‖σ) := by simp [hα] /-- The sandwiched Rényi divergence is invariant under SWAP. -/ @[simp] theorem sandwichedRenyiEntropy_SWAP (ρ σ : MState (dA × dB)) : - D̃_ α(ρ.SWAP‖σ.SWAP) = D̃_ α(ρ‖σ) := by - exact sandwichedRelRentropy_relabel ρ σ _ + D̃_ α(ρ.SWAP‖σ.SWAP) = D̃_ α(ρ‖σ) := sandwichedRelRentropy_relabel ρ σ _ /- Monotonicity of the sandwiched Rényi divergence under traceRight for `α > 1`, diff --git a/QuantumInfo/Entropy/Relative.lean b/QuantumInfo/Entropy/Relative.lean index 4775e59d6..49db5cee4 100644 --- a/QuantumInfo/Entropy/Relative.lean +++ b/QuantumInfo/Entropy/Relative.lean @@ -265,9 +265,8 @@ lemma HermitianMat.rpow_neg_mul_rpow_eq_supportProj rw [ h_cfc, ← mat_cfc_mul ]; have h_cfc : ∀ x : ℝ, 0 ≤ x → x ^ (-p) * x ^ p = if x = 0 then 0 else 1 := by intro x hx; by_cases hx' : x = 0 <;> simp [ hx', Real.rpow_neg, hx, hp ] ; - have h_cfc_eq : (A.cfc (fun x => x ^ (-p) * x ^ p)) = (A.cfc (fun x => if x = 0 then 0 else 1)) := by - apply cfc_congr_of_nonneg hA; - exact fun x hx => h_cfc x hx; + have h_cfc_eq : (A.cfc (fun x => x ^ (-p) * x ^ p)) = (A.cfc (fun x => if x = 0 then 0 else 1)) := + cfc_congr_of_nonneg hA (fun x hx => h_cfc x hx) convert! congr_arg ( fun x : HermitianMat d ℂ => x.val ) h_cfc_eq using 1; exact congr_arg ( fun x : HermitianMat d ℂ => x.val ) ( supportProj_eq_cfc A ) @@ -280,10 +279,8 @@ lemma HermitianMat.supportProj_mul_self (A : HermitianMat d ℂ) : have h_supportProj_mul_A : ∀ (v : EuclideanSpace ℂ d), v ∈ LinearMap.range A.val.toEuclideanLin → (A.supportProj.val.toEuclideanLin v) = v := by intro v hv have h_supportProj_mul_A : (A.supportProj.val.toEuclideanLin v) = (Submodule.orthogonalProjectionOnto (LinearMap.range A.val.toEuclideanLin) v) := by - simp only [val_eq_coe, Submodule.coe_orthogonalProjectionOnto_apply] + simp only [val_eq_coe] simp [supportProj, projector] - simp only [Submodule.starProjection] - simp have key : ∀ (f : EuclideanSpace ℂ d →ₗ[ℂ] EuclideanSpace ℂ d), Matrix.toEuclideanLin ((LinearMap.toMatrix (EuclideanSpace.basisFun d ℂ).toBasis (EuclideanSpace.basisFun d ℂ).toBasis) f) = f := by @@ -314,8 +311,7 @@ lemma HermitianMat.mul_supportProj_of_ker_le {A B : HermitianMat d ℂ} (h : LinearMap.ker B.lin.toLinearMap ≤ LinearMap.ker A.lin.toLinearMap) : A.mat * B.supportProj.mat = A.mat := by -- Since $B.supportProj$ is the projection onto $range B$, we have $B.supportProj * B.mat = B.mat$. - have h_supportProj_mul_B : B.supportProj.mat * B.mat = B.mat := by - exact supportProj_mul_self B + have h_supportProj_mul_B : B.supportProj.mat * B.mat = B.mat := supportProj_mul_self B have h_range_A_subset_range_B : LinearMap.range A.lin.toLinearMap ≤ LinearMap.range B.lin.toLinearMap := by have h_orthogonal_complement : LinearMap.range (B.lin : EuclideanSpace ℂ d →ₗ[ℂ] EuclideanSpace ℂ d) = (LinearMap.ker (B.lin : EuclideanSpace ℂ d →ₗ[ℂ] EuclideanSpace ℂ d))ᗮ := by have h_orthogonal_complement : ∀ (T : EuclideanSpace ℂ d →ₗ[ℂ] EuclideanSpace ℂ d), T = T.adjoint → LinearMap.range T = (LinearMap.ker T)ᗮ := by @@ -361,8 +357,7 @@ lemma HermitianMat.mul_supportProj_of_ker_le {A B : HermitianMat d ℂ} lemma HermitianMat.inner_supportProj_of_ker_le {A B : HermitianMat d ℂ} (h : LinearMap.ker B.lin.toLinearMap ≤ LinearMap.ker A.lin.toLinearMap) : - ⟪A, B.supportProj⟫ = A.trace := by - rw [inner_def, mul_supportProj_of_ker_le h, trace] + ⟪A, B.supportProj⟫ = A.trace := by rw [inner_def, mul_supportProj_of_ker_le h, trace] lemma supportProj_inner_density (h : σ.M.ker ≤ ρ.M.ker) : ⟪σ.M.supportProj, ρ.M⟫_ℝ = 1 := by @@ -439,8 +434,7 @@ private theorem sandwichedRelRentropy_nonneg_α_gt_1 (h : σ.M.ker ≤ ρ.M.ker) positivity private lemma sandwichedRelRentropy.trace_at_one (ρ σ : MState d) : - ((ρ.M.conj (σ.M ^ ((1 - (1:ℝ)) / (2 * (1:ℝ)))).mat) ^ (1:ℝ)).trace = 1 := by - simp + ((ρ.M.conj (σ.M ^ ((1 - (1:ℝ)) / (2 * (1:ℝ)))).mat) ^ (1:ℝ)).trace = 1 := by simp /- For fixed PSD B, the derivative of α ↦ Tr[B^α] at α = 1 is ⟪B, B.log⟫ = Tr[B log B]. @@ -508,14 +502,11 @@ private lemma trace_conj_eq_inner_rpow {ρ σ : MState d} {t : ℝ} (ht : t ≠ rw [ h_cyclic, two_mul ] ring_nf have h_exp : (σ.M ^ (t + t)).mat = (σ.M ^ t).mat * (σ.M ^ t).mat := by - have h_nonneg : 0 ≤ σ.M := by - exact σ.nonneg - have h_ne_zero : t + t ≠ 0 := by - exact fun h => ht ( by linarith ) + have h_nonneg : 0 ≤ σ.M := σ.nonneg + have h_ne_zero : t + t ≠ 0 := fun h => ht ( by linarith ) exact HermitianMat.mat_rpow_add h_nonneg h_ne_zero rw [ mul_two, h_exp ] - have h_inner : ⟪ρ.M, σ.M ^ (2 * t)⟫ = ((ρ.M.mat * (σ.M ^ (2 * t)).mat).trace).re := by - exact rfl + have h_inner : ⟪ρ.M, σ.M ^ (2 * t)⟫ = ((ρ.M.mat * (σ.M ^ (2 * t)).mat).trace).re := rfl simp_all convert congr_arg Complex.re h_cyclic using 1 ; simp [ HermitianMat.conj ] ; ring!; rw [ Matrix.trace_mul_comm ] @@ -527,8 +518,7 @@ private def eigenWeight (ρ σ : MState d) (i : d) : ℝ := private lemma inner_cfc_eq_sum_eigenWeight (ρ σ : MState d) (f : ℝ → ℝ) : ⟪ρ.M, σ.M.cfc f⟫ = ∑ i, f (σ.M.H.eigenvalues i) * eigenWeight ρ σ i := by -- By definition of the inner product in the context of Hermitian matrices, we can expand it using the trace. - have h_inner : ⟪ρ.M, σ.M.cfc f⟫ = RCLike.re (Matrix.trace (ρ.M.mat * (σ.M.cfc f).mat)) := by - exact rfl; + have h_inner : ⟪ρ.M, σ.M.cfc f⟫ = RCLike.re (Matrix.trace (ρ.M.mat * (σ.M.cfc f).mat)) := rfl; have h_trace : Matrix.trace (ρ.M.mat * (σ.M.cfc f).mat) = ∑ i, f (σ.M.H.eigenvalues i) * (star (σ.M.H.eigenvectorBasis i) ⬝ᵥ ρ.M.mat.mulVec (σ.M.H.eigenvectorBasis i)) := by rw [ Matrix.trace ]; have h_cfc_def : (σ.M.cfc f).mat = ∑ i, (f (Matrix.IsHermitian.eigenvalues σ.M.H i)) • Matrix.of (fun x y => (σ.M.H.eigenvectorBasis i x) * (star (σ.M.H.eigenvectorBasis i y))) := by @@ -663,14 +653,12 @@ private lemma B_of_nonneg (ρ σ : MState d) (α : ℝ) : 0 ≤ B_of ρ σ α := -- The function g(M) = Tr[M^s] - Tr[M] satisfies g(M) = 0 when s = 1. private lemma trace_rpow_sub_trace_at_one (M : HermitianMat d ℂ) : - (M ^ (1 : ℝ)).trace - M.trace = 0 := by - simp [HermitianMat.rpow_one] + (M ^ (1 : ℝ)).trace - M.trace = 0 := by simp [HermitianMat.rpow_one] -- The cross term function value at α = 1 is zero. private lemma cross_term_at_one (ρ σ : MState d) : ((B_of ρ σ 1) ^ (1 : ℝ)).trace - (B_of ρ σ 1).trace - - (ρ.M ^ (1 : ℝ)).trace + 1 = 0 := by - simp [B_of_one, HermitianMat.rpow_one, ρ.tr] + - (ρ.M ^ (1 : ℝ)).trace + 1 = 0 := by simp [B_of_one, HermitianMat.rpow_one, ρ.tr] /- Scalar rpow cross term with just continuity: for a continuous function b with @@ -837,11 +825,10 @@ private lemma B_of_continuousAt (ρ σ : MState d) (h : σ.M.ker ≤ ρ.M.ker) : ContinuousAt (B_of ρ σ) 1 := by -- Use the fact that the composition of continuous functions is continuous. have h_cont : ContinuousAt (fun α : ℝ => ρ.M.conj (σ.M ^ ((1 - α) / (2 * α))).mat) 1 := by - have h_inner : ContinuousAt (fun r : ℝ => ρ.M.conj (σ.M ^ r).mat) 0 := by - -- Apply the hypothesis `h_cont` directly to conclude the proof. - exact conj_rpow_continuousAt_zero σ.M ρ.M h - have h_exp : ContinuousAt (fun α : ℝ => (1 - α) / (2 * α)) 1 := by - exact ContinuousAt.div ( continuousAt_const.sub continuousAt_id ) ( continuousAt_const.mul continuousAt_id ) ( by norm_num ) + have h_inner : ContinuousAt (fun r : ℝ => ρ.M.conj (σ.M ^ r).mat) 0 := + conj_rpow_continuousAt_zero σ.M ρ.M h + have h_exp : ContinuousAt (fun α : ℝ => (1 - α) / (2 * α)) 1 := + ContinuousAt.div ( continuousAt_const.sub continuousAt_id ) ( continuousAt_const.mul continuousAt_id ) ( by norm_num ) exact ContinuousAt.comp ( by simpa using h_inner ) h_exp |> ContinuousAt.congr <| Filter.eventuallyEq_of_mem ( Ioi_mem_nhds zero_lt_one ) fun x hx ↦ by aesop; exact h_cont @@ -985,12 +972,10 @@ private lemma trace_cfc_tendsto_of_tendsto (f : ℝ → ℝ) have h_cfc_cont : ContinuousWithinAt (fun A : HermitianMat d ℂ => A.cfc f) {A : HermitianMat d ℂ | 0 ≤ A} ρ := by have h_cont : ContinuousOn (fun A : HermitianMat d ℂ => A.cfc f) {A : HermitianMat d ℂ | 0 ≤ A} := by have h_cont_trace : ContinuousOn (fun A : HermitianMat d ℂ => (A.cfc f)) {A : HermitianMat d ℂ | 0 ≤ A} := by - have h_cont_cfc : ContinuousOn (fun A : HermitianMat d ℂ => A.cfc f) {A : HermitianMat d ℂ | spectrum ℝ A.mat ⊆ Set.Ici 0} := by - intro A hA - exact HermitianMat.continuousWithinAt_cfc_of_continuousOn hf hA - have h_spectrum_subset : ∀ A : HermitianMat d ℂ, 0 ≤ A → spectrum ℝ A.mat ⊆ Set.Ici 0 := by - intro A hA - exact (HermitianMat.posSemidef_iff_spectrum_Ici A).mp hA + have h_cont_cfc : ContinuousOn (fun A : HermitianMat d ℂ => A.cfc f) {A : HermitianMat d ℂ | spectrum ℝ A.mat ⊆ Set.Ici 0} := + fun A hA => HermitianMat.continuousWithinAt_cfc_of_continuousOn hf hA + have h_spectrum_subset : ∀ A : HermitianMat d ℂ, 0 ≤ A → spectrum ℝ A.mat ⊆ Set.Ici 0 := + fun A hA => (HermitianMat.posSemidef_iff_spectrum_Ici A).mp hA exact h_cont_cfc.mono fun A hA => h_spectrum_subset A hA exact h_cont_trace exact h_cont _ ( by simp [ ρ.2 ] ) |> ContinuousWithinAt.mono <| Set.Subset.refl _; @@ -1551,8 +1536,7 @@ theorem sandwichedRelRentropy_additive_alpha_ne_one {α : ℝ} (hα : α ≠ 1) · norm_num [ add_div ]; exact rfl; · exact False.elim ( ‹¬ ( σ₁ ⊗ᴹ σ₂ |> MState.M |> HermitianMat.ker ) ≤ ( ρ₁ ⊗ᴹ ρ₂ |> MState.M |> HermitianMat.ker ) › ( by simpa [ HermitianMat.ker ] using ker_prod_le_iff _ _ _ _ |>.2 h_ker ) ); - · have h_ker_prod : ¬((σ₁ ⊗ᴹ σ₂).M.ker ≤ (ρ₁ ⊗ᴹ ρ₂).M.ker) := by - simp_all [ ker_prod_le_iff ] + · have h_ker_prod : ¬((σ₁ ⊗ᴹ σ₂).M.ker ≤ (ρ₁ ⊗ᴹ ρ₂).M.ker) := by simp_all [ ker_prod_le_iff ] rw [not_and_or] at h_ker rcases h_ker with h_ker | h_ker · simp [SandwichedRelRentropy, h_ker_prod, h_ker, hα0] @@ -1640,8 +1624,7 @@ lemma maps_to_Iio_of_Ioi_1 : Set.MapsTo (fun α : ℝ => (1 - α) / (2 * α)) (S --PR'ed: #35494 @[simp] theorem frontier_singleton {X : Type*} [TopologicalSpace X] [T1Space X] [PerfectSpace X] - (p : X) : frontier {p} = {p} := by - simp [frontier] + (p : X) : frontier {p} = {p} := by simp [frontier] private theorem sandwichedRelRentropy.continuousOn_Ioi_1_aux (ρ σ : MState d) : ContinuousOn (fun (α : ℝ) ↦ ((HermitianMat.conj (σ.M ^ ((1 - α) / (2 * α))).mat) ρ.M ^ α)) (Set.Ioi 1) := by @@ -1796,8 +1779,7 @@ theorem qRelativeEnt_eq_neg_Sᵥₙ_add (ρ σ : MState d) : /-- The quantum relative entropy is unchanged by `MState.relabel` -/ @[simp] theorem qRelativeEnt_relabel (ρ σ : MState d) (e : d₂ ≃ d) : - 𝐃(ρ.relabel e‖σ.relabel e) = 𝐃(ρ‖σ) := by - simp [qRelativeEnt] + 𝐃(ρ.relabel e‖σ.relabel e) = 𝐃(ρ‖σ) := by simp [qRelativeEnt] @[simp] theorem sandwichedRelRentropy_of_unique [Unique d] (ρ σ : MState d) : @@ -1810,8 +1792,7 @@ theorem sandwichedRelRentropy_of_unique [Unique d] (ρ σ : MState d) : @[simp] theorem qRelEntropy_of_unique [Unique d] (ρ σ : MState d) : - 𝐃(ρ‖σ) = 0 := by - exact sandwichedRelRentropy_of_unique ρ σ + 𝐃(ρ‖σ) = 0 := sandwichedRelRentropy_of_unique ρ σ theorem sandwichedRelRentropy_heq_congr {d₁ d₂ : Type u} [Fintype d₁] [DecidableEq d₁] [Fintype d₂] [DecidableEq d₂] @@ -1835,9 +1816,8 @@ theorem sandwichedRelRentropy_congr {α : ℝ} simp theorem qRelEntropy_heq_congr {d₁ d₂ : Type u} [Fintype d₁] [DecidableEq d₁] [Fintype d₂] [DecidableEq d₂] - {ρ₁ σ₁ : MState d₁} {ρ₂ σ₂ : MState d₂} (hd : d₁ = d₂) (hρ : ρ₁ ≍ ρ₂) (hσ : σ₁ ≍ σ₂) : - 𝐃(ρ₁‖σ₁) = 𝐃(ρ₂‖σ₂) := by - exact sandwichedRelRentropy_heq_congr hd hρ hσ + {ρ₁ σ₁ : MState d₁} {ρ₂ σ₂ : MState d₂} (hd : d₁ = d₂) (hρ : ρ₁ ≍ ρ₂) (hσ : σ₁ ≍ σ₂) : + 𝐃(ρ₁‖σ₁) = 𝐃(ρ₂‖σ₂) := sandwichedRelRentropy_heq_congr hd hρ hσ /-- Quantum relative entropy when σ has full rank -/ theorem qRelativeEnt_rank {ρ σ : MState d} [σ.M.NonSingular] : @@ -1943,8 +1923,7 @@ private lemma eigenWeight_eq_zero_iff (ρ x : MState d) (i : d) : intro v w have h_inner : star v ⬝ᵥ (ρ.M.mat.mulVec w) = star (star w ⬝ᵥ (ρ.M.mat.mulVec v)) := by have h_inner : star v ⬝ᵥ (ρ.M.mat.mulVec w) = star (star w ⬝ᵥ (ρ.M.mat.mulVec v)) := by - have h_inner : ρ.M.mat = star ρ.M.mat := by - exact ρ.M.2.symm ▸ rfl + have h_inner : ρ.M.mat = star ρ.M.mat := ρ.M.2.symm ▸ rfl conv_rhs => rw [ h_inner ] simp [ Matrix.mulVec, dotProduct ] ring_nf @@ -1962,8 +1941,7 @@ private lemma eigenWeight_eq_zero_iff (ρ x : MState d) (i : d) : refine ⟨h_forward, fun h ↦ ?_⟩ -- Since ρ e_i = 0, we have e_i^* ρ e_i = 0. have h_zero : (Matrix.vecMul (star (x.M.H.eigenvectorBasis i : d → ℂ)) ρ.M.mat) ⬝ᵥ (x.M.H.eigenvectorBasis i : d → ℂ) = 0 := by - have h_zero : ρ.M.mat.mulVec (x.M.H.eigenvectorBasis i : d → ℂ) = 0 := by - exact congr(WithLp.ofLp $h) + have h_zero : ρ.M.mat.mulVec (x.M.H.eigenvectorBasis i : d → ℂ) = 0 := congr(WithLp.ofLp $h) convert congr_arg ( fun v => star ( x.M.H.eigenvectorBasis i : d → ℂ ) ⬝ᵥ v ) h_zero using 1 simp [ Matrix.dotProduct_mulVec] ring_nf @@ -2122,8 +2100,7 @@ theorem qRelativeEnt_joint_convexity : sorry @[simp] -theorem qRelEntropy_self (ρ : MState d) : 𝐃(ρ‖ρ) = 0 := by - simp [qRelativeEnt] +theorem qRelEntropy_self (ρ : MState d) : 𝐃(ρ‖ρ) = 0 := by simp [qRelativeEnt] @[aesop (rule_sets := [finiteness]) unsafe apply] theorem qRelativeEnt_ne_top {ρ σ : MState d} [σ.M.NonSingular] : 𝐃(ρ‖σ) ≠ ⊤ := by @@ -2213,9 +2190,8 @@ theorem qMutualInfo_as_qRelativeEnt (ρ : MState (dA × dB)) : simpa [HermitianMat.lin, Matrix.toEuclideanLin, A, B, ← Matrix.mul_kronecker_mul] using hmul have prod_marginals_ker_le : (ρ.traceRight ⊗ᴹ ρ.traceLeft).M.ker ≤ ρ.M.ker := by let P : HermitianMat (dA × dB) ℂ := ρ.traceRight.M.supportProj ⊗ₖ ρ.traceLeft.M.supportProj - have hP : ρ.M.support ≤ P.support := by - intro x hx - exact ⟨x, by simpa [P] using fixed_support_kron_prod hx⟩ + have hP : ρ.M.support ≤ P.support := + fun x hx => ⟨x, by simpa [P] using fixed_support_kron_prod hx⟩ have hkerP : P.ker ≤ ρ.M.ker := by simpa [HermitianMat.support_orthogonal_eq_range] using Submodule.orthogonal_le hP exact (show (ρ.traceRight ⊗ᴹ ρ.traceLeft).M.ker ≤ P.ker by @@ -2314,8 +2290,7 @@ private lemma pos_of_MState_le_smul {σ₁ σ₂ : MState d} (hσ : σ₂.M ≤ open ComplexOrder in private lemma HermitianMat.inner_log_mono_of_posDef_of_le {A B C : HermitianMat d 𝕜} (hC : 0 ≤ C) (hA : A.mat.PosDef) (hAB : A ≤ B) : - ⟪C, A.log⟫ ≤ ⟪C, B.log⟫ := by - exact inner_mono hC (log_mono hA hAB) + ⟪C, A.log⟫ ≤ ⟪C, B.log⟫ := inner_mono hC (log_mono hA hAB) open ComplexOrder in private lemma posDef_add_eps {A : HermitianMat d ℂ} (hA : 0 ≤ A) {ε : ℝ} (hε : 0 < ε) : @@ -2325,12 +2300,10 @@ private lemma posDef_add_eps {A : HermitianMat d ℂ} (hA : 0 ≤ A) {ε : ℝ} constructor · exact HermitianMat.H _ · intro x hx_ne_zero - have h_inner : star x ⬝ᵥ (A.val.mulVec x) ≥ 0 := by - simp [hA] + have h_inner : star x ⬝ᵥ (A.val.mulVec x) ≥ 0 := by simp [hA] have h_eps : star x ⬝ᵥ (ε • 1 : Matrix d d ℂ).mulVec x = ε * star x ⬝ᵥ x := by simp [Matrix.mulVec, dotProduct, Finset.mul_sum, mul_left_comm, Matrix.one_apply] - have h_pos : 0 < ε * star x ⬝ᵥ x := by - simp [*] + have h_pos : 0 < ε * star x ⬝ᵥ x := by simp [*] simpa [Matrix.add_mulVec, h_eps] using add_pos_of_nonneg_of_pos h_inner h_pos private lemma log_add_eps_eq_cfc (A : HermitianMat d 𝕜) (ε : ℝ) : @@ -2438,9 +2411,7 @@ theorem qRelEntropy_le_add_of_le_smul (ρ : MState d) {σ₁ σ₂ : MState d} ( <;> simp only [sup_of_le_left, *] <;> norm_cast at * <;> linarith [Real.log_nonneg one_le_two] - have h_final' : qRelativeEnt ρ σ₁ ≤ qRelativeEnt ρ σ₂ + ENNReal.ofReal (Real.log α) := by - exact_mod_cast h_final - exact h_final' + exact_mod_cast h_final · by_contra h_contra; have hker_le : σ₁.M.ker ≤ σ₂.M.ker := by apply_rules [ HermitianMat.ker_le_of_le_smul, hσ ]; @@ -2452,5 +2423,4 @@ theorem qRelEntropy_le_add_of_le_smul (ρ : MState d) {σ₁ σ₂ : MState d} ( · simp [hker, SandwichedRelRentropy, qRelativeEnt] theorem qRelativeEnt_op_le {ρ σ : MState d} (h : ρ.M ≤ α • σ.M) : - 𝐃(ρ‖σ) ≤ .ofReal (Real.log α) := by - simpa using qRelEntropy_le_add_of_le_smul ρ h + 𝐃(ρ‖σ) ≤ .ofReal (Real.log α) := by simpa using qRelEntropy_le_add_of_le_smul ρ h diff --git a/QuantumInfo/Entropy/SSA.lean b/QuantumInfo/Entropy/SSA.lean index 7b169c0c8..e9011a35d 100644 --- a/QuantumInfo/Entropy/SSA.lean +++ b/QuantumInfo/Entropy/SSA.lean @@ -188,8 +188,7 @@ lemma PosDef_traceRight [Nonempty dB] (A : HermitianMat (dA × dB) ℂ) (hA : A. rw [Finset.sum_comm_cycle] lemma PosDef_traceLeft [Nonempty dA] (A : HermitianMat (dA × dB) ℂ) (hA : A.mat.PosDef) : - A.traceLeft.mat.PosDef := by - exact PosDef_traceRight (A.reindex (Equiv.prodComm _ _)) (hA.reindex _) + A.traceLeft.mat.PosDef := PosDef_traceRight (A.reindex (Equiv.prodComm _ _)) (hA.reindex _) /-- V_rho is an isometry. @@ -200,8 +199,7 @@ theorem V_rho_isometry [Nonempty dB] (ρAB : HermitianMat (dA × dB) ℂ) (hρ : have h_pos_def : (ρAB.traceRight⁻¹.sqrt : Matrix dA dA ℂ) * (ρAB.traceRight : Matrix dA dA ℂ) * (ρAB.traceRight⁻¹.sqrt : Matrix dA dA ℂ) = 1 := by convert HermitianMat.sqrt_inv_mul_self_mul_sqrt_inv_eq_one _; exact PosDef_traceRight _ hρ - rw [← h_pos_def] - exact V_rho_conj_mul_self_eq ρAB hρ + simpa [← h_pos_def] using V_rho_conj_mul_self_eq ρAB hρ /-- V_sigma is an isometry. @@ -364,8 +362,7 @@ theorem HermitianMat.PosDef_kronecker {m n : Type*} [Fintype m] [DecidableEq m] [Fintype n] [DecidableEq n] (A : HermitianMat m ℂ) (B : HermitianMat n ℂ) (hA : A.mat.PosDef) (hB : B.mat.PosDef) : - (A ⊗ₖ B).mat.PosDef := by - exact Matrix.PosDef.kron hA hB + (A ⊗ₖ B).mat.PosDef := Matrix.PosDef.kron hA hB /- Reindex of PosDef is PosDef. -/ theorem HermitianMat.PosDef_reindex {d d₂ : Type*} [Fintype d] [DecidableEq d] @@ -572,8 +569,7 @@ private lemma T₂_sq_le_one [Nonempty dB] · aesop · aesop -private lemma PERM_isometry : (PERM_mat dA dB dC)ᴴ * PERM_mat dA dB dC = 1 := by - simp [PERM_mat] +private lemma PERM_isometry : (PERM_mat dA dB dC)ᴴ * PERM_mat dA dB dC = 1 := by simp [PERM_mat] /-- Element-wise identity: W_mat = ∑_{b*} V_rho * V_sigma†. This is the key computation from Eq. (6) of Lin-Kim-Hsieh. -/ @@ -804,12 +800,10 @@ theorem operator_ineq_SSA [Nonempty dA] [Nonempty dB] [Nonempty dC] convert HermitianMat.inv_kronecker _ _ using 1; · infer_instance; · exact ⟨ ⟨ Classical.arbitrary dB, Classical.arbitrary dC ⟩ ⟩; - · have h_trace_right_pos_def : (ρAB.traceRight).mat.PosDef := by - exact PosDef_traceRight ρAB hρ + · have h_trace_right_pos_def : (ρAB.traceRight).mat.PosDef := PosDef_traceRight ρAB hρ exact ⟨by exact PosDef_traceRight ρAB hρ |>.isUnit⟩ · have h_inv_symm : σBC⁻¹.NonSingular := by - have h_inv_symm : σBC.NonSingular := by - exact nonSingular_of_posDef hσ + have h_inv_symm : σBC.NonSingular := nonSingular_of_posDef hσ exact nonSingular_iff_inv.mpr h_inv_symm; exact h_inv_symm; convert congr_arg ( fun x : HermitianMat _ _ => x.reindex ( Equiv.prodAssoc dA dB dC ).symm ) h_inv_symm using 1; @@ -832,8 +826,7 @@ theorem operator_ineq_SSA [Nonempty dA] [Nonempty dB] [Nonempty dC] have h_inv_symm : (σBC.traceLeft⁻¹)⁻¹ = σBC.traceLeft := by have h_inv_symm : (σBC.traceLeft⁻¹).mat * σBC.traceLeft.mat = 1 := by have h_inv_symm : (σBC.traceLeft⁻¹).mat * σBC.traceLeft.mat = 1 := by - have h_inv_symm : σBC.traceLeft.mat.PosDef := by - exact PosDef_traceLeft σBC hσ + have h_inv_symm : σBC.traceLeft.mat.PosDef := PosDef_traceLeft σBC hσ convert! Matrix.nonsing_inv_mul _ _; exact isUnit_iff_ne_zero.mpr h_inv_symm.det_pos.ne'; exact h_inv_symm diff --git a/QuantumInfo/Entropy/VonNeumann.lean b/QuantumInfo/Entropy/VonNeumann.lean index 59e5e7717..d415d33b9 100644 --- a/QuantumInfo/Entropy/VonNeumann.lean +++ b/QuantumInfo/Entropy/VonNeumann.lean @@ -141,14 +141,12 @@ theorem Sᵥₙ_unit_zero [Unique d] (ρ : MState d) : Sᵥₙ ρ = 0 := by /-- Von Neumann entropy is invariant under relabeling of the basis. -/ @[simp] theorem Sᵥₙ_relabel (ρ : MState d₁) (e : d₂ ≃ d₁) : - Sᵥₙ (ρ.relabel e) = Sᵥₙ ρ := by - simp [Sᵥₙ_eq_neg_trace_log] + Sᵥₙ (ρ.relabel e) = Sᵥₙ ρ := by simp [Sᵥₙ_eq_neg_trace_log] /-- Von Neumann entropy is unchanged under SWAP. TODO: All unitaries-/ @[simp] -theorem Sᵥₙ_of_SWAP_eq (ρ : MState (d₁ × d₂)) : Sᵥₙ ρ.SWAP = Sᵥₙ ρ := by - apply Hₛ_eq_of_multiset_map_eq - exact ρ.multiset_spectrum_relabel_eq (Equiv.prodComm d₁ d₂).symm +theorem Sᵥₙ_of_SWAP_eq (ρ : MState (d₁ × d₂)) : Sᵥₙ ρ.SWAP = Sᵥₙ ρ := + Hₛ_eq_of_multiset_map_eq _ _ (ρ.multiset_spectrum_relabel_eq (Equiv.prodComm d₁ d₂).symm) /-- Von Neumann entropy is unchanged under assoc. -/ @[simp] @@ -257,8 +255,7 @@ the same von Neumann entropy. private lemma Sᵥₙ_eq_of_nonzero_eigenvalues_eq (ρ₁ : MState d₁) (ρ₂ : MState d₂) (h : (Finset.univ.val.map ρ₁.spectrum.prob).filter (· ≠ 0) = (Finset.univ.val.map ρ₂.spectrum.prob).filter (· ≠ 0)) : - Sᵥₙ ρ₁ = Sᵥₙ ρ₂ := by - exact Hₛ_eq_of_nonzero_multiset_eq _ _ h + Sᵥₙ ρ₁ = Sᵥₙ ρ₂ := Hₛ_eq_of_nonzero_multiset_eq _ _ h /-- Filtering non-zero elements commutes with mapping `RCLike.ofReal` for multisets. @@ -331,8 +328,7 @@ theorem qConditionalEnt_of_pure_symm (ψ : Ket (d₁ × d₂)) : /-- Quantum mutual information is symmetric. -/ @[simp] theorem qMutualInfo_symm (ρ : MState (d₁ × d₂)) : - qMutualInfo ρ.SWAP = qMutualInfo ρ := by - simp [qMutualInfo, add_comm] + qMutualInfo ρ.SWAP = qMutualInfo ρ := by simp [qMutualInfo, add_comm] /-- For a pure state, the entropy of one subsystem equals the entropy of its complement, even after relabeling. -/ diff --git a/QuantumInfo/ForMathlib/ComplexLaplaceTransform.lean b/QuantumInfo/ForMathlib/ComplexLaplaceTransform.lean index 1b239ca22..6cc9c6a49 100644 --- a/QuantumInfo/ForMathlib/ComplexLaplaceTransform.lean +++ b/QuantumInfo/ForMathlib/ComplexLaplaceTransform.lean @@ -139,9 +139,7 @@ theorem measurable_complexLaplaceIntegrand have hUntop : y.untop hy = e := by apply WithTop.coe_inj.mp rw [WithTop.coe_untop, ← he] - have hUntopD : y.untopD 0 = e := by - rw [← he] - rfl + have hUntopD : y.untopD 0 = e := he ▸ rfl rw [hUntop, hUntopD]] exact Measurable.ite (hE (measurableSet_singleton (⊤ : WithTop ℝ))) measurable_const (Complex.continuous_exp.measurable.comp (by fun_prop : @@ -187,9 +185,8 @@ theorem continuousAt_complexLaplaceTransform_of_mem_interior_convergenceDomain theorem continuousOn_complexLaplaceTransform_interior_convergenceDomain {α : Type*} [MeasureTheory.MeasureSpace α] {E : α → WithTop ℝ} : - ContinuousOn (ComplexLaplaceTransform E) (interior (ComplexLaplaceConvergenceDomain E)) := by - intro z hz - exact (continuousAt_complexLaplaceTransform_of_mem_interior_convergenceDomain hz).continuousWithinAt + ContinuousOn (ComplexLaplaceTransform E) (interior (ComplexLaplaceConvergenceDomain E)) := + fun _ hz => (continuousAt_complexLaplaceTransform_of_mem_interior_convergenceDomain hz).continuousWithinAt private theorem integrable_uncurry_complexLaplaceIntegrand_horizontal {α : Type*} [MeasureTheory.MeasureSpace α] diff --git a/QuantumInfo/ForMathlib/ContinuousLinearMap.lean b/QuantumInfo/ForMathlib/ContinuousLinearMap.lean index e1e96b3d0..2353e2b24 100644 --- a/QuantumInfo/ForMathlib/ContinuousLinearMap.lean +++ b/QuantumInfo/ForMathlib/ContinuousLinearMap.lean @@ -32,8 +32,7 @@ variable [TopologicalSpace M] [AddCommMonoid M] [TopologicalSpace M₂] [AddComm variable [Module R M] [Module S M₂] theorem ker_mk (f : M →ₛₗ[σ] M₂) (hf : Continuous f.toFun) : - (ContinuousLinearMap.mk f hf).ker = LinearMap.ker f := by - rfl + (ContinuousLinearMap.mk f hf).ker = LinearMap.ker f := rfl end ContinuousLinearMap diff --git a/QuantumInfo/ForMathlib/ContinuousSup.lean b/QuantumInfo/ForMathlib/ContinuousSup.lean index a8ea0c1d0..04456d914 100644 --- a/QuantumInfo/ForMathlib/ContinuousSup.lean +++ b/QuantumInfo/ForMathlib/ContinuousSup.lean @@ -182,8 +182,7 @@ end ContinuousLinearMap theorem LinearMap.BilinForm.continuous_iSup_fst {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] [FiniteDimensional ℝ E] (f : LinearMap.BilinForm ℝ E) {S : Set E} (hS : Bornology.IsBounded S) : - Continuous fun x ↦ ⨆ y : S, f y x := by - exact LinearMap.BilinForm.continuous_iSup f.flip hS + Continuous fun x ↦ ⨆ y : S, f y x := LinearMap.BilinForm.continuous_iSup f.flip hS --Old "direct" proof: -- -- Since $f$ is continuous, there exists $C > 0$ such that for all $y \in S$ and $x \in E$, $|f y x| \leq C \|y\| \|x\|$. -- obtain ⟨C, hC1, hC2⟩ : ∃ C > 0, ∀ y ∈ S, ∀ x : E, |f y x| ≤ C * ‖y‖ * ‖x‖ := by diff --git a/QuantumInfo/ForMathlib/Filter.lean b/QuantumInfo/ForMathlib/Filter.lean index 503835a25..3691d1c66 100644 --- a/QuantumInfo/ForMathlib/Filter.lean +++ b/QuantumInfo/ForMathlib/Filter.lean @@ -53,7 +53,6 @@ theorem ENNReal.tendsto_toReal_iff_of_eventually_ne_top rw [EventuallyEq] peel hf with h simp [h] - have he₂ : (fun n ↦ (f n).toReal) = (fun n ↦ ((f n).toNNReal : ℝ≥0∞).toReal) := - rfl + have he₂ : (fun n ↦ (f n).toReal) = (fun n ↦ ((f n).toNNReal : ℝ≥0∞).toReal) := rfl rw [Filter.tendsto_congr' he₁, he₂] exact tendsto_toReal_iff (by finiteness) hx diff --git a/QuantumInfo/ForMathlib/HayataGroup/TraceInequality/BlockDiagonal.lean b/QuantumInfo/ForMathlib/HayataGroup/TraceInequality/BlockDiagonal.lean index 6f0af1e74..073f0bdf4 100644 --- a/QuantumInfo/ForMathlib/HayataGroup/TraceInequality/BlockDiagonal.lean +++ b/QuantumInfo/ForMathlib/HayataGroup/TraceInequality/BlockDiagonal.lean @@ -165,18 +165,15 @@ noncomputable def blockDiagonalHom : (L ℋ × L ℋ) →⋆ₐ[ℝ] L (HSum ℋ omit [Nontrivial ℋ] in @[simp] theorem blockDiagonalHom_apply (p : L ℋ × L ℋ) : - blockDiagonalHom (ℋ := ℋ) p = blockDiagonal (ℋ := ℋ) p.1 p.2 := - rfl + blockDiagonalHom (ℋ := ℋ) p = blockDiagonal (ℋ := ℋ) p.1 p.2 := rfl omit [CompleteSpace ℋ] [Nontrivial ℋ] in @[simp] theorem hsumProj_blockDiagonal_zero (A B : L ℋ) (z : HSum ℋ) : - hsumProj ℋ 0 (blockDiagonal A B z) = A (hsumProj ℋ 0 z) := by - simp [blockDiagonal] + hsumProj ℋ 0 (blockDiagonal A B z) = A (hsumProj ℋ 0 z) := by simp [blockDiagonal] omit [CompleteSpace ℋ] [Nontrivial ℋ] in @[simp] theorem hsumProj_blockDiagonal_one (A B : L ℋ) (z : HSum ℋ) : - hsumProj ℋ 1 (blockDiagonal A B z) = B (hsumProj ℋ 1 z) := by - simp [blockDiagonal] + hsumProj ℋ 1 (blockDiagonal A B z) = B (hsumProj ℋ 1 z) := by simp [blockDiagonal] omit [CompleteSpace ℋ] [Nontrivial ℋ] in @[simp] theorem blockDiagonal_one : @@ -210,16 +207,14 @@ theorem blockDiagonal_nonneg {A B : L ℋ} (hA : 0 ≤ A) (hB : 0 ≤ B) : (inner ℂ (A (hsumProj ℋ 0 z)) (hsumProj ℋ 0 z) + inner ℂ (B (hsumProj ℋ 1 z)) (hsumProj ℋ 1 z))) = ↑(RCLike.re (inner ℂ (A (hsumProj ℋ 0 z)) (hsumProj ℋ 0 z)) + - RCLike.re (inner ℂ (B (hsumProj ℋ 1 z)) (hsumProj ℋ 1 z))) := by - simp + RCLike.re (inner ℂ (B (hsumProj ℋ 1 z)) (hsumProj ℋ 1 z))) := by simp _ = inner ℂ (A (hsumProj ℋ 0 z)) (hsumProj ℋ 0 z) + inner ℂ (B (hsumProj ℋ 1 z)) (hsumProj ℋ 1 z) := by have hsumre : (↑(RCLike.re (inner ℂ (A (hsumProj ℋ 0 z)) (hsumProj ℋ 0 z)) + RCLike.re (inner ℂ (B (hsumProj ℋ 1 z)) (hsumProj ℋ 1 z))) : ℂ) = ((RCLike.re (inner ℂ (A (hsumProj ℋ 0 z)) (hsumProj ℋ 0 z)) : ℂ) + - (RCLike.re (inner ℂ (B (hsumProj ℋ 1 z)) (hsumProj ℋ 1 z)) : ℂ)) := by - simp + (RCLike.re (inner ℂ (B (hsumProj ℋ 1 z)) (hsumProj ℋ 1 z)) : ℂ)) := by simp rw [hsumre, hAz.1, hBz.1] · dsimp [blockDiagonal] erw [inner_add_left, hz0, hz1] @@ -228,14 +223,12 @@ theorem blockDiagonal_nonneg {A B : L ℋ} (hA : 0 ≤ A) (hB : 0 ≤ B) : omit [CompleteSpace ℋ] [Nontrivial ℋ] in @[simp] theorem hsumProj_blockOp_zero (A00 A01 A10 A11 : L ℋ) (z : HSum ℋ) : hsumProj ℋ 0 (blockOp (ℋ := ℋ) A00 A01 A10 A11 z) = - A00 (hsumProj ℋ 0 z) + A01 (hsumProj ℋ 1 z) := by - simp [blockOp] + A00 (hsumProj ℋ 0 z) + A01 (hsumProj ℋ 1 z) := by simp [blockOp] omit [CompleteSpace ℋ] [Nontrivial ℋ] in @[simp] theorem hsumProj_blockOp_one (A00 A01 A10 A11 : L ℋ) (z : HSum ℋ) : hsumProj ℋ 1 (blockOp (ℋ := ℋ) A00 A01 A10 A11 z) = - A10 (hsumProj ℋ 0 z) + A11 (hsumProj ℋ 1 z) := by - simp [blockOp] + A10 (hsumProj ℋ 0 z) + A11 (hsumProj ℋ 1 z) := by simp [blockOp] omit [Nontrivial ℋ] in @[simp] theorem blockOp_star (A00 A01 A10 A11 : L ℋ) : diff --git a/QuantumInfo/ForMathlib/HayataGroup/TraceInequality/GeneralizedPerspectiveFunction.lean b/QuantumInfo/ForMathlib/HayataGroup/TraceInequality/GeneralizedPerspectiveFunction.lean index d92d8e73c..cca85cffe 100644 --- a/QuantumInfo/ForMathlib/HayataGroup/TraceInequality/GeneralizedPerspectiveFunction.lean +++ b/QuantumInfo/ForMathlib/HayataGroup/TraceInequality/GeneralizedPerspectiveFunction.lean @@ -126,8 +126,7 @@ private lemma spectrum_convexCombo_Ioi {A B : L ℋ} {t : ℝ} (smul_le_smul_of_nonneg_left hrB_le ht0) have hLHS : (1 - t) • algebraMap ℝ (L ℋ) rA + t • algebraMap ℝ (L ℋ) rB = - algebraMap ℝ (L ℋ) rC := by - simp [rC, Algebra.smul_def] + algebraMap ℝ (L ℋ) rC := by simp [rC, Algebra.smul_def] simpa [hLHS] using hsum intro x hx simpa [C] using @@ -173,14 +172,12 @@ private lemma hpow_continuousOn omit [Nontrivial ℋ] in private lemma hSqrt_selfAdjoint (h : ℝ → ℝ) (B : L ℋ) : IsSelfAdjoint (hSqrt (ℋ := ℋ) h B) := by - dsimp [hSqrt, cfcR] - exact cfc_predicate _ _ + simp [hSqrt, cfcR] omit [Nontrivial ℋ] in private lemma hInvSqrt_selfAdjoint (h : ℝ → ℝ) (B : L ℋ) : IsSelfAdjoint (hInvSqrt (ℋ := ℋ) h B) := by - dsimp [hInvSqrt, cfcR] - exact cfc_predicate _ _ + simp [hInvSqrt, cfcR] omit [Nontrivial ℋ] in private lemma hSqrt_mul_hInvSqrt_eq_one @@ -249,8 +246,7 @@ omit [Nontrivial ℋ] in private lemma conj_le_conj {X Y T : L ℋ} (hXY : X ≤ Y) (hT : IsSelfAdjoint T) : T * X * T ≤ T * Y * T := by have hnonneg : 0 ≤ Y - X := sub_nonneg.mpr hXY - have hconj : 0 ≤ T * (Y - X) * T := by - simpa using hT.conjugate_nonneg hnonneg + have hconj : 0 ≤ T * (Y - X) * T := by simpa using hT.conjugate_nonneg hnonneg have hsub : T * (Y - X) * T = T * Y * T - T * X * T := by simp [sub_eq_add_neg, mul_add, add_mul, mul_assoc] exact sub_nonneg.mp (by simpa [hsub] using hconj) @@ -325,11 +321,9 @@ private theorem theorem_2_5_forward_jointlyConvexOn_psd_pd_of_condV have hIR₂S₂ : IR₂ * S₂ = (1 : L ℋ) := hInvSqrt_mul_hSqrt_eq_one (ℋ := ℋ) hB₂_sa hB₂_spec hcont hpos have hM₁_nonneg : (0 : L ℋ) ≤ M₁ := by - dsimp [M₁] - simpa [mul_assoc] using hIR₁_sa.conjugate_nonneg hA₁_nonneg + simpa [M₁, mul_assoc] using hIR₁_sa.conjugate_nonneg hA₁_nonneg have hM₂_nonneg : (0 : L ℋ) ≤ M₂ := by - dsimp [M₂] - simpa [mul_assoc] using hIR₂_sa.conjugate_nonneg hA₂_nonneg + simpa [M₂, mul_assoc] using hIR₂_sa.conjugate_nonneg hA₂_nonneg have hM₁_sa : IsSelfAdjoint M₁ := IsSelfAdjoint.of_nonneg hM₁_nonneg have hM₂_sa : IsSelfAdjoint M₂ := IsSelfAdjoint.of_nonneg hM₂_nonneg have hM₁_spec : spectrum ℝ M₁ ⊆ Set.Ici (0 : ℝ) := by @@ -421,10 +415,8 @@ private theorem theorem_2_5_forward_jointlyConvexOn_psd_pd_of_condV simp [T₁, hS₁_sa.star_eq, hIR_sa.star_eq, mul_assoc, smul_smul] _ = (1 - θ) • (S * IR * (S₁ * cfcR (ℋ := ℋ) f M₁ * S₁) * IR * S) := by rw [Real.mul_self_sqrt (sub_nonneg.mpr hθ1)] - _ = (1 - θ) • (S₁ * cfcR (ℋ := ℋ) f M₁ * S₁) := by - simp [mul_assoc, hSIR, hIRS] - _ = (1 - θ) • ((f Δ h) A₁ B₁) := by - rfl + _ = (1 - θ) • (S₁ * cfcR (ℋ := ℋ) f M₁ * S₁) := by simp [mul_assoc, hSIR, hIRS] + _ = (1 - θ) • ((f Δ h) A₁ B₁) := rfl have hright₂ : S * (star T₂ * cfcR (ℋ := ℋ) f M₂ * T₂) * S = θ • ((f Δ h) A₂ B₂) := by @@ -435,17 +427,14 @@ private theorem theorem_2_5_forward_jointlyConvexOn_psd_pd_of_condV simp [T₂, hS₂_sa.star_eq, hIR_sa.star_eq, mul_assoc, smul_smul] _ = θ • (S * IR * (S₂ * cfcR (ℋ := ℋ) f M₂ * S₂) * IR * S) := by rw [Real.mul_self_sqrt hθ0] - _ = θ • (S₂ * cfcR (ℋ := ℋ) f M₂ * S₂) := by - simp [mul_assoc, hSIR, hIRS] - _ = θ • ((f Δ h) A₂ B₂) := by - rfl + _ = θ • (S₂ * cfcR (ℋ := ℋ) f M₂ * S₂) := by simp [mul_assoc, hSIR, hIRS] + _ = θ • ((f Δ h) A₂ B₂) := rfl have hright : S * (star T₁ * cfcR (ℋ := ℋ) f M₁ * T₁ + star T₂ * cfcR (ℋ := ℋ) f M₂ * T₂) * S = (1 - θ) • ((f Δ h) A₁ B₁) + θ • ((f Δ h) A₂ B₂) := by rw [mul_add, add_mul, hright₁, hright₂] have hleft : - S * cfcR (ℋ := ℋ) f (IR * A * IR) * S = (f Δ h) A B := by - rfl + S * cfcR (ℋ := ℋ) f (IR * A * IR) * S = (f Δ h) A B := rfl simpa [hleft, hright] using houter -- Restricted forward form of Theorem 2.5 on the positive cone. diff --git a/QuantumInfo/ForMathlib/HayataGroup/TraceInequality/HilbertSchmidtOperatorSpace.lean b/QuantumInfo/ForMathlib/HayataGroup/TraceInequality/HilbertSchmidtOperatorSpace.lean index 212343dbc..1758b69bd 100644 --- a/QuantumInfo/ForMathlib/HayataGroup/TraceInequality/HilbertSchmidtOperatorSpace.lean +++ b/QuantumInfo/ForMathlib/HayataGroup/TraceInequality/HilbertSchmidtOperatorSpace.lean @@ -515,27 +515,20 @@ noncomputable def rightMulHSStarAlgHom : (L ℋ)ᵐᵒᵖ →⋆ₐ[ℝ] L (HSOp simp [rightMulHS_star (ℋ := ℋ) (MulOpposite.unop A)] @[simp] theorem rightMulHSStarAlgHom_apply (A : (L ℋ)ᵐᵒᵖ) : - rightMulHSStarAlgHom (ℋ := ℋ) A = rightMulHS (ℋ := ℋ) (MulOpposite.unop A) := - rfl + rightMulHSStarAlgHom (ℋ := ℋ) A = rightMulHS (ℋ := ℋ) (MulOpposite.unop A) := rfl /-- The `⋆`-algebra hom sending `A` to `op (star A)`. On selfadjoint operators this is just `op`. -/ noncomputable def opStarHSStarAlgHom : L ℋ →⋆ₐ[ℝ] (L ℋ)ᵐᵒᵖ where toFun := fun A => MulOpposite.op (star A) - map_one' := by simp - map_mul' := by - intro A B - simp [star_mul] - map_zero' := by simp - map_add' := by - intro A B - simp + map_one' := congrArg MulOpposite.op (star_one (R := L ℋ)) + map_mul' A B := congrArg MulOpposite.op (star_mul A B) + map_zero' := congrArg MulOpposite.op (star_zero (R := L ℋ)) + map_add' A B := congrArg MulOpposite.op (star_add A B) commutes' := by intro r apply congrArg MulOpposite.op simp [Algebra.algebraMap_eq_smul_one] - map_star' := by - intro A - simp + map_star' A := rfl private noncomputable def opStarHSAlgEquiv : L ℋ ≃ₐ[ℝ] (L ℋ)ᵐᵒᵖ where toFun A := MulOpposite.op (star A) @@ -550,8 +543,7 @@ private noncomputable def opStarHSAlgEquiv : L ℋ ≃ₐ[ℝ] (L ℋ)ᵐᵒᵖ omit [FiniteDimensional ℂ ℋ] in lemma op_isSelfAdjoint (A : L ℋ) (hA : IsSelfAdjoint A) : - IsSelfAdjoint (MulOpposite.op A : (L ℋ)ᵐᵒᵖ) := by - exact congrArg MulOpposite.op hA.star_eq + IsSelfAdjoint (MulOpposite.op A : (L ℋ)ᵐᵒᵖ) := congrArg MulOpposite.op hA.star_eq private noncomputable def opStarHSLinearMap : L ℋ →ₗ[ℝ] (L ℋ)ᵐᵒᵖ where toFun := fun A => MulOpposite.op (star A) @@ -604,9 +596,8 @@ lemma cfc_op_eq_op_cfc [ContinuousFunctionalCalculus ℝ (L ℋ) IsSelfAdjoint] cfc (R := ℝ) (A := (L ℋ)ᵐᵒᵖ) (p := IsSelfAdjoint) f (MulOpposite.op A) = MulOpposite.op (cfcR f A) := by let φ : L ℋ →⋆ₐ[ℝ] (L ℋ)ᵐᵒᵖ := opStarHSStarAlgHom (ℋ := ℋ) - have hφ : Continuous φ := by - exact - (LinearMap.continuous_of_finiteDimensional (opStarHSLinearMap (ℋ := ℋ))) + have hφ : Continuous φ := + LinearMap.continuous_of_finiteDimensional (opStarHSLinearMap (ℋ := ℋ)) have hopA : IsSelfAdjoint (MulOpposite.op A : (L ℋ)ᵐᵒᵖ) := op_isSelfAdjoint (A := A) hA have hφA : IsSelfAdjoint (φ A) := hA.map φ have hcfcA : @@ -627,9 +618,8 @@ lemma leftMulHS_cfcR [ContinuousFunctionalCalculus ℝ (L ℋ) IsSelfAdjoint] [N leftMulHS (ℋ := ℋ) (cfcR f A) = cfcR (ℋ := HSOp ℋ) f (leftMulHS (ℋ := ℋ) A) := by let φ : L ℋ →⋆ₐ[ℝ] L (HSOp ℋ) := leftMulHSStarAlgHom (ℋ := ℋ) - have hφ : Continuous φ := by - exact - (LinearMap.continuous_of_finiteDimensional (leftMulHSLinearMap (ℋ := ℋ))) + have hφ : Continuous φ := + LinearMap.continuous_of_finiteDimensional (leftMulHSLinearMap (ℋ := ℋ)) have hφA : IsSelfAdjoint (φ A) := hA.map φ have hmap := StarAlgHom.map_cfc (φ := φ) (f := f) (a := A) (hf := hf) (hφ := hφ) (ha := hA) (hφa := hφA) @@ -642,9 +632,8 @@ lemma rightMulHS_cfcR [ContinuousFunctionalCalculus ℝ (L ℋ) IsSelfAdjoint] rightMulHS (ℋ := ℋ) (cfcR f A) = cfcR (ℋ := HSOp ℋ) f (rightMulHS (ℋ := ℋ) A) := by let φ : (L ℋ)ᵐᵒᵖ →⋆ₐ[ℝ] L (HSOp ℋ) := rightMulHSStarAlgHom (ℋ := ℋ) - have hφ : Continuous φ := by - exact - (LinearMap.continuous_of_finiteDimensional (rightMulHSLinearMap (ℋ := ℋ))) + have hφ : Continuous φ := + LinearMap.continuous_of_finiteDimensional (rightMulHSLinearMap (ℋ := ℋ)) have hopA : IsSelfAdjoint (MulOpposite.op A : (L ℋ)ᵐᵒᵖ) := op_isSelfAdjoint (A := A) hA have hφA : IsSelfAdjoint (φ (MulOpposite.op A)) := hopA.map φ have hmap := StarAlgHom.map_cfc (φ := φ) (f := f) (a := MulOpposite.op A) diff --git a/QuantumInfo/ForMathlib/HayataGroup/TraceInequality/JensenOperatorInequality.lean b/QuantumInfo/ForMathlib/HayataGroup/TraceInequality/JensenOperatorInequality.lean index edd08ffd7..1a843e17b 100644 --- a/QuantumInfo/ForMathlib/HayataGroup/TraceInequality/JensenOperatorInequality.lean +++ b/QuantumInfo/ForMathlib/HayataGroup/TraceInequality/JensenOperatorInequality.lean @@ -63,8 +63,7 @@ private theorem nontrivial_hsumL_wrap [Nontrivial ℋ] : Nontrivial (L (HSum ℋ have hdiag_ne_zero : (blockDiagonal (ℋ := ℋ) (1 : L ℋ) 0 : L (HSum ℋ)) ≠ 0 := by intro h0 have hz : - blockDiagonal (ℋ := ℋ) (1 : L ℋ) 0 (hsumIncl ℋ 0 w) = 0 := by - simp [h0] + blockDiagonal (ℋ := ℋ) (1 : L ℋ) 0 (hsumIncl ℋ 0 w) = 0 := by simp [h0] have hw0 : w = 0 := by have hz0 := congrArg (fun z : HSum ℋ => hsumProj ℋ 0 z) hz simpa [blockDiagonal] using hz0 @@ -130,10 +129,8 @@ private lemma cfcR_blockDiagonal_wrap (f : ℝ → ℝ) (hab := hpair) (ha := hA) (hb := hB)) calc cfcR (ℋ := HSum ℋ) f (blockDiagonal (ℋ := ℋ) A B) - = cfc (R := ℝ) (A := L (HSum ℋ)) (p := IsSelfAdjoint) f (φ (A, B)) := by - simp [cfcR, φ] - _ = φ (cfc (R := ℝ) (A := L ℋ × L ℋ) (p := IsSelfAdjoint) f (A, B)) := by - simpa using hmap.symm + = cfc (R := ℝ) (A := L (HSum ℋ)) (p := IsSelfAdjoint) f (φ (A, B)) := by simp [cfcR, φ] + _ = φ (cfc (R := ℝ) (A := L ℋ × L ℋ) (p := IsSelfAdjoint) f (A, B)) := by simpa using hmap.symm _ = φ (cfcR (ℋ := ℋ) f A, cfcR (ℋ := ℋ) f B) := by rw [hprod] _ = blockDiagonal (ℋ := ℋ) (cfcR (ℋ := ℋ) f A) (cfcR (ℋ := ℋ) f B) := by @@ -150,10 +147,9 @@ private lemma continuousOn_union_of_subset_Ici_wrap {f : ℝ → ℝ} · exact ht hx private lemma spectrum_Ici_of_nonneg_wrap {A : L ℋ} (hA0 : (0 : L ℋ) ≤ A) : - spectrum ℝ A ⊆ Set.Ici (0 : ℝ) := by - exact - (StarOrderedRing.nonneg_iff_spectrum_nonneg (R := ℝ) A - (ha := IsSelfAdjoint.of_nonneg hA0)).1 hA0 + spectrum ℝ A ⊆ Set.Ici (0 : ℝ) := + (StarOrderedRing.nonneg_iff_spectrum_nonneg (R := ℝ) A + (ha := IsSelfAdjoint.of_nonneg hA0)).1 hA0 variable [Nontrivial ℋ] @@ -161,8 +157,7 @@ omit [CompleteSpace ℋ] in private lemma spectrum_zero_subset_Ici_wrap : spectrum ℝ (0 : L ℋ) ⊆ Set.Ici (0 : ℝ) := by intro x hx - have hx0 : x = 0 := by - simpa using hx + have hx0 : x = 0 := by simpa using hx simp [Set.Ici, hx0] omit [Nontrivial ℋ] in @@ -242,15 +237,12 @@ theorem theorem_2_5_2_iv_imp_v {f : ℝ → ℝ} (hiv : CondIVAll.{u} f) blockDiagonal (ℋ := ℋ) (star X * X + star Y * Y) 0 ≤ (1 : L (HSum ℋ)) := by exact sub_nonneg.mp (by simpa [hsub] using hblock_nonneg) simpa [hXtilde_star_mul] using hblock - have hXtilde_star_mul_nonneg : (0 : L (HSum ℋ)) ≤ star Xtilde * Xtilde := by - simp + have hXtilde_star_mul_nonneg : (0 : L (HSum ℋ)) ≤ star Xtilde * Xtilde := by simp have hXtilde_norm : ‖Xtilde‖ ≤ 1 := by have hnormSq : ‖star Xtilde * Xtilde‖ ≤ 1 := (CStarAlgebra.norm_le_one_iff_of_nonneg _ hXtilde_star_mul_nonneg).2 hXtilde_star_mul_le - have hnormSq' : ‖Xtilde‖ * ‖Xtilde‖ ≤ 1 := by - simpa [CStarRing.norm_star_mul_self] using hnormSq - have hsq : ‖Xtilde‖ ^ 2 ≤ 1 := by - simpa [pow_two] using hnormSq' + have hnormSq' : ‖Xtilde‖ * ‖Xtilde‖ ≤ 1 := by simpa [CStarRing.norm_star_mul_self] using hnormSq + have hsq : ‖Xtilde‖ ^ 2 ≤ 1 := by simpa [pow_two] using hnormSq' nlinarith [norm_nonneg Xtilde] have hiv_hsum : CondIV (ℋ := HSum ℋ) f := @hiv (HSum ℋ) _ _ _ _ have hcore := hiv_hsum (A := Atilde) (X := Xtilde) hAtilde_sa hAtilde_spec hXtilde_norm @@ -295,8 +287,7 @@ theorem theorem_2_5_2_iv_imp_v {f : ℝ → ℝ} (hiv : CondIVAll.{u} f) /-- Uniform consequence of Theorem 2.5.2: `(i) → (v)` via `(iv)`. -/ theorem theorem_2_5_2_i_all_imp_v {f : ℝ → ℝ} (hf : CondIAll.{u} f) : CondV (ℋ := ℋ) f := by - have hconv : OperatorConvex (ℋ := ℋ) f := by - exact hf.1 + have hconv : OperatorConvex (ℋ := ℋ) f := hf.1 have hcont : ContinuousOn f Set.univ := operatorConvex_continuousOn_univ (ℋ := ℋ) hconv refine theorem_2_5_2_iv_imp_v (ℋ := ℋ) ?_ hcont @@ -357,25 +348,20 @@ theorem theorem_2_5_2_i_ici_all_imp_v {f : ℝ → ℝ} blockDiagonal (ℋ := ℋ) (star X * X + star Y * Y) 0 ≤ (1 : L (HSum ℋ)) := by exact sub_nonneg.mp (by simpa [hsub] using hblock_nonneg) simpa [hXtilde_star_mul] using hblock - have hXtilde_star_mul_nonneg : (0 : L (HSum ℋ)) ≤ star Xtilde * Xtilde := by - simp + have hXtilde_star_mul_nonneg : (0 : L (HSum ℋ)) ≤ star Xtilde * Xtilde := by simp have hXtilde_norm : ‖Xtilde‖ ≤ 1 := by have hnormSq : ‖star Xtilde * Xtilde‖ ≤ 1 := (CStarAlgebra.norm_le_one_iff_of_nonneg _ hXtilde_star_mul_nonneg).2 hXtilde_star_mul_le - have hnormSq' : ‖Xtilde‖ * ‖Xtilde‖ ≤ 1 := by - simpa [CStarRing.norm_star_mul_self] using hnormSq - have hsq : ‖Xtilde‖ ^ 2 ≤ 1 := by - simpa [pow_two] using hnormSq' + have hnormSq' : ‖Xtilde‖ * ‖Xtilde‖ ≤ 1 := by simpa [CStarRing.norm_star_mul_self] using hnormSq + have hsq : ‖Xtilde‖ ^ 2 ≤ 1 := by simpa [pow_two] using hnormSq' nlinarith [norm_nonneg Xtilde] have hiv_hsum : CondIV (ℋ := HSum ℋ) f := theorem_2_5_2_i_ici_all_imp_iv (ℋ := HSum ℋ) (f := f) hfIci have hcore := hiv_hsum (A := Atilde) (X := Xtilde) hAtilde_sa hAtilde_spec hXtilde_norm - have hsum_nonneg : (0 : L ℋ) ≤ star X * A * X + star Y * B * Y := by - have hXA : (0 : L ℋ) ≤ star X * A * X := by - simpa [mul_assoc] using star_left_conjugate_nonneg hA0 X - have hYB : (0 : L ℋ) ≤ star Y * B * Y := by - simpa [mul_assoc] using star_left_conjugate_nonneg hB0 Y - exact add_nonneg hXA hYB + have hsum_nonneg : (0 : L ℋ) ≤ star X * A * X + star Y * B * Y := + add_nonneg + (by simpa [mul_assoc] using star_left_conjugate_nonneg hA0 X) + (by simpa [mul_assoc] using star_left_conjugate_nonneg hB0 Y) have hsum_sa : IsSelfAdjoint (star X * A * X + star Y * B * Y) := IsSelfAdjoint.of_nonneg hsum_nonneg have hmul_block : diff --git a/QuantumInfo/ForMathlib/HayataGroup/TraceInequality/JensenOperatorInequalityIImpIV.lean b/QuantumInfo/ForMathlib/HayataGroup/TraceInequality/JensenOperatorInequalityIImpIV.lean index c495d7723..8b5da62e6 100644 --- a/QuantumInfo/ForMathlib/HayataGroup/TraceInequality/JensenOperatorInequalityIImpIV.lean +++ b/QuantumInfo/ForMathlib/HayataGroup/TraceInequality/JensenOperatorInequalityIImpIV.lean @@ -76,8 +76,7 @@ private noncomputable def blockSwap (X : L ℋ) : L (HSum ℋ) := blockOp (ℋ := ℋ) 0 (star X) X 0 private lemma blockSwap_star (X : L ℋ) : - star (blockSwap (ℋ := ℋ) X) = blockSwap (ℋ := ℋ) X := by - simp [blockSwap, blockOp_star] + star (blockSwap (ℋ := ℋ) X) = blockSwap (ℋ := ℋ) X := by simp [blockSwap, blockOp_star] private lemma blockSwap_sq (X : L ℋ) : blockSwap (ℋ := ℋ) X * blockSwap (ℋ := ℋ) X = @@ -186,10 +185,8 @@ private lemma cfcR_blockDiagonal (f : ℝ → ℝ) (hab := hpair) (ha := hA) (hb := hB)) calc cfcR (ℋ := HSum ℋ) f (blockDiagonal (ℋ := ℋ) A B) - = cfc (R := ℝ) (A := L (HSum ℋ)) (p := IsSelfAdjoint) f (φ (A, B)) := by - simp [cfcR, φ] - _ = φ (cfc (R := ℝ) (A := L ℋ × L ℋ) (p := IsSelfAdjoint) f (A, B)) := by - simpa using hmap.symm + = cfc (R := ℝ) (A := L (HSum ℋ)) (p := IsSelfAdjoint) f (φ (A, B)) := by simp [cfcR, φ] + _ = φ (cfc (R := ℝ) (A := L ℋ × L ℋ) (p := IsSelfAdjoint) f (A, B)) := by simpa using hmap.symm _ = φ (cfcR (ℋ := ℋ) f A, cfcR (ℋ := ℋ) f B) := by rw [hprod] _ = blockDiagonal (ℋ := ℋ) (cfcR (ℋ := ℋ) f A) (cfcR (ℋ := ℋ) f B) := by @@ -329,18 +326,15 @@ private lemma complex_I_smul_real_I_smul_invTwo (r : ℝ) (T : L ℋ) : simpa using (smul_comm r (Complex.I : ℂ) ((2⁻¹ : ℝ) • T x)) calc Complex.I • r • Complex.I • (2⁻¹ : ℝ) • T x - = Complex.I • (r • (Complex.I • ((2⁻¹ : ℝ) • T x))) := by - rfl + = Complex.I • (r • (Complex.I • ((2⁻¹ : ℝ) • T x))) := rfl _ = Complex.I • (Complex.I • (r • ((2⁻¹ : ℝ) • T x))) := by rw [hcomm] _ = ((Complex.I : ℂ) * Complex.I) • (r • ((2⁻¹ : ℝ) • T x)) := by rw [smul_smul] - _ = (-1 : ℂ) • (r • ((2⁻¹ : ℝ) • T x)) := by - norm_num + _ = (-1 : ℂ) • (r • ((2⁻¹ : ℝ) • T x)) := by norm_num _ = (-1 : ℂ) • (((r * 2⁻¹ : ℝ)) • T x) := by rw [smul_smul] - _ = -((2⁻¹ : ℝ) * r) • T x := by - simp [neg_smul, mul_comm] + _ = -((2⁻¹ : ℝ) * r) • T x := by simp [neg_smul, mul_comm] omit [CompleteSpace ℋ] in private lemma real_smul_complex_I_real_smul_complex_I_comm (s r : ℝ) (T : L ℋ) : @@ -354,15 +348,13 @@ private lemma real_smul_complex_I_real_smul_complex_I_comm (s r : ℝ) (T : L rw [smul_comm (s : ℝ) r (Complex.I • T)] _ = Complex.I • (r • (Complex.I • ((s : ℝ) • T))) := by rw [smul_comm (s : ℝ) (Complex.I : ℂ) T] - _ = Complex.I • r • Complex.I • (s : ℝ) • T := by - rfl + _ = Complex.I • r • Complex.I • (s : ℝ) • T := rfl omit [CompleteSpace ℋ] in private lemma half_add_half_eq (T : L ℋ) : (2⁻¹ : ℝ) • T + (2⁻¹ : ℝ) • T = T := by calc - (2⁻¹ : ℝ) • T + (2⁻¹ : ℝ) • T = (2⁻¹ + 2⁻¹ : ℝ) • T := by - simp [add_smul] + (2⁻¹ : ℝ) • T + (2⁻¹ : ℝ) • T = (2⁻¹ + 2⁻¹ : ℝ) • T := by simp [add_smul] _ = (1 : ℝ) • T := by norm_num _ = T := by simp @@ -371,8 +363,7 @@ private lemma half_mul_real_add_half_mul_real_eq (r : ℝ) (T : L ℋ) : ((2⁻¹ : ℝ) * r) • T + ((2⁻¹ : ℝ) * r) • T = r • T := by calc ((2⁻¹ : ℝ) * r) • T + ((2⁻¹ : ℝ) * r) • T = - (((2⁻¹ : ℝ) * r) + ((2⁻¹ : ℝ) * r)) • T := by - simp [add_smul] + (((2⁻¹ : ℝ) * r) + ((2⁻¹ : ℝ) * r)) • T := by simp [add_smul] _ = r • T := by ring_nf private lemma rightEval_topLeft_scalar @@ -385,8 +376,7 @@ private lemma rightEval_topLeft_scalar have hP : (2⁻¹ : ℝ) • (star X * (T * X)) + (2⁻¹ : ℝ) • (star X * (T * X)) = - star X * (T * X) := by - simpa using half_add_half_eq (ℋ := ℋ) (star X * (T * X)) + star X * (T * X) := by simpa using half_add_half_eq (ℋ := ℋ) (star X * (T * X)) have hQhalf : -((2⁻¹ : ℝ) • Complex.I • r • Complex.I • (R0 * R0)) + -((2⁻¹ : ℝ) • Complex.I • r • Complex.I • (R0 * R0)) = @@ -405,8 +395,7 @@ private lemma rightEval_topLeft_scalar calc -((2⁻¹ : ℝ) • Complex.I • r • Complex.I • (R0 * R0)) + -((2⁻¹ : ℝ) • Complex.I • r • Complex.I • (R0 * R0)) = - ((2⁻¹ : ℝ) * r) • (R0 * R0) + ((2⁻¹ : ℝ) * r) • (R0 * R0) := by - simp [hterm] + ((2⁻¹ : ℝ) * r) • (R0 * R0) + ((2⁻¹ : ℝ) * r) • (R0 * R0) := by simp [hterm] _ = r • (R0 * R0) := half_mul_real_add_half_mul_real_eq (ℋ := ℋ) r (R0 * R0) calc (2⁻¹ : ℝ) • (star X * (T * X)) + @@ -433,8 +422,7 @@ private lemma rightEval_bottomRight_scalar simpa using half_mul_real_add_half_mul_real_eq (ℋ := ℋ) r (X * star X) have hT : (2⁻¹ : ℝ) • (R1 * (T * R1)) + (2⁻¹ : ℝ) • (R1 * (T * R1)) = - R1 * (T * R1) := by - simpa using half_add_half_eq (ℋ := ℋ) (R1 * (T * R1)) + R1 * (T * R1) := by simpa using half_add_half_eq (ℋ := ℋ) (R1 * (T * R1)) calc (2⁻¹ * r) • (X * star X) + ((2⁻¹ * r) • (X * star X) + @@ -494,8 +482,7 @@ private lemma blockSwap_norm_le_one [Nontrivial ℋ] (X : L ℋ) (hX : ‖X‖ simp [sub_eq_add_neg, add_left_comm, add_comm] have hle' : blockDiagonal (ℋ := ℋ) (star X * X) (X * star X) ≤ - blockDiagonal (ℋ := ℋ) (1 : L ℋ) (1 : L ℋ) := by - simpa [hsum] using hle + blockDiagonal (ℋ := ℋ) (1 : L ℋ) (1 : L ℋ) := by simpa [hsum] using hle simpa [blockDiagonal_one] using hle' have hSstarSle : star (blockSwap (ℋ := ℋ) X) * blockSwap (ℋ := ℋ) X ≤ (1 : L (HSum ℋ)) := by @@ -506,8 +493,7 @@ private lemma blockSwap_norm_le_one [Nontrivial ℋ] (X : L ℋ) (hX : ‖X‖ (CStarAlgebra.norm_le_one_iff_of_nonneg _ hSstarSnonneg).2 hSstarSle have hnormSq' : ‖blockSwap (ℋ := ℋ) X‖ * ‖blockSwap (ℋ := ℋ) X‖ ≤ 1 := by simpa [CStarRing.norm_star_mul_self] using hnormSq - have hsq : ‖blockSwap (ℋ := ℋ) X‖ ^ 2 ≤ 1 := by - simpa [pow_two] using hnormSq' + have hsq : ‖blockSwap (ℋ := ℋ) X‖ ^ 2 ≤ 1 := by simpa [pow_two] using hnormSq' have hnonneg : 0 ≤ ‖blockSwap (ℋ := ℋ) X‖ := norm_nonneg _ nlinarith @@ -522,10 +508,9 @@ private lemma continuousOn_union_of_subset_Ici {f : ℝ → ℝ} · exact ht hx private lemma spectrum_Ici_of_nonneg {A : L ℋ} (hA0 : (0 : L ℋ) ≤ A) : - spectrum ℝ A ⊆ Set.Ici (0 : ℝ) := by - exact - (StarOrderedRing.nonneg_iff_spectrum_nonneg (R := ℝ) A - (ha := IsSelfAdjoint.of_nonneg hA0)).1 hA0 + spectrum ℝ A ⊆ Set.Ici (0 : ℝ) := + (StarOrderedRing.nonneg_iff_spectrum_nonneg (R := ℝ) A + (ha := IsSelfAdjoint.of_nonneg hA0)).1 hA0 variable [Nontrivial ℋ] @@ -533,8 +518,7 @@ omit [CompleteSpace ℋ] in private lemma spectrum_zero_subset_Ici : spectrum ℝ (0 : L ℋ) ⊆ Set.Ici (0 : ℝ) := by intro x hx - have hx0 : x = 0 := by - simpa using hx + have hx0 : x = 0 := by simpa using hx simp [Set.Ici, hx0] @@ -555,8 +539,7 @@ theorem theorem_2_5_2_i_ici_all_imp_iv {f : ℝ → ℝ} (hf : CondIciAll.{u} f) have hSsa : IsSelfAdjoint S := by change star S = S simpa [S] using blockSwap_star (ℋ := ℋ) X - have hSnorm : ‖S‖ ≤ 1 := by - simpa [S] using blockSwap_norm_le_one (ℋ := ℋ) X hX + have hSnorm : ‖S‖ ≤ 1 := by simpa [S] using blockSwap_norm_le_one (ℋ := ℋ) X hX letI : Algebra ℝ (L (HSum ℋ)) := by infer_instance have hU_mem : S + Complex.I • CFC.sqrt (1 - S ^ 2) ∈ unitary (L (HSum ℋ)) := by @@ -653,8 +636,7 @@ theorem theorem_2_5_2_i_ici_all_imp_iv {f : ℝ → ℝ} (hf : CondIciAll.{u} f) · have hhalf : (2⁻¹ + 2⁻¹ : ℝ) = (1 : ℝ) := by norm_num calc (1 / 2 : ℝ) • (star X * A * X) + (1 / 2 : ℝ) • (star X * A * X) - = (2⁻¹ + 2⁻¹ : ℝ) • (star X * (A * X)) := by - simp [add_smul, mul_assoc] + = (2⁻¹ + 2⁻¹ : ℝ) • (star X * (A * X)) := by simp [add_smul, mul_assoc] _ = (1 : ℝ) • (star X * (A * X)) := by rw [hhalf] _ = star X * (A * X) := by simp _ = star X * A * X := by simp [mul_assoc] @@ -809,8 +791,7 @@ theorem theorem_2_5_2_i_all_imp_iv {f : ℝ → ℝ} (hf : CondIAll.{u} f) : have hSsa : IsSelfAdjoint S := by change star S = S simpa [S] using blockSwap_star (ℋ := ℋ) X - have hSnorm : ‖S‖ ≤ 1 := by - simpa [S] using blockSwap_norm_le_one (ℋ := ℋ) X hX + have hSnorm : ‖S‖ ≤ 1 := by simpa [S] using blockSwap_norm_le_one (ℋ := ℋ) X hX letI : Algebra ℝ (L (HSum ℋ)) := by infer_instance have hU_mem : S + Complex.I • CFC.sqrt (1 - S ^ 2) ∈ unitary (L (HSum ℋ)) := by @@ -908,8 +889,7 @@ theorem theorem_2_5_2_i_all_imp_iv {f : ℝ → ℝ} (hf : CondIAll.{u} f) : · have hhalf : (2⁻¹ + 2⁻¹ : ℝ) = (1 : ℝ) := by norm_num calc (1 / 2 : ℝ) • (star X * A * X) + (1 / 2 : ℝ) • (star X * A * X) - = (2⁻¹ + 2⁻¹ : ℝ) • (star X * (A * X)) := by - simp [add_smul, mul_assoc] + = (2⁻¹ + 2⁻¹ : ℝ) • (star X * (A * X)) := by simp [add_smul, mul_assoc] _ = (1 : ℝ) • (star X * (A * X)) := by rw [hhalf] _ = star X * (A * X) := by simp _ = star X * A * X := by simp [mul_assoc] diff --git a/QuantumInfo/ForMathlib/HayataGroup/TraceInequality/JensenOperatorInequalityIVtoV.lean b/QuantumInfo/ForMathlib/HayataGroup/TraceInequality/JensenOperatorInequalityIVtoV.lean index 02e3168cf..efad0c931 100644 --- a/QuantumInfo/ForMathlib/HayataGroup/TraceInequality/JensenOperatorInequalityIVtoV.lean +++ b/QuantumInfo/ForMathlib/HayataGroup/TraceInequality/JensenOperatorInequalityIVtoV.lean @@ -75,8 +75,7 @@ private theorem nontrivial_hsumL : Nontrivial (L (HSum ℋ)) := by have hdiag_ne_zero : (blockDiagonal (ℋ := ℋ) (1 : L ℋ) 0 : L (HSum ℋ)) ≠ 0 := by intro h0 have hz : - blockDiagonal (ℋ := ℋ) (1 : L ℋ) 0 (hsumIncl ℋ 0 w) = 0 := by - simp [h0] + blockDiagonal (ℋ := ℋ) (1 : L ℋ) 0 (hsumIncl ℋ 0 w) = 0 := by simp [h0] have hw0 : w = 0 := by have hz0 := congrArg (fun z : HSum ℋ => hsumProj ℋ 0 z) hz simpa [blockDiagonal] using hz0 @@ -146,10 +145,8 @@ private lemma cfcR_blockDiagonal (f : ℝ → ℝ) (hab := hpair) (ha := hA) (hb := hB)) calc cfcR (ℋ := HSum ℋ) f (blockDiagonal (ℋ := ℋ) A B) - = cfc (R := ℝ) (A := L (HSum ℋ)) (p := IsSelfAdjoint) f (φ (A, B)) := by - simp [cfcR, φ] - _ = φ (cfc (R := ℝ) (A := L ℋ × L ℋ) (p := IsSelfAdjoint) f (A, B)) := by - simpa using hmap.symm + = cfc (R := ℝ) (A := L (HSum ℋ)) (p := IsSelfAdjoint) f (φ (A, B)) := by simp [cfcR, φ] + _ = φ (cfc (R := ℝ) (A := L ℋ × L ℋ) (p := IsSelfAdjoint) f (A, B)) := by simpa using hmap.symm _ = φ (cfcR (ℋ := ℋ) f A, cfcR (ℋ := ℋ) f B) := by rw [hprod] _ = blockDiagonal (ℋ := ℋ) (cfcR (ℋ := ℋ) f A) (cfcR (ℋ := ℋ) f B) := by @@ -234,15 +231,12 @@ theorem theorem_2_5_2_iv_imp_v {f : ℝ → ℝ} (hiv : CondIVAll.{u} f) blockDiagonal (ℋ := ℋ) (star X * X + star Y * Y) 0 ≤ (1 : L (HSum ℋ)) := by exact sub_nonneg.mp (by simpa [hsub] using hblock_nonneg) simpa [hXtilde_star_mul] using hblock - have hXtilde_star_mul_nonneg : (0 : L (HSum ℋ)) ≤ star Xtilde * Xtilde := by - simp + have hXtilde_star_mul_nonneg : (0 : L (HSum ℋ)) ≤ star Xtilde * Xtilde := by simp have hXtilde_norm : ‖Xtilde‖ ≤ 1 := by have hnormSq : ‖star Xtilde * Xtilde‖ ≤ 1 := (CStarAlgebra.norm_le_one_iff_of_nonneg _ hXtilde_star_mul_nonneg).2 hXtilde_star_mul_le - have hnormSq' : ‖Xtilde‖ * ‖Xtilde‖ ≤ 1 := by - simpa [CStarRing.norm_star_mul_self] using hnormSq - have hsq : ‖Xtilde‖ ^ 2 ≤ 1 := by - simpa [pow_two] using hnormSq' + have hnormSq' : ‖Xtilde‖ * ‖Xtilde‖ ≤ 1 := by simpa [CStarRing.norm_star_mul_self] using hnormSq + have hsq : ‖Xtilde‖ ^ 2 ≤ 1 := by simpa [pow_two] using hnormSq' nlinarith [norm_nonneg Xtilde] have hiv_hsum : CondIV (ℋ := HSum ℋ) f := @hiv (HSum ℋ) _ _ _ _ have hcore := hiv_hsum (A := Atilde) (X := Xtilde) hAtilde_sa hAtilde_spec hXtilde_norm diff --git a/QuantumInfo/ForMathlib/HayataGroup/TraceInequality/LiebAndoTrace.lean b/QuantumInfo/ForMathlib/HayataGroup/TraceInequality/LiebAndoTrace.lean index d50805849..5c1d5d07c 100644 --- a/QuantumInfo/ForMathlib/HayataGroup/TraceInequality/LiebAndoTrace.lean +++ b/QuantumInfo/ForMathlib/HayataGroup/TraceInequality/LiebAndoTrace.lean @@ -417,13 +417,11 @@ private lemma hmiddle_leftMul_rightMul exact (rightMulHS_cfcR (ℋ := ℋ) (fun x : ℝ ↦ x ^ s) (B ^ (-1 : ℝ)) hBinv_sa (by intro x hx - have hx0 : x ≠ 0 := by - intro hx0 - exact spectrum.zero_notMem (R := ℝ) hBinv_unit (by simpa [hx0] using hx) + have hx0 : x ≠ 0 := + fun hx0 => spectrum.zero_notMem (R := ℝ) hBinv_unit (by simpa [hx0] using hx) exact (Real.continuousAt_rpow_const x s (Or.inl hx0)).continuousWithinAt)).symm have hprod0 : - 0 ≤ leftMulHS (ℋ := ℋ) A * rightMulHS (ℋ := ℋ) (B ^ (-1 : ℝ)) := by - exact (leftMulHS_rightMulHS_commute (ℋ := ℋ) A (B ^ (-1 : ℝ))).mul_nonneg + 0 ≤ leftMulHS (ℋ := ℋ) A * rightMulHS (ℋ := ℋ) (B ^ (-1 : ℝ)) := (leftMulHS_rightMulHS_commute (ℋ := ℋ) A (B ^ (-1 : ℝ))).mul_nonneg (leftMulHS_nonneg (ℋ := ℋ) hA0) (rightMulHS_nonneg (ℋ := ℋ) hBinv0) have hprod_sa : @@ -431,8 +429,7 @@ private lemma hmiddle_leftMul_rightMul (leftMulHS (ℋ := ℋ) A * rightMulHS (ℋ := ℋ) (B ^ (-1 : ℝ))) := IsSelfAdjoint.of_nonneg hprod0 have htop : - (⨆ α, ⨆ β, eigenspace T0 α ⊓ eigenspace T1 β) = ⊤ := by - exact LinearMap.IsSymmetric.iSup_iSup_eigenspace_inf_eigenspace_eq_top_of_commute + (⨆ α, ⨆ β, eigenspace T0 α ⊓ eigenspace T1 β) = ⊤ := LinearMap.IsSymmetric.iSup_iSup_eigenspace_inf_eigenspace_eq_top_of_commute hT0_symm hT1_symm hcomm have hjoint_ker : ∀ α β, @@ -530,8 +527,7 @@ private lemma hmiddle_leftMul_rightMul simp [mul_comm] have hscal : (((α.re * β.re : ℝ) ^ s : ℝ) : ℂ) = - ((((α.re ^ s) * (β.re ^ s) : ℝ)) : ℂ) := by - exact congrArg (fun t : ℝ => (t : ℂ)) (Real.mul_rpow hαnonneg hβnonneg) + ((((α.re ^ s) * (β.re ^ s) : ℝ)) : ℂ) := congrArg (fun t : ℝ => (t : ℂ)) (Real.mul_rpow hαnonneg hβnonneg) simpa [D] using sub_eq_zero.mpr (hlhsx.trans (hscal ▸ hrhsx.symm)) have hker_top : LinearMap.ker D.toLinearMap = ⊤ := by @@ -617,8 +613,7 @@ private lemma phiK_operatorPowerMean_eq_liebTraceMap simp have hBinv_sa : IsSelfAdjoint (B ^ (-1 : ℝ)) := IsSelfAdjoint.of_nonneg hBinv0 have hright_invHalf0 : - 0 ≤ rightMulHS (ℋ := ℋ) (B ^ ((-1 : ℝ) / 2)) := by - exact rightMulHS_nonneg (ℋ := ℋ) hBinvHalf0 + 0 ≤ rightMulHS (ℋ := ℋ) (B ^ ((-1 : ℝ) / 2)) := rightMulHS_nonneg (ℋ := ℋ) hBinvHalf0 have hmid_nonneg : 0 ≤ cfcR (ℋ := HSOp ℋ) (fun x : ℝ ↦ x ^ ((-1 : ℝ) / 2)) (rightMulHS (ℋ := ℋ) B) * leftMulHS (ℋ := ℋ) A * @@ -650,8 +645,7 @@ private lemma phiK_operatorPowerMean_eq_liebTraceMap (cfcR (ℋ := HSOp ℋ) (fun x : ℝ ↦ x ^ ((-1 : ℝ) / 2)) (rightMulHS (ℋ := ℋ) B) * leftMulHS (ℋ := ℋ) A * cfcR (ℋ := HSOp ℋ) (fun x : ℝ ↦ x ^ ((-1 : ℝ) / 2)) (rightMulHS (ℋ := ℋ) B)) = - leftMulHS (ℋ := ℋ) (A ^ s) * rightMulHS (ℋ := ℋ) (B ^ (-s)) := by - exact hmiddle_leftMul_rightMul (ℋ := ℋ) (s := s) ⟨hA_sa, hA_spec⟩ ⟨hB_sa, hB_spec⟩ + leftMulHS (ℋ := ℋ) (A ^ s) * rightMulHS (ℋ := ℋ) (B ^ (-s)) := hmiddle_leftMul_rightMul (ℋ := ℋ) (s := s) ⟨hA_sa, hA_spec⟩ ⟨hB_sa, hB_spec⟩ have happly : operatorPowerMean (ℋ := HSOp ℋ) s 1 (leftMulHS (ℋ := ℋ) A) (rightMulHS (ℋ := ℋ) B) (ofOp (star K)) = @@ -750,8 +744,7 @@ private lemma phiK_operatorPowerMean_eq_liebTraceMap congrArg Complex.re (LinearMap.trace_mul_comm (R := ℂ) (M := ℋ) K.toLinearMap X.toLinearMap) simpa [X, mul_assoc] using htrace'.trans hcycle - _ = liebTraceMap (ℋ := ℋ) s K A B := by - rfl + _ = liebTraceMap (ℋ := ℋ) s K A B := rfl omit [FiniteDimensional ℂ ℋ] in /-- Convex combinations preserve `pdSet` (strict positivity). -/ @@ -915,8 +908,7 @@ private lemma liebTraceMap_mono_right have hdiff0 : 0 ≤ B₂ ^ (1 - s) - B₁ ^ (1 - s) := sub_nonneg.mpr hpow have hprod0 : 0 ≤ leftMulHS (ℋ := ℋ) (A ^ s) * - rightMulHS (ℋ := ℋ) (B₂ ^ (1 - s) - B₁ ^ (1 - s)) := by - exact (leftMulHS_rightMulHS_commute (ℋ := ℋ) (A ^ s) (B₂ ^ (1 - s) - B₁ ^ (1 - s))).mul_nonneg + rightMulHS (ℋ := ℋ) (B₂ ^ (1 - s) - B₁ ^ (1 - s)) := (leftMulHS_rightMulHS_commute (ℋ := ℋ) (A ^ s) (B₂ ^ (1 - s) - B₁ ^ (1 - s))).mul_nonneg (leftMulHS_nonneg (ℋ := ℋ) hApow0) (rightMulHS_nonneg (ℋ := ℋ) hdiff0) have hphi : 0 ≤ @@ -993,8 +985,7 @@ private lemma liebTraceMap_antitone_right have hdiff0 : 0 ≤ B₁ ^ (1 - s) - B₂ ^ (1 - s) := sub_nonneg.mpr hpow have hprod0 : 0 ≤ leftMulHS (ℋ := ℋ) (A ^ s) * - rightMulHS (ℋ := ℋ) (B₁ ^ (1 - s) - B₂ ^ (1 - s)) := by - exact (leftMulHS_rightMulHS_commute (ℋ := ℋ) (A ^ s) (B₁ ^ (1 - s) - B₂ ^ (1 - s))).mul_nonneg + rightMulHS (ℋ := ℋ) (B₁ ^ (1 - s) - B₂ ^ (1 - s)) := (leftMulHS_rightMulHS_commute (ℋ := ℋ) (A ^ s) (B₁ ^ (1 - s) - B₂ ^ (1 - s))).mul_nonneg (leftMulHS_nonneg (ℋ := ℋ) hApow0) (rightMulHS_nonneg (ℋ := ℋ) hdiff0) have hphi : 0 ≤ @@ -1068,11 +1059,9 @@ theorem liebTrace_jointlyConcaveOn_pdSet toOp T * ((1 - θ) • B₁ + θ • B₂) rw [mul_add, mul_smul_comm, mul_smul_comm] have hA_combo : - ((1 - θ) • A₁ + θ • A₂) ∈ pdSet (ℋ := ℋ) := by - exact pdSet_convexCombo (ℋ := ℋ) hA₁ hA₂ hθ0 hθ1 + ((1 - θ) • A₁ + θ • A₂) ∈ pdSet (ℋ := ℋ) := pdSet_convexCombo (ℋ := ℋ) hA₁ hA₂ hθ0 hθ1 have hB_combo : - ((1 - θ) • B₁ + θ • B₂) ∈ pdSet (ℋ := ℋ) := by - exact pdSet_convexCombo (ℋ := ℋ) hB₁ hB₂ hθ0 hθ1 + ((1 - θ) • B₁ + θ • B₂) ∈ pdSet (ℋ := ℋ) := pdSet_convexCombo (ℋ := ℋ) hB₁ hB₂ hθ0 hθ1 letI : Nontrivial (HSOp ℋ) := by delta HSOp infer_instance @@ -1105,8 +1094,7 @@ theorem liebTrace_jointlyConcaveOn_pdSet phiK (ℋ := ℋ) K (operatorPowerMean (ℋ := HSOp ℋ) s 1 (leftMulHS (ℋ := ℋ) ((1 - θ) • A₁ + θ • A₂)) - (rightMulHS (ℋ := ℋ) ((1 - θ) • B₁ + θ • B₂))) := by - exact phiK_mono (ℋ := ℋ) K hconc + (rightMulHS (ℋ := ℋ) ((1 - θ) • B₁ + θ • B₂))) := phiK_mono (ℋ := ℋ) K hconc rw [phiK_weightedSum_operatorPowerMean_eq (ℋ := ℋ) (s := s) (θ := θ) K A₁ A₂ B₁ B₂ hA₁ hA₂ hB₁ hB₂] at hphi_mono rw [phiK_operatorPowerMean_eq_liebTraceMap (ℋ := ℋ) (s := s) K @@ -1133,11 +1121,9 @@ theorem liebTrace_jointlyConvexOn_pdSet toOp T * ((1 - θ) • B₁ + θ • B₂) rw [mul_add, mul_smul_comm, mul_smul_comm] have hA_combo : - ((1 - θ) • A₁ + θ • A₂) ∈ pdSet (ℋ := ℋ) := by - exact pdSet_convexCombo (ℋ := ℋ) hA₁ hA₂ hθ0 hθ1 + ((1 - θ) • A₁ + θ • A₂) ∈ pdSet (ℋ := ℋ) := pdSet_convexCombo (ℋ := ℋ) hA₁ hA₂ hθ0 hθ1 have hB_combo : - ((1 - θ) • B₁ + θ • B₂) ∈ pdSet (ℋ := ℋ) := by - exact pdSet_convexCombo (ℋ := ℋ) hB₁ hB₂ hθ0 hθ1 + ((1 - θ) • B₁ + θ • B₂) ∈ pdSet (ℋ := ℋ) := pdSet_convexCombo (ℋ := ℋ) hB₁ hB₂ hθ0 hθ1 letI : Nontrivial (HSOp ℋ) := by delta HSOp infer_instance @@ -1170,8 +1156,7 @@ theorem liebTrace_jointlyConvexOn_pdSet ((1 - θ) • operatorPowerMean (ℋ := HSOp ℋ) s 1 (leftMulHS (ℋ := ℋ) A₁) (rightMulHS (ℋ := ℋ) B₁) + θ • operatorPowerMean (ℋ := HSOp ℋ) s 1 - (leftMulHS (ℋ := ℋ) A₂) (rightMulHS (ℋ := ℋ) B₂)) := by - exact phiK_mono (ℋ := ℋ) K hconv + (leftMulHS (ℋ := ℋ) A₂) (rightMulHS (ℋ := ℋ) B₂)) := phiK_mono (ℋ := ℋ) K hconv rw [phiK_operatorPowerMean_eq_liebTraceMap (ℋ := ℋ) (s := s) K ((1 - θ) • A₁ + θ • A₂) ((1 - θ) • B₁ + θ • B₂) hA_combo hB_combo] at hphi_mono rw [phiK_weightedSum_operatorPowerMean_eq (ℋ := ℋ) (s := s) (θ := θ) K A₁ A₂ B₁ B₂ @@ -1199,11 +1184,9 @@ theorem liebExtensionTrace_jointlyConcaveOn_pdSet field_simp [h1q.ne'] intro A₁ A₂ B₁ B₂ θ hA₁ hA₂ hB₁ hB₂ hθ0 hθ1 have hA_combo : - ((1 - θ) • A₁ + θ • A₂) ∈ pdSet (ℋ := ℋ) := by - exact pdSet_convexCombo (ℋ := ℋ) hA₁ hA₂ hθ0 hθ1 + ((1 - θ) • A₁ + θ • A₂) ∈ pdSet (ℋ := ℋ) := pdSet_convexCombo (ℋ := ℋ) hA₁ hA₂ hθ0 hθ1 have hB_combo : - ((1 - θ) • B₁ + θ • B₂) ∈ pdSet (ℋ := ℋ) := by - exact pdSet_convexCombo (ℋ := ℋ) hB₁ hB₂ hθ0 hθ1 + ((1 - θ) • B₁ + θ • B₂) ∈ pdSet (ℋ := ℋ) := pdSet_convexCombo (ℋ := ℋ) hB₁ hB₂ hθ0 hθ1 have hB₁β : B₁ ^ β ∈ pdSet (ℋ := ℋ) := pdSet_rpow_of_mem_Icc_zero_one (ℋ := ℋ) hβ hB₁ have hB₂β : B₂ ^ β ∈ pdSet (ℋ := ℋ) := @@ -1212,8 +1195,7 @@ theorem liebExtensionTrace_jointlyConcaveOn_pdSet (((1 - θ) • B₁ + θ • B₂) ^ β) ∈ pdSet (ℋ := ℋ) := pdSet_rpow_of_mem_Icc_zero_one (ℋ := ℋ) hβ hB_combo have hBpow_combo : - ((1 - θ) • (B₁ ^ β) + θ • (B₂ ^ β)) ∈ pdSet (ℋ := ℋ) := by - exact pdSet_convexCombo (ℋ := ℋ) hB₁β hB₂β hθ0 hθ1 + ((1 - θ) • (B₁ ^ β) + θ • (B₂ ^ β)) ∈ pdSet (ℋ := ℋ) := pdSet_convexCombo (ℋ := ℋ) hB₁β hB₂β hθ0 hθ1 have hB₁_mem := hB₁ have hB₂_mem := hB₂ have hB_combo_mem := hB_combo @@ -1265,8 +1247,7 @@ theorem liebExtensionTrace_jointlyConcaveOn_pdSet ((1 - θ) • (B₁ ^ β) + θ • (B₂ ^ β)) ≤ liebTraceMap (ℋ := ℋ) q K ((1 - θ) • A₁ + θ • A₂) - (((1 - θ) • B₁ + θ • B₂) ^ β) := by - exact liebTraceMap_mono_right (ℋ := ℋ) (s := q) hsmono K + (((1 - θ) • B₁ + θ • B₂) ^ β) := liebTraceMap_mono_right (ℋ := ℋ) (s := q) hsmono K ((1 - θ) • A₁ + θ • A₂) ((1 - θ) • (B₁ ^ β) + θ • (B₂ ^ β)) (((1 - θ) • B₁ + θ • B₂) ^ β) @@ -1325,11 +1306,9 @@ theorem andoTrace_jointlyConvexOn_pdSet ring intro A₁ A₂ B₁ B₂ θ hA₁ hA₂ hB₁ hB₂ hθ0 hθ1 have hA_combo : - ((1 - θ) • A₁ + θ • A₂) ∈ pdSet (ℋ := ℋ) := by - exact pdSet_convexCombo (ℋ := ℋ) hA₁ hA₂ hθ0 hθ1 + ((1 - θ) • A₁ + θ • A₂) ∈ pdSet (ℋ := ℋ) := pdSet_convexCombo (ℋ := ℋ) hA₁ hA₂ hθ0 hθ1 have hB_combo : - ((1 - θ) • B₁ + θ • B₂) ∈ pdSet (ℋ := ℋ) := by - exact pdSet_convexCombo (ℋ := ℋ) hB₁ hB₂ hθ0 hθ1 + ((1 - θ) • B₁ + θ • B₂) ∈ pdSet (ℋ := ℋ) := pdSet_convexCombo (ℋ := ℋ) hB₁ hB₂ hθ0 hθ1 have hB₁β : B₁ ^ β ∈ pdSet (ℋ := ℋ) := pdSet_rpow_of_mem_Icc_zero_one (ℋ := ℋ) hβ hB₁ have hB₂β : B₂ ^ β ∈ pdSet (ℋ := ℋ) := @@ -1338,8 +1317,7 @@ theorem andoTrace_jointlyConvexOn_pdSet (((1 - θ) • B₁ + θ • B₂) ^ β) ∈ pdSet (ℋ := ℋ) := pdSet_rpow_of_mem_Icc_zero_one (ℋ := ℋ) hβ hB_combo have hBpow_combo : - ((1 - θ) • (B₁ ^ β) + θ • (B₂ ^ β)) ∈ pdSet (ℋ := ℋ) := by - exact pdSet_convexCombo (ℋ := ℋ) hB₁β hB₂β hθ0 hθ1 + ((1 - θ) • (B₁ ^ β) + θ • (B₂ ^ β)) ∈ pdSet (ℋ := ℋ) := pdSet_convexCombo (ℋ := ℋ) hB₁β hB₂β hθ0 hθ1 have hB₁_mem := hB₁ have hB₂_mem := hB₂ have hB_combo_mem := hB_combo @@ -1391,8 +1369,7 @@ theorem andoTrace_jointlyConvexOn_pdSet (((1 - θ) • B₁ + θ • B₂) ^ β) ≤ liebTraceMap (ℋ := ℋ) q K ((1 - θ) • A₁ + θ • A₂) - ((1 - θ) • (B₁ ^ β) + θ • (B₂ ^ β)) := by - exact liebTraceMap_antitone_right (ℋ := ℋ) (s := q) hsanti K + ((1 - θ) • (B₁ ^ β) + θ • (B₂ ^ β)) := liebTraceMap_antitone_right (ℋ := ℋ) (s := q) hsanti K ((1 - θ) • A₁ + θ • A₂) ((1 - θ) • (B₁ ^ β) + θ • (B₂ ^ β)) (((1 - θ) • B₁ + θ • B₂) ^ β) diff --git a/QuantumInfo/ForMathlib/HayataGroup/TraceInequality/LownerHeinzCore.lean b/QuantumInfo/ForMathlib/HayataGroup/TraceInequality/LownerHeinzCore.lean index 93674e3e5..cab27837e 100644 --- a/QuantumInfo/ForMathlib/HayataGroup/TraceInequality/LownerHeinzCore.lean +++ b/QuantumInfo/ForMathlib/HayataGroup/TraceInequality/LownerHeinzCore.lean @@ -156,8 +156,7 @@ variable [NonnegSpectrumClass ℝ 𝓐] omit [Nontrivial (𝓐)] [NonnegSpectrumClass ℝ 𝓐] in lemma conjugate_isPositive {X T : 𝓐} (hX : 0 ≤ X) (hT : IsSelfAdjoint T) : - 0 ≤ T * X * T := by - simpa using hT.conjugate_nonneg hX + 0 ≤ T * X * T := by simpa using hT.conjugate_nonneg hX omit [Nontrivial 𝓐] [NonnegSpectrumClass ℝ 𝓐] in theorem one_div_operatorAntitoneOn_Ioi : @@ -167,24 +166,18 @@ theorem one_div_operatorAntitoneOn_Ioi : let f : ℝ → ℝ := fun x ↦ x have hA_sa : IsSelfAdjoint A := IsSelfAdjoint.of_nonneg A_nonneg have hB_sa : IsSelfAdjoint B := IsSelfAdjoint.of_nonneg B_nonneg - have hA_ne0 : ∀ x ∈ spectrum ℝ A, f x ≠ 0 := by - intro x hx - exact ne_of_gt (As hx) - have hB_ne0 : ∀ x ∈ spectrum ℝ B, f x ≠ 0 := by - intro x hx - exact ne_of_gt (Bs hx) + have hA_ne0 : ∀ x ∈ spectrum ℝ A, f x ≠ 0 := + fun _ hx => ne_of_gt (As hx) + have hB_ne0 : ∀ x ∈ spectrum ℝ B, f x ≠ 0 := + fun _ hx => ne_of_gt (Bs hx) let uA : (𝓐)ˣ := cfcUnits (R := ℝ) (A := 𝓐) (p := IsSelfAdjoint) f A hA_ne0 (ha := hA_sa) let uB : (𝓐)ˣ := cfcUnits (R := ℝ) (A := 𝓐) (p := IsSelfAdjoint) f B hB_ne0 (ha := hB_sa) - have huA_val : (uA : 𝓐) = A := by - simp [uA, cfcUnits, f, cfc_id' (R := ℝ) (a := A) (ha := hA_sa)] - have huB_val : (uB : 𝓐) = B := by - simp [uB, cfcUnits, f, cfc_id' (R := ℝ) (a := B) (ha := hB_sa)] - have huB_nonneg : 0 ≤ (uB : 𝓐) := by - simpa [huB_val] using B_nonneg - have hub_le_hua : (uB : 𝓐) ≤ (uA : 𝓐) := by - simpa [huA_val, huB_val] using BA + have huA_val : (uA : 𝓐) = A := by simp [uA, cfcUnits, f, cfc_id' (R := ℝ) (a := A) (ha := hA_sa)] + have huB_val : (uB : 𝓐) = B := by simp [uB, cfcUnits, f, cfc_id' (R := ℝ) (a := B) (ha := hB_sa)] + have huB_nonneg : 0 ≤ (uB : 𝓐) := by simpa [huB_val] using B_nonneg + have hub_le_hua : (uB : 𝓐) ≤ (uA : 𝓐) := by simpa [huA_val, huB_val] using BA have hinv : (↑uA⁻¹ : 𝓐) ≤ (↑uB⁻¹ : 𝓐) := by simpa using (CStarAlgebra.inv_le_inv (A := 𝓐) (a := uB) (b := uA) huB_nonneg hub_le_hua) @@ -220,8 +213,7 @@ private lemma spectrum_convexCombo_Ioi {A B : 𝓐} {t : ℝ} simpa [C] using add_le_add (smul_le_smul_of_nonneg_left hrA_le (sub_nonneg.mpr ht1)) (smul_le_smul_of_nonneg_left hrB_le ht0) have hLHS : (1 - t) • algebraMap ℝ (𝓐) rA + t • algebraMap ℝ (𝓐) rB = - algebraMap ℝ (𝓐) rC := by - simp [rC, Algebra.smul_def] + algebraMap ℝ (𝓐) rC := by simp [rC, Algebra.smul_def] simpa [hLHS] using hsum intro x hx simpa [C] using (CFC.exists_pos_algebraMap_le_iff (A := 𝓐) (a := C) (ha := hC)).1 ⟨rC, hrC, hrC_le⟩ x hx @@ -239,11 +231,9 @@ private lemma posSemidef_block_one_inv {A : 𝓐} (hA : IsSelfAdjoint A) have posV : Matrix.PosSemidef (Matrix.vecMulVec v (star v)) := by simpa using (Matrix.posSemidef_vecMulVec_self_star (R := 𝓐) v) have hsqrtA : IsSelfAdjoint sqrtA := by - dsimp [sqrtA, cfcR] - exact cfc_predicate _ _ + simp [sqrtA, cfcR] have hinvSqrtA : IsSelfAdjoint invSqrtA := by - dsimp [invSqrtA, cfcR] - exact cfc_predicate _ _ + simp [invSqrtA, cfcR] have hcont_sqrt : ContinuousOn (fun x : ℝ ↦ x ^ ((1 : ℝ) / 2)) (spectrum ℝ A) := fun x hx => (Real.continuousAt_rpow_const x _ (Or.inl (ne_of_gt (As hx)))).continuousWithinAt have hcont_invSqrt : ContinuousOn (fun x : ℝ ↦ x ^ ((-1 : ℝ) / 2)) (spectrum ℝ A) := @@ -281,7 +271,6 @@ private lemma posSemidef_block_one_inv {A : 𝓐} (hA : IsSelfAdjoint A) rw [← Real.rpow_add (As hx), show ((1 : ℝ) / 2 + (1 : ℝ) / 2 : ℝ) = 1 from by ring, Real.rpow_one] _ = A := cfc_id' (R := ℝ) (a := A) (ha := hA) have invA_eq : cfcR (fun x : ℝ ↦ x ^ (-1 : ℝ)) A = cfcR (fun x : ℝ ↦ x⁻¹) A := by - dsimp [cfcR] apply cfc_congr intro x hx have hxne : x ≠ 0 := ne_of_gt (As hx) @@ -309,8 +298,7 @@ private lemma schur_conj_eq_diagonal {C D invC : 𝓐} (hInvC_sa : IsSelfAdjoint fin_cases i <;> fin_cases j <;> simp [hInvC_sa.star_eq] have hP : star U * (!![C, 1; 1, D] : Matrix (Fin 2) (Fin 2) (𝓐)) = - !![C, 1; -invC * C + 1, -invC + D] := by - simp [hstarU, U] + !![C, 1; -invC * C + 1, -invC + D] := by simp [hstarU, U] have hQ : star U * (!![C, 1; 1, D] : Matrix (Fin 2) (Fin 2) (𝓐)) * U = !![C, 0; 0, D - invC] := by @@ -375,16 +363,13 @@ theorem one_div_operatorConvexOn_Ioi : have hU : IsUnit U := by let V : Matrix (Fin 2) (Fin 2) (𝓐) := !![(1 : 𝓐), invC; 0, 1] refine ⟨⟨U, V, ?_, ?_⟩, rfl⟩ - · dsimp [U, V] - simp [Matrix.one_fin_two] - · dsimp [U, V] - simp [Matrix.one_fin_two] + · simp [U, V, Matrix.one_fin_two] + · simp [U, V, Matrix.one_fin_two] have hconj : star U * (!![C, 1; 1, D] : Matrix (Fin 2) (Fin 2) (𝓐)) * U = Matrix.diagonal (fun i : Fin 2 => if i = 0 then C else D - invC) := by have hInvC_sa : IsSelfAdjoint invC := by - dsimp [invC, cfcR] - exact cfc_predicate _ _ + simp [invC, cfcR] have hcont_inv : ContinuousOn (fun x : ℝ ↦ x⁻¹) (spectrum ℝ C) := fun x hx => (continuousAt_inv₀ (ne_of_gt (specC hx))).continuousWithinAt have invC_mul_C : invC * C = (1 : 𝓐) := by @@ -422,11 +407,9 @@ theorem one_div_operatorConvexOn_Ioi : Matrix.PosSemidef (star U * (!![C, 1; 1, D] : Matrix (Fin 2) (Fin 2) 𝓐) * U) := by -- rewrite the middle block matrix as `M` - rw [← hM] - exact posConj + simpa [← hM] using posConj -- rewrite the goal using the computed conjugation - rw [← hconj] - exact posConj' + simpa [← hconj] using posConj' have hinvC : invC ≤ D := by have hDinvC : 0 ≤ D - invC := by simpa using @@ -444,16 +427,10 @@ theorem one_div_add_t_operatorAntitoneOn_Ici : ∀ (t : ℝ), 0 < t → let f : ℝ → ℝ := fun x => x + t have hA_sa : IsSelfAdjoint A := IsSelfAdjoint.of_nonneg A_nonneg have hB_sa : IsSelfAdjoint B := IsSelfAdjoint.of_nonneg B_nonneg - have hA_ne0 : ∀ x ∈ spectrum ℝ A, f x ≠ 0 := by - intro x hx - have hx0 : (0 : ℝ) ≤ x := by - simpa [Set.Ici] using (As hx) - exact ne_of_gt (add_pos_of_nonneg_of_pos hx0 ht) - have hB_ne0 : ∀ x ∈ spectrum ℝ B, f x ≠ 0 := by - intro x hx - have hx0 : (0 : ℝ) ≤ x := by - simpa [Set.Ici] using (Bs hx) - exact ne_of_gt (add_pos_of_nonneg_of_pos hx0 ht) + have hA_ne0 : ∀ x ∈ spectrum ℝ A, f x ≠ 0 := + fun _ hx => ne_of_gt (add_pos_of_nonneg_of_pos (by simpa [Set.Ici] using As hx) ht) + have hB_ne0 : ∀ x ∈ spectrum ℝ B, f x ≠ 0 := + fun _ hx => ne_of_gt (add_pos_of_nonneg_of_pos (by simpa [Set.Ici] using Bs hx) ht) let uA : (𝓐)ˣ := cfcUnits (R := ℝ) (A := 𝓐) (p := IsSelfAdjoint) f A hA_ne0 (ha := hA_sa) let uB : (𝓐)ˣ := @@ -475,9 +452,7 @@ theorem one_div_add_t_operatorAntitoneOn_Ici : ∀ (t : ℝ), 0 < t → simp only [uB, cfcUnits, f] refine cfc_nonneg (R := ℝ) (A := 𝓐) (p := IsSelfAdjoint) (a := B) ?_ intro x hx - have hx0 : (0 : ℝ) ≤ x := by - simpa [Set.Ici] using (Bs hx) - exact le_of_lt (add_pos_of_nonneg_of_pos hx0 ht) + exact le_of_lt (add_pos_of_nonneg_of_pos (by simpa [Set.Ici] using Bs hx) ht) have hub_le_hua : (uB : 𝓐) ≤ (uA : 𝓐) := by simpa [huA_val, huB_val, add_assoc, add_left_comm, add_comm] using add_le_add_right BA (algebraMap ℝ (𝓐) t) have hinv : (↑uA⁻¹ : 𝓐) ≤ (↑uB⁻¹ : 𝓐) := by @@ -508,14 +483,12 @@ theorem one_div_add_t_operatorConvexOn_Ici : ∀ (t : ℝ), 0 < t → (hr := IsSelfAdjoint.all (t : ℝ))) have A_nonneg : 0 ≤ A := by have h0 : 0 ≤ cfcR (fun x : ℝ ↦ x) A := by - dsimp [cfcR] apply cfc_nonneg intro x hx simpa [Set.Ici] using (As hx) simpa [cfcR, cfc_id' (R := ℝ) (a := A) (ha := hA)] using h0 have B_nonneg : 0 ≤ B := by have h0 : 0 ≤ cfcR (fun x : ℝ ↦ x) B := by - dsimp [cfcR] apply cfc_nonneg intro x hx simpa [Set.Ici] using (Bs hx) @@ -523,18 +496,15 @@ theorem one_div_add_t_operatorConvexOn_Ici : ∀ (t : ℝ), 0 < t → have C_nonneg : 0 ≤ C := by simpa [C] using add_nonneg (smul_nonneg (sub_nonneg.mpr hθ1) A_nonneg) (smul_nonneg hθ0 B_nonneg) have hA_shift : cfcR shift A = A + T := by - dsimp [cfcR, shift, T] - simpa [cfc_id' (R := ℝ) (a := A) (ha := hA)] using + simpa [cfcR, shift, T, cfc_id' (R := ℝ) (a := A) (ha := hA)] using (cfc_add_const (R := ℝ) (A := 𝓐) (p := IsSelfAdjoint) (r := t) (f := fun x : ℝ ↦ x) (a := A) (ha := hA)) have hB_shift : cfcR shift B = B + T := by - dsimp [cfcR, shift, T] - simpa [cfc_id' (R := ℝ) (a := B) (ha := hB)] using + simpa [cfcR, shift, T, cfc_id' (R := ℝ) (a := B) (ha := hB)] using (cfc_add_const (R := ℝ) (A := 𝓐) (p := IsSelfAdjoint) (r := t) (f := fun x : ℝ ↦ x) (a := B) (ha := hB)) have hC_shift : cfcR shift C = C + T := by - dsimp [cfcR, shift, T] - simpa [cfc_id' (R := ℝ) (a := C) (ha := hC)] using + simpa [cfcR, shift, T, cfc_id' (R := ℝ) (a := C) (ha := hC)] using (cfc_add_const (R := ℝ) (A := 𝓐) (p := IsSelfAdjoint) (r := t) (f := fun x : ℝ ↦ x) (a := C) (ha := hC)) set A1 : 𝓐 := A + T @@ -554,13 +524,11 @@ theorem one_div_add_t_operatorConvexOn_Ici : ∀ (t : ℝ), 0 < t → (f := shift) (ha := hA)) have hx' : x ∈ shift '' spectrum ℝ A := by have hx0 : x ∈ spectrum ℝ (cfc shift A) := by - have hval : cfc shift A = A1 := by - simpa [cfcR, shift, A1] using hA_shift + have hval : cfc shift A = A1 := by simpa [cfcR, shift, A1] using hA_shift simpa [hval] using hx simpa [hs] using hx0 rcases hx' with ⟨y, hy, rfl⟩ - have hy0 : 0 ≤ y := by - simpa [Set.Ici] using (As hy) + have hy0 : 0 ≤ y := by simpa [Set.Ici] using (As hy) simpa [Set.Ioi] using (add_pos_of_nonneg_of_pos hy0 ht) have specB1 : spectrum ℝ B1 ⊆ Set.Ioi (0 : ℝ) := by intro x hx @@ -570,58 +538,47 @@ theorem one_div_add_t_operatorConvexOn_Ici : ∀ (t : ℝ), 0 < t → (f := shift) (ha := hB)) have hx' : x ∈ shift '' spectrum ℝ B := by have hx0 : x ∈ spectrum ℝ (cfc shift B) := by - have hval : cfc shift B = B1 := by - simpa [cfcR, shift, B1] using hB_shift + have hval : cfc shift B = B1 := by simpa [cfcR, shift, B1] using hB_shift simpa [hval] using hx simpa [hs] using hx0 rcases hx' with ⟨y, hy, rfl⟩ - have hy0 : 0 ≤ y := by - simpa [Set.Ici] using (Bs hy) + have hy0 : 0 ≤ y := by simpa [Set.Ici] using (Bs hy) simpa [Set.Ioi] using (add_pos_of_nonneg_of_pos hy0 ht) have hC1 : C1 = C + T := by subst A1 B1 C1 simp [C, add_assoc, add_left_comm, add_comm, smul_add] - have hshift_ne0_A : ∀ x ∈ spectrum ℝ A, shift x ≠ 0 := by - intro x hx - have hx0 : 0 ≤ x := by - simpa [Set.Ici] using (As hx) - exact ne_of_gt (by simpa [shift] using (add_pos_of_nonneg_of_pos hx0 ht)) - have hshift_ne0_B : ∀ x ∈ spectrum ℝ B, shift x ≠ 0 := by - intro x hx - have hx0 : 0 ≤ x := by - simpa [Set.Ici] using (Bs hx) - exact ne_of_gt (by simpa [shift] using (add_pos_of_nonneg_of_pos hx0 ht)) + have hshift_ne0_A : ∀ x ∈ spectrum ℝ A, shift x ≠ 0 := + fun _ hx => ne_of_gt (by + simpa [shift] using add_pos_of_nonneg_of_pos (by simpa [Set.Ici] using As hx) ht) + have hshift_ne0_B : ∀ x ∈ spectrum ℝ B, shift x ≠ 0 := + fun _ hx => ne_of_gt (by + simpa [shift] using add_pos_of_nonneg_of_pos (by simpa [Set.Ici] using Bs hx) ht) have hshift_ne0_C : ∀ x ∈ spectrum ℝ C, shift x ≠ 0 := fun x hx ↦ ne_of_gt (by simpa [shift] using (add_pos_of_nonneg_of_pos (spectrum_nonneg_of_nonneg C_nonneg hx) ht)) have hA_inv : cfcR (fun x : ℝ ↦ (x + t)⁻¹) A = Ring.inverse A1 := by have h' : cfc (fun x : ℝ ↦ (shift x)⁻¹) A = Ring.inverse (cfc shift A) := by simpa [shift] using (cfc_inv (R := ℝ) (A := 𝓐) (p := IsSelfAdjoint) (f := shift) (a := A) hshift_ne0_A (ha := hA)) - have hval : cfc shift A = A1 := by - simpa [cfcR, shift, A1] using hA_shift + have hval : cfc shift A = A1 := by simpa [cfcR, shift, A1] using hA_shift simpa [cfcR, shift, hval] using h' have hB_inv : cfcR (fun x : ℝ ↦ (x + t)⁻¹) B = Ring.inverse B1 := by have h' : cfc (fun x : ℝ ↦ (shift x)⁻¹) B = Ring.inverse (cfc shift B) := by simpa [shift] using (cfc_inv (R := ℝ) (A := 𝓐) (p := IsSelfAdjoint) (f := shift) (a := B) hshift_ne0_B (ha := hB)) - have hval : cfc shift B = B1 := by - simpa [cfcR, shift, B1] using hB_shift + have hval : cfc shift B = B1 := by simpa [cfcR, shift, B1] using hB_shift simpa [cfcR, shift, hval] using h' have hC_inv : cfcR (fun x : ℝ ↦ (x + t)⁻¹) C = Ring.inverse (C + T) := by have h' : cfc (fun x : ℝ ↦ (shift x)⁻¹) C = Ring.inverse (cfc shift C) := by simpa [shift] using (cfc_inv (R := ℝ) (A := 𝓐) (p := IsSelfAdjoint) (f := shift) (a := C) hshift_ne0_C (ha := hC)) - have hval : cfc shift C = C + T := by - simpa [cfcR, shift] using hC_shift + have hval : cfc shift C = C + T := by simpa [cfcR, shift] using hC_shift simpa [cfcR, shift, hval] using h' have hA1_inv : cfcR (fun x : ℝ ↦ x⁻¹) A1 = Ring.inverse A1 := by - dsimp [cfcR] - simpa [cfc_id' (R := ℝ) (a := A1) (ha := hA1_sa)] using + simpa [cfcR, cfc_id' (R := ℝ) (a := A1) (ha := hA1_sa)] using (cfc_inv (R := ℝ) (A := 𝓐) (p := IsSelfAdjoint) (f := fun x : ℝ ↦ x) (a := A1) (fun x hx ↦ ne_of_gt (specA1 hx)) (ha := hA1_sa)) have hB1_inv : cfcR (fun x : ℝ ↦ x⁻¹) B1 = Ring.inverse B1 := by - dsimp [cfcR] - simpa [cfc_id' (R := ℝ) (a := B1) (ha := hB1_sa)] using + simpa [cfcR, cfc_id' (R := ℝ) (a := B1) (ha := hB1_sa)] using (cfc_inv (R := ℝ) (A := 𝓐) (p := IsSelfAdjoint) (f := fun x : ℝ ↦ x) (a := B1) (fun x hx ↦ ne_of_gt (specB1 hx)) (ha := hB1_sa)) have hA_eq : cfcR (fun x : ℝ ↦ (x + t)⁻¹) A = cfcR (fun x : ℝ ↦ x⁻¹) A1 := by @@ -636,10 +593,8 @@ theorem one_div_add_t_operatorConvexOn_Ici : ∀ (t : ℝ), 0 < t → (f := shift) (ha := hC)) have hx' : x ∈ shift '' spectrum ℝ C := by have hx0 : x ∈ spectrum ℝ (cfc shift C) := by - have hval : cfc shift C = C + T := by - simpa [cfcR, shift] using hC_shift - have hval' : cfc shift C = C1 := by - simpa [hC1] using hval + have hval : cfc shift C = C + T := by simpa [cfcR, shift] using hC_shift + have hval' : cfc shift C = C1 := by simpa [hC1] using hval simpa [hval'] using hx simpa [hs] using hx0 rcases hx' with ⟨y, hy, rfl⟩ @@ -647,11 +602,9 @@ theorem one_div_add_t_operatorConvexOn_Ici : ∀ (t : ℝ), 0 < t → have : 0 < y + t := add_pos_of_nonneg_of_pos hy0 ht simpa [Set.Ioi] using this have hC1_ne0 : ∀ x ∈ spectrum ℝ C1, (x : ℝ) ≠ 0 := fun x hx ↦ ne_of_gt (specC1 hx) - have hC1_sa : IsSelfAdjoint C1 := by - simpa [hC1] using (hC.add hT) + have hC1_sa : IsSelfAdjoint C1 := by simpa [hC1] using (hC.add hT) have hC1_inv : cfcR (fun x : ℝ ↦ x⁻¹) C1 = Ring.inverse C1 := by - dsimp [cfcR] - simpa [cfc_id' (R := ℝ) (a := C1) (ha := hC1_sa)] using + simpa [cfcR, cfc_id' (R := ℝ) (a := C1) (ha := hC1_sa)] using (cfc_inv (R := ℝ) (A := 𝓐) (p := IsSelfAdjoint) (f := fun x : ℝ ↦ x) (a := C1) hC1_ne0 (ha := hC1_sa)) have hC_eq : cfcR (fun x : ℝ ↦ (x + t)⁻¹) C = cfcR (fun x : ℝ ↦ x⁻¹) C1 := by @@ -689,16 +642,12 @@ theorem ratio_add_t_operatorMonotoneOn_Ici : ∀ (t : ℝ), 0 < t → have hEqT : (spectrum ℝ T).EqOn (fun x : ℝ ↦ x / (x + t)) (fun x : ℝ ↦ 1 - t * invfun x) := by intro x hx - have hx0 : (0 : ℝ) ≤ x := by - simpa [Set.Ici] using (hspT hx) + have hx0 : (0 : ℝ) ≤ x := by simpa [Set.Ici] using (hspT hx) simp [invfun] field_simp [ne_of_gt (add_pos_of_nonneg_of_pos hx0 ht)] ring - have hT_ne0 : ∀ x ∈ spectrum ℝ T, x + t ≠ 0 := by - intro x hx - have hx0 : (0 : ℝ) ≤ x := by - simpa [Set.Ici] using (hspT hx) - exact ne_of_gt (add_pos_of_nonneg_of_pos hx0 ht) + have hT_ne0 : ∀ x ∈ spectrum ℝ T, x + t ≠ 0 := + fun _ hx => ne_of_gt (add_pos_of_nonneg_of_pos (by simpa [Set.Ici] using hspT hx) ht) have hT_cont : ContinuousOn invfun (spectrum ℝ T) := by simpa [invfun, one_div] using (continuousOn_id.add continuousOn_const).inv₀ hT_ne0 dsimp [cfcR] @@ -734,11 +683,9 @@ theorem ratio_add_t_operatorMonotoneOn_Ici : ∀ (t : ℝ), 0 < t → rw [hone, hmul] calc cfcR (fun x : ℝ ↦ x / (x + t)) B - = (1 : 𝓐) - t • cfcR invfun B := by - simpa using hrepr B hB0 hspB + = (1 : 𝓐) - t • cfcR invfun B := by simpa using hrepr B hB0 hspB _ ≤ (1 : 𝓐) - t • cfcR invfun A := hmono_core - _ = cfcR (fun x : ℝ ↦ x / (x + t)) A := by - simpa using (hrepr A hA0 hspA).symm + _ = cfcR (fun x : ℝ ↦ x / (x + t)) A := by simpa using (hrepr A hA0 hspA).symm theorem ratio_add_t_operatorConcaveOn_Ici : ∀ (t : ℝ), 0 < t → OperatorConcaveOn (𝓐 := 𝓐) (Set.Ici (0 : ℝ)) (fun x : ℝ ↦ x / (x + t)) := by @@ -759,11 +706,8 @@ theorem ratio_add_t_operatorConcaveOn_Ici : ∀ (t : ℝ), 0 < t → = algebraMap ℝ (𝓐) (-1 : ℝ) + t • cfcR (fun x : ℝ ↦ 1 / (x + t)) T := by let invfun : ℝ → ℝ := fun x ↦ 1 / (x + t) - have hne0 : ∀ x ∈ spectrum ℝ T, x + t ≠ 0 := by - intro x hx - have hx0 : (0 : ℝ) ≤ x := by - simpa [Set.Ici] using (Ts hx) - exact ne_of_gt (add_pos_of_nonneg_of_pos hx0 ht) + have hne0 : ∀ x ∈ spectrum ℝ T, x + t ≠ 0 := + fun _ hx => ne_of_gt (add_pos_of_nonneg_of_pos (by simpa [Set.Ici] using Ts hx) ht) have hcont : ContinuousOn invfun (spectrum ℝ T) := by simpa [invfun, one_div] using (continuousOn_id.add continuousOn_const).inv₀ hne0 dsimp [cfcR] @@ -773,8 +717,7 @@ theorem ratio_add_t_operatorConcaveOn_Ici : ∀ (t : ℝ), 0 < t → (fun x : ℝ ↦ (-1 : ℝ) + t * invfun x) T := by apply cfc_congr intro x hx - have hx0 : (0 : ℝ) ≤ x := by - simpa [Set.Ici] using (Ts hx) + have hx0 : (0 : ℝ) ≤ x := by simpa [Set.Ici] using (Ts hx) have : - (x / (x + t)) = (-1 : ℝ) + t * (1 / (x + t)) := by field_simp [ne_of_gt (add_pos_of_nonneg_of_pos hx0 ht)] @@ -795,12 +738,10 @@ theorem ratio_add_t_operatorConcaveOn_Ici : ∀ (t : ℝ), 0 < t → simp [cfc_const_mul (R := ℝ) (A := 𝓐) (p := IsSelfAdjoint) t invfun T (hf := hcont)] _ = algebraMap ℝ (𝓐) (-1 : ℝ) - + t • cfcR (fun x : ℝ ↦ 1 / (x + t)) T := by - simp [invfun] + + t • cfcR (fun x : ℝ ↦ 1 / (x + t)) T := by simp [invfun] set AB : 𝓐 := (1 - u) • A + u • B have hAB : IsSelfAdjoint AB := by - dsimp [AB] - simpa using + simpa [AB] using (IsSelfAdjoint.smul (by simp [IsSelfAdjoint]) hA).add (IsSelfAdjoint.smul (by simp [IsSelfAdjoint]) hB) -- apply operator convexity of `-(x/(x+t))` @@ -824,8 +765,7 @@ theorem ratio_add_t_operatorConcaveOn_Ici : ∀ (t : ℝ), 0 < t → have hB0 : 0 ≤ B := nonneg_of_spectrum_subset_Ici0 (T := B) hB Bs have hAB0 : 0 ≤ AB := by - dsimp [AB] - exact add_nonneg (smul_nonneg hu0' hA0) (smul_nonneg hu0 hB0) + simpa [AB] using add_nonneg (smul_nonneg hu0' hA0) (smul_nonneg hu0 hB0) have ABs : spectrum ℝ AB ⊆ Set.Ici (0 : ℝ) := by intro x hx have hx0 : (0 : ℝ) ≤ x := @@ -838,8 +778,7 @@ theorem ratio_add_t_operatorConcaveOn_Ici : ∀ (t : ℝ), 0 < t → have hconv_inv_AB : cfcR (fun x : ℝ ↦ 1 / (x + t)) AB ≤ (1 - u) • cfcR (fun x : ℝ ↦ 1 / (x + t)) A - + u • cfcR (fun x : ℝ ↦ 1 / (x + t)) B := by - simpa [AB] using hconv_inv + + u • cfcR (fun x : ℝ ↦ 1 / (x + t)) B := by simpa [AB] using hconv_inv have hscale0 : t • cfcR (fun x : ℝ ↦ 1 / (x + t)) AB ≤ t • @@ -853,8 +792,7 @@ theorem ratio_add_t_operatorConcaveOn_Ici : ∀ (t : ℝ), 0 < t → + u • cfcR (fun x : ℝ ↦ 1 / (x + t)) B) := hscale0 _ = (t * (1 - u)) • cfcR (fun x : ℝ ↦ 1 / (x + t)) A - + (t * u) • cfcR (fun x : ℝ ↦ 1 / (x + t)) B := by - simp [smul_add, smul_smul] + + (t * u) • cfcR (fun x : ℝ ↦ 1 / (x + t)) B := by simp [smul_add, smul_smul] have hconst : (1 - u) • C + u • C = C := by simpa [add_smul, sub_add_cancel] using (add_smul (1 - u) u C).symm have hmain : @@ -906,12 +844,10 @@ theorem ratio_add_t_operatorConcaveOn_Ici : ∀ (t : ℝ), 0 < t → = ((1 - u) • C + u • C) + ((t * (1 - u)) • cfcR (fun x : ℝ ↦ 1 / (x + t)) A - + (t * u) • cfcR (fun x : ℝ ↦ 1 / (x + t)) B) := by - simp [hconst, add_comm] + + (t * u) • cfcR (fun x : ℝ ↦ 1 / (x + t)) B) := by simp [hconst, add_comm] _ = (1 - u) • (C + t • cfcR (fun x : ℝ ↦ 1 / (x + t)) A) - + u • (C + t • cfcR (fun x : ℝ ↦ 1 / (x + t)) B) := by - simpa using hR'.symm + + u • (C + t • cfcR (fun x : ℝ ↦ 1 / (x + t)) B) := by simpa using hR'.symm calc C + t • cfcR (fun x : ℝ ↦ 1 / (x + t)) AB ≤ @@ -981,8 +917,7 @@ private lemma cfcₙ_rpowIntegrand₀₁_eq_smul_cfcR_ratio {q : NNReal} (hq : q cfcₙ (Real.rpowIntegrand₀₁ (q : ℝ) t) X = r • cfcR ratio X := by calc cfcₙ (Real.rpowIntegrand₀₁ (q : ℝ) t) X = - cfcR (Real.rpowIntegrand₀₁ (q : ℝ) t) X := by - simpa using hcfcₙ + cfcR (Real.rpowIntegrand₀₁ (q : ℝ) t) X := by simpa using hcfcₙ _ = cfcR (fun x : ℝ ↦ r * ratio x) X := hcfc_congr _ = r • cfcR ratio X := hcfc_mul _ = r • cfcR ratio X := by simp [cfcR] @@ -1080,8 +1015,7 @@ private lemma concaveOn_nnrpow_Ioo {q : NNReal} (hq : q ∈ Set.Ioo (0 : NNReal) refine hconc_int.congr ?_ intro A hA -- `A ^ q` is the set integral of the integrand on `Ioi 0` - have hEq : A ^ q = ∫ t, F t A ∂ν := by - simpa [F, ν] using (hμ A hA).2 + have hEq : A ^ q = ∫ t, F t A ∂ν := by simpa [F, ν] using (hμ A hA).2 simp [hEq] private lemma concaveOn_rpow_Ioo {p : ℝ} (hp : p ∈ Set.Ioo (0 : ℝ) 1) : @@ -1089,12 +1023,10 @@ private lemma concaveOn_rpow_Ioo {p : ℝ} (hp : p ∈ Set.Ioo (0 : ℝ) 1) : -- reduce to the `ℝ≥0` exponent case let q : NNReal := ⟨p, le_of_lt hp.1⟩ have hq0 : (0 : NNReal) < q := by - have : (0 : ℝ) < (q : ℝ) := by - exact hp.1 + have : (0 : ℝ) < (q : ℝ) := hp.1 exact (NNReal.coe_pos).1 this have hq1 : q < (1 : NNReal) := by - have : (q : ℝ) < (1 : ℝ) := by - exact hp.2 + have : (q : ℝ) < (1 : ℝ) := hp.2 exact (NNReal.coe_lt_coe).1 (by simpa using this) have hq : q ∈ Set.Ioo (0 : NNReal) 1 := ⟨hq0, hq1⟩ -- main lemma: concavity for `a ↦ a ^ q` @@ -1169,8 +1101,7 @@ theorem power_Icc_zero_one_operatorConcaveOn_Ici : ∀ p ∈ Set.Icc (0 : ℝ) 1 have hC0 : 0 ≤ (1 - u) • A + u • B := add_nonneg (smul_nonneg hu0' hA0) (smul_nonneg hu0 hB0) set C : 𝓐 := (1 - u) • A + u • B - have hC_mem : C ∈ Set.Ici (0 : 𝓐) := by - simpa [C, Set.Ici] using hC0 + have hC_mem : C ∈ Set.Ici (0 : 𝓐) := by simpa [C, Set.Ici] using hC0 have hA_mem : A ∈ Set.Ici (0 : 𝓐) := by simpa [Set.Ici] using hA0 have hB_mem : B ∈ Set.Ici (0 : 𝓐) := by simpa [Set.Ici] using hB0 have hconcC : (1 - u) • (A ^ p) + u • (B ^ p) ≤ C ^ p := by @@ -1470,8 +1401,7 @@ private lemma convexOn_nnrpow_Ioo_one_add {q : NNReal} (hq : q ∈ Set.Ioo (0 : simpa [add_comm, add_left_comm, add_assoc] using (CFC.nnrpow_add (A := 𝓐) (a := A) (x := (1 : NNReal)) (y := q) zero_lt_one hq0) simpa [CFC.nnrpow_one (A := 𝓐) A hA0] using h1 - have hEq_q : A ^ q = ∫ t, F0 t A ∂ν := by - simpa [F0, ν] using (hμ A hA).2 + have hEq_q : A ^ q = ∫ t, F0 t A ∂ν := by simpa [F0, ν] using (hμ A hA).2 have hEq_mul : A * (∫ t, F0 t A ∂ν) = ∫ t, A * F0 t A ∂ν := by have h : @@ -1499,10 +1429,9 @@ private lemma convexOn_rpow_Ioo_one_two {p : ℝ} (hp : p ∈ Set.Ioo (1 : ℝ) ConvexOn ℝ (Set.Ici (0 : 𝓐)) (fun A : 𝓐 ↦ A ^ p) := by -- reduce to the `ℝ≥0` exponent case with `p = 1 + q`, `q ∈ (0,1)` let q : NNReal := ⟨p - 1, sub_nonneg.mpr (le_of_lt hp.1)⟩ - have hq0 : (0 : NNReal) < q := by - have : (0 : ℝ) < (q : ℝ) := by - exact_mod_cast sub_pos.mpr hp.1 - exact (NNReal.coe_pos).1 this + have hq0 : (0 : NNReal) < q := + (NNReal.coe_pos).1 (show (0 : ℝ) < (q : ℝ) by + exact_mod_cast sub_pos.mpr hp.1) have hq1 : q < (1 : NNReal) := by have : (q : ℝ) < (1 : ℝ) := by have : p - 1 < (1 : ℝ) := by linarith [hp.2] @@ -1538,16 +1467,14 @@ private lemma cfcR_mul_self (T : 𝓐) (hT : IsSelfAdjoint T) : simpa using (cfc_mul (R := ℝ) (A := 𝓐) (p := IsSelfAdjoint) (f := fun x : ℝ ↦ x) (g := fun x : ℝ ↦ x) (a := T)) - _ = T * T := by - simp [cfc_id' (R := ℝ) (a := T) (ha := hT)] + _ = T * T := by simp [cfc_id' (R := ℝ) (a := T) (ha := hT)] omit [Nontrivial (𝓐)] in omit [PartialOrder 𝓐] [StarOrderedRing 𝓐] [NonnegSpectrumClass ℝ 𝓐] in private lemma sub_mul_sub (A B : 𝓐) : (A - B) * (A - B) = A * A - A * B - B * A + B * B := by calc - (A - B) * (A - B) = (A * A - B * A) - (A * B - B * B) := by - simp [mul_sub, sub_mul] + (A - B) * (A - B) = (A * A - B * A) - (A * B - B * B) := by simp [mul_sub, sub_mul] _ = A * A - A * B - B * A + B * B := by abel @@ -1555,8 +1482,7 @@ omit [Nontrivial (𝓐)] in omit [PartialOrder 𝓐] [StarOrderedRing 𝓐] [NonnegSpectrumClass ℝ 𝓐] in private lemma smul_sub_mul_sub (α : ℝ) (A B : 𝓐) : α • (A * A - A * B - B * A + B * B) = - α • (A * A) - α • (A * B) - α • (B * A) + α • (B * B) := by - rw [smul_add, smul_sub, smul_sub] + α • (A * A) - α • (A * B) - α • (B * A) + α • (B * B) := by rw [smul_add, smul_sub, smul_sub] omit [Nontrivial (𝓐)] in omit [PartialOrder 𝓐] [StarOrderedRing 𝓐] [NonnegSpectrumClass ℝ 𝓐] in @@ -1571,16 +1497,14 @@ private lemma square_convexity_diff_rhs (A B : 𝓐) (u : ℝ) : α • (A * A) - α • (A * B) - α • (B * A) + α • (B * B) = (u * (1 - u)) • (A * A) - (u * (1 - u)) • (A * B) - (u * (1 - u)) • (B * A) - + (u * (1 - u)) • (B * B) := by - simp [α] + + (u * (1 - u)) • (B * B) := by simp [α] calc (u * (1 - u)) • ((A - B) * (A - B)) = α • ((A - B) * (A - B)) := by simp [α] _ = α • (A * A - A * B - B * A + B * B) := hsmul _ = α • (A * A) - α • (A * B) - α • (B * A) + α • (B * B) := smul_sub_mul_sub (α := α) A B _ = (u * (1 - u)) • (A * A) - (u * (1 - u)) • (A * B) - (u * (1 - u)) • (B * A) - + (u * (1 - u)) • (B * B) := by - simp [hα] + + (u * (1 - u)) • (B * B) := by simp [hα] omit [Nontrivial (𝓐)] in omit [PartialOrder 𝓐] [StarOrderedRing 𝓐] [NonnegSpectrumClass ℝ 𝓐] in @@ -1651,8 +1575,7 @@ private lemma square_convexity_diff_hCC_sum (A B : 𝓐) (u : ℝ) : exact Algebra.smul_mul_assoc (R := ℝ) (A := 𝓐) (1 - u) A ((1 - u) • A) _ = (1 - u) • ((1 - u) • (A * A)) := by rw [Algebra.mul_smul_comm] - _ = ((1 - u) * (1 - u)) • (A * A) := by - simp [smul_smul] + _ = ((1 - u) * (1 - u)) • (A * A) := by simp [smul_smul] have hAB' : ((1 - u) • A) * (u • B) = ((1 - u) * u) • (A * B) := by calc @@ -1660,26 +1583,21 @@ private lemma square_convexity_diff_hCC_sum (A B : 𝓐) (u : ℝ) : exact Algebra.smul_mul_assoc (R := ℝ) (A := 𝓐) (1 - u) A (u • B) _ = (1 - u) • (u • (A * B)) := by rw [Algebra.mul_smul_comm] - _ = ((1 - u) * u) • (A * B) := by - simp [smul_smul] + _ = ((1 - u) * u) • (A * B) := by simp [smul_smul] have hBA' : (u • B) * ((1 - u) • A) = (u * (1 - u)) • (B * A) := by calc (u • B) * ((1 - u) • A) = u • (B * ((1 - u) • A)) := by exact Algebra.smul_mul_assoc (R := ℝ) (A := 𝓐) u B ((1 - u) • A) - _ = u • ((1 - u) • (B * A)) := by - simp [Algebra.mul_smul_comm] - _ = (u * (1 - u)) • (B * A) := by - simpa using (smul_smul u (1 - u) (B * A)) + _ = u • ((1 - u) • (B * A)) := by simp [Algebra.mul_smul_comm] + _ = (u * (1 - u)) • (B * A) := by simpa using (smul_smul u (1 - u) (B * A)) have hBB' : (u • B) * (u • B) = (u * u) • (B * B) := by calc (u • B) * (u • B) = u • (B * (u • B)) := by exact Algebra.smul_mul_assoc (R := ℝ) (A := 𝓐) u B (u • B) - _ = u • (u • (B * B)) := by - simp [Algebra.mul_smul_comm] - _ = (u * u) • (B * B) := by - simp [smul_smul] + _ = u • (u • (B * B)) := by simp [Algebra.mul_smul_comm] + _ = (u * u) • (B * B) := by simp [smul_smul] rw [hAA', hAB', hBA', hBB'] omit [Nontrivial (𝓐)] in @@ -1698,19 +1616,15 @@ private lemma square_convexity_diff_hCC (A B : 𝓐) (u : ℝ) : set Y : 𝓐 := u • B have hXY : (1 - u) • A + u • B = X + Y := by simp [X, Y] calc - ((1 - u) • A + u • B) * ((1 - u) • A + u • B) = (X + Y) * (X + Y) := by - simp [hXY] - _ = X * (X + Y) + Y * (X + Y) := by - simp [add_mul] - _ = (X * X + X * Y) + (Y * X + Y * Y) := by - simp [mul_add, add_assoc] + ((1 - u) • A + u • B) * ((1 - u) • A + u • B) = (X + Y) * (X + Y) := by simp [hXY] + _ = X * (X + Y) + Y * (X + Y) := by simp [add_mul] + _ = (X * X + X * Y) + (Y * X + Y * Y) := by simp [mul_add, add_assoc] _ = X * X + X * Y + Y * X + Y * Y := by abel _ = ((1 - u) • A) * ((1 - u) • A) + ((1 - u) • A) * (u • B) + (u • B) * ((1 - u) • A) - + (u • B) * (u • B) := by - simp [X, Y] + + (u • B) * (u • B) := by simp [X, Y] exact hexpand.trans (square_convexity_diff_hCC_sum A B u) omit [PartialOrder 𝓐] [StarOrderedRing 𝓐] [NonnegSpectrumClass ℝ 𝓐] [Nontrivial (𝓐)] in @@ -1760,8 +1674,7 @@ private lemma operatorConvexOn_pow_two_Ici : have hub : 0 ≤ u * (1 - u) := mul_nonneg hu0 hu0' have hdiff : (1 - u) • (A * A) + u • (B * B) - C * C - = (u * (1 - u)) • ((A - B) * (A - B)) := by - simpa [C] using (square_convexity_diff A B u) + = (u * (1 - u)) • ((A - B) * (A - B)) := by simpa [C] using (square_convexity_diff A B u) have hnonneg : 0 ≤ (1 - u) • (A * A) + u • (B * B) - C * C := by have hscale : 0 ≤ (u * (1 - u)) • ((A - B) * (A - B)) := smul_nonneg hub hsq simpa [hdiff] using hscale @@ -1816,8 +1729,7 @@ theorem power_Icc_one_two_operatorConvexOn_Ici : ∀ p ∈ Set.Icc (1 : ℝ) 2, set C : 𝓐 := (1 - u) • A + u • B have hC0 : 0 ≤ C := add_nonneg (smul_nonneg hu0' hA0) (smul_nonneg hu0 hB0) - have hC_mem : C ∈ Set.Ici (0 : 𝓐) := by - simpa [C, Set.Ici] using hC0 + have hC_mem : C ∈ Set.Ici (0 : 𝓐) := by simpa [C, Set.Ici] using hC0 have hA_mem : A ∈ Set.Ici (0 : 𝓐) := by simpa [Set.Ici] using hA0 have hB_mem : B ∈ Set.Ici (0 : 𝓐) := by simpa [Set.Ici] using hB0 have hab : (1 - u) + u = (1 : ℝ) := by ring @@ -1842,10 +1754,8 @@ theorem power_Icc_neg_one_zero_neg_operatorMonotoneOn_Ioi : ∀ p ∈ Set.Icc (- let q : ℝ := -p have hq : q ∈ Set.Icc (0 : ℝ) 1 := by constructor - · dsimp [q] - exact neg_nonneg.mpr hp.2 - · dsimp [q] - simpa using (neg_le_neg hp.1) + · simpa [q] using neg_nonneg.mpr hp.2 + · simpa [q] using (neg_le_neg hp.1) have hBAq : cfcR (fun x : ℝ ↦ x ^ q) B ≤ cfcR (fun x : ℝ ↦ x ^ q) A := by have hspA' : spectrum ℝ A ⊆ Set.Ici (0 : ℝ) := by intro x hx @@ -1859,13 +1769,11 @@ theorem power_Icc_neg_one_zero_neg_operatorMonotoneOn_Ioi : ∀ p ∈ Set.Icc (- let Aq : 𝓐 := cfcR (fun x : ℝ ↦ x ^ q) A let Bq : 𝓐 := cfcR (fun x : ℝ ↦ x ^ q) B have hAq0 : 0 ≤ Aq := by - dsimp [Aq, cfcR] refine cfc_nonneg ?_ intro x hx have hx0 : (0 : ℝ) < x := by simpa [Set.Ioi] using hspA hx exact le_of_lt (Real.rpow_pos_of_pos hx0 _) have hBq0 : 0 ≤ Bq := by - dsimp [Bq, cfcR] refine cfc_nonneg ?_ intro x hx have hx0 : (0 : ℝ) < x := by simpa [Set.Ioi] using hspB hx @@ -1878,8 +1786,7 @@ theorem power_Icc_neg_one_zero_neg_operatorMonotoneOn_Ioi : ∀ p ∈ Set.Icc (- exact (Real.continuousAt_rpow_const x q (Or.inl (ne_of_gt hx0))).continuousWithinAt have hspec : spectrum ℝ Aq = (fun x : ℝ ↦ x ^ q) '' spectrum ℝ A := by - dsimp [Aq, cfcR] - simpa using + simpa [Aq, cfcR] using (cfc_map_spectrum (R := ℝ) (A := 𝓐) (p := IsSelfAdjoint) (f := fun x : ℝ ↦ x ^ q) (a := A) (ha := hA_sa) (hf := hcontA)) intro y hy @@ -1895,8 +1802,7 @@ theorem power_Icc_neg_one_zero_neg_operatorMonotoneOn_Ioi : ∀ p ∈ Set.Icc (- exact (Real.continuousAt_rpow_const x q (Or.inl (ne_of_gt hx0))).continuousWithinAt have hspec : spectrum ℝ Bq = (fun x : ℝ ↦ x ^ q) '' spectrum ℝ B := by - dsimp [Bq, cfcR] - simpa using + simpa [Bq, cfcR] using (cfc_map_spectrum (R := ℝ) (A := 𝓐) (p := IsSelfAdjoint) (f := fun x : ℝ ↦ x ^ q) (a := B) (ha := hB_sa) (hf := hcontB)) intro y hy @@ -1927,21 +1833,17 @@ theorem power_Icc_neg_one_zero_neg_operatorMonotoneOn_Ioi : ∀ p ∈ Set.Icc (- have hcomp : cfcR (fun y : ℝ ↦ 1 / y) (cfcR (fun x : ℝ ↦ x ^ q) A) = cfcR (fun x : ℝ ↦ 1 / (x ^ q)) A := by - dsimp [cfcR] - simpa [Function.comp] using + simpa [cfcR, Function.comp] using (cfc_comp' (R := ℝ) (A := 𝓐) (p := IsSelfAdjoint) (g := fun y : ℝ ↦ 1 / y) (f := fun x : ℝ ↦ x ^ q) (a := A) (hg := hg) (hf := hcontA) (ha := hA_sa)).symm have hL : cfcR (fun x : ℝ ↦ 1 / x) Aq = - cfcR (fun y : ℝ ↦ y⁻¹) (cfcR (fun x : ℝ ↦ x ^ q) A) := by - simp [Aq, one_div] + cfcR (fun y : ℝ ↦ y⁻¹) (cfcR (fun x : ℝ ↦ x ^ q) A) := by simp [Aq, one_div] rw [hL] have hcomp' : cfcR (fun y : ℝ ↦ y⁻¹) (cfcR (fun x : ℝ ↦ x ^ q) A) = - cfcR (fun x : ℝ ↦ (x ^ q)⁻¹) A := by - simpa [one_div] using hcomp + cfcR (fun x : ℝ ↦ (x ^ q)⁻¹) A := by simpa [one_div] using hcomp rw [hcomp'] - dsimp [cfcR] apply cfc_congr intro x hx have hx0 : (0 : ℝ) < x := by simpa [Set.Ioi] using hspA hx @@ -1965,21 +1867,17 @@ theorem power_Icc_neg_one_zero_neg_operatorMonotoneOn_Ioi : ∀ p ∈ Set.Icc (- have hcomp : cfcR (fun y : ℝ ↦ 1 / y) (cfcR (fun x : ℝ ↦ x ^ q) B) = cfcR (fun x : ℝ ↦ 1 / (x ^ q)) B := by - dsimp [cfcR] - simpa [Function.comp] using + simpa [cfcR, Function.comp] using (cfc_comp' (R := ℝ) (A := 𝓐) (p := IsSelfAdjoint) (g := fun y : ℝ ↦ 1 / y) (f := fun x : ℝ ↦ x ^ q) (a := B) (hg := hg) (hf := hcontB) (ha := hB_sa)).symm have hL : cfcR (fun x : ℝ ↦ 1 / x) Bq = - cfcR (fun y : ℝ ↦ y⁻¹) (cfcR (fun x : ℝ ↦ x ^ q) B) := by - simp [Bq, one_div] + cfcR (fun y : ℝ ↦ y⁻¹) (cfcR (fun x : ℝ ↦ x ^ q) B) := by simp [Bq, one_div] rw [hL] have hcomp' : cfcR (fun y : ℝ ↦ y⁻¹) (cfcR (fun x : ℝ ↦ x ^ q) B) = - cfcR (fun x : ℝ ↦ (x ^ q)⁻¹) B := by - simpa [one_div] using hcomp + cfcR (fun x : ℝ ↦ (x ^ q)⁻¹) B := by simpa [one_div] using hcomp rw [hcomp'] - dsimp [cfcR] apply cfc_congr intro x hx have hx0 : (0 : ℝ) < x := by simpa [Set.Ioi] using hspB hx @@ -1989,19 +1887,15 @@ theorem power_Icc_neg_one_zero_neg_operatorMonotoneOn_Ioi : ∀ p ∈ Set.Icc (- have hanti : cfcR (fun x : ℝ ↦ x ^ p) A ≤ cfcR (fun x : ℝ ↦ x ^ p) B := by calc cfcR (fun x : ℝ ↦ x ^ p) A = - cfcR (fun x : ℝ ↦ 1 / x) Aq := by - simpa using hcompA.symm + cfcR (fun x : ℝ ↦ 1 / x) Aq := by simpa using hcompA.symm _ ≤ cfcR (fun x : ℝ ↦ 1 / x) Bq := h_inv - _ = cfcR (fun x : ℝ ↦ x ^ p) B := by - simpa using hcompB + _ = cfcR (fun x : ℝ ↦ x ^ p) B := by simpa using hcompB have hneg : -cfcR (fun x : ℝ ↦ x ^ p) B ≤ -cfcR (fun x : ℝ ↦ x ^ p) A := neg_le_neg hanti have hnegA : - cfcR (fun x : ℝ ↦ -(x ^ p)) A = -cfcR (fun x : ℝ ↦ x ^ p) A := by - simp [cfcR, cfc_neg] + cfcR (fun x : ℝ ↦ -(x ^ p)) A = -cfcR (fun x : ℝ ↦ x ^ p) A := by simp [cfcR, cfc_neg] have hnegB : - cfcR (fun x : ℝ ↦ -(x ^ p)) B = -cfcR (fun x : ℝ ↦ x ^ p) B := by - simp [cfcR, cfc_neg] + cfcR (fun x : ℝ ↦ -(x ^ p)) B = -cfcR (fun x : ℝ ↦ x ^ p) B := by simp [cfcR, cfc_neg] simpa [hnegA, hnegB] using hneg theorem power_Icc_neg_one_zero_neg_operatorConcaveOn_Ioi : ∀ p ∈ Set.Icc (-1 : ℝ) 0, @@ -2014,10 +1908,8 @@ theorem power_Icc_neg_one_zero_neg_operatorConcaveOn_Ioi : ∀ p ∈ Set.Icc (-1 let r : ℝ := -p have hr : r ∈ Set.Icc (0 : ℝ) 1 := by constructor - · dsimp [r] - exact neg_nonneg.mpr hp.2 - · dsimp [r] - simpa using (neg_le_neg hp.1) + · simpa [r] using neg_nonneg.mpr hp.2 + · simpa [r] using (neg_le_neg hp.1) -- convex combination set C : 𝓐 := (1 - t) • A + t • B have hC : IsSelfAdjoint C := by @@ -2045,8 +1937,7 @@ theorem power_Icc_neg_one_zero_neg_operatorConcaveOn_Ioi : ∀ p ∈ Set.Icc (-1 (-Cr) ≤ (1 - t) • (-Ar) + t • (-Br) := by simpa [C, Ar, Br, Cr, cfcR, cfc_neg] using hconc (A := A) (B := B) (t := t) hA hB ht0 ht1 As0 Bs0 - have h2 : (1 - t) • (-Ar) + t • (-Br) = -Dr := by - simp [Dr, smul_neg, add_comm] + have h2 : (1 - t) • (-Ar) + t • (-Br) = -Dr := by simp [Dr, smul_neg, add_comm] have h3 : (-Cr) ≤ (-Dr) := by calc (-Cr) ≤ (1 - t) • (-Ar) + t • (-Br) := h1 @@ -2056,35 +1947,28 @@ theorem power_Icc_neg_one_zero_neg_operatorConcaveOn_Ioi : ∀ p ∈ Set.Icc (-1 have h_inv1 : cfcR (fun x : ℝ ↦ 1 / x) Cr ≤ cfcR (fun x : ℝ ↦ 1 / x) Dr := by have hCr0 : 0 ≤ Cr := by - dsimp [Cr, cfcR] refine cfc_nonneg ?_ intro x hx have hx0 : (0 : ℝ) < x := by simpa [Set.Ioi] using Cs hx exact le_of_lt (Real.rpow_pos_of_pos hx0 r) have hAr0 : 0 ≤ Ar := by - dsimp [Ar, cfcR] refine cfc_nonneg ?_ intro x hx have hx0 : (0 : ℝ) < x := by simpa [Set.Ioi] using As hx exact le_of_lt (Real.rpow_pos_of_pos hx0 r) have hBr0 : 0 ≤ Br := by - dsimp [Br, cfcR] refine cfc_nonneg ?_ intro x hx have hx0 : (0 : ℝ) < x := by simpa [Set.Ioi] using Bs hx exact le_of_lt (Real.rpow_pos_of_pos hx0 r) have hDr0 : 0 ≤ Dr := by - dsimp [Dr] - exact add_nonneg (smul_nonneg (sub_nonneg.mpr ht1) hAr0) (smul_nonneg ht0 hBr0) + simpa [Dr] using add_nonneg (smul_nonneg (sub_nonneg.mpr ht1) hAr0) (smul_nonneg ht0 hBr0) have hCr_sa : IsSelfAdjoint Cr := by - dsimp [Cr, cfcR] - exact cfc_predicate _ _ + simp [Cr, cfcR] have hAr_sa : IsSelfAdjoint Ar := by - dsimp [Ar, cfcR] - exact cfc_predicate _ _ + simp [Ar, cfcR] have hBr_sa : IsSelfAdjoint Br := by - dsimp [Br, cfcR] - exact cfc_predicate _ _ + simp [Br, cfcR] have hspCr : spectrum ℝ Cr ⊆ Set.Ioi (0 : ℝ) := by have hcontC : ContinuousOn (fun x : ℝ ↦ x ^ r) (spectrum ℝ C) := by intro x hx @@ -2092,8 +1976,7 @@ theorem power_Icc_neg_one_zero_neg_operatorConcaveOn_Ioi : ∀ p ∈ Set.Icc (-1 exact (Real.continuousAt_rpow_const x r (Or.inl (ne_of_gt hx0))).continuousWithinAt have hspec : spectrum ℝ Cr = (fun x : ℝ ↦ x ^ r) '' spectrum ℝ C := by - dsimp [Cr, cfcR] - simpa using + simpa [Cr, cfcR] using (cfc_map_spectrum (R := ℝ) (A := 𝓐) (p := IsSelfAdjoint) (f := fun x : ℝ ↦ x ^ r) (a := C) (ha := hC) (hf := hcontC)) intro y hy @@ -2108,8 +1991,7 @@ theorem power_Icc_neg_one_zero_neg_operatorConcaveOn_Ioi : ∀ p ∈ Set.Icc (-1 exact (Real.continuousAt_rpow_const x r (Or.inl (ne_of_gt hx0))).continuousWithinAt have hspec : spectrum ℝ Ar = (fun x : ℝ ↦ x ^ r) '' spectrum ℝ A := by - dsimp [Ar, cfcR] - simpa using + simpa [Ar, cfcR] using (cfc_map_spectrum (R := ℝ) (A := 𝓐) (p := IsSelfAdjoint) (f := fun x : ℝ ↦ x ^ r) (a := A) (ha := hA) (hf := hcontA)) intro y hy @@ -2124,8 +2006,7 @@ theorem power_Icc_neg_one_zero_neg_operatorConcaveOn_Ioi : ∀ p ∈ Set.Icc (-1 exact (Real.continuousAt_rpow_const x r (Or.inl (ne_of_gt hx0))).continuousWithinAt have hspec : spectrum ℝ Br = (fun x : ℝ ↦ x ^ r) '' spectrum ℝ B := by - dsimp [Br, cfcR] - simpa using + simpa [Br, cfcR] using (cfc_map_spectrum (R := ℝ) (A := 𝓐) (p := IsSelfAdjoint) (f := fun x : ℝ ↦ x ^ r) (a := B) (ha := hB) (hf := hcontB)) intro y hy @@ -2144,11 +2025,9 @@ theorem power_Icc_neg_one_zero_neg_operatorConcaveOn_Ioi : ∀ p ∈ Set.Icc (-1 ≤ (1 - t) • cfcR (fun x : ℝ ↦ 1 / x) Ar + t • cfcR (fun x : ℝ ↦ 1 / x) Br := by have hAr_sa : IsSelfAdjoint Ar := by - dsimp [Ar, cfcR] - exact cfc_predicate _ _ + simp [Ar, cfcR] have hBr_sa : IsSelfAdjoint Br := by - dsimp [Br, cfcR] - exact cfc_predicate _ _ + simp [Br, cfcR] have hspAr : spectrum ℝ Ar ⊆ Set.Ioi (0 : ℝ) := by have hcontA : ContinuousOn (fun x : ℝ ↦ x ^ r) (spectrum ℝ A) := by intro x hx @@ -2156,8 +2035,7 @@ theorem power_Icc_neg_one_zero_neg_operatorConcaveOn_Ioi : ∀ p ∈ Set.Icc (-1 exact (Real.continuousAt_rpow_const x r (Or.inl (ne_of_gt hx0))).continuousWithinAt have hspec : spectrum ℝ Ar = (fun x : ℝ ↦ x ^ r) '' spectrum ℝ A := by - dsimp [Ar, cfcR] - simpa using + simpa [Ar, cfcR] using (cfc_map_spectrum (R := ℝ) (A := 𝓐) (p := IsSelfAdjoint) (f := fun x : ℝ ↦ x ^ r) (a := A) (ha := hA) (hf := hcontA)) intro y hy @@ -2172,8 +2050,7 @@ theorem power_Icc_neg_one_zero_neg_operatorConcaveOn_Ioi : ∀ p ∈ Set.Icc (-1 exact (Real.continuousAt_rpow_const x r (Or.inl (ne_of_gt hx0))).continuousWithinAt have hspec : spectrum ℝ Br = (fun x : ℝ ↦ x ^ r) '' spectrum ℝ B := by - dsimp [Br, cfcR] - simpa using + simpa [Br, cfcR] using (cfc_map_spectrum (R := ℝ) (A := 𝓐) (p := IsSelfAdjoint) (f := fun x : ℝ ↦ x ^ r) (a := B) (ha := hB) (hf := hcontB)) intro y hy @@ -2202,27 +2079,22 @@ theorem power_Icc_neg_one_zero_neg_operatorConcaveOn_Ioi : ∀ p ∈ Set.Icc (-1 have hcomp : cfcR (fun y : ℝ ↦ 1 / y) (cfcR (fun x : ℝ ↦ x ^ r) A) = cfcR (fun x : ℝ ↦ 1 / (x ^ r)) A := by - dsimp [cfcR] - simpa [Function.comp] using + simpa [cfcR, Function.comp] using (cfc_comp' (R := ℝ) (A := 𝓐) (p := IsSelfAdjoint) (g := fun y : ℝ ↦ 1 / y) (f := fun x : ℝ ↦ x ^ r) (a := A) (hg := hg) (hf := hcontA) (ha := hA)).symm have hL : cfcR (fun x : ℝ ↦ 1 / x) Ar = - cfcR (fun y : ℝ ↦ y⁻¹) (cfcR (fun x : ℝ ↦ x ^ r) A) := by - simp [Ar, one_div] + cfcR (fun y : ℝ ↦ y⁻¹) (cfcR (fun x : ℝ ↦ x ^ r) A) := by simp [Ar, one_div] rw [hL] have hcomp' : cfcR (fun y : ℝ ↦ y⁻¹) (cfcR (fun x : ℝ ↦ x ^ r) A) = - cfcR (fun x : ℝ ↦ (x ^ r)⁻¹) A := by - simpa [one_div] using hcomp + cfcR (fun x : ℝ ↦ (x ^ r)⁻¹) A := by simpa [one_div] using hcomp rw [hcomp'] - dsimp [cfcR] apply cfc_congr intro x hx have hx0 : (0 : ℝ) < x := by simpa [Set.Ioi] using As hx calc - (x ^ r)⁻¹ = x ^ (-r) := by - simpa using (Real.rpow_neg (le_of_lt hx0) r).symm + (x ^ r)⁻¹ = x ^ (-r) := by simpa using (Real.rpow_neg (le_of_lt hx0) r).symm _ = x ^ p := by simp [r] have hcompB : cfcR (fun x : ℝ ↦ 1 / x) Br = cfcR (fun x : ℝ ↦ x ^ p) B := by @@ -2240,27 +2112,22 @@ theorem power_Icc_neg_one_zero_neg_operatorConcaveOn_Ioi : ∀ p ∈ Set.Icc (-1 have hcomp : cfcR (fun y : ℝ ↦ 1 / y) (cfcR (fun x : ℝ ↦ x ^ r) B) = cfcR (fun x : ℝ ↦ 1 / (x ^ r)) B := by - dsimp [cfcR] - simpa [Function.comp] using + simpa [cfcR, Function.comp] using (cfc_comp' (R := ℝ) (A := 𝓐) (p := IsSelfAdjoint) (g := fun y : ℝ ↦ 1 / y) (f := fun x : ℝ ↦ x ^ r) (a := B) (hg := hg) (hf := hcontB) (ha := hB)).symm have hL : cfcR (fun x : ℝ ↦ 1 / x) Br = - cfcR (fun y : ℝ ↦ y⁻¹) (cfcR (fun x : ℝ ↦ x ^ r) B) := by - simp [Br, one_div] + cfcR (fun y : ℝ ↦ y⁻¹) (cfcR (fun x : ℝ ↦ x ^ r) B) := by simp [Br, one_div] rw [hL] have hcomp' : cfcR (fun y : ℝ ↦ y⁻¹) (cfcR (fun x : ℝ ↦ x ^ r) B) = - cfcR (fun x : ℝ ↦ (x ^ r)⁻¹) B := by - simpa [one_div] using hcomp + cfcR (fun x : ℝ ↦ (x ^ r)⁻¹) B := by simpa [one_div] using hcomp rw [hcomp'] - dsimp [cfcR] apply cfc_congr intro x hx have hx0 : (0 : ℝ) < x := by simpa [Set.Ioi] using Bs hx calc - (x ^ r)⁻¹ = x ^ (-r) := by - simpa using (Real.rpow_neg (le_of_lt hx0) r).symm + (x ^ r)⁻¹ = x ^ (-r) := by simpa using (Real.rpow_neg (le_of_lt hx0) r).symm _ = x ^ p := by simp [r] have hcompC : cfcR (fun x : ℝ ↦ 1 / x) Cr = cfcR (fun x : ℝ ↦ x ^ p) C := by @@ -2278,27 +2145,22 @@ theorem power_Icc_neg_one_zero_neg_operatorConcaveOn_Ioi : ∀ p ∈ Set.Icc (-1 have hcomp : cfcR (fun y : ℝ ↦ 1 / y) (cfcR (fun x : ℝ ↦ x ^ r) C) = cfcR (fun x : ℝ ↦ 1 / (x ^ r)) C := by - dsimp [cfcR] - simpa [Function.comp] using + simpa [cfcR, Function.comp] using (cfc_comp' (R := ℝ) (A := 𝓐) (p := IsSelfAdjoint) (g := fun y : ℝ ↦ 1 / y) (f := fun x : ℝ ↦ x ^ r) (a := C) (hg := hg) (hf := hcontC) (ha := hC)).symm have hL : cfcR (fun x : ℝ ↦ 1 / x) Cr = - cfcR (fun y : ℝ ↦ y⁻¹) (cfcR (fun x : ℝ ↦ x ^ r) C) := by - simp [Cr, one_div] + cfcR (fun y : ℝ ↦ y⁻¹) (cfcR (fun x : ℝ ↦ x ^ r) C) := by simp [Cr, one_div] rw [hL] have hcomp' : cfcR (fun y : ℝ ↦ y⁻¹) (cfcR (fun x : ℝ ↦ x ^ r) C) = - cfcR (fun x : ℝ ↦ (x ^ r)⁻¹) C := by - simpa [one_div] using hcomp + cfcR (fun x : ℝ ↦ (x ^ r)⁻¹) C := by simpa [one_div] using hcomp rw [hcomp'] - dsimp [cfcR] apply cfc_congr intro x hx have hx0 : (0 : ℝ) < x := by simpa [Set.Ioi] using Cs hx calc - (x ^ r)⁻¹ = x ^ (-r) := by - simpa using (Real.rpow_neg (le_of_lt hx0) r).symm + (x ^ r)⁻¹ = x ^ (-r) := by simpa using (Real.rpow_neg (le_of_lt hx0) r).symm _ = x ^ p := by simp [r] -- finish have hmain : @@ -2320,8 +2182,7 @@ theorem power_Icc_neg_one_zero_neg_operatorConcaveOn_Ioi : ∀ p ∈ Set.Icc (-1 have hchain' : cfcR (fun x : ℝ ↦ x⁻¹) Cr ≤ (1 - t) • cfcR (fun x : ℝ ↦ x⁻¹) Ar - + t • cfcR (fun x : ℝ ↦ x⁻¹) Br := by - simpa [one_div] using hchain + + t • cfcR (fun x : ℝ ↦ x⁻¹) Br := by simpa [one_div] using hchain simpa [hcompA', hcompB', hcompC'] using hchain' simpa [C] using hmain diff --git a/QuantumInfo/ForMathlib/HayataGroup/TraceInequality/LownerHeinzTheorem.lean b/QuantumInfo/ForMathlib/HayataGroup/TraceInequality/LownerHeinzTheorem.lean index 7f89cad56..f2f0c8e49 100644 --- a/QuantumInfo/ForMathlib/HayataGroup/TraceInequality/LownerHeinzTheorem.lean +++ b/QuantumInfo/ForMathlib/HayataGroup/TraceInequality/LownerHeinzTheorem.lean @@ -158,10 +158,8 @@ theorem operatorConvex_convexOn_univ {f : ℝ → ℝ} (hf : OperatorConvex (ℋ (algebraMap ℝ (L ℋ) u) * (algebraMap ℝ (L ℋ) r) + (algebraMap ℝ (L ℋ) v) * (algebraMap ℝ (L ℋ) s) := by rw [Algebra.smul_def, Algebra.smul_def] - _ = algebraMap ℝ (L ℋ) (u * r) + algebraMap ℝ (L ℋ) (v * s) := by - simp - _ = algebraMap ℝ (L ℋ) (u * r + v * s) := by - simp + _ = algebraMap ℝ (L ℋ) (u * r) + algebraMap ℝ (L ℋ) (v * s) := by simp + _ = algebraMap ℝ (L ℋ) (u * r + v * s) := by simp have hop : cfcR (ℋ := ℋ) f ((1 - b) • (algebraMap ℝ (L ℋ) x) + b • (algebraMap ℝ (L ℋ) y)) ≤ @@ -183,8 +181,7 @@ theorem operatorConvex_convexOn_univ {f : ℝ → ℝ} (hf : OperatorConvex (ℋ halg_combo (u := 1 - b) (v := b) (r := f x) (s := f y)] at hop have hscalar : algebraMap ℝ (L ℋ) (f ((1 - b) * x + b * y)) ≤ - algebraMap ℝ (L ℋ) ((1 - b) * f x + b * f y) := by - simpa [Algebra.smul_def] using hop + algebraMap ℝ (L ℋ) ((1 - b) * f x + b * f y) := by simpa [Algebra.smul_def] using hop have hspec_le : ∀ z ∈ spectrum ℝ (algebraMap ℝ (L ℋ) (f ((1 - b) * x + b * y))), z ≤ (1 - b) * f x + b * f y := by @@ -229,51 +226,42 @@ theorem one_div_operatorConvexOn_Ioi : omit [Nontrivial ℋ] in theorem one_div_add_t_operatorAntitoneOn_Ici : ∀ (t : ℝ), 0 < t → - OperatorAntitoneOn (ℋ := ℋ) (Set.Ici (0 : ℝ)) (fun x : ℝ ↦ 1 / (x + t)) := by - intro t ht - exact (LownerHeinzCore.one_div_add_t_operatorAntitoneOn_Ici (𝓐 := L ℋ) t ht) + OperatorAntitoneOn (ℋ := ℋ) (Set.Ici (0 : ℝ)) (fun x : ℝ ↦ 1 / (x + t)) := + fun t ht => LownerHeinzCore.one_div_add_t_operatorAntitoneOn_Ici (𝓐 := L ℋ) t ht theorem one_div_add_t_operatorConvexOn_Ici : ∀ (t : ℝ), 0 < t → - OperatorConvexOn (ℋ := ℋ) (Set.Ici (0 : ℝ)) (fun x : ℝ ↦ 1 / (x + t)) := by - intro t ht - exact (LownerHeinzCore.one_div_add_t_operatorConvexOn_Ici (𝓐 := L ℋ) t ht) + OperatorConvexOn (ℋ := ℋ) (Set.Ici (0 : ℝ)) (fun x : ℝ ↦ 1 / (x + t)) := + fun t ht => LownerHeinzCore.one_div_add_t_operatorConvexOn_Ici (𝓐 := L ℋ) t ht omit [Nontrivial ℋ] in theorem ratio_add_t_operatorMonotoneOn_Ici : ∀ (t : ℝ), 0 < t → - OperatorMonotoneOn (ℋ := ℋ) (Set.Ici (0 : ℝ)) (fun x : ℝ ↦ x / (x + t)) := by - intro t ht - exact (LownerHeinzCore.ratio_add_t_operatorMonotoneOn_Ici (𝓐 := L ℋ) t ht) + OperatorMonotoneOn (ℋ := ℋ) (Set.Ici (0 : ℝ)) (fun x : ℝ ↦ x / (x + t)) := + fun t ht => LownerHeinzCore.ratio_add_t_operatorMonotoneOn_Ici (𝓐 := L ℋ) t ht theorem ratio_add_t_operatorConcaveOn_Ici : ∀ (t : ℝ), 0 < t → - OperatorConcaveOn (ℋ := ℋ) (Set.Ici (0 : ℝ)) (fun x : ℝ ↦ x / (x + t)) := by - intro t ht - exact (LownerHeinzCore.ratio_add_t_operatorConcaveOn_Ici (𝓐 := L ℋ) t ht) + OperatorConcaveOn (ℋ := ℋ) (Set.Ici (0 : ℝ)) (fun x : ℝ ↦ x / (x + t)) := + fun t ht => LownerHeinzCore.ratio_add_t_operatorConcaveOn_Ici (𝓐 := L ℋ) t ht omit [Nontrivial ℋ] in theorem power_Icc_zero_one_operatorMonotoneOn_Ici : ∀ p ∈ Set.Icc (0 : ℝ) 1, - OperatorMonotoneOn (ℋ := ℋ) (Set.Ici (0 : ℝ)) (fun x ↦ x ^ p) := by - intro p hp - exact (LownerHeinzCore.power_Icc_zero_one_operatorMonotoneOn_Ici (𝓐 := L ℋ) p hp) + OperatorMonotoneOn (ℋ := ℋ) (Set.Ici (0 : ℝ)) (fun x ↦ x ^ p) := + fun p hp => LownerHeinzCore.power_Icc_zero_one_operatorMonotoneOn_Ici (𝓐 := L ℋ) p hp theorem power_Icc_zero_one_operatorConcaveOn_Ici : ∀ p ∈ Set.Icc (0 : ℝ) 1, - OperatorConcaveOn (ℋ := ℋ) (Set.Ici (0 : ℝ)) (fun x ↦ x ^ p) := by - intro p hp - exact (LownerHeinzCore.power_Icc_zero_one_operatorConcaveOn_Ici (𝓐 := L ℋ) p hp) + OperatorConcaveOn (ℋ := ℋ) (Set.Ici (0 : ℝ)) (fun x ↦ x ^ p) := + fun p hp => LownerHeinzCore.power_Icc_zero_one_operatorConcaveOn_Ici (𝓐 := L ℋ) p hp theorem power_Icc_one_two_operatorConvexOn_Ici : ∀ p ∈ Set.Icc (1 : ℝ) 2, - OperatorConvexOn (ℋ := ℋ) (Set.Ici (0 : ℝ)) (fun x ↦ x ^ p) := by - intro p hp - exact (LownerHeinzCore.power_Icc_one_two_operatorConvexOn_Ici (𝓐 := L ℋ) p hp) + OperatorConvexOn (ℋ := ℋ) (Set.Ici (0 : ℝ)) (fun x ↦ x ^ p) := + fun p hp => LownerHeinzCore.power_Icc_one_two_operatorConvexOn_Ici (𝓐 := L ℋ) p hp omit [Nontrivial ℋ] in theorem power_Icc_neg_one_zero_neg_operatorMonotoneOn_Ioi : ∀ p ∈ Set.Icc (-1 : ℝ) 0, - OperatorMonotoneOn (ℋ := ℋ) (Set.Ioi (0 : ℝ)) (fun x ↦ -(x ^ p)) := by - intro p hp - exact (LownerHeinzCore.power_Icc_neg_one_zero_neg_operatorMonotoneOn_Ioi (𝓐 := L ℋ) p hp) + OperatorMonotoneOn (ℋ := ℋ) (Set.Ioi (0 : ℝ)) (fun x ↦ -(x ^ p)) := + fun p hp => LownerHeinzCore.power_Icc_neg_one_zero_neg_operatorMonotoneOn_Ioi (𝓐 := L ℋ) p hp theorem power_Icc_neg_one_zero_neg_operatorConcaveOn_Ioi : ∀ p ∈ Set.Icc (-1 : ℝ) 0, - OperatorConcaveOn (ℋ := ℋ) (Set.Ioi (0 : ℝ)) (fun x ↦ -(x ^ p)) := by - intro p hp - exact (LownerHeinzCore.power_Icc_neg_one_zero_neg_operatorConcaveOn_Ioi (𝓐 := L ℋ) p hp) + OperatorConcaveOn (ℋ := ℋ) (Set.Ioi (0 : ℝ)) (fun x ↦ -(x ^ p)) := + fun p hp => LownerHeinzCore.power_Icc_neg_one_zero_neg_operatorConcaveOn_Ioi (𝓐 := L ℋ) p hp end LownerHeinzTheorem diff --git a/QuantumInfo/ForMathlib/HayataGroup/TraceInequality/OperatorGeometricMean.lean b/QuantumInfo/ForMathlib/HayataGroup/TraceInequality/OperatorGeometricMean.lean index cf15c94a6..9fbfc2a0f 100644 --- a/QuantumInfo/ForMathlib/HayataGroup/TraceInequality/OperatorGeometricMean.lean +++ b/QuantumInfo/ForMathlib/HayataGroup/TraceInequality/OperatorGeometricMean.lean @@ -25,9 +25,8 @@ noncomputable def operatorPowerMean (α β : ℝ) (A B : L ℋ) : L ℋ := GeneralizedPerspective (fun x : ℝ ↦ x ^ α) (fun x : ℝ ↦ x ^ β) A B private lemma rpow_continuousOn_Ici (p : ℝ) (hp : 0 ≤ p) : - ContinuousOn (fun x : ℝ ↦ x ^ p) (Set.Ici (0 : ℝ)) := by - intro x hx - exact (Real.continuousAt_rpow_const x p (Or.inr hp)).continuousWithinAt + ContinuousOn (fun x : ℝ ↦ x ^ p) (Set.Ici (0 : ℝ)) := + fun x _ => (Real.continuousAt_rpow_const x p (Or.inr hp)).continuousWithinAt omit [Nontrivial ℋ] in private lemma operatorConcaveOn_Ioi_of_Ici {f : ℝ → ℝ} @@ -44,9 +43,8 @@ private lemma pdSet_subset_psdSet : pdSet (ℋ := ℋ) ⊆ psdSet (ℋ := ℋ) : exact ⟨hA_sa, Set.Subset.trans hA_spec Set.Ioi_subset_Ici_self⟩ private lemma rpow_pos_on_Ioi (p : ℝ) : - ∀ x ∈ Set.Ioi (0 : ℝ), 0 < x ^ p := by - intro x hx - exact Real.rpow_pos_of_pos hx p + ∀ x ∈ Set.Ioi (0 : ℝ), 0 < x ^ p := + fun _ hx => Real.rpow_pos_of_pos hx p /-- Theorem 1.1, concave range: the operator `(α, β)`-power mean is jointly concave on @@ -68,14 +66,11 @@ theorem operatorPowerMean_jointlyConcaveOn_pdSet intro K _ _ _ _ exact power_Icc_zero_one_operatorConcaveOn_Ici (ℋ := K) α hα) (hfcont := rpow_continuousOn_Ici α hα.1) - (hf0 := by - exact Real.rpow_nonneg (show (0 : ℝ) ≤ 0 by simp) α) - (hconc := by - exact operatorConcaveOn_Ioi_of_Ici (ℋ := ℋ) - (power_Icc_zero_one_operatorConcaveOn_Ici (ℋ := ℋ) β hβ)) - (hcont := by - intro x hx - exact (Real.continuousAt_rpow_const x β (Or.inl (ne_of_gt hx))).continuousWithinAt) + (hf0 := Real.rpow_nonneg (show (0 : ℝ) ≤ 0 by simp) α) + (hconc := operatorConcaveOn_Ioi_of_Ici (ℋ := ℋ) + (power_Icc_zero_one_operatorConcaveOn_Ici (ℋ := ℋ) β hβ)) + (hcont := fun x hx => + (Real.continuousAt_rpow_const x β (Or.inl (ne_of_gt hx))).continuousWithinAt) (hpos := rpow_pos_on_Ioi β) simpa [operatorPowerMean] using hconc (A₁ := A₁) (A₂ := A₂) (B₁ := B₁) (B₂ := B₂) (θ := θ) @@ -106,12 +101,10 @@ theorem operatorPowerMean_jointlyConvexOn_pdSet · have hα0 : α ≠ 0 := by linarith [hα.1] simp [Real.zero_rpow hα0] ) - (hconc := by - exact operatorConcaveOn_Ioi_of_Ici (ℋ := ℋ) - (power_Icc_zero_one_operatorConcaveOn_Ici (ℋ := ℋ) β hβ)) - (hcont := by - intro x hx - exact (Real.continuousAt_rpow_const x β (Or.inl (ne_of_gt hx))).continuousWithinAt) + (hconc := operatorConcaveOn_Ioi_of_Ici (ℋ := ℋ) + (power_Icc_zero_one_operatorConcaveOn_Ici (ℋ := ℋ) β hβ)) + (hcont := fun x hx => + (Real.continuousAt_rpow_const x β (Or.inl (ne_of_gt hx))).continuousWithinAt) (hpos := rpow_pos_on_Ioi β) simpa [operatorPowerMean] using hconv (A₁ := A₁) (A₂ := A₂) (B₁ := B₁) (B₂ := B₂) (θ := θ) diff --git a/QuantumInfo/ForMathlib/HermitianMat/Basic.lean b/QuantumInfo/ForMathlib/HermitianMat/Basic.lean index 31eaa84ad..b8f8e3047 100644 --- a/QuantumInfo/ForMathlib/HermitianMat/Basic.lean +++ b/QuantumInfo/ForMathlib/HermitianMat/Basic.lean @@ -28,8 +28,7 @@ section addgroup variable [AddGroup α] [StarAddMonoid α] -theorem eq_IsHermitian : HermitianMat n α = { m : Matrix n n α // m.IsHermitian} := by - rfl +theorem eq_IsHermitian : HermitianMat n α = { m : Matrix n n α // m.IsHermitian} := rfl @[coe] def mat : HermitianMat n α → Matrix n n α := Subtype.val @@ -41,12 +40,10 @@ theorem val_eq_coe (A : HermitianMat n α) : A.val = A := by rfl @[simp] -theorem mat_mk (x : Matrix n n α) (h) : mat ⟨x, h⟩ = x := by - rfl +theorem mat_mk (x : Matrix n n α) (h) : mat ⟨x, h⟩ = x := rfl @[simp] -theorem mk_mat {A : HermitianMat n α} (h : A.mat.IsHermitian) : ⟨A.mat, h⟩ = A := by - rfl +theorem mk_mat {A : HermitianMat n α} (h : A.mat.IsHermitian) : ⟨A.mat, h⟩ = A := rfl /-- Alias for HermitianMat.property or HermitianMat.2, this gets the fact that the value is actually `IsHermitian`.-/ @@ -61,8 +58,7 @@ instance instFun : FunLike (HermitianMat n α) n (n → α) where coe_injective _ _ h := HermitianMat.ext h @[simp] -theorem mat_apply {A : HermitianMat n α} {i j : n} : A.mat i j = A i j := by - rfl +theorem mat_apply {A : HermitianMat n α} {i j : n} : A.mat i j = A i j := rfl @[simp] theorem conjTranspose_mat (A : HermitianMat n α) : @@ -77,31 +73,25 @@ instance [IsEmpty n] : Unique (HermitianMat n α) where uniq a := by ext; exact (IsEmpty.false ‹_›).elim @[simp, norm_cast] -theorem mat_zero : (0 : HermitianMat n α).mat = 0 := by - rfl +theorem mat_zero : (0 : HermitianMat n α).mat = 0 := rfl @[simp] -theorem mk_zero (h : (0 : Matrix n n α).IsHermitian) : ⟨0, h⟩ = (0 : HermitianMat n α) := by - rfl +theorem mk_zero (h : (0 : Matrix n n α).IsHermitian) : ⟨0, h⟩ = (0 : HermitianMat n α) := rfl @[simp] -theorem zero_apply (i j : n) : (0 : HermitianMat n 𝕜) i j = 0 := by - rfl +theorem zero_apply (i j : n) : (0 : HermitianMat n 𝕜) i j = 0 := rfl @[simp, norm_cast] theorem mat_add (A B : HermitianMat n α) : - (A + B).mat = A.mat + B.mat := by - rfl + (A + B).mat = A.mat + B.mat := rfl @[simp, norm_cast] theorem mat_sub (A B : HermitianMat n α) : - (A - B).mat = A.mat - B.mat := by - rfl + (A - B).mat = A.mat - B.mat := rfl @[simp, norm_cast] theorem mat_neg (A : HermitianMat n α) : - (-A).mat = -A.mat := by - rfl + (-A).mat = -A.mat := rfl section smul variable [SMul R α] [StarModule R α] @@ -116,8 +106,7 @@ theorem mat_smul (c : R) (A : HermitianMat n α) : @[simp] theorem smul_apply (c : R) (A : HermitianMat n α) (i j : n) : - (c • A) i j = c • A i j := by - rfl + (c • A) i j = c • A i j := rfl end smul section topology @@ -223,16 +212,13 @@ instance : One (HermitianMat n α) := Matrix.one_apply, apply_ite (β := α), eq_comm]⟩ @[simp, norm_cast] -theorem mat_one : (1 : HermitianMat n α).mat = 1 := by - rfl +theorem mat_one : (1 : HermitianMat n α).mat = 1 := rfl @[simp] -theorem mk_one (h : (1 : Matrix n n α).IsHermitian) : ⟨1, h⟩ = (1 : HermitianMat n α) := by - rfl +theorem mk_one (h : (1 : Matrix n n α).IsHermitian) : ⟨1, h⟩ = (1 : HermitianMat n α) := rfl @[simp] -theorem one_apply (i j : n) : (1 : HermitianMat n α) i j = (1 : Matrix n n α) i j := by - rfl +theorem one_apply (i j : n) : (1 : HermitianMat n α) i j = (1 : Matrix n n α) i j := rfl noncomputable instance : AddCommMonoidWithOne (HermitianMat n 𝕜) where @@ -251,8 +237,7 @@ noncomputable instance instInv : Inv (HermitianMat m α) := ⟨fun x ↦ ⟨x⁻¹, x.H.inv⟩⟩ @[simp, norm_cast] -theorem mat_inv : (A⁻¹).mat = A.mat⁻¹ := by - rfl +theorem mat_inv : (A⁻¹).mat = A.mat⁻¹ := rfl @[simp] theorem zero_inv : ((0 : HermitianMat m α)⁻¹) = 0 := by @@ -266,8 +251,7 @@ noncomputable instance instPow : Pow (HermitianMat m α) ℕ := ⟨fun x n ↦ ⟨x ^ n, x.H.pow n⟩⟩ @[simp, norm_cast] -theorem mat_pow (n : ℕ) : (A ^ n).mat = A.mat ^ n := by - rfl +theorem mat_pow (n : ℕ) : (A ^ n).mat = A.mat ^ n := rfl @[simp] theorem pow_zero : A ^ 0 = 1 := by @@ -285,12 +269,10 @@ noncomputable instance instZPow : Pow (HermitianMat m α) ℤ := ⟨fun x z ↦ ⟨x ^ z, x.H.zpow z⟩⟩ @[simp] -theorem mat_zpow (z : ℤ) : (A ^ z).mat = A.mat ^ z := by - rfl +theorem mat_zpow (z : ℤ) : (A ^ z).mat = A.mat ^ z := rfl @[simp, norm_cast] -theorem zpow_natCast : A ^ (n : ℤ) = A ^ n := by - rfl +theorem zpow_natCast : A ^ (n : ℤ) = A ^ n := rfl @[simp] theorem zpow_zero : A ^ (0 : ℤ) = 1 := by @@ -371,13 +353,11 @@ def conj {m} (B : Matrix m n α) : HermitianMat n α →+ HermitianMat m α wher map_zero' := by simp theorem conj_apply (B : Matrix m n α) (A : HermitianMat n α) : - conj B A = ⟨B * A.mat * B.conjTranspose, (conj B A).2⟩ := by - rfl + conj B A = ⟨B * A.mat * B.conjTranspose, (conj B A).2⟩ := rfl @[simp] theorem conj_apply_mat (B : Matrix m n α) (A : HermitianMat n α) : - (A.conj B).mat = B * A.mat * B.conjTranspose := by - rfl + (A.conj B).mat = B * A.mat * B.conjTranspose := rfl theorem conj_conj {m l} [Fintype m] (B : Matrix m n α) (C : Matrix l m α) : (A.conj B).conj C = A.conj (C * B) := by @@ -387,12 +367,10 @@ theorem conj_conj {m l} [Fintype m] (B : Matrix m n α) (C : Matrix l m α) : variable (B : HermitianMat n α) @[simp] -theorem conj_zero [DecidableEq n] : A.conj (0 : Matrix m n α) = 0 := by - simp [conj_apply] +theorem conj_zero [DecidableEq n] : A.conj (0 : Matrix m n α) = 0 := by simp [conj_apply] @[simp] -theorem conj_one [DecidableEq n] : A.conj 1 = A := by - simp [conj_apply] +theorem conj_one [DecidableEq n] : A.conj 1 = A := by simp [conj_apply] @[simp] lemma conj_one_unitary [DecidableEq n] (U : Matrix.unitaryGroup n α) : @@ -411,8 +389,7 @@ def conjLinear {m} (B : Matrix m n α) : HermitianMat n α →ₗ[R] HermitianMa simp @[simp] -theorem conjLinear_apply (B : Matrix m n α) : conjLinear R B A = conj B A := by - rfl +theorem conjLinear_apply (B : Matrix m n α) : conjLinear R B A = conj B A := rfl @[fun_prop] lemma continuous_conj (ρ : HermitianMat n 𝕜) : Continuous (ρ.conj (m := m) ·) := by @@ -439,12 +416,10 @@ theorem isSymmetric : A.lin.IsSymmetric := Matrix.isSymmetric_toEuclideanLin_iff.symm.mp A.H @[simp] -theorem lin_zero : (0 : HermitianMat n 𝕜).lin = 0 := by - simp [lin]; rfl +theorem lin_zero : (0 : HermitianMat n 𝕜).lin = 0 := by simp [lin]; rfl @[simp] -theorem lin_one : (1 : HermitianMat n 𝕜).lin = 1 := by - simp [lin]; rfl +theorem lin_one : (1 : HermitianMat n 𝕜).lin = 1 := by simp [lin]; rfl noncomputable def eigenspace (μ : 𝕜) : Submodule 𝕜 (EuclideanSpace 𝕜 n) := Module.End.eigenspace A.lin μ @@ -463,12 +438,10 @@ theorem ker_eq_eigenspace_zero : A.ker = A.eigenspace 0 := by simp [ker, eigenspace] @[simp] -theorem ker_zero : (0 : HermitianMat n 𝕜).ker = ⊤ := by - simp [ker] +theorem ker_zero : (0 : HermitianMat n 𝕜).ker = ⊤ := by simp [ker] @[simp] -theorem ker_one : (1 : HermitianMat n 𝕜).ker = ⊥ := by - simp [ker]; rfl +theorem ker_one : (1 : HermitianMat n 𝕜).ker = ⊥ := by simp [ker]; rfl theorem ker_pos_smul {c : ℝ} (hc : c ≠ 0) : (c • A).ker = A.ker := by ext x @@ -484,8 +457,7 @@ theorem support_eq_sup_eigenspace_nonzero : A.support = ⨆ μ ≠ 0, A.eigenspa exact A.lin.support_eq_sup_eigenspace_nonzero A.isSymmetric @[simp] -theorem support_zero : (0 : HermitianMat n 𝕜).support = ⊥ := by - simp [support] +theorem support_zero : (0 : HermitianMat n 𝕜).support = ⊥ := by simp [support] @[simp] theorem support_one : (1 : HermitianMat n 𝕜).support = ⊤ := by @@ -517,8 +489,7 @@ def diagonal (f : n → ℝ) : HermitianMat n 𝕜 := variable (f g : n → ℝ) @[simp] -theorem diagonal_mat : (diagonal 𝕜 f).mat = Matrix.diagonal (f · : n → 𝕜) := by - rfl +theorem diagonal_mat : (diagonal 𝕜 f).mat = Matrix.diagonal (f · : n → 𝕜) := rfl @[simp] theorem diagonal_zero : (diagonal 𝕜 0) = (0 : HermitianMat n 𝕜) := by @@ -573,8 +544,7 @@ scoped[HermitianMat] infixl:100 " ⊗ₖ " => HermitianMat.kronecker @[simp, norm_cast] theorem kronecker_mat (A : HermitianMat m α) (B : HermitianMat n α) : - (A ⊗ₖ B).mat = A.mat ⊗ₖ B.mat := by - rfl + (A ⊗ₖ B).mat = A.mat ⊗ₖ B.mat := rfl @[simp] theorem zero_kronecker (A : HermitianMat m α) : (0 : HermitianMat n α) ⊗ₖ A = 0 := by @@ -691,8 +661,7 @@ theorem _root_.Matrix.range_mul_conjTranspose_of_ker_le_ker {A : Matrix d d 𝕜 rw [← inner_self_eq_zero (𝕜 := 𝕜)] have : ∀ y, @inner 𝕜 _ _ y (Matrix.toEuclideanLin M x) = 0 := by intro y - rw [← LinearMap.adjoint_inner_left] - exact h _ ⟨y, rfl⟩ + simpa [← LinearMap.adjoint_inner_left] using h _ ⟨y, rfl⟩ exact this _ · intro h y ⟨z, hz⟩ rw [← hz, LinearMap.adjoint_inner_left, h, inner_zero_right] @@ -741,8 +710,7 @@ theorem _root_.Matrix.IsHermitian.spectrum_rcLike {A : Matrix n n 𝕜} (hA : A. of the real spectrum. -/ @[simp] theorem spectrum_rcLike (A : HermitianMat n 𝕜) : - spectrum 𝕜 A.mat = RCLike.ofReal '' spectrum ℝ A.mat := by - exact A.H.spectrum_rcLike.symm + spectrum 𝕜 A.mat = RCLike.ofReal '' spectrum ℝ A.mat := A.H.spectrum_rcLike.symm theorem ne_zero_iff_ne_zero_spectrum (A : HermitianMat n 𝕜) : A ≠ 0 ↔ ∃ x ∈ spectrum ℝ A.mat, x ≠ 0 := by diff --git a/QuantumInfo/ForMathlib/HermitianMat/CFC.lean b/QuantumInfo/ForMathlib/HermitianMat/CFC.lean index b342732de..e1187b559 100644 --- a/QuantumInfo/ForMathlib/HermitianMat/CFC.lean +++ b/QuantumInfo/ForMathlib/HermitianMat/CFC.lean @@ -33,25 +33,21 @@ variable (A : HermitianMat d 𝕜) (f : ℝ → ℝ) (g : ℝ → ℝ) (q r : /- Adding this to the `CStarAlgebra` aesop set allows `cfc_tac` to use it. -/ omit [Fintype d] [DecidableEq d] in @[aesop safe apply (rule_sets := [CStarAlgebra])] -theorem isSelfAdjoint : IsSelfAdjoint A.mat := by - exact A.H +theorem isSelfAdjoint : IsSelfAdjoint A.mat := A.H /- Adding this to `fun_prop` allows `cfc_cont_tac` to use it. -/ @[fun_prop] theorem continuousOn_finite {α β : Type*} (f : α → β) (S : Set α) [TopologicalSpace α] [TopologicalSpace β] [T1Space α] [Finite S] : ContinuousOn f S := by - rw [continuousOn_iff_continuous_restrict] - exact continuous_of_discreteTopology + simpa [continuousOn_iff_continuous_restrict] using continuous_of_discreteTopology @[simp] -theorem conjTranspose_cfc : (cfc f A.mat).conjTranspose = cfc f A.mat := by - exact cfc_predicate f A.mat +theorem conjTranspose_cfc : (cfc f A.mat).conjTranspose = cfc f A.mat := cfc_predicate f A.mat protected def cfc : HermitianMat d 𝕜 := ⟨cfc f A.mat, cfc_predicate _ _⟩ -theorem cfc_eq : A.cfc f = ⟨cfc f A.mat, cfc_predicate f A.mat⟩ := by - rfl +theorem cfc_eq : A.cfc f = ⟨cfc f A.mat, cfc_predicate f A.mat⟩ := rfl @[simp] theorem mat_cfc : (A.cfc f).mat = _root_.cfc f A.mat := by @@ -93,8 +89,7 @@ variable {A B : HermitianMat d 𝕜} @[aesop unsafe apply 50% (rule_sets := [Commutes])] theorem _root_.Commute.cfc_left (hAB : Commute A.mat B.mat) : - Commute (A.cfc f).mat B.mat := by - exact hAB.cfc_real f + Commute (A.cfc f).mat B.mat := hAB.cfc_real f @[aesop unsafe apply 50% (rule_sets := [Commutes])] theorem _root_.Commute.cfc_right (hAB : Commute A.mat B.mat) : @@ -102,8 +97,7 @@ theorem _root_.Commute.cfc_right (hAB : Commute A.mat B.mat) : (hAB.symm.cfc_left f).symm theorem cfc_commute (f g : ℝ → ℝ) (hAB : Commute A.mat B.mat) : - Commute (A.cfc f).mat (B.cfc g).mat := by - exact (hAB.cfc_right g).cfc_left f + Commute (A.cfc f).mat (B.cfc g).mat := (hAB.cfc_right g).cfc_left f @[aesop safe apply (rule_sets := [Commutes])] theorem cfc_self_commute (A : HermitianMat d 𝕜) (f g : ℝ → ℝ) : @@ -120,8 +114,7 @@ theorem cfc_reindex (e : d ≃ d₂) : (A.reindex e).cfc f = (A.cfc f).reindex e exact Matrix.cfc_reindex f e theorem spectrum_cfc_eq_image (A : HermitianMat d 𝕜) (f : ℝ → ℝ) : - spectrum ℝ (A.cfc f).mat = f '' (spectrum ℝ A.mat) := by - exact cfc_map_spectrum f A.mat + spectrum ℝ (A.cfc f).mat = f '' (spectrum ℝ A.mat) := cfc_map_spectrum f A.mat set_option backward.isDefEq.respectTransparency false in /-- @@ -156,8 +149,7 @@ theorem cfc_eigenvalues (A : HermitianMat d 𝕜) : etc. We need these because (as above) `HermitianMat.cfc` is different from `_root_.cfc`. -/ @[simp] -nonrec theorem cfc_id : A.cfc id = A := by - simpa [HermitianMat.ext_iff] using cfc_id ℝ A.mat +nonrec theorem cfc_id : A.cfc id = A := by simpa [HermitianMat.ext_iff] using cfc_id ℝ A.mat @[simp] nonrec theorem cfc_id' : A.cfc (·) = A := @@ -189,8 +181,7 @@ theorem mat_cfc_mul : (A.cfc (f * g)).mat = A.cfc f * A.cfc g := by simp only [mat_cfc] exact cfc_mul .. -theorem mat_cfc_mul_apply : (A.cfc (fun x ↦ f x * g x)).mat = A.cfc f * A.cfc g := by - exact mat_cfc_mul .. +theorem mat_cfc_mul_apply : (A.cfc (fun x ↦ f x * g x)).mat = A.cfc f * A.cfc g := mat_cfc_mul .. nonrec theorem cfc_comp : A.cfc (g ∘ f) = (A.cfc f).cfc g := by ext1; exact cfc_comp .. @@ -386,8 +377,7 @@ theorem Matrix.PosDef.spectrum_subset_Ioi {d 𝕜 : Type*} [Fintype d] [Decidabl {A : Matrix d d 𝕜} (hA : A.PosDef) : spectrum ℝ A ⊆ Set.Ioi 0 := by intro x hx; -- Since $A$ is positive definite, all its eigenvalues are positive. - have h_eigenvalues_pos : ∀ i : d, 0 < hA.1.eigenvalues i := by - exact hA.eigenvalues_pos; + have h_eigenvalues_pos : ∀ i : d, 0 < hA.1.eigenvalues i := hA.eigenvalues_pos have h_spectrum_eq_range : spectrum ℝ A = Set.range (hA.1.eigenvalues) := by exact Matrix.IsHermitian.spectrum_real_eq_range_eigenvalues hA.left; aesop @@ -458,8 +448,7 @@ lemma norm_cfc_sub_cfc_le_sqrt_card {A : HermitianMat d ℂ} {f g : ℝ → ℝ} · intro x hx apply le_csSup; · -- The supremum of a finite set of real numbers is finite. - have h_finite : Set.Finite (spectrum ℝ A.mat) := by - exact Set.toFinite _; + have h_finite : Set.Finite (spectrum ℝ A.mat) := Set.toFinite _ obtain ⟨ M, hM ⟩ := h_finite.exists_finset_coe; refine' ⟨ ∑ x ∈ M, ‖f x - g x‖, Set.forall_mem_range.2 fun x => _ ⟩; rw [ ← hM ]; @@ -740,11 +729,9 @@ lemma continuousWithinAt_cfc_of_continuousOn {T : Set ℝ} {g : ℝ → ℝ} (hg : ContinuousOn g T) (hA₀ : spectrum ℝ A₀.mat ⊆ T) : ContinuousWithinAt (fun B ↦ B.cfc g) {B | spectrum ℝ B.mat ⊆ T} A₀ := by have h_ext : ∃ h : ℝ → ℝ, Continuous h ∧ ∀ x ∈ spectrum ℝ A₀.mat, h x = g x := by - have h_finite : Set.Finite (spectrum ℝ A₀.mat) := by - exact Set.toFinite _ + have h_finite : Set.Finite (spectrum ℝ A₀.mat) := Set.toFinite _ generalize_proofs at *; ( - have h_cont : ContinuousOn g (spectrum ℝ A₀.val) := by - exact hg.mono hA₀ + have h_cont : ContinuousOn g (spectrum ℝ A₀.val) := hg.mono hA₀ generalize_proofs at *; ( have := @ContinuousMap.exists_restrict_eq ℝ; specialize this ( show IsClosed ( spectrum ℝ A₀.val ) from h_finite.isClosed ) ( ContinuousMap.mk ( fun x => g x ) <| by exact continuousOn_iff_continuous_restrict.mp h_cont ) ; rcases this with ⟨ h, hh ⟩ ; exact ⟨ h, h.continuous, fun x hx => by simpa using congr_arg ( fun f => f ⟨ x, hx ⟩ ) hh ⟩ ;)); @@ -762,8 +749,7 @@ lemma continuousWithinAt_cfc_of_continuousOn {T : Set ℝ} {g : ℝ → ℝ} simpa [ hh_eq y hy ] using h_diff_small.abs; have := Metric.tendsto_nhdsWithin_nhds.mp h_diff_small ( ε / ( Real.sqrt ( Fintype.card d ) + 1 ) ) ( div_pos ε_pos ( add_pos_of_nonneg_of_pos ( Real.sqrt_nonneg _ ) zero_lt_one ) ) ; aesop; choose! δ hδ_pos hδ using h_diff_small; - have h_finite : Set.Finite (spectrum ℝ A₀.mat) := by - exact Set.toFinite _; + have h_finite : Set.Finite (spectrum ℝ A₀.mat) := Set.toFinite _; obtain ⟨δ_min, hδ_min_pos, hδ_min⟩ : ∃ δ_min > 0, ∀ y ∈ spectrum ℝ A₀.mat, δ_min ≤ δ y := by by_cases h_empty : spectrum ℝ A₀.mat = ∅; · exact ⟨ 1, zero_lt_one, by simp [ h_empty ] ⟩; @@ -773,8 +759,7 @@ lemma continuousWithinAt_cfc_of_continuousOn {T : Set ℝ} {g : ℝ → ℝ} -- By the spectrum_subset_of_isOpen lemma, there exists a neighborhood U of A₀ such that the spectrum of B is within δ of the spectrum of A₀ for all B in U. obtain ⟨U, hU⟩ : ∃ U ∈ nhds A₀, ∀ B ∈ U, spectrum ℝ B.mat ⊆ {x | ∃ y ∈ spectrum ℝ A₀.mat, |x - y| < δ} := by have h_spectrum_subset : ∀ᶠ B in nhds A₀, spectrum ℝ B.mat ⊆ Metric.thickening δ (spectrum ℝ A₀.mat) := by - have h_open : IsOpen (Metric.thickening δ (spectrum ℝ A₀.mat)) := by - exact Metric.isOpen_thickening + have h_open : IsOpen (Metric.thickening δ (spectrum ℝ A₀.mat)) := Metric.isOpen_thickening have := spectrum_subset_of_isOpen A₀ ( Metric.thickening δ ( spectrum ℝ A₀.mat ) ) h_open ( Metric.self_subset_thickening δ_pos _ ) ; aesop; generalize_proofs at *; ( exact ⟨ _, h_spectrum_subset, fun B hB => fun x hx => by simpa [ dist_eq_norm ] using Metric.mem_thickening_iff.mp ( hB hx ) ⟩) @@ -876,8 +861,7 @@ lemma dist_lt_of_continuous_spectrum {X : Type*} [TopologicalSpace X] choose U_i V_i hU_i hV_i hx₀_i hV_i_i h_cont_i using h_cont; exact ⟨ U_i, V_i, hU_i, hV_i, hx₀_i, hV_i_i, h_cont_i ⟩ ;); -- The open set W := ⋃ᵢ V_i contains spectrum(A x₀) (since each λᵢ ∈ V_i and spectrum = range of eigenvalues). W is open as a union of open sets. set W := ⋃ i, V_i i with hW_def - have hW_open : IsOpen W := by - exact isOpen_iUnion hV_i + have hW_open : IsOpen W := isOpen_iUnion hV_i have hW_spectrum : spectrum ℝ (A x₀).mat ⊆ W := by intro t ht obtain ⟨i, hi⟩ : ∃ i, t = (A x₀).H.eigenvalues i := by @@ -886,8 +870,7 @@ lemma dist_lt_of_continuous_spectrum {X : Type*} [TopologicalSpace X] generalize_proofs at *; ( exact h_eigenvalues.subset ht |> Exists.imp fun i hi => hi.symm) aesop - have hW_subset : ∀ᶠ B in nhds (A x₀), spectrum ℝ B.mat ⊆ W := by - exact spectrum_subset_of_isOpen (A x₀) W hW_open hW_spectrum + have hW_subset : ∀ᶠ B in nhds (A x₀), spectrum ℝ B.mat ⊆ W := spectrum_subset_of_isOpen (A x₀) W hW_open hW_spectrum have hW_subset_S : ∀ᶠ y in nhdsWithin x₀ S, spectrum ℝ (A y).mat ⊆ W := by exact Filter.mem_of_superset ( hA₂.continuousWithinAt hx₀ |> fun h => h.eventually ( hW_subset ) ) fun y hy => hy obtain ⟨U', hU'⟩ : ∃ U' ∈ nhds x₀, ∀ y ∈ U' ∩ S, spectrum ℝ (A y).mat ⊆ W := by @@ -895,8 +878,7 @@ lemma dist_lt_of_continuous_spectrum {X : Type*} [TopologicalSpace X] obtain ⟨U'', hU''⟩ : ∃ U'' ∈ nhds x₀, ∀ i, U'' ⊆ U_i i := by exact ⟨ ⋂ i, U_i i, Filter.mem_of_superset ( Filter.iInter_mem.mpr fun i => IsOpen.mem_nhds ( hU_i i ) ( h_cont.1 i ) ) fun x hx => by aesop, fun i => Set.iInter_subset _ i ⟩ set U := U' ∩ U'' with hU_def - have hU_mem : U ∈ nhds x₀ := by - exact Filter.inter_mem hU'.1 hU''.1 + have hU_mem : U ∈ nhds x₀ := Filter.inter_mem hU'.1 hU''.1 have hU_subset : ∀ y ∈ U ∩ S, spectrum ℝ (A y).mat ⊆ W := by exact fun y hy => hU'.2 y ⟨ hy.1.1, hy.2 ⟩ |> Set.Subset.trans <| by simp [ hW_def ] ; have hU_cont : ∀ y ∈ U ∩ S, ∀ t ∈ spectrum ℝ (A y).mat, ‖f y t - f x₀ t‖ < ε := by @@ -1240,14 +1222,12 @@ theorem inv_ge_one_of_le_one (hA : A.mat.PosDef) (h : A ≤ 1) : 1 ≤ A⁻¹ := have h_cfc_nonneg : ∀ i, 0 ≤ (A.H.eigenvalues i)⁻¹ - 1 := by have h_pos : ∀ i, 0 < A.H.eigenvalues i ∧ A.H.eigenvalues i ≤ 1 := by -- Since $A$ is positive definite, all its eigenvalues are positive. - have h_pos : ∀ i, 0 < A.H.eigenvalues i := by - exact fun i => Matrix.PosDef.eigenvalues_pos hA i; + have h_pos : ∀ i, 0 < A.H.eigenvalues i := fun i => Matrix.PosDef.eigenvalues_pos hA i -- Since $A \leq 1$, for any eigenvalue $\lambda_i$ of $A$, we have $\lambda_i \leq 1$. have h_le_one : ∀ i, A.H.eigenvalues i ≤ 1 := by have h_le_one : ∀ i, A.H.eigenvalues i ≤ 1 := by intro i - have h_eigenvalue : A.mat.PosSemidef := by - exact hA.posSemidef + have h_eigenvalue : A.mat.PosSemidef := hA.posSemidef have h_eigenvalue_le_one : ∀ x : d → 𝕜, x ≠ 0 → (star x ⬝ᵥ A.mat.mulVec x) / (star x ⬝ᵥ x) ≤ 1 := by intro x hx_ne_zero have h_eigenvalue_le_one : (star x ⬝ᵥ (1 - A.mat).mulVec x) ≥ 0 := by @@ -1267,8 +1247,7 @@ theorem inv_ge_one_of_le_one (hA : A.mat.PosDef) (h : A ≤ 1) : 1 ≤ A⁻¹ := exact (cfc_nonneg_iff A fun x => x⁻¹ - 1).mpr h_cfc_nonneg; -- Since $A.cfc (fun x => x⁻¹ - 1) \geq 0$, we have $A.cfc (fun x => x⁻¹) \geq 1$. have h_cfc_ge_one : A.cfc (fun x => x⁻¹) ≥ 1 := by - have h_cfc_sub : A.cfc (fun x => x⁻¹ - 1) = A.cfc (fun x => x⁻¹) - A.cfc (fun _ => 1) := by - exact cfc_sub_apply A Inv.inv fun x => 1; + have h_cfc_sub : A.cfc (fun x => x⁻¹ - 1) = A.cfc (fun x => x⁻¹) - A.cfc (fun _ => 1) := cfc_sub_apply A Inv.inv fun x => 1; aesop; convert h_cfc_ge_one.le using 1; convert cfc_inv.symm; @@ -1366,8 +1345,7 @@ lemma ker_cfc_le_ker_on_set (A.cfc f).ker ≤ A.ker := by intro x hx have h_inner : ∀ i, A.H.eigenvalues i ≠ 0 → inner ℂ (A.H.eigenvectorBasis i) x = 0 := by - have h_inner_zero : (A.cfc f).mat.mulVec x = 0 := by - exact (mem_ker_iff_mulVec_zero (A.cfc f) x).mp hx + have h_inner_zero : (A.cfc f).mat.mulVec x = 0 := (mem_ker_iff_mulVec_zero (A.cfc f) x).mp hx have h_inner_zero_expansion : ∑ i, (f (A.H.eigenvalues i) : ℂ) • inner ℂ (A.H.eigenvectorBasis i) x • A.H.eigenvectorBasis i = 0 := by convert h_inner_zero using 1; rw [ cfc_mulVec_expansion ]; @@ -1390,8 +1368,7 @@ lemma ker_cfc_le_ker_on_set exact mem_ker_iff_mulVec_zero A x lemma ker_cfc_le_ker (h : ∀ i, f i = 0 → i = 0) : - (A.cfc f).ker ≤ A.ker := by - exact ker_cfc_le_ker_on_set (Set.subset_univ _) (by simpa using h) + (A.cfc f).ker ≤ A.ker := ker_cfc_le_ker_on_set (Set.subset_univ _) (by simpa using h) lemma ker_cfc_le_ker_nonneg (hA : 0 ≤ A) (h : ∀ i ≥ 0, f i = 0 → i = 0) : (A.cfc f).ker ≤ A.ker := by @@ -1403,8 +1380,7 @@ lemma ker_le_ker_cfc_on_set (hs : spectrum ℝ A.mat ⊆ s) (h : ∀ i ∈ s, i intro x hx have h_inner_zero : ∀ i, A.H.eigenvalues i ≠ 0 → inner ℂ (A.H.eigenvectorBasis i) x = 0 := by intro i hi - have h_inner_zero : A.mat.mulVec x = 0 := by - exact (mem_ker_iff_mulVec_zero A x).mp hx; + have h_inner_zero : A.mat.mulVec x = 0 := (mem_ker_iff_mulVec_zero A x).mp hx have := mulVec_eq_zero_iff_inner_eigenvector_zero A x; aesop; have h_mulVec_zero : (A.cfc f).mat.mulVec x = ∑ i, (f (A.H.eigenvalues i) : ℂ) • inner ℂ (A.H.eigenvectorBasis i) x • A.H.eigenvectorBasis i := by convert cfc_mulVec_expansion A f x using 1; @@ -1416,8 +1392,7 @@ lemma ker_le_ker_cfc_on_set (hs : spectrum ℝ A.mat ⊆ s) (h : ∀ i ∈ s, i exact Or.inl ( h _ ( hs (Matrix.IsHermitian.eigenvalues_mem_spectrum_real (H A) j ) ) hj ) lemma ker_le_ker_cfc (h : ∀ i, i = 0 → f i = 0) : - A.ker ≤ (A.cfc f).ker := by - exact ker_le_ker_cfc_on_set (Set.subset_univ _) (by simpa using h) + A.ker ≤ (A.cfc f).ker := ker_le_ker_cfc_on_set (Set.subset_univ _) (by simpa using h) lemma ker_le_ker_cfc_nonneg (hA : 0 ≤ A) (h : ∀ i ≥ 0, i = 0 → f i = 0) : A.ker ≤ (A.cfc f).ker := by diff --git a/QuantumInfo/ForMathlib/HermitianMat/Inner.lean b/QuantumInfo/ForMathlib/HermitianMat/Inner.lean index a7278fad0..d30f0d640 100644 --- a/QuantumInfo/ForMathlib/HermitianMat/Inner.lean +++ b/QuantumInfo/ForMathlib/HermitianMat/Inner.lean @@ -45,8 +45,7 @@ instance : Inner R (HermitianMat n α) where inner A B := selfadjMap (A.mat * B.mat).trace theorem inner_def (A B : HermitianMat n α) : - ⟪A, B⟫_R = selfadjMap (A.mat * B.mat).trace := by - rfl + ⟪A, B⟫_R = selfadjMap (A.mat * B.mat).trace := rfl end defs section semiring @@ -64,12 +63,10 @@ protected theorem inner_add_left : ⟪A + B, C⟫_R = ⟪A, C⟫_R + ⟪B, C⟫_ simp [inner_def, right_distrib] @[simp] -protected theorem inner_zero_right : ⟪A, 0⟫_R = 0 := by - simp [inner_def] +protected theorem inner_zero_right : ⟪A, 0⟫_R = 0 := by simp [inner_def] @[simp] -protected theorem inner_zero_left : ⟪0, A⟫_R = 0 := by - simp [inner_def] +protected theorem inner_zero_left : ⟪0, A⟫_R = 0 := by simp [inner_def] end semiring section ring @@ -78,12 +75,10 @@ variable [CommRing R] [Ring α] [StarAddMonoid α] [Algebra R α] [IsMaximalSelf variable (A B C : HermitianMat n α) @[simp] -protected theorem inner_neg_left : ⟪-A, B⟫_R = -⟪A, B⟫_R := by - simp [inner_def] +protected theorem inner_neg_left : ⟪-A, B⟫_R = -⟪A, B⟫_R := by simp [inner_def] @[simp] -protected theorem inner_neg_right : ⟪A, -B⟫_R = -⟪A, B⟫_R := by - simp [inner_def] +protected theorem inner_neg_right : ⟪A, -B⟫_R = -⟪A, B⟫_R := by simp [inner_def] protected theorem inner_sub_left : ⟪A, B - C⟫_R = ⟪A, B⟫_R - ⟪A, C⟫_R := by simp [inner_def, mul_sub] @@ -119,12 +114,10 @@ variable [CommSemiring R] [Ring α] [StarRing α] [Algebra R α] [IsMaximalSelfA variable (A B : HermitianMat n α) @[simp] -theorem inner_one : ⟪A, 1⟫_R = A.trace := by - simp only [inner_def, mat_one, mul_one, trace] +theorem inner_one : ⟪A, 1⟫_R = A.trace := by simp only [inner_def, mat_one, mul_one, trace] @[simp] -theorem one_inner : ⟪1, A⟫_R = A.trace := by - simp only [inner_def, one_mul, mat_one, trace] +theorem one_inner : ⟪1, A⟫_R = A.trace := by simp only [inner_def, one_mul, mat_one, trace] end starring section commring @@ -140,8 +133,7 @@ theorem inner_eq_trace_mul : algebraMap R α ⟪A, B⟫_R = (A.mat * B.mat).trac rw [Finset.sum_comm] congr! <;> apply congrFun₂ (H _) -theorem inner_comm : ⟪A, B⟫_R = ⟪B, A⟫_R := by - rw [inner_def, inner_def, Matrix.trace_mul_comm] +theorem inner_comm : ⟪A, B⟫_R = ⟪B, A⟫_R := by rw [inner_def, inner_def, Matrix.trace_mul_comm] end commring @@ -151,8 +143,7 @@ variable (A B : HermitianMat n α) /-- `HermitianMat.inner` reduces to `Matrix.trace (A * B)` when the elements are a `TrivialStar`. -/ theorem inner_eq_trace_trivial : ⟪A, B⟫_α = (A.mat * B.mat).trace := by - rw [← inner_eq_trace_mul] - rfl + simpa using inner_eq_trace_mul A B end trivialstar @@ -162,8 +153,7 @@ open ComplexOrder variable {n 𝕜 : Type*} [Fintype n] [RCLike 𝕜] (A B C : HermitianMat n 𝕜) -theorem inner_eq_re_trace : ⟪A, B⟫ = RCLike.re (A.mat * B.mat).trace := by - rfl +theorem inner_eq_re_trace : ⟪A, B⟫ = RCLike.re (A.mat * B.mat).trace := rfl theorem inner_eq_trace_rc : ⟪A, B⟫ = (A.mat * B.mat).trace := by rw [inner_eq_re_trace, ← RCLike.conj_eq_iff_re] @@ -201,8 +191,7 @@ theorem inner_mono (hA : 0 ≤ A) : B ≤ C → ⟪A, B⟫ ≤ ⟪A, C⟫ := by theorem inner_mono' (hA : 0 ≤ A) : B ≤ C → ⟪B, A⟫ ≤ ⟪C, A⟫ := by intro hBC - rw [inner_comm B A, inner_comm C A] - exact inner_mono hA hBC + simpa [inner_comm B A, inner_comm C A] using inner_mono hA hBC /-- The inner product for PSD matrices is at most the product of their traces. -/ theorem inner_le_mul_trace (hA : 0 ≤ A) (hB : 0 ≤ B) : ⟪A, B⟫ ≤ A.trace * B.trace := by diff --git a/QuantumInfo/ForMathlib/HermitianMat/Jordan.lean b/QuantumInfo/ForMathlib/HermitianMat/Jordan.lean index cf43f296d..1f6dbf8ab 100644 --- a/QuantumInfo/ForMathlib/HermitianMat/Jordan.lean +++ b/QuantumInfo/ForMathlib/HermitianMat/Jordan.lean @@ -37,16 +37,13 @@ theorem symmMul_comm : A.symmMul B = B.symmMul A := by rw [symmMul, symmMul, Subtype.mk.injEq, add_comm] @[simp] -theorem symmMul_zero : A.symmMul 0 = 0:= by - simp [symmMul] +theorem symmMul_zero : A.symmMul 0 = 0:= by simp [symmMul] @[simp] -theorem zero_symmMul : symmMul 0 A = 0 := by - simp [symmMul] +theorem zero_symmMul : symmMul 0 A = 0 := by simp [symmMul] theorem symmMul_toMat : (A.symmMul B).mat = - (2 : 𝕜)⁻¹ • (A.mat * B.mat + B.mat * A.mat) := by - rfl + (2 : 𝕜)⁻¹ • (A.mat * B.mat + B.mat * A.mat) := rfl variable [Invertible (2 : 𝕜)] @@ -58,8 +55,7 @@ theorem symmMul_of_commute (hAB : Commute A.mat B.mat) : rw [smul_add, ← add_smul, inv_eq_one_div, ← add_div] rw [add_self_div_two, one_smul] -theorem symmMul_self : (symmMul A A).mat = A.mat * A.mat := by - simp +theorem symmMul_self : (symmMul A A).mat = A.mat * A.mat := by simp variable [DecidableEq d] @@ -97,8 +93,7 @@ scoped instance : CommMagma (HermitianMat d 𝕜) where -- scoped instance : Mul (HermitianMat d 𝕜) := -- CommMagma.toMul -theorem mul_eq_symmMul : A * B = A.symmMul B := by - rfl +theorem mul_eq_symmMul : A * B = A.symmMul B := rfl scoped instance : IsCommJordan (HermitianMat d 𝕜) where lmul_comm_rmul_rmul a b := by diff --git a/QuantumInfo/ForMathlib/HermitianMat/LiebConcavity.lean b/QuantumInfo/ForMathlib/HermitianMat/LiebConcavity.lean index db26cb40e..e649e19ff 100644 --- a/QuantumInfo/ForMathlib/HermitianMat/LiebConcavity.lean +++ b/QuantumInfo/ForMathlib/HermitianMat/LiebConcavity.lean @@ -98,8 +98,7 @@ lemma Φ_mem_pdSet [Nonempty d] (A : HermitianMat d ℂ) (hA : A.mat.PosDef) : set_option synthInstance.maxHeartbeats 80000 in /-- `Φ` commutes with CFC for Hermitian matrices. -/ lemma Φ_cfc (A : HermitianMat d ℂ) (f : ℝ → ℝ) : - Φ (cfc f A.mat) = cfc f (Φ A.mat) := by - exact StarAlgHomClass.map_cfc Φ f A.mat (hφ := Φ_continuous) + Φ (cfc f A.mat) = cfc f (Φ A.mat) := StarAlgHomClass.map_cfc Φ f A.mat (hφ := Φ_continuous) (ha := A.H.isSelfAdjoint) set_option synthInstance.maxHeartbeats 80000 in @@ -120,8 +119,7 @@ lemma trace_Φ_eq (M : Matrix d d ℂ) : /-- `traceRe(Φ(M)) = re(Tr[M])` for any matrix M. -/ lemma traceRe_Φ_general (M : Matrix d d ℂ) : - traceRe (Φ M) = Complex.re M.trace := by - simp [traceRe, trace_Φ_eq] + traceRe (Φ M) = Complex.re M.trace := by simp [traceRe, trace_Φ_eq] end HermitianMatBridge @@ -183,8 +181,7 @@ omit [Fintype d] in /-- σ + εI → σ as ε → 0+. -/ private lemma tendsto_add_eps (σ : HermitianMat d ℂ) : Filter.Tendsto (fun ε : ℝ ↦ σ + ε • (1 : HermitianMat d ℂ)) - (nhdsWithin 0 (Set.Ioi 0)) (nhds σ) := by - exact tendsto_nhdsWithin_of_tendsto_nhds + (nhdsWithin 0 (Set.Ioi 0)) (nhds σ) := tendsto_nhdsWithin_of_tendsto_nhds (Continuous.tendsto' (by continuity) _ _ (by simp)) /-! ### Helper lemmas for the core concavity proof -/ @@ -255,8 +252,7 @@ private lemma variational_eq_optimizer have h_exp : (X ^ p) ^ ((p - 1) / p) = X ^ (p - 1) := by rw [← rpow_mul hX, mul_div_cancel₀ _ (by positivity)] have h_inner : ⟪X, X ^ (p - 1)⟫_ℝ = (X ^ p).trace := by - have h_inner : ⟪X, X ^ (p - 1)⟫_ℝ = (X * (X ^ (p - 1)).mat).trace.re := by - exact Real.ext_cauchy rfl + have h_inner : ⟪X, X ^ (p - 1)⟫_ℝ = (X * (X ^ (p - 1)).mat).trace.re := Real.ext_cauchy rfl convert h_inner using 1 have h_exp : (X ^ p).mat = X.mat * (X ^ (p - 1)).mat := by convert mat_rpow_add hX _ @@ -294,8 +290,7 @@ private lemma liebExtension_bridge [Nonempty d] rw [← traceRe_Φ_general] simp [liebExtensionTraceMap, Φ_rpow, hσ, hZ] rw [show star (Φ K.mat) = Φ K.mat from ?_] - have h_rewrite : IsSelfAdjoint (Φ K.mat) := by - exact Φ_isSelfAdjoint K + have h_rewrite : IsSelfAdjoint (Φ K.mat) := Φ_isSelfAdjoint K exact h_rewrite convert! h_joint_concave (Φ_mem_pdSet σ₁ hσ₁) (Φ_mem_pdSet σ₂ hσ₂) (Φ_mem_pdSet Z₁ hZ₁) (Φ_mem_pdSet Z₂ hZ₂) hθ₀ hθ₁ using 1 @@ -363,9 +358,8 @@ private lemma liebExtension_bridge_psd [Nonempty d] open scoped Topology in have h_cont : ∀ (ε : ℝ), 0 < ε → (1 - θ) * ⟪(σ₁ ^ q).conj K, (Z₁ + ε • 1) ^ r⟫_ℝ + θ * ⟪(σ₂ ^ q).conj K, (Z₂ + ε • 1) ^ r⟫_ℝ ≤ ⟪(((1 - θ) • σ₁ + θ • σ₂) ^ q).conj K, - ((1 - θ) • (Z₁ + ε • 1) + θ • (Z₂ + ε • 1)) ^ r⟫_ℝ := by - intro ε hε_pos - exact liebExtension_bridge hq hr hqr K σ₁ σ₂ (Z₁ + ε • 1) (Z₂ + ε • 1) hσ₁ hσ₂ + ((1 - θ) • (Z₁ + ε • 1) + θ • (Z₂ + ε • 1)) ^ r⟫_ℝ := fun ε hε_pos => + liebExtension_bridge hq hr hqr K σ₁ σ₂ (Z₁ + ε • 1) (Z₂ + ε • 1) hσ₁ hσ₂ (psd_add_eps_posdef Z₁ hZ₁ ε hε_pos) (psd_add_eps_posdef Z₂ hZ₂ ε hε_pos) θ hθ₀ hθ₁ -- Apply the continuity results to take the limit as ε approaches 0. have h_lim : @@ -481,8 +475,7 @@ private lemma trace_conj_rpow_concave_pd [Nonempty d] {α : ℝ} (hα : 1 < α) rw [trace_lin] linarith [mul_le_mul_of_nonneg_left bridge hp_pos.le] _ ≤ (X_mix ^ p).trace := by - rw [hr_eq] - exact variational_lower_bound X_mix (a • Z₁ + b • Z₂) hX_mix hZ_mix hp_gt1 + simpa [hr_eq] using variational_lower_bound X_mix (a • Z₁ + b • Z₂) hX_mix hZ_mix hp_gt1 end VariationalAndBridge diff --git a/QuantumInfo/ForMathlib/HermitianMat/LogExp.lean b/QuantumInfo/ForMathlib/HermitianMat/LogExp.lean index 36063f7c9..6d5e0e6a0 100644 --- a/QuantumInfo/ForMathlib/HermitianMat/LogExp.lean +++ b/QuantumInfo/ForMathlib/HermitianMat/LogExp.lean @@ -48,27 +48,23 @@ def exp (A : HermitianMat d 𝕜) : HermitianMat d 𝕜 := /-- Primed because `Commute.exp_left` refers to `NormedSpace.exp` instead of `HermitianMat.exp`. -/ @[aesop unsafe apply 50% (rule_sets := [Commutes])] theorem _root_.Commute.exp_left' (hAB : Commute A.mat B.mat) : - Commute (A.exp).mat B.mat := by - rw [exp]; commutes + Commute (A.exp).mat B.mat := by rw [exp]; commutes /-- Primed because `Commute.exp_right` refers to `NormedSpace.exp` instead of `HermitianMat.exp`. -/ @[aesop unsafe apply 50% (rule_sets := [Commutes])] theorem _root_.Commute.exp_right' (hAB : Commute A.mat B.mat) : - Commute A.mat (B.exp).mat := by - rw [exp]; commutes + Commute A.mat (B.exp).mat := by rw [exp]; commutes @[simp] theorem reindex_exp (e : d ≃ d₂) : (A.reindex e).exp = A.exp.reindex e := cfc_reindex A Real.exp e variable (A) in -instance nonSingular_exp : NonSingular A.exp := by - exact cfc_nonSingular A Real.exp (fun i ↦ by positivity) +instance nonSingular_exp : NonSingular A.exp := cfc_nonSingular A Real.exp (fun i ↦ by positivity) /-- The matrix exponential of a Hermitian matrix is nonnegative. -/ theorem exp_nonneg (A : HermitianMat d 𝕜) : 0 ≤ A.exp := by - rw [exp, HermitianMat.cfc_nonneg_iff] - exact fun i ↦ le_of_lt (Real.exp_pos _) + simpa [exp, HermitianMat.cfc_nonneg_iff] using fun i ↦ le_of_lt (Real.exp_pos _) /-- The matrix exponential of a Hermitian matrix is strictly positive (Loewner order). Requires `Nonempty` since over an empty index type every matrix equals zero and `0 < 0` @@ -104,25 +100,21 @@ def log (A : HermitianMat d 𝕜) : HermitianMat d 𝕜 := @[aesop unsafe apply 50% (rule_sets := [Commutes])] theorem _root_.Commute.log_left (hAB : Commute A.mat B.mat) : - Commute (A.log).mat B.mat := by - rw [log]; commutes + Commute (A.log).mat B.mat := by rw [log]; commutes @[aesop unsafe apply 50% (rule_sets := [Commutes])] theorem _root_.Commute.log_right (hAB : Commute A.mat B.mat) : - Commute A.mat (B.log).mat := by - rw [log]; commutes + Commute A.mat (B.log).mat := by rw [log]; commutes @[simp] theorem reindex_log (e : d ≃ d₂) : (A.reindex e).log = A.log.reindex e := cfc_reindex A Real.log e @[simp] -theorem log_zero : (0 : HermitianMat d 𝕜).log = 0 := by - simp [log] +theorem log_zero : (0 : HermitianMat d 𝕜).log = 0 := by simp [log] @[simp] -theorem log_one : (1 : HermitianMat d 𝕜).log = 0 := by - simp [log] +theorem log_one : (1 : HermitianMat d 𝕜).log = 0 := by simp [log] theorem log_smul_of_pos (A : HermitianMat d 𝕜) (hx : x ≠ 0) : (x • A).log = Real.log x • A.supportProj + A.log := by @@ -131,8 +123,7 @@ theorem log_smul_of_pos (A : HermitianMat d 𝕜) (hx : x ≠ 0) : simp [cfc, log, supportProj_eq_cfc] theorem log_smul {A : HermitianMat d 𝕜} {x : ℝ} (hx : x ≠ 0) [NonSingular A] : - (x • A).log = Real.log x • 1 + A.log := by - simp [log_smul_of_pos A hx] + (x • A).log = Real.log x • 1 + A.log := by simp [log_smul_of_pos A hx] /- The inverse function is operator antitone for positive definite matrices. @@ -365,9 +356,8 @@ theorem logApprox_eq_log_add_error convert! logApprox_eq_cfc_scalar x hx T hT using 1; apply cfc_congr_of_posDef hx; exact fun u hu => Eq.symm ( scalarLogApprox_eq u T hu.out hT ); - have h_cfc_add : x.cfc (fun u => Real.log u + Real.log ((1 + T) / (u + T))) = x.cfc Real.log + x.cfc (fun u => Real.log ((1 + T) / (u + T))) := by - apply cfc_add; - exact h_logApprox.trans h_cfc_add + exact h_logApprox.trans (cfc_add (A := x) (f := Real.log) + (g := fun u => Real.log ((1 + T) / (u + T)))) open ComplexOrder Filter Topology in open scoped Matrix.Norms.Frobenius in @@ -448,8 +438,7 @@ lemma inv_convex {x y : HermitianMat d 𝕜} (hx : x.mat.PosDef) (hy : y.mat.Pos have h_block_pos : ∀ A : Matrix d d 𝕜, A.PosDef → (Matrix.fromBlocks A 1 1 A⁻¹).PosSemidef := by intro A hA have h_block_pos : (Matrix.fromBlocks A (1 : Matrix d d 𝕜) (1 : Matrix d d 𝕜) (A⁻¹)).PosSemidef := by - have h_inv_pos : A⁻¹.PosSemidef := by - exact hA.inv.posSemidef + have h_inv_pos : A⁻¹.PosSemidef := hA.inv.posSemidef have h_block_pos : (Matrix.fromBlocks A (1 : Matrix d d 𝕜) (1 : Matrix d d 𝕜) (A⁻¹)) = (Matrix.fromBlocks 1 0 A⁻¹ 1) * (Matrix.fromBlocks A 0 0 (A⁻¹ - A⁻¹ * A * A⁻¹)) * (Matrix.fromBlocks 1 A⁻¹ 0 1) := by simp [ Matrix.fromBlocks_multiply ]; have := hA.det_pos; @@ -629,8 +618,7 @@ lemma log_kron_diagonal {m n 𝕜 : Type*} [Fintype m] [DecidableEq m] [Fintype {d₁ : m → ℝ} {d₂ : n → ℝ} (h₁ : ∀ i, 0 < d₁ i) (h₂ : ∀ j, 0 < d₂ j) : (diagonal 𝕜 d₁ ⊗ₖ diagonal 𝕜 d₂).log = (diagonal 𝕜 d₁).log ⊗ₖ 1 + 1 ⊗ₖ (diagonal 𝕜 d₂).log := by - have h_eq : (diagonal 𝕜 d₁ ⊗ₖ diagonal 𝕜 d₂) = (diagonal 𝕜 (fun (i : m × n) => d₁ i.1 * d₂ i.2)) := by - exact kronecker_diagonal d₁ d₂ + have h_eq : (diagonal 𝕜 d₁ ⊗ₖ diagonal 𝕜 d₂) = (diagonal 𝕜 (fun (i : m × n) => d₁ i.1 * d₂ i.2)) := kronecker_diagonal d₁ d₂ convert congr_arg _ h_eq using 1; -- By definition of logarithm, we can rewrite the right-hand side. have h_rhs : (diagonal 𝕜 (fun (i : m × n) => d₁ i.1 * d₂ i.2)).log = @@ -665,8 +653,7 @@ lemma log_conj_unitary (A : HermitianMat d 𝕜) (U : Matrix.unitaryGroup d 𝕜 open RealInnerProductSpace in theorem inner_log_smul_of [NonSingular A] {x : ℝ} (hx : x ≠ 0) : - ⟪(x • A).log, B⟫ = Real.log x * B.trace + ⟪A.log, B⟫ := by - simp [log_smul hx, inner_add_left] + ⟪(x • A).log, B⟫ = Real.log x * B.trace + ⟪A.log, B⟫ := by simp [log_smul hx, inner_add_left] section kron diff --git a/QuantumInfo/ForMathlib/HermitianMat/NonSingular.lean b/QuantumInfo/ForMathlib/HermitianMat/NonSingular.lean index 94b66f777..175ed0757 100644 --- a/QuantumInfo/ForMathlib/HermitianMat/NonSingular.lean +++ b/QuantumInfo/ForMathlib/HermitianMat/NonSingular.lean @@ -135,9 +135,7 @@ theorem nonSingular_iff_neg : NonSingular (-A) ↔ NonSingular A := by simp [nonSingular_iff_det_ne_zero, Matrix.det_neg] @[simp] -theorem nonSingular_iff_inv : NonSingular (A⁻¹) ↔ NonSingular A := by - rw [nonsingular_iff_isUnit, nonsingular_iff_isUnit] - exact Matrix.isUnit_nonsing_inv_iff +theorem nonSingular_iff_inv : NonSingular (A⁻¹) ↔ NonSingular A := by simp [nonsingular_iff_isUnit] @[simp] theorem nonSingular_iff_kronecker [Nonempty n] [Nonempty m] : @@ -163,22 +161,17 @@ theorem nonSingular_empty [IsEmpty n] : NonSingular A := by variable [NonSingular A] [NonSingular B] -theorem nonSingular_det_ne_zero : A.mat.det ≠ 0 := by - rwa [← nonSingular_iff_det_ne_zero] +theorem nonSingular_det_ne_zero : A.mat.det ≠ 0 := by rwa [← nonSingular_iff_det_ne_zero] @[simp] -theorem nonSingular_ker_bot : A.ker = ⊥ := by - rwa [← nonSingular_iff_ker_bot] +theorem nonSingular_ker_bot : A.ker = ⊥ := by rwa [← nonSingular_iff_ker_bot] @[simp] -theorem nonSingular_support_top : A.support = ⊤ := by - rwa [← nonSingular_iff_support_top] +theorem nonSingular_support_top : A.support = ⊤ := by rwa [← nonSingular_iff_support_top] -instance nonSingular_neg : NonSingular (-A) := by - rwa [nonSingular_iff_neg] +instance nonSingular_neg : NonSingular (-A) := by rwa [nonSingular_iff_neg] -instance nonSingular_inv : NonSingular (A⁻¹) := by - rwa [nonSingular_iff_inv] +instance nonSingular_inv : NonSingular (A⁻¹) := by rwa [nonSingular_iff_inv] instance nonSingular_kron [Nonempty n] [Nonempty m] : NonSingular (A ⊗ₖ B) := nonSingular_iff_kronecker.mpr ⟨inferInstance, inferInstance⟩ @@ -187,8 +180,7 @@ theorem nonSingular_conj (hC : IsUnit C) : NonSingular (A.conj C) := by rwa [nonSingular_iff_conj hC] instance nonSingular_conj_isometry {B : HermitianMat n 𝕜} [NonSingular B] : - NonSingular (A.conj B.mat) := by - simpa [nonSingular_iff_conj] + NonSingular (A.conj B.mat) := by simpa [nonSingular_iff_conj] theorem nonSingular_zero_notMem_spectrum : 0 ∉ spectrum ℝ A.mat := by rwa [← nonSingular_iff_zero_notMem_spectrum] diff --git a/QuantumInfo/ForMathlib/HermitianMat/Order.lean b/QuantumInfo/ForMathlib/HermitianMat/Order.lean index 5f31efe28..12e1d4a03 100644 --- a/QuantumInfo/ForMathlib/HermitianMat/Order.lean +++ b/QuantumInfo/ForMathlib/HermitianMat/Order.lean @@ -31,21 +31,17 @@ instance : IsOrderedAddMonoid (HermitianMat n 𝕜) := inferInstanceAs (IsOrderedAddMonoid (selfAdjoint _)) omit [Fintype n] in -theorem le_iff : A ≤ B ↔ (B - A).mat.PosSemidef := by - rfl +theorem le_iff : A ≤ B ↔ (B - A).mat.PosSemidef := Iff.rfl omit [Fintype n] in -theorem zero_le_iff : 0 ≤ A ↔ A.mat.PosSemidef := by - rw [le_iff, sub_zero] +theorem zero_le_iff : 0 ≤ A ↔ A.mat.PosSemidef := by rw [le_iff, sub_zero] theorem le_iff_mulVec_le : A ≤ B ↔ ∀ x, star x ⬝ᵥ A.mat *ᵥ x ≤ star x ⬝ᵥ B.mat *ᵥ x := by simp [le_iff, Matrix.posSemidef_iff_dotProduct_mulVec, B.H.sub A.H, Matrix.sub_mulVec] instance [DecidableEq n] : ZeroLEOneClass (HermitianMat n 𝕜) where - zero_le_one := by - rw [zero_le_iff] - exact Matrix.PosSemidef.one + zero_le_one := by simpa [zero_le_iff] using Matrix.PosSemidef.one omit [Fintype n] in theorem lt_iff_posdef : A < B ↔ (B - A).mat.PosSemidef ∧ A ≠ B := @@ -54,8 +50,7 @@ theorem lt_iff_posdef : A < B ↔ (B - A).mat.PosSemidef ∧ A ≠ B := instance : IsStrictOrderedModule ℝ (HermitianMat n 𝕜) where smul_lt_smul_of_pos_left a ha b b₂ hb := by rw [HermitianMat.lt_iff_posdef] at hb ⊢ - simp only [← smul_sub, ne_eq, smul_right_inj ha.ne'] - exact ⟨hb.left.smul ha.le, hb.right⟩ + simpa only [← smul_sub, ne_eq, smul_right_inj ha.ne'] using ⟨hb.left.smul ha.le, hb.right⟩ smul_lt_smul_of_pos_right a ha b b2 hb := by rw [HermitianMat.lt_iff_posdef] at ha ⊢ rw [sub_zero] at ha @@ -75,8 +70,7 @@ theorem posSemidef_iff_spectrum_Ici [DecidableEq n] (A : HermitianMat n 𝕜) : simp [A.H, Set.Ici.eq_1] theorem posSemidef_iff_spectrum_nonneg [DecidableEq n] (A : HermitianMat n 𝕜) : - 0 ≤ A ↔ ∀ x ∈ spectrum ℝ A.mat, 0 ≤ x := by - exact A.posSemidef_iff_spectrum_Ici + 0 ≤ A ↔ ∀ x ∈ spectrum ℝ A.mat, 0 ≤ x := A.posSemidef_iff_spectrum_Ici theorem trace_nonneg (hA : 0 ≤ A) : 0 ≤ A.trace := by exact (RCLike.nonneg_iff.mp (zero_le_iff.mp hA).trace_nonneg).1 @@ -136,8 +130,7 @@ theorem kronecker_self_mono (hA : 0 ≤ A) (hB : 0 ≤ B) (hAB : A ≤ B) : (HermitianMat.kronecker_add (A := A) (B := B) (C := -A)).symm have hEq : B ⊗ₖ B - A ⊗ₖ A = A ⊗ₖ (B - A) + (B - A) ⊗ₖ B := by calc - B ⊗ₖ B - A ⊗ₖ A = (A + (B - A)) ⊗ₖ B - A ⊗ₖ A := by - rw [show A + (B - A) = B by abel] + B ⊗ₖ B - A ⊗ₖ A = (A + (B - A)) ⊗ₖ B - A ⊗ₖ A := by rw [show A + (B - A) = B by abel] _ = (A ⊗ₖ B + (B - A) ⊗ₖ B) - A ⊗ₖ A := by rw [HermitianMat.add_kronecker] _ = (A ⊗ₖ B + -(A ⊗ₖ A)) + (B - A) ⊗ₖ B := by abel _ = A ⊗ₖ (B - A) + (B - A) ⊗ₖ B := by rw [hAC] @@ -157,8 +150,7 @@ theorem kronecker_pos {A : HermitianMat m 𝕜} (hA : 0 < A) (hB : 0 < B) : 0 < omit [Fintype n] in open MatrixOrder in -theorem posSemidef_to_nonneg {A : Matrix n n 𝕜} (hA : A.PosSemidef) : 0 ≤ A := by - exact hA.nonneg +theorem posSemidef_to_nonneg {A : Matrix n n 𝕜} (hA : A.PosSemidef) : 0 ≤ A := hA.nonneg open MatrixOrder in theorem posDef_to_pos {A : Matrix n n 𝕜} (hA : A.PosDef) [Nonempty n] : 0 < A := by @@ -237,8 +229,7 @@ omit [Fintype n] in theorem mat_posSemidef_to_nonneg (hA : A.mat.PosSemidef) : 0 ≤ A := zero_le_iff.mpr hA -theorem mat_posDef_to_pos [Nonempty n] (hA : A.mat.PosDef) : 0 < A := by - exact posDef_to_pos hA +theorem mat_posDef_to_pos [Nonempty n] (hA : A.mat.PosDef) : 0 < A := posDef_to_pos hA open Lean Meta in /-- Given an expression `e` (a `HermitianMat`) and a proof expression `p` whose type may be @@ -347,27 +338,21 @@ meta def evalHermitianMatConj : PositivityExt where eval {_u _α} _zα _pα e := pure (.nonnegative (← mkAppM ``HermitianMat.conj_nonneg #[M, pfNonneg])) open MatrixOrder in -example {A : Matrix n n ℂ} (hA : A.PosSemidef) : 0 ≤ A := by - positivity +example {A : Matrix n n ℂ} (hA : A.PosSemidef) : 0 ≤ A := by positivity open MatrixOrder in -example {A : Matrix n n ℂ} [Nonempty n] (hA : A.PosDef) : 0 < A := by - positivity +example {A : Matrix n n ℂ} [Nonempty n] (hA : A.PosDef) : 0 < A := by positivity -example (hA : A.mat.PosSemidef) : 0 ≤ A := by - positivity +example (hA : A.mat.PosSemidef) : 0 ≤ A := by positivity -example [Nonempty n] (hA : A.mat.PosDef) : 0 < A := by - positivity +example [Nonempty n] (hA : A.mat.PosDef) : 0 < A := by positivity example [DecidableEq n] [DecidableEq m] [Nonempty n] [Nonempty m] (A B : HermitianMat n ℂ) (hA : 0 ≤ A) (hB : 0 ≤ B) (M : Matrix m n ℂ) : - 0 < (2 : HermitianMat (n × m) ℂ) + (3 • A) ⊗ₖ (Real.pi • B).conj M := by - positivity + 0 < (2 : HermitianMat (n × m) ℂ) + (3 • A) ⊗ₖ (Real.pi • B).conj M := by positivity example (A B : HermitianMat n ℂ) (hA : 0 < A) (hB : 0 < B) : - 0 < ((37 • A) ⊗ₖ ((38 : ℝ) • B)).trace := by - positivity + 0 < ((37 • A) ⊗ₖ ((38 : ℝ) • B)).trace := by positivity omit [Fintype n] in theorem convex_cone (hA : 0 ≤ A) (hB : 0 ≤ B) {c₁ c₂ : ℝ} (hc₁ : 0 ≤ c₁) (hc₂ : 0 ≤ c₂) : @@ -497,8 +482,7 @@ theorem ker_conj [DecidableEq n] (hA : 0 ≤ A) (B : Matrix n n 𝕜) : · exact Eq.symm (LinearMap.map_zero (Matrix.toEuclideanLin B)) theorem ker_le_of_le_smul {α : ℝ} [DecidableEq n] (hα : α ≠ 0) (hA : 0 ≤ A) (hAB : A ≤ α • B) : B.ker ≤ A.ker := by - rw [← ker_pos_smul B hα] - exact ker_antitone hA hAB + simpa [← ker_pos_smul B hα] using ker_antitone hA hAB /-- If a Hermitian matrix is bounded by `M * I`, then all its eigenvalues are at most `M`. -/ theorem le_smul_one_imp_eigenvalues_le [DecidableEq n] (A : HermitianMat n ℂ) (M : ℝ) @@ -525,9 +509,8 @@ open MatrixOrder in /-- If all eigenvalues of a Hermitian matrix are at most `M`, then it is bounded by `M * I`. -/ theorem eigenvalues_le_imp_le_smul_one [DecidableEq n] (A : HermitianMat n ℂ) (M : ℝ) (h : ∀ i, A.H.eigenvalues i ≤ M) : - A ≤ M • (1 : HermitianMat n ℂ) := by - exact - (Matrix.PosSemidef.le_smul_one_of_eigenvalues_iff A.H M).mp h + A ≤ M • (1 : HermitianMat n ℂ) := + (Matrix.PosSemidef.le_smul_one_of_eigenvalues_iff A.H M).mp h --TODO: Positivity extensions for traceLeft, traceRight, rpow, nat powers, inverse function, -- the various `proj` function (in Proj.lean), and the inner product. @@ -651,8 +634,7 @@ variable [DecidableEq n] [DecidableEq m] open MatrixOrder -- Test: eigenvalues nonneg from PSD HermitianMat -example (A : HermitianMat n ℂ) (hA : 0 < A) (i : n) : 0 ≤ A.H.eigenvalues i := by - positivity +example (A : HermitianMat n ℂ) (hA : 0 < A) (i : n) : 0 ≤ A.H.eigenvalues i := by positivity -- Test: A.mat nonneg from A nonneg example (A : HermitianMat n ℂ) (hA : 0 ≤ A) : 0 ≤ A.mat := by positivity @@ -677,8 +659,7 @@ example (M : Matrix n m ℝ) : positivity example (M : Matrix n n ℂ) (i : n) (A : HermitianMat n ℂ) (hA : 0 ≤ A) : - 0 ≤ (A + ⟨_, M.isHermitian_mul_conjTranspose_self⟩ + 0).H.eigenvalues i := by - positivity + 0 ≤ (A + ⟨_, M.isHermitian_mul_conjTranspose_self⟩ + 0).H.eigenvalues i := by positivity end tests end MatrixPositivity diff --git a/QuantumInfo/ForMathlib/HermitianMat/Peierls.lean b/QuantumInfo/ForMathlib/HermitianMat/Peierls.lean index 5db4fab2e..6ad270653 100644 --- a/QuantumInfo/ForMathlib/HermitianMat/Peierls.lean +++ b/QuantumInfo/ForMathlib/HermitianMat/Peierls.lean @@ -116,8 +116,7 @@ theorem trace_function_convex_univ (g : ℝ → ℝ) (hg : ConvexOn ℝ Set.univ -- Let $C = aA + bB$. set C : HermitianMat d ℂ := a • A + b • B -- By the properties of the trace and the convexity of $g$, we have: - have h_trace : (C.cfc g).trace = ∑ i, g (C.H.eigenvalues i) := by - exact trace_cfc_eq C g + have h_trace : (C.cfc g).trace = ∑ i, g (C.H.eigenvalues i) := trace_cfc_eq C g have h_sum : ∑ i, g (C.H.eigenvalues i) ≤ a * ∑ i, g ((A.conj (star C.H.eigenvectorUnitary.val)).mat i i).re + b * ∑ i, g ((B.conj (star C.H.eigenvectorUnitary.val)).mat i i |> Complex.re) := by @@ -174,8 +173,7 @@ theorem trace_function_convex_ici {g : ℝ → ℝ} (hg : ConvexOn ℝ (Set.Ici -- Let $C = aA + bB$. set C : HermitianMat d ℂ := a • A + b • B -- By the properties of the trace and the convexity of $g$, we have: - have h_trace : (C.cfc g).trace = ∑ i, g (C.H.eigenvalues i) := by - exact trace_cfc_eq C g + have h_trace : (C.cfc g).trace = ∑ i, g (C.H.eigenvalues i) := trace_cfc_eq C g have h_sum : ∑ i, g (C.H.eigenvalues i) ≤ a * ∑ i, g ((A.conj (star C.H.eigenvectorUnitary.val)).mat i i).re + b * ∑ i, g ((B.conj (star C.H.eigenvectorUnitary.val)).mat i i).re := by diff --git a/QuantumInfo/ForMathlib/HermitianMat/Proj.lean b/QuantumInfo/ForMathlib/HermitianMat/Proj.lean index 486d825c3..08a367255 100644 --- a/QuantumInfo/ForMathlib/HermitianMat/Proj.lean +++ b/QuantumInfo/ForMathlib/HermitianMat/Proj.lean @@ -230,11 +230,9 @@ scoped notation "{" A " ≤ₚ " B "}" => projLE A B scoped notation "{" A " >ₚ " B "}" => projLT B A scoped notation "{" A " <ₚ " B "}" => projLT A B -theorem projLE_def : {A ≤ₚ B} = (B - A).cfc (fun x ↦ if 0 ≤ x then 1 else 0) := by - rfl +theorem projLE_def : {A ≤ₚ B} = (B - A).cfc (fun x ↦ if 0 ≤ x then 1 else 0) := rfl -theorem projLT_def : {A <ₚ B} = (B - A).cfc (fun x ↦ if 0 < x then 1 else 0) := by - rfl +theorem projLT_def : {A <ₚ B} = (B - A).cfc (fun x ↦ if 0 < x then 1 else 0) := rfl theorem projLE_sq : {A ≤ₚ B}^2 = {A ≤ₚ B} := by rw [projLE_def, ← cfc_pow, ← cfc_comp] @@ -297,8 +295,7 @@ theorem projLE_mul_nonneg : 0 ≤ {A ≤ₚ B}.mat * (B - A).mat := by open MatrixOrder in theorem projLE_mul_le : {A ≤ₚ B}.mat * A.mat ≤ {A ≤ₚ B}.mat * B.mat := by - rw [← sub_nonneg, ← mul_sub_left_distrib] - exact projLE_mul_nonneg A B + simpa [← sub_nonneg, ← mul_sub_left_distrib] using projLE_mul_nonneg A B @[simp] theorem proj_le_add_lt : {A <ₚ B} + {B ≤ₚ A} = 1 := by @@ -334,11 +331,9 @@ instance : PosPart (HermitianMat n 𝕜) where instance : NegPart (HermitianMat n 𝕜) where negPart A := A.cfc (fun x ↦ -x ⊔ 0) -theorem posPart_eq_cfc_max : A⁺ = A.cfc (fun x ↦ x ⊔ 0) := by - rfl +theorem posPart_eq_cfc_max : A⁺ = A.cfc (fun x ↦ x ⊔ 0) := rfl -theorem negPart_eq_cfc_min : A⁻ = A.cfc (fun x ↦ -x ⊔ 0) := by - rfl +theorem negPart_eq_cfc_min : A⁻ = A.cfc (fun x ↦ -x ⊔ 0) := rfl theorem posPart_eq_cfc_ite : A⁺ = A.cfc (fun x ↦ if 0 ≤ x then x else 0) := by simp only [← max_def', posPart_eq_cfc_max] @@ -409,8 +404,7 @@ theorem projLE_inner_nonneg : 0 ≤ ⟪{A ≤ₚ B}, (B - A)⟫ := inner_mul_nonneg (projLE_mul_nonneg A B) theorem projLE_inner_le : ⟪{A ≤ₚ B}, A⟫ ≤ ⟪{A ≤ₚ B}, B⟫ := by - rw [← sub_nonneg, ← inner_sub_right] - exact projLE_inner_nonneg A B + simpa [← sub_nonneg, ← inner_sub_right] using projLE_inner_nonneg A B open RealInnerProductSpace in theorem inner_projLE_nonneg : 0 ≤ ⟪{A ≤ₚ B}, (B - A)⟫ := @@ -447,8 +441,7 @@ theorem negPart_Continuous : Continuous (·⁻ : HermitianMat n ℂ → _) := by -- variable {d : Type*} [Fintype d] [DecidableEq d] (A B : HermitianMat d ℂ) -theorem one_sub_projLT : 1 - {B ≤ₚ A} = {A <ₚ B} := by - rw [sub_eq_iff_eq_add, proj_le_add_lt] +theorem one_sub_projLT : 1 - {B ≤ₚ A} = {A <ₚ B} := by rw [sub_eq_iff_eq_add, proj_le_add_lt] open MatrixOrder ComplexOrder in theorem projLT_mul_nonneg : 0 ≤ {A <ₚ B}.mat * (B - A).mat := by @@ -462,8 +455,7 @@ theorem projLT_mul_nonneg : 0 ≤ {A <ₚ B}.mat * (B - A).mat := by open MatrixOrder ComplexOrder in theorem proj_lt_mul_lt : {A <ₚ B}.mat * A.mat ≤ {A <ₚ B}.mat * B.mat := by - rw [← sub_nonneg, ← mul_sub_left_distrib] - exact A.projLT_mul_nonneg B + simpa [← sub_nonneg, ← mul_sub_left_distrib] using A.projLT_mul_nonneg B theorem inner_negPart_nonpos : ⟪A, A⁻⟫ ≤ 0 := by rw [← neg_le_neg_iff, neg_zero, ← inner_neg_right] diff --git a/QuantumInfo/ForMathlib/HermitianMat/Reindex.lean b/QuantumInfo/ForMathlib/HermitianMat/Reindex.lean index 9cc20aea9..4e816a204 100644 --- a/QuantumInfo/ForMathlib/HermitianMat/Reindex.lean +++ b/QuantumInfo/ForMathlib/HermitianMat/Reindex.lean @@ -28,8 +28,7 @@ def reindex (e : d ≃ d₂) : HermitianMat d₂ 𝕜 := ⟨A.mat.reindex e e, A.H.submatrix e.symm⟩ @[simp] -theorem mat_reindex : (A.reindex e).mat = A.mat.reindex e e := by - rfl +theorem mat_reindex : (A.reindex e).mat = A.mat.reindex e e := rfl /-! Our simp-normal form for expressions involving `HermitianMat.reindex` is that we try to push the reindexing as far out as possible, so that it can be absorbed by `HermitianMat.trace`, or @@ -38,8 +37,7 @@ we push it to the right side. One downside is that we're not as likely to hit `r @[simp] theorem reindex_refl (A : HermitianMat d 𝕜) : - A.reindex (.refl _) = A := by - rfl + A.reindex (.refl _) = A := rfl @[simp] theorem reindex_reindex (A : HermitianMat d 𝕜) (e : d ≃ d₂) (f : d₂ ≃ d₃) : diff --git a/QuantumInfo/ForMathlib/HermitianMat/Rpow.lean b/QuantumInfo/ForMathlib/HermitianMat/Rpow.lean index 8cea291bd..69b3c1179 100644 --- a/QuantumInfo/ForMathlib/HermitianMat/Rpow.lean +++ b/QuantumInfo/ForMathlib/HermitianMat/Rpow.lean @@ -52,11 +52,9 @@ theorem rpow_conj_unitary (A : HermitianMat d 𝕜) (U : Matrix.unitaryGroup d (HermitianMat.conj U.val A) ^ r = HermitianMat.conj U.val (A ^ r) := by exact A.cfc_conj_unitary (· ^ r) U -theorem pow_eq_rpow : A ^ r = A.rpow r := - rfl +theorem pow_eq_rpow : A ^ r = A.rpow r := rfl -theorem rpow_eq_cfc : A ^ r = A.cfc (· ^ r) := - rfl +theorem rpow_eq_cfc : A ^ r = A.cfc (· ^ r) := rfl theorem diagonal_pow (f : d → ℝ) : (diagonal 𝕜 f) ^ r = diagonal 𝕜 (fun i ↦ (f i) ^ r) := by @@ -93,8 +91,7 @@ theorem continuousOn_rpow_neg (A : HermitianMat d ℂ) : ContinuousOn (fun x : exact (Real.continuousAt_const_rpow' hx.ne).continuousWithinAt @[simp] -theorem rpow_one : A ^ (1 : ℝ) = A := by - simp [rpow_eq_cfc] +theorem rpow_one : A ^ (1 : ℝ) = A := by simp [rpow_eq_cfc] /-- Functional calculus of Real.sqrt is equal to functional calculus of x^(1/2). @@ -114,12 +111,10 @@ theorem one_rpow : (1 : HermitianMat d 𝕜) ^ r = 1 := by simp @[simp] -lemma rpow_zero (A : HermitianMat d 𝕜) : A ^ (0 : ℝ) = 1 := by - simp [rpow_eq_cfc] +lemma rpow_zero (A : HermitianMat d 𝕜) : A ^ (0 : ℝ) = 1 := by simp [rpow_eq_cfc] lemma rpow_diagonal (a : d → ℝ) (r : ℝ) : - (diagonal ℂ a) ^ r = diagonal ℂ (fun i => a i ^ r) := by - exact cfc_diagonal _ _ + (diagonal ℂ a) ^ r = diagonal ℂ (fun i => a i ^ r) := cfc_diagonal _ _ /-- Keeps in line with our simp-normal form for moving reindex outwards. -/ @[simp] @@ -154,9 +149,8 @@ theorem rpow_pos {A : HermitianMat d 𝕜} (hA : 0 < A) {p : ℝ} : 0 < A ^ p := · exact fun i hi => Real.rpow_pos_of_pos hi _ · rcases eq_or_ne p 0 with h | h <;> simp [h] -theorem rpow_nonneg (hA : 0 ≤ A) {p : ℝ} : 0 ≤ A ^ p := by - apply cfc_nonneg_of_nonneg hA - exact fun i hi => Real.rpow_nonneg hi p +theorem rpow_nonneg (hA : 0 ≤ A) {p : ℝ} : 0 ≤ A ^ p := + cfc_nonneg_of_nonneg hA fun _ hi => Real.rpow_nonneg hi p open ComplexOrder in theorem inv_eq_rpow_neg_one (hA : A.mat.PosDef) : A⁻¹ = A ^ (-1 : ℝ) := by @@ -169,10 +163,8 @@ theorem sandwich_self (hB : B.mat.PosDef) : (B.conj (B ^ (-1/2 : ℝ)).mat) = 1 := by have hB_inv_sqrt : (B ^ (-1 / 2 : ℝ)).mat * (B ^ (-1 / 2 : ℝ)).mat = (B ^ (-1 : ℝ)).mat := by rw [ ← mat_rpow_add ] <;> norm_num - rw [zero_le_iff] - exact hB.posSemidef - have hB_inv : (B ^ (-1 : ℝ)).mat = B.mat⁻¹ := by - rw [← inv_eq_rpow_neg_one hB, mat_inv] + simpa [zero_le_iff] using hB.posSemidef + have hB_inv : (B ^ (-1 : ℝ)).mat = B.mat⁻¹ := by rw [← inv_eq_rpow_neg_one hB, mat_inv] rw [ hB_inv ] at hB_inv_sqrt; ext1 simp [mul_assoc]; @@ -186,10 +178,8 @@ lemma rpow_inv_eq_neg_rpow (hA : A.mat.PosDef) (p : ℝ) : (A ^ p)⁻¹ = A ^ (- ext i j; have h_inv : (A ^ p).mat * (A ^ (-p)).mat = 1 := by have h_inv : (A ^ p).mat * (A ^ (-p)).mat = 1 := by - have h_pow : (A ^ p).mat = A.cfc (fun x => x ^ p) := by - exact rfl - have h_pow_neg : (A ^ (-p)).mat = A.cfc (fun x => x ^ (-p)) := by - exact rfl + have h_pow : (A ^ p).mat = A.cfc (fun x => x ^ p) := rfl + have h_pow_neg : (A ^ (-p)).mat = A.cfc (fun x => x ^ (-p)) := rfl have h_inv : (A ^ p).mat * (A ^ (-p)).mat = A.cfc (fun x => x ^ p * x ^ (-p)) := by rw [ h_pow, h_pow_neg, ← mat_cfc_mul ]; rfl; @@ -200,14 +190,12 @@ lemma rpow_inv_eq_neg_rpow (hA : A.mat.PosDef) (p : ℝ) : (A ^ p)⁻¹ = A ^ (- rw [ h_inv, cfc_const ] ; norm_num; exact h_inv; -- By definition of matrix inverse, if $(A^p) * (A^{-p}) = 1$, then $(A^{-p})$ is the inverse of $(A^p)$. - have h_inv_def : (A ^ p).mat⁻¹ = (A ^ (-p)).mat := by - exact Matrix.inv_eq_right_inv h_inv; + have h_inv_def : (A ^ p).mat⁻¹ = (A ^ (-p)).mat := Matrix.inv_eq_right_inv h_inv convert! congr_fun ( congr_fun h_inv_def i ) j using 1 open ComplexOrder in lemma sandwich_le_one (hB : B.mat.PosDef) (h : A ≤ B) : - (A.conj (B ^ (-1/2 : ℝ)).mat) ≤ 1 := by - exact le_trans (conj_mono h) (sandwich_self hB).le + (A.conj (B ^ (-1/2 : ℝ)).mat) ≤ 1 := le_trans (conj_mono h) (sandwich_self hB).le open ComplexOrder in lemma rpow_neg_mul_rpow_self (hA : A.mat.PosDef) (p : ℝ) : @@ -232,13 +220,11 @@ lemma rpow_neg_mul_rpow_self (hA : A.mat.PosDef) (p : ℝ) : open ComplexOrder in lemma isUnit_rpow_toMat (hA : A.mat.PosDef) (p : ℝ) : IsUnit (A ^ p).mat := by have hA_inv : IsUnit (A ^ (-p)).mat := by - have hA_inv : (A ^ (-p)).mat * (A ^ p).mat = 1 := by - exact rpow_neg_mul_rpow_self hA p + have hA_inv : (A ^ (-p)).mat * (A ^ p).mat = 1 := rpow_neg_mul_rpow_self hA p exact IsUnit.of_mul_eq_one _ hA_inv -- Since $(A^{-p}) (A^p) = 1$, we have that $(A^p)$ is the inverse of $(A^{-p})$. have hA_inv : (A ^ p).mat = (A ^ (-p)).mat⁻¹ := by - have hA_inv : (A ^ (-p)).mat * (A ^ p).mat = 1 := by - exact rpow_neg_mul_rpow_self hA p; + have hA_inv : (A ^ (-p)).mat * (A ^ p).mat = 1 := rpow_neg_mul_rpow_self hA p exact Eq.symm (Matrix.inv_eq_right_inv hA_inv); aesop @@ -364,8 +350,7 @@ theorem cfc_sq_rpow_eq_cfc_rpow /-- Tr[A^p] = ∑ᵢ λᵢ^p for a Hermitian matrix A. -/ lemma trace_rpow_eq_sum (A : HermitianMat d ℂ) (p : ℝ) : - (A ^ p).trace = ∑ i, (A.H.eigenvalues i) ^ p := by - exact A.trace_cfc_eq (· ^ p) + (A ^ p).trace = ∑ i, (A.H.eigenvalues i) ^ p := A.trace_cfc_eq (· ^ p) /-! ## Loewner-Heinz Theorem The operator monotonicity of `x ↦ x ^ q` for `0 < q ≤ 1`: @@ -447,8 +432,7 @@ theorem rpowApprox_eq_cfc_scalar (A : HermitianMat d ℂ) (hA : A.mat.PosDef) (q exact fun {f} hf => inv_cfc_eq_cfc_inv f hf apply h_inv_smul intro i - have h_eigenvalue_pos : 0 < A.H.eigenvalues i := by - exact Matrix.PosDef.eigenvalues_pos hA i + have h_eigenvalue_pos : 0 < A.H.eigenvalues i := Matrix.PosDef.eigenvalues_pos hA i exact ne_of_gt (add_pos h_eigenvalue_pos ht.left); rw [h_inv_def, h_inv_comp]; exact h_inv @@ -461,8 +445,7 @@ theorem rpowApprox_eq_cfc_scalar (A : HermitianMat d ℂ) (hA : A.mat.PosDef) (q have h_integrable : ∀ u : d, IntervalIntegrable (fun t : ℝ => t ^ q * (1 / (1 + t) - 1 / (A.H.eigenvalues u + t))) volume 0 T := by intro u have h_integrable : IntervalIntegrable (fun t : ℝ => t ^ q * (1 / (1 + t) - 1 / (A.H.eigenvalues u + t))) volume 0 T := by - have h_pos : 0 < A.H.eigenvalues u := by - exact Matrix.PosDef.eigenvalues_pos hA u + have h_pos : 0 < A.H.eigenvalues u := Matrix.PosDef.eigenvalues_pos hA u exact ContinuousOn.intervalIntegrable ( by exact ContinuousOn.mul ( continuousOn_id.rpow_const fun x hx => Or.inr <| by linarith ) <| ContinuousOn.sub ( continuousOn_const.div ( continuousOn_const.add continuousOn_id ) fun x hx => by linarith [ Set.mem_Icc.mp <| by simpa [ hT.le ] using hx ] ) ( continuousOn_const.div ( continuousOn_const.add continuousOn_id ) fun x hx => by linarith [ Set.mem_Icc.mp <| by simpa [ hT.le ] using hx ] ) ) ..; exact h_integrable exact integral_cfc_eq_cfc_integral _ _ _ h_integrable @@ -614,8 +597,7 @@ theorem rpow_le_rpow_of_posDef (hA : A.mat.PosDef) (hAB : A ≤ B) convert le_of_tendsto_of_tendsto ( tendsto_rpowApprox hA hq ( lt_of_le_of_ne hq1 hq_eq_one ) ) ( tendsto_rpowApprox ( posDef_of_posDef_le hA hAB ) hq ( lt_of_le_of_ne hq1 hq_eq_one ) ) _ using 1 generalize_proofs at *; ( filter_upwards [ Filter.eventually_gt_atTop 0 ] with T hT using rpowApprox_mono hA ( posDef_of_posDef_le hA hAB ) hAB hq.le T hT |> le_trans <| by aesop;); - have h_rpow_pos : 0 < rpowConst q := by - exact rpowConst_pos hq ( lt_of_le_of_ne hq1 hq_eq_one ); + have h_rpow_pos : 0 < rpowConst q := rpowConst_pos hq ( lt_of_le_of_ne hq1 hq_eq_one ) simp_all open ComplexOrder Filter in @@ -639,16 +621,13 @@ theorem rpow_le_rpow_of_le (hA : 0 ≤ A) (hAB : A ≤ B) ring_nf simp [ Matrix.mulVec, dotProduct, Finset.mul_sum _ _ _, mul_assoc, mul_left_comm]; simp [ Matrix.one_apply] - have h_inner_nonneg : 0 ≤ star x ⬝ᵥ A.mat.mulVec x := by - exact inner_mulVec_nonneg hA x - have h_inner_pos : 0 < star x ⬝ᵥ x := by - simp_all + have h_inner_nonneg : 0 ≤ star x ⬝ᵥ A.mat.mulVec x := inner_mulVec_nonneg hA x + have h_inner_pos : 0 < star x ⬝ᵥ x := by simp_all exact h_inner.symm ▸ add_pos_of_nonneg_of_pos h_inner_nonneg ( mul_pos ( mod_cast hε_pos ) ( mod_cast h_inner_pos ) ) |> lt_of_lt_of_le <| le_rfl; have h_pos_def_Bε : (Bε ε).mat.PosDef := by convert posDef_of_posDef_le h_pos_def_Aε _ using 1 exact add_le_add_left hAB _ |> le_trans ( by simp [ Aε ] ) ; - have h_le_Aε_Bε : Aε ε ≤ Bε ε := by - exact add_le_add_left hAB _ |> le_trans <| by simp [ Bε ] ; + have h_le_Aε_Bε : Aε ε ≤ Bε ε := add_le_add_left hAB _ |> le_trans <| by simp [ Bε ] exact ⟨h_pos_def_Aε, h_pos_def_Bε, h_le_Aε_Bε⟩ -- By the continuity of the function $M \mapsto M^q$, we have $(Aε ε)^q \to A^q$ and $(Bε ε)^q \to B^q$ as $\epsilon \to 0^+$. have h_cont : Filter.Tendsto (fun ε => (Aε ε) ^ q) (nhdsWithin 0 (Set.Ioi 0)) (nhds (A ^ q)) ∧ Filter.Tendsto (fun ε => (Bε ε) ^ q) (nhdsWithin 0 (Set.Ioi 0)) (nhds (B ^ q)) := by @@ -713,8 +692,7 @@ private lemma conj_rpow_le_one_of_conj_le_one_posDef have hconj := HermitianMat.conj_mono (M := (B ^ (-1 : ℝ)).mat) hAB have hleft : (A.conj B.mat).conj (B ^ (-1 : ℝ)).mat = A := by rw [HermitianMat.conj_conj] - have hmul : (B ^ (-1 : ℝ)).mat * B.mat = 1 := by - simpa using rpow_neg_mul_rpow_self hB 1 + have hmul : (B ^ (-1 : ℝ)).mat * B.mat = 1 := by simpa using rpow_neg_mul_rpow_self hB 1 exact (HermitianMat.conj_one (A := A)).symm ▸ by simp [hmul] have hright : (1 : HermitianMat d ℂ).conj (B ^ (-1 : ℝ)).mat = B ^ (-2 : ℝ) := by ext1 @@ -766,8 +744,7 @@ private lemma top_singular_le_of_self_mul_le_smul_one (hcard : 0 < Fintype.card e) : singularValuesSorted X ⟨0, hcard⟩ ≤ Real.sqrt α := by letI : Nonempty e := Fintype.card_pos_iff.mp hcard - let hne : (Finset.univ : Finset e).Nonempty := by - simp + let hne : (Finset.univ : Finset e).Nonempty := by simp rw [singularValuesSorted_zero_eq_sup X hcard] refine Finset.sup'_le _ _ ?_ intro i hi @@ -847,8 +824,7 @@ private lemma compound_top_singular_le_posDef have hconj := congrArg (fun H : HermitianMat _ ℂ => H.conj (Bk ^ (-1 : ℝ)).mat) hMk_eq_zero have hleft : (Ak.conj Bk.mat).conj (Bk ^ (-1 : ℝ)).mat = Ak := by rw [HermitianMat.conj_conj] - have : (Bk ^ (-1 : ℝ)).mat * Bk.mat = 1 := by - simpa using rpow_neg_mul_rpow_self hBk 1 + have : (Bk ^ (-1 : ℝ)).mat * Bk.mat = 1 := by simpa using rpow_neg_mul_rpow_self hBk 1 simp [this, HermitianMat.conj_one (A := Ak)] simpa [hleft] using hconj have hNk_zero : Nk.conjTranspose * Nk = 0 := by @@ -886,8 +862,7 @@ private lemma compound_top_singular_le_posDef apply HermitianMat.cfc_congr_of_nonneg (zero_le_iff.mpr hBk.posSemidef) intro x hx rw [Function.comp_apply, Real.mul_rpow (inv_nonneg.mpr hc_nonneg) hx] - _ = (c⁻¹) ^ r • (Bk ^ r) := by - rw [HermitianMat.cfc_const_mul, HermitianMat.rpow_eq_cfc] + _ = (c⁻¹) ^ r • (Bk ^ r) := by rw [HermitianMat.cfc_const_mul, HermitianMat.rpow_eq_cfc] rwa [hBk_scale, conj_smul_right] at hpow have hNk_le : ((Ak ^ r).conj (Bk ^ r).mat) ≤ c ^ (2 * r) • 1 := by have hmul := smul_le_smul_of_nonneg_left hpow' (show 0 ≤ c ^ (2 * r) by positivity) @@ -898,13 +873,10 @@ private lemma compound_top_singular_le_posDef c ^ (2 * r) = c ^ (r + r) := by ring_nf _ = c ^ r * c ^ r := by rw [Real.rpow_add hc_pos] _ = (c ^ r) ^ 2 := by ring - have hinv : (c⁻¹) ^ r = (c ^ r)⁻¹ := by - rw [Real.inv_rpow hc_nonneg] + have hinv : (c⁻¹) ^ r = (c ^ r)⁻¹ := by rw [Real.inv_rpow hc_nonneg] calc - c ^ (2 * r) * ((c⁻¹) ^ r) ^ 2 = (c ^ r) ^ 2 * ((c ^ r)⁻¹) ^ 2 := by - rw [hpow, hinv] - _ = 1 := by - field_simp [pow_two, hcr_pos.ne'] + c ^ (2 * r) * ((c⁻¹) ^ r) ^ 2 = (c ^ r) ^ 2 * ((c ^ r)⁻¹) ^ 2 := by rw [hpow, hinv] + _ = 1 := by field_simp [pow_two, hcr_pos.ne'] rwa [smul_smul, hs, one_smul] at hmul have htop : singularValuesSorted Nk (compoundZero k hk) ≤ Real.sqrt (c ^ (2 * r)) := top_singular_le_of_self_mul_le_smul_one Nk @@ -1248,8 +1220,7 @@ private lemma intervalIntegrable_weighted_trace_mul_inv_shift {A : HermitianMat hp hT).add hs refine hg.congr ?_ intro t ht - have htIoc : t ∈ Set.Ioc (0 : ℝ) T := by - simpa [Set.uIoc_of_le hT.le] using ht + have htIoc : t ∈ Set.Ioc (0 : ℝ) T := by simpa [Set.uIoc_of_le hT.le] using ht unfold g change ∑ i, t ^ (p - 1) * (A.H.eigenvalues i / (A.H.eigenvalues i + t)) = t ^ (p - 1) * (((A.mat * (A + t • 1).mat⁻¹).trace : ℂ)).re @@ -1273,9 +1244,7 @@ private lemma tendsto_intervalIntegral_weighted_trace_mul_inv_shift {A : Hermiti apply intervalIntegral.integral_congr_ae filter_upwards with t ht rw [trace_mul_inv_shift_eq_sum_div hA (by - have htIoc : t ∈ Set.Ioc (0 : ℝ) T := by - simpa [Set.uIoc_of_le hT.le] using ht - exact htIoc.1)] + exact (show t ∈ Set.Ioc (0 : ℝ) T by simpa [Set.uIoc_of_le hT.le] using ht).1)] simp [Finset.mul_sum] _ = ∑ i, ∫ t in (0)..T, t ^ (p - 1) * (A.H.eigenvalues i / (A.H.eigenvalues i + t)) := by rw [intervalIntegral.integral_finsetSum] diff --git a/QuantumInfo/ForMathlib/HermitianMat/Schatten.lean b/QuantumInfo/ForMathlib/HermitianMat/Schatten.lean index 5a7a5236f..18be6542d 100644 --- a/QuantumInfo/ForMathlib/HermitianMat/Schatten.lean +++ b/QuantumInfo/ForMathlib/HermitianMat/Schatten.lean @@ -39,8 +39,7 @@ theorem schattenNorm_hermitian_pow {A : HermitianMat d ℂ} (hA : 0 ≤ A) {p : ext simp only [HermitianMat.conjTranspose_mat, HermitianMat.mat_pow] convert rfl using 2 - rw [sq] - exact Matrix.IsHermitian.cfc_eq _ _ + simpa [sq] using Matrix.IsHermitian.cfc_eq _ _ lemma schattenNorm_nonneg (A : Matrix d d ℂ) (p : ℝ) : 0 ≤ schattenNorm A p := by @@ -62,8 +61,7 @@ lemma schattenNorm_pow_eq · rw [ mul_comm, ← HermitianMat.rpow_mul ]; exact hA; · -- Since $A$ is positive, $A^{k*p}$ is also positive, and the trace of a positive matrix is non-negative. - have h_pos : 0 ≤ A ^ (k * p) := by - exact HermitianMat.rpow_nonneg hA; + have h_pos : 0 ≤ A ^ (k * p) := HermitianMat.rpow_nonneg hA exact HermitianMat.trace_nonneg h_pos; · exact HermitianMat.rpow_nonneg hA diff --git a/QuantumInfo/ForMathlib/HermitianMat/Sqrt.lean b/QuantumInfo/ForMathlib/HermitianMat/Sqrt.lean index 858d572df..776d0d4ea 100644 --- a/QuantumInfo/ForMathlib/HermitianMat/Sqrt.lean +++ b/QuantumInfo/ForMathlib/HermitianMat/Sqrt.lean @@ -29,8 +29,7 @@ theorem sqrt_sq_eq_proj (A : HermitianMat d 𝕜) : grind [Pi.mul_apply, Real.mul_self_sqrt, Real.sqrt_eq_zero'] theorem sqrt_sq (hA : 0 ≤ A) : - A.sqrt.mat * A.sqrt.mat = A := by - rw [sqrt_sq_eq_proj, posPart_eq_self hA] + A.sqrt.mat * A.sqrt.mat = A := by rw [sqrt_sq_eq_proj, posPart_eq_self hA] @[aesop unsafe apply 50% (rule_sets := [Commutes])] theorem commute_sqrt_left (hAB : Commute A.mat B.mat) : @@ -50,8 +49,7 @@ lemma sqrt_inv_mul_self_mul_sqrt_inv_eq_one {A : HermitianMat d 𝕜} (hA : A.ma A⁻¹.sqrt.mat * A.mat * A⁻¹.sqrt.mat = 1 := by have h_inv_def : A⁻¹.sqrt.mat * A⁻¹.sqrt.mat = A⁻¹ := by apply HermitianMat.sqrt_sq - rw [zero_le_iff] - exact hA.inv.posSemidef + simpa [zero_le_iff] using hA.inv.posSemidef have h_inv_comm : Commute A⁻¹.sqrt.mat A.mat := by commutes rw [h_inv_comm, mul_assoc, h_inv_def] @@ -85,8 +83,6 @@ meta def evalHermitianMatSqrt : PositivityExt where eval {_u _α} _zα _pα e := catch _ => pure (.nonnegative (← mkAppM ``HermitianMat.sqrt_nonneg #[A])) -example {A : HermitianMat d ℂ} : 0 ≤ A.sqrt := by - positivity +example {A : HermitianMat d ℂ} : 0 ≤ A.sqrt := by positivity -example [Nonempty d] {A : HermitianMat d ℂ} : 0 < (1 + A.sqrt).sqrt := by - positivity +example [Nonempty d] {A : HermitianMat d ℂ} : 0 < (1 + A.sqrt).sqrt := by positivity diff --git a/QuantumInfo/ForMathlib/HermitianMat/Trace.lean b/QuantumInfo/ForMathlib/HermitianMat/Trace.lean index 3df4fc059..49043a307 100644 --- a/QuantumInfo/ForMathlib/HermitianMat/Trace.lean +++ b/QuantumInfo/ForMathlib/HermitianMat/Trace.lean @@ -57,24 +57,20 @@ section semiring variable [CommSemiring R] [Ring α] [StarAddMonoid α] [Algebra R α] [IsMaximalSelfAdjoint R α] @[simp] -theorem trace_zero : (0 : HermitianMat n α).trace = 0 := by - simp [trace] +theorem trace_zero : (0 : HermitianMat n α).trace = 0 := by simp [trace] @[simp] -theorem trace_add (A B : HermitianMat n α) : (A + B).trace = A.trace + B.trace := by - simp [trace] +theorem trace_add (A B : HermitianMat n α) : (A + B).trace = A.trace + B.trace := by simp [trace] end semiring section ring variable [CommRing R] [Ring α] [StarAddMonoid α] [Algebra R α] [IsMaximalSelfAdjoint R α] @[simp] -theorem trace_neg (A : HermitianMat n α) : (-A).trace = -A.trace := by - simp [trace] +theorem trace_neg (A : HermitianMat n α) : (-A).trace = -A.trace := by simp [trace] @[simp] -theorem trace_sub (A B : HermitianMat n α) : (A - B).trace = A.trace - B.trace := by - simp [trace] +theorem trace_sub (A B : HermitianMat n α) : (A - B).trace = A.trace - B.trace := by simp [trace] end ring section starring @@ -108,8 +104,7 @@ variable [Star α] [TrivialStar α] [CommSemiring α] /-- `HermitianMat.trace` reduces to `Matrix.trace` when the elements are a `TrivialStar`. -/ @[simp] theorem trace_eq_trace_trivial (A : HermitianMat n ℝ) : A.trace = A.mat.trace := by - rw [← trace_eq_trace] - rfl + simpa using trace_eq_trace A end trivialstar @@ -117,8 +112,7 @@ section RCLike variable {n m 𝕜 : Type*} [Fintype n] [Fintype m] [RCLike 𝕜] -theorem trace_eq_re_trace (A : HermitianMat n 𝕜) : A.trace = RCLike.re A.mat.trace := by - rfl +theorem trace_eq_re_trace (A : HermitianMat n 𝕜) : A.trace = RCLike.re A.mat.trace := rfl @[simp] theorem trace_one [DecidableEq n] : (1 : HermitianMat n 𝕜).trace = Fintype.card n := by @@ -144,17 +138,14 @@ theorem sum_eigenvalues_eq_trace [DecidableEq n] (A : HermitianMat n 𝕜) : --Proving that traces are 0 or 1 is common enough that we have a convenience lemma here for turning --statements about HermitianMat traces into Matrix traces. theorem trace_eq_zero_iff (A : HermitianMat n 𝕜) : A.trace = 0 ↔ A.mat.trace = 0 := by - rw [← trace_eq_trace_rc] - exact ⟨mod_cast id, mod_cast id⟩ + simp [← trace_eq_trace_rc] theorem trace_eq_one_iff (A : HermitianMat n 𝕜) : A.trace = 1 ↔ A.mat.trace = 1 := by - rw [← trace_eq_trace_rc] - exact ⟨mod_cast id, mod_cast id⟩ + simp [← trace_eq_trace_rc] @[simp] theorem trace_reindex (A : HermitianMat n ℂ) (e : n ≃ m) : - (A.reindex e).trace = A.trace := by - simp [reindex, trace_eq_re_trace] + (A.reindex e).trace = A.trace := by simp [reindex, trace_eq_re_trace] end RCLike section partialTrace @@ -172,8 +163,7 @@ def traceRight (A : HermitianMat (m × n) α) : HermitianMat m α := variable (A B : HermitianMat (m × n) α) @[simp] -theorem traceLeft_mat : A.traceLeft.mat = A.mat.traceLeft := by - rfl +theorem traceLeft_mat : A.traceLeft.mat = A.mat.traceLeft := rfl @[simp] theorem traceLeft_add : (A + B).traceLeft = A.traceLeft + B.traceLeft := by @@ -191,8 +181,7 @@ variable (A B : HermitianMat (n × m) α) @[simp] theorem traceRight_mat : - (traceRight A).mat = A.mat.traceRight := by - rfl + (traceRight A).mat = A.mat.traceRight := rfl @[simp] theorem traceRight_add : (A + B).traceRight = A.traceRight + B.traceRight := by @@ -223,12 +212,10 @@ theorem traceRight_smul (r : ℝ) : (r • A).traceRight = r • A.traceRight := ext1; simp @[simp] -theorem traceLeft_trace : A.traceLeft.trace = A.trace := by - simp [trace_eq_re_trace] +theorem traceLeft_trace : A.traceLeft.trace = A.trace := by simp [trace_eq_re_trace] @[simp] -theorem traceRight_trace : A.traceRight.trace = A.trace := by - simp [trace_eq_re_trace] +theorem traceRight_trace : A.traceRight.trace = A.trace := by simp [trace_eq_re_trace] end rcLike section kron diff --git a/QuantumInfo/ForMathlib/HermitianMat/Unitary.lean b/QuantumInfo/ForMathlib/HermitianMat/Unitary.lean index feab49853..fb8e708c4 100644 --- a/QuantumInfo/ForMathlib/HermitianMat/Unitary.lean +++ b/QuantumInfo/ForMathlib/HermitianMat/Unitary.lean @@ -20,8 +20,7 @@ variable {α : Type*} [NonUnitalNonAssocSemiring α] [StarRing α] variable {α β : Type*} [DecidableEq α] [Fintype α] [DecidableEq β] [Fintype β] @[simp] -theorem neg_unitary_val (u : 𝐔[α]) : (-u).val = -u := by - rfl +theorem neg_unitary_val (u : 𝐔[α]) : (-u).val = -u := rfl omit [DecidableEq α] [Fintype α] [DecidableEq β] [Fintype β] in open Kronecker in @@ -42,8 +41,7 @@ scoped infixl:60 " ⊗ᵤ " => unitary_kron @[simp] theorem unitary_kron_apply (a : 𝐔[α]) (b : 𝐔[β]) (i₁ i₂ : α) (j₁ j₂ : β) : - (a ⊗ᵤ b) (i₁, j₁) (i₂, j₂) = (a i₁ i₂) * (b j₁ j₂) := by - rfl + (a ⊗ᵤ b) (i₁, j₁) (i₂, j₂) = (a i₁ i₂) * (b j₁ j₂) := rfl @[simp] theorem unitary_kron_one_one : (1 : 𝐔[α]) ⊗ᵤ (1 : 𝐔[β]) = (1 : 𝐔[α × β]) := by diff --git a/QuantumInfo/ForMathlib/IsMaximalSelfAdjoint.lean b/QuantumInfo/ForMathlib/IsMaximalSelfAdjoint.lean index 113394d4a..c66c117e0 100644 --- a/QuantumInfo/ForMathlib/IsMaximalSelfAdjoint.lean +++ b/QuantumInfo/ForMathlib/IsMaximalSelfAdjoint.lean @@ -54,11 +54,9 @@ namespace IsMaximalSelfAdjoint @[simp] theorem trivial_selfadjMap {R} [Star R] [TrivialStar R] [CommSemiring R] : - (selfadjMap : R →+ R) = .id R := by - rfl + (selfadjMap : R →+ R) = .id R := rfl @[simp] -theorem RCLike_selfadjMap {α} [RCLike α] : (selfadjMap : α →+ ℝ) = RCLike.re := by - rfl +theorem RCLike_selfadjMap {α} [RCLike α] : (selfadjMap : α →+ ℝ) = RCLike.re := rfl end IsMaximalSelfAdjoint diff --git a/QuantumInfo/ForMathlib/Isometry.lean b/QuantumInfo/ForMathlib/Isometry.lean index 133acee53..162928573 100644 --- a/QuantumInfo/ForMathlib/Isometry.lean +++ b/QuantumInfo/ForMathlib/Isometry.lean @@ -370,8 +370,7 @@ theorem LinearMap.IsSymmetric.directSum_isInternal_of_commute' {𝕜 E : Type*} ext μ₁₂ simp only [DirectSum.zero_apply, ZeroMemClass.coe_zero] rw [← inner_self_eq_zero (𝕜 := 𝕜)] - have h_inner_zero : inner 𝕜 (x μ₁₂ : E) (x.coeAddMonoidHom _) = 0 := by - simp [hx] + have h_inner_zero : inner 𝕜 (x μ₁₂ : E) (x.coeAddMonoidHom _) = 0 := by simp [hx] rw [← h_inner_zero] simp only [DirectSum.coeAddMonoidHom_eq_dfinsuppSum, ZeroMemClass.coe_zero, implies_true, DFinsupp.sum_eq_sum_fintype, DFinsupp.equivFunOnFintype_apply] diff --git a/QuantumInfo/ForMathlib/LimSupInf.lean b/QuantumInfo/ForMathlib/LimSupInf.lean index fdc408a49..b0efa1f9d 100644 --- a/QuantumInfo/ForMathlib/LimSupInf.lean +++ b/QuantumInfo/ForMathlib/LimSupInf.lean @@ -265,16 +265,14 @@ lemma tendsto_of_block_sequence {α : Type*} [TopologicalSpace α] {x : ℕ → obtain ⟨k, hk⟩ : ∃ k, T k ≤ n ∧ n < T (k + 1) := by -- Since $T$ is strictly increasing, the set $\{k \mid T k \leq n\}$ is finite and non-empty. have h_finite : Set.Finite {k | T k ≤ n} := by - rw [Set.finite_iff_bddAbove] - exact ⟨_, (hT.id_le · |>.trans)⟩ + exact Set.finite_iff_bddAbove.mpr ⟨_, (hT.id_le · |>.trans)⟩ use h_finite.toFinset.max' ⟨a, h_finite.mem_toFinset.mpr hn⟩ constructor · exact h_finite.mem_toFinset.mp (Finset.max'_mem _ _) · rw [← not_le] intro h exact not_lt_of_ge (Finset.le_max' _ _ (h_finite.mem_toFinset.mpr h)) (Nat.lt_succ_self _) - rw [hg k n hk] - exact ha k (le_of_not_gt fun hk' ↦ by linarith [hT.monotone hk']) + simpa [hg k n hk] using ha k (le_of_not_gt fun hk' ↦ by linarith [hT.monotone hk']) /- Given a lower bound sequence M and a property P that can always be satisfied eventually, there exists a strictly increasing sequence T bounded by M such that each interval [T_k, T_{k+1}) contains a witness for P. @@ -399,8 +397,7 @@ lemma exists_liminf_zero_of_forall_liminf_limsup_le_with_UB (y₁ y₂ : ℝ≥0 · aesop · aesop obtain ⟨N0, hN0⟩ : ∃ N0 : ℕ → ℕ, ∀ k, ∀ n ≥ N0 k, f₂ (x k) n ≤ y₂ + (k + 1 : ℝ≥0)⁻¹ := by - have h_limsup : ∀ k, Filter.limsup (f₂ (x k)) Filter.atTop ≤ y₂ := by - exact fun k => hf₂ _ ( hx.1 k ); + have h_limsup : ∀ k, Filter.limsup (f₂ (x k)) Filter.atTop ≤ y₂ := fun k => hf₂ _ ( hx.1 k ) have h_limsup_le : ∀ k, ∀ ε > 0, ∃ N, ∀ n ≥ N, f₂ (x k) n ≤ y₂ + ε := by intro k ε hε_pos have h_limsup_le : Filter.limsup (f₂ (x k)) Filter.atTop ≤ y₂ := h_limsup k; diff --git a/QuantumInfo/ForMathlib/LinearEquiv.lean b/QuantumInfo/ForMathlib/LinearEquiv.lean index 144eb99e1..d3e4d6826 100644 --- a/QuantumInfo/ForMathlib/LinearEquiv.lean +++ b/QuantumInfo/ForMathlib/LinearEquiv.lean @@ -61,13 +61,11 @@ def euclidean_of_relabel (e : d ≃ d₂) : EuclideanSpace 𝕜 d₂ ≃ₗ[𝕜 (WithLp.linearEquiv 2 𝕜 _).trans ((of_relabel _ e).trans (WithLp.linearEquiv 2 𝕜 _).symm) @[simp] -theorem of_relabel_refl : of_relabel R (.refl d) = LinearEquiv.refl R (d → R) := by - rfl +theorem of_relabel_refl : of_relabel R (.refl d) = LinearEquiv.refl R (d → R) := rfl @[simp] theorem euclidean_of_relabel_refl : euclidean_of_relabel 𝕜 (.refl d) = - LinearEquiv.refl 𝕜 (EuclideanSpace 𝕜 d) := by - rfl + LinearEquiv.refl 𝕜 (EuclideanSpace 𝕜 d) := rfl end LinearEquiv diff --git a/QuantumInfo/ForMathlib/Majorization.lean b/QuantumInfo/ForMathlib/Majorization.lean index 5c8324e32..d0adaa010 100644 --- a/QuantumInfo/ForMathlib/Majorization.lean +++ b/QuantumInfo/ForMathlib/Majorization.lean @@ -59,10 +59,8 @@ noncomputable def singularValuesSorted (A : Matrix d d ℂ) : /-- Sorted singular values are nonneg. -/ lemma singularValuesSorted_nonneg (A : Matrix d d ℂ) (i : Fin (Fintype.card d)) : 0 ≤ singularValuesSorted A i := by - have h_nonneg : ∀ i, 0 ≤ (singularValues A i) := by - exact singularValues_nonneg A - have h_sorted_nonneg : ∀ {l : List ℝ}, (∀ x ∈ l, 0 ≤ x) → ∀ i < l.length, 0 ≤ l[i]! := by - aesop + have h_nonneg : ∀ i, 0 ≤ (singularValues A i) := singularValues_nonneg A + have h_sorted_nonneg : ∀ {l : List ℝ}, (∀ x ∈ l, 0 ≤ x) → ∀ i < l.length, 0 ≤ l[i]! := by aesop contrapose! h_sorted_nonneg use Multiset.sort (Finset.univ.val.map (singularValues A)) (· ≥ ·) refine' ⟨_, i, _, _⟩ @@ -102,8 +100,7 @@ lemma singularValuesSorted_antitone (A : Matrix d d ℂ) : lemma antitone_mul_of_antitone_nonneg {n : ℕ} {f g : Fin n → ℝ} (hf : Antitone f) (hg : Antitone g) (hf_nn : ∀ i, 0 ≤ f i) (hg_nn : ∀ i, 0 ≤ g i) : - Antitone (fun i => f i * g i) := by - exact fun i j hij => mul_le_mul (hf hij) (hg hij) (hg_nn _) (hf_nn _) + Antitone (fun i => f i * g i) := fun _ _ hij => mul_le_mul (hf hij) (hg hij) (hg_nn _) (hf_nn _) /-! ### Compound matrices and auxiliary lemmas for Horn's inequality @@ -201,15 +198,13 @@ lemma cauchyBinet {m : ℕ} {n : Type*} [Fintype n] [DecidableEq n] [LinearOrder obtain ⟨a, ha⟩ : ∃ a : Fin m → Fin m, ∀ i, σ i = S.val.orderEmbOfFin S.property (a i) := by have h_exists_a : ∀ i, ∃ a : Fin m, σ i = S.val.orderEmbOfFin S.property a := by intro i - have h_exists_a : σ i ∈ S.val := by - exact hσ.2 ▸ Finset.mem_image_of_mem _ (Finset.mem_univ _) + have h_exists_a : σ i ∈ S.val := hσ.2 ▸ Finset.mem_image_of_mem _ (Finset.mem_univ _) have h_exists_a : Finset.image (fun a : Fin m => S.val.orderEmbOfFin S.property a) Finset.univ = S.val := by refine' Finset.eq_of_subset_of_card_le (Finset.image_subset_iff.mpr fun a _ => Finset.orderEmbOfFin_mem _ _ _) _ rw [Finset.card_image_of_injective _ fun a b h => by simpa [Fin.ext_iff] using h]; simp [S.2] grind exact ⟨fun i => Classical.choose (h_exists_a i), fun i => Classical.choose_spec (h_exists_a i)⟩ - have ha_inj : Function.Injective a := by - exact fun i j hij => hσ.1 <| by simp [ha, hij] + have ha_inj : Function.Injective a := fun i j hij => hσ.1 <| by simp [ha, hij] exact ⟨Equiv.ofBijective a ⟨ha_inj, Finite.injective_iff_surjective.mp ha_inj⟩, funext fun i => ha i ▸ rfl⟩ · rintro ⟨a, rfl⟩ constructor @@ -639,8 +634,7 @@ lemma prod_singularValuesSorted_eq_compoundSV (M : Matrix d d ℂ) (k : ℕ) exact singularValuesSorted_antitone (compoundMatrix M k) (Fin.zero_le idx) · obtain ⟨j, hj⟩ := singularValuesSorted_mem_values (compoundMatrix M k) ⟨0, hcard⟩ obtain ⟨S, hS⟩ := singularValues_compoundMatrix_rev M k j - rw [hj, hS] - exact prod_singularValues_subset_le_sorted_prod M k hk S + simpa [hj, hS] using prod_singularValues_subset_le_sorted_prod M k hk S /-- The **Rayleigh quotient bound**: @@ -799,8 +793,7 @@ lemma horn_weak_log_majorization (A B : Matrix d d ℂ) (k : ℕ) lemma rpow_antitone_of_nonneg_antitone {n : ℕ} {f : Fin n → ℝ} (hf : Antitone f) (hf_nn : ∀ i, 0 ≤ f i) {r : ℝ} (hr : 0 < r) : - Antitone (fun i => f i ^ r) := by - exact fun i j hij => Real.rpow_le_rpow (hf_nn _) (hf hij) hr.le + Antitone (fun i => f i ^ r) := fun _ _ hij => Real.rpow_le_rpow (hf_nn _) (hf hij) hr.le /-- Weak log-majorization is preserved under positive powers. -/ lemma rpow_preserves_weak_log_maj {n : ℕ} @@ -921,8 +914,7 @@ lemma weak_log_maj_sum_le {n : ℕ} · simp [Fin.sum_univ_castSucc, h_last] refine le_add_of_le_of_nonneg (ih (fun i => hx_nn _) (fun i => hy_nn _) (fun i j hij => hx_anti hij) (fun i j hij => hy_anti hij) ?_) (hy_nn _) intro k hk - simp - exact h_log_maj k (by linarith) + simpa using h_log_maj k (by linarith) · -- Since $x_{\text{last}} > 0$, we have $x_i > 0$ for all $i$. have hx_pos : ∀ i, 0 < x i := by exact fun i => lt_of_lt_of_le (lt_of_le_of_ne (hx_nn _) (Ne.symm h_last)) (hx_anti (Fin.le_last _)) diff --git a/QuantumInfo/ForMathlib/Matrix.lean b/QuantumInfo/ForMathlib/Matrix.lean index a2aee46ca..5f8cdcfa2 100644 --- a/QuantumInfo/ForMathlib/Matrix.lean +++ b/QuantumInfo/ForMathlib/Matrix.lean @@ -421,8 +421,7 @@ theorem le_smul_one_of_eigenvalues_iff (hA : A.IsHermitian) (c : ℝ) : (∀ i, hA.eigenvalues i ≤ c) ↔ A ≤ c • (1 : Matrix n n 𝕜) := by let U : Matrix n n 𝕜 := ↑hA.eigenvectorUnitary have hU : U.conjTranspose = star U := by simp only [star] - have hU' : U * star U = 1 := by - simp only [SetLike.coe_mem, Unitary.mul_star_self_of_mem, U] + have hU' : U * star U = 1 := by simp only [SetLike.coe_mem, Unitary.mul_star_self_of_mem, U] have hc : c • (1 : Matrix n n 𝕜) = U * (c • 1) * U.conjTranspose := by simp only [Algebra.mul_smul_comm, mul_one, hU, Algebra.smul_mul_assoc, hU'] have hc' : c • (1 : Matrix n n 𝕜) = diagonal (RCLike.ofReal ∘ fun _ : n ↦ c) := by @@ -430,8 +429,7 @@ theorem le_smul_one_of_eigenvalues_iff (hA : A.IsHermitian) (c : ℝ) : simp only [smul_apply, one_apply, smul_ite, RCLike.real_smul_eq_coe_mul, mul_one, smul_zero, diagonal, Function.comp_apply, of_apply] have hAST : A = U * diagonal (RCLike.ofReal ∘ hA.eigenvalues) * U.conjTranspose := by - rw [hU] - exact IsHermitian.spectral_theorem hA + simpa [hU] using IsHermitian.spectral_theorem hA constructor · intro h rw [hc, hc', hAST] @@ -441,8 +439,7 @@ theorem le_smul_one_of_eigenvalues_iff (hA : A.IsHermitian) (c : ℝ) : simp only [Function.comp_apply, algebraMap_le_algebraMap, h i] intro hAc i replace hAc := conjTranspose_mul_mul_mono U hAc - have hU'CT : star U * U = 1 := by - simp only [SetLike.coe_mem, Unitary.star_mul_self_of_mem, U] + have hU'CT : star U * U = 1 := by simp only [SetLike.coe_mem, Unitary.star_mul_self_of_mem, U] have hcCT : U.conjTranspose * (c • 1) * U = c • (1 : Matrix n n 𝕜) := by simp only [Algebra.mul_smul_comm, mul_one, hU, Algebra.smul_mul_assoc, hU'CT] have hASTCT : U.conjTranspose * A * U = diagonal (RCLike.ofReal ∘ hA.eigenvalues) := by @@ -459,8 +456,7 @@ theorem smul_one_le_of_eigenvalues_iff (hA : A.IsHermitian) (c : ℝ) : -- I did the lazy thing and just copied the previous proof let U : Matrix n n 𝕜 := ↑hA.eigenvectorUnitary have hU : U.conjTranspose = star U := by simp only [star] - have hU' : U * star U = 1 := by - simp only [SetLike.coe_mem, Unitary.mul_star_self_of_mem, U] + have hU' : U * star U = 1 := by simp only [SetLike.coe_mem, Unitary.mul_star_self_of_mem, U] have hc : c • (1 : Matrix n n 𝕜) = U * (c • 1) * U.conjTranspose := by simp only [Algebra.mul_smul_comm, mul_one, hU, Algebra.smul_mul_assoc, hU'] have hc' : c • (1 : Matrix n n 𝕜) = diagonal (RCLike.ofReal ∘ fun _ : n ↦ c) := by @@ -468,8 +464,7 @@ theorem smul_one_le_of_eigenvalues_iff (hA : A.IsHermitian) (c : ℝ) : simp only [smul_apply, one_apply, smul_ite, RCLike.real_smul_eq_coe_mul, mul_one, smul_zero, diagonal, Function.comp_apply, of_apply] have hAST : A = U * diagonal (RCLike.ofReal ∘ hA.eigenvalues) * U.conjTranspose := by - rw [hU] - exact IsHermitian.spectral_theorem hA + simpa [hU] using IsHermitian.spectral_theorem hA constructor · intro h rw [hc, hc', hAST] @@ -479,8 +474,7 @@ theorem smul_one_le_of_eigenvalues_iff (hA : A.IsHermitian) (c : ℝ) : simp only [Function.comp_apply, algebraMap_le_algebraMap, h i] intro hAc i replace hAc := conjTranspose_mul_mul_mono U hAc - have hU'CT : star U * U = 1 := by - simp only [SetLike.coe_mem, Unitary.star_mul_self_of_mem, U] + have hU'CT : star U * U = 1 := by simp only [SetLike.coe_mem, Unitary.star_mul_self_of_mem, U] have hcCT : U.conjTranspose * (c • 1) * U = c • (1 : Matrix n n 𝕜) := by simp only [Algebra.mul_smul_comm, mul_one, hU, Algebra.smul_mul_assoc, hU'CT] have hASTCT : U.conjTranspose * A * U = diagonal (RCLike.ofReal ∘ hA.eigenvalues) := by @@ -748,8 +742,7 @@ theorem PosDef_iff_eigenvalues' (M : Matrix d d 𝕜) : --These is disgusting atm. There's cleaner versions of them headed to Mathlib. See #29526 and follow-ups theorem IsHermitian.cfc_eigenvalues {M : Matrix d d 𝕜} (hM : M.IsHermitian) (f : ℝ → ℝ) : ∃ (e : d ≃ d), Matrix.IsHermitian.eigenvalues (cfc_predicate f M) = f ∘ hM.eigenvalues ∘ e := by - have h_eigenvalues : Multiset.map hM.eigenvalues Finset.univ.val = Multiset.map (fun i => hM.eigenvalues i) Finset.univ.val := by - rfl + have h_eigenvalues : Multiset.map hM.eigenvalues Finset.univ.val = Multiset.map (fun i => hM.eigenvalues i) Finset.univ.val := rfl generalize_proofs at *; have h_eigenvalues_cfc : (IsHermitian.cfc hM f).charpoly.roots = Multiset.map (fun i => (f (hM.eigenvalues i) : 𝕜)) Finset.univ.val := by rw [ Matrix.IsHermitian.cfc, Matrix.charpoly ]; @@ -900,14 +893,12 @@ theorem PosSemidef.pos_of_mem_spectrum {A : Matrix d d 𝕜} (hA : A.PosSemidef) exact hA.eigenvalues_nonneg i theorem PosSemidef.pow_add {A : Matrix d d 𝕜} (hA : A.PosSemidef) {x y : ℝ} (hxy : x + y ≠ 0) : - cfc (· ^ (x + y) : ℝ → ℝ) A = cfc (fun r ↦ r ^ x * r ^ y : ℝ → ℝ) A := by - refine cfc_congr fun r hr ↦ ?_ - exact Real.rpow_add' (hA.pos_of_mem_spectrum r hr) hxy + cfc (· ^ (x + y) : ℝ → ℝ) A = cfc (fun r ↦ r ^ x * r ^ y : ℝ → ℝ) A := + cfc_congr fun r hr => Real.rpow_add' (hA.pos_of_mem_spectrum r hr) hxy theorem PosSemidef.pow_mul {A : Matrix d d 𝕜} {x y : ℝ} (hA : A.PosSemidef) : - cfc (· ^ (x * y) : ℝ → ℝ) A = cfc (fun r ↦ (r ^ x) ^ y : ℝ → ℝ) A := by - refine cfc_congr fun r hr ↦ ?_ - exact Real.rpow_mul (hA.pos_of_mem_spectrum r hr) x y + cfc (· ^ (x * y) : ℝ → ℝ) A = cfc (fun r ↦ (r ^ x) ^ y : ℝ → ℝ) A := + cfc_congr fun r hr => Real.rpow_mul (hA.pos_of_mem_spectrum r hr) x y end more_cfc @@ -919,8 +910,7 @@ variable {d₁ d₂ : Type*} [Fintype d₁] [Fintype d₂] @[simp] theorem trace_submatrix (A : Matrix d₁ d₁ α) (e : d₂ ≃ d₁) : - (A.submatrix e e).trace = A.trace := by - simpa [Matrix.trace] using e.sum_comp (fun x ↦ A x x) + (A.submatrix e e).trace = A.trace := by simpa [Matrix.trace] using e.sum_comp (fun x ↦ A x x) end subm @@ -1446,8 +1436,7 @@ The right partial trace of a matrix is equal to the left partial trace of the ma -/ theorem traceRight_eq_traceLeft_reindex {n m R : Type*} [Fintype m] [AddCommMonoid R] (M : Matrix (n × m) (n × m) R) : - M.traceRight = (M.reindex (.prodComm ..) (.prodComm ..)).traceLeft := by - rfl + M.traceRight = (M.reindex (.prodComm ..) (.prodComm ..)).traceLeft := rfl open ComplexOrder in theorem PosSemidef.trace_pos {n 𝕜 : Type*} [Fintype n] [RCLike 𝕜] @@ -1475,8 +1464,7 @@ theorem traceLeft_neg : (-A).traceLeft = -A.traceLeft := by ext : 2; simp [Matrix.traceLeft] @[simp] -theorem traceLeft_sub : (A - B).traceLeft = A.traceLeft - B.traceLeft := by - simp [sub_eq_add_neg] +theorem traceLeft_sub : (A - B).traceLeft = A.traceLeft - B.traceLeft := by simp [sub_eq_add_neg] variable {A B : Matrix (n × m) (n × m) α} diff --git a/QuantumInfo/ForMathlib/MatrixNorm/TraceNorm.lean b/QuantumInfo/ForMathlib/MatrixNorm/TraceNorm.lean index 7bffe61ca..14d942279 100644 --- a/QuantumInfo/ForMathlib/MatrixNorm/TraceNorm.lean +++ b/QuantumInfo/ForMathlib/MatrixNorm/TraceNorm.lean @@ -30,16 +30,14 @@ def traceNorm (A : Matrix m n R) : ℝ := RCLike.re (CFC.sqrt (Aᴴ * A)).trace @[simp] -theorem traceNorm_zero : traceNorm (0 : Matrix m n R) = 0 := by - simp [traceNorm] +theorem traceNorm_zero : traceNorm (0 : Matrix m n R) = 0 := by simp [traceNorm] /-- The trace norm of the negative is equal to the trace norm. -/ @[simp] theorem traceNorm_neg (A : Matrix m n R) : traceNorm (-A) = traceNorm A := by unfold traceNorm congr! 3 - rw [Matrix.conjTranspose_neg, Matrix.neg_mul, Matrix.mul_neg] - exact neg_neg _ + simp [Matrix.conjTranspose_neg, Matrix.neg_mul, Matrix.mul_neg] open MatrixOrder Isometry @@ -228,9 +226,8 @@ theorem exists_svd_sqrt_eigenvalues (A : Matrix n n ℂ) : have hleft : (A * W.val) i j = A.mulVec (hH.eigenvectorBasis j).ofLp i := by simp [Matrix.mul_apply, Matrix.mulVec, dotProduct, W, Matrix.IsHermitian.eigenvectorUnitary_apply] by_cases hj : hH.eigenvalues j = 0 - · have hzero : A.mulVec (hH.eigenvectorBasis j).ofLp = 0 := by - apply (WithLp.toLp_injective (p := 2)) - exact inner_self_eq_zero.mp (by + · have hzero : A.mulVec (hH.eigenvectorBasis j).ofLp = 0 := + WithLp.toLp_injective (p := 2) <| inner_self_eq_zero.mp (by rw [inner_A_mulVec_eq] rw [hH.mulVec_eigenvectorBasis j, hj] simp) @@ -286,8 +283,7 @@ theorem singularValues_le_opNorm [DecidableEq n] (A : Matrix n n ℂ) (i : n) : let hH : (Aᴴ * A).IsHermitian := by simpa using (Matrix.isHermitian_mul_conjTranspose_self A.conjTranspose) have hmem : hH.eigenvalues i ∈ spectrum ℝ (Aᴴ * A) := by - rw [hH.spectrum_real_eq_range_eigenvalues] - exact ⟨i, rfl⟩ + simp [hH.spectrum_real_eq_range_eigenvalues] have hsq : singularValues A i * singularValues A i ≤ ‖A‖ * ‖A‖ := by have hsv_sq : singularValues A i * singularValues A i = hH.eigenvalues i := by dsimp [singularValues] @@ -315,9 +311,8 @@ theorem traceNorm_mul_le_opNorm_traceNorm [DecidableEq n] (A B : Matrix n n ℂ) rw [singularValuesSorted_zero_eq_sup A hcard] rw [Finset.sup'_le_iff] exact fun i _ => singularValues_le_opNorm A i - have hA_bound : ∀ i : Fin (Fintype.card n), singularValuesSorted A i ≤ ‖A‖ := by - intro i - exact ((singularValuesSorted_antitone A) (Fin.zero_le i)).trans htop + have hA_bound : ∀ i : Fin (Fintype.card n), singularValuesSorted A i ≤ ‖A‖ := + fun i => ((singularValuesSorted_antitone A) (Fin.zero_le i)).trans htop calc (A * B).traceNorm = ∑ i : Fin (Fintype.card n), singularValuesSorted (A * B) i := by rw [traceNorm_eq_sum_singularValuesSorted] @@ -327,10 +322,8 @@ theorem traceNorm_mul_le_opNorm_traceNorm [DecidableEq n] (A B : Matrix n n ℂ) refine Finset.sum_le_sum ?_ intro i hi exact mul_le_mul_of_nonneg_right (hA_bound i) (singularValuesSorted_nonneg B i) - _ = ‖A‖ * ∑ i : Fin (Fintype.card n), singularValuesSorted B i := by - rw [Finset.mul_sum] - _ = ‖A‖ * B.traceNorm := by - rw [traceNorm_eq_sum_singularValuesSorted] + _ = ‖A‖ * ∑ i : Fin (Fintype.card n), singularValuesSorted B i := by rw [Finset.mul_sum] + _ = ‖A‖ * B.traceNorm := by rw [traceNorm_eq_sum_singularValuesSorted] omit [DecidableEq n] in /-- The trace norm is invariant under conjugate transpose. -/ @@ -371,12 +364,10 @@ omit [Fintype m] [RCLike R] [DecidableEq n] in theorem traceNorm_sandwich_le [DecidableEq n] {S M T : Matrix n n ℂ} (hS : ‖S‖ ≤ 1) (hT : ‖T‖ ≤ 1) : (S * M * T).traceNorm ≤ M.traceNorm := calc (S * M * T).traceNorm - ≤ (M * T).traceNorm := by - exact le_trans + ≤ (M * T).traceNorm := le_trans (by simpa [Matrix.mul_assoc] using Matrix.traceNorm_mul_le_opNorm_traceNorm S (M * T)) (by simpa using mul_le_mul_of_nonneg_right hS (Matrix.traceNorm_nonneg (M * T))) - _ ≤ M.traceNorm := by - exact le_trans (traceNorm_mul_le_traceNorm_opNorm M T) + _ ≤ M.traceNorm := le_trans (traceNorm_mul_le_traceNorm_opNorm M T) (by simpa using mul_le_mul_of_nonneg_left hT (Matrix.traceNorm_nonneg M)) end @@ -399,13 +390,11 @@ theorem abs_trace_le_traceNorm (A : Matrix n n ℂ) : simpa [Matrix.trace] using norm_sum_le (s := Finset.univ) (f := fun i => (C.val * D) i i) _ = ∑ i, ‖C.val i i‖ * Real.sqrt (hH.eigenvalues i) := by simp [D, Matrix.mul_apply, Matrix.diagonal, Real.norm_eq_abs, abs_of_nonneg] - _ ≤ ∑ i, Real.sqrt (hH.eigenvalues i) := by - exact Finset.sum_le_sum (fun i _ => by + _ ≤ ∑ i, Real.sqrt (hH.eigenvalues i) := Finset.sum_le_sum (fun i _ => by simpa using mul_le_mul_of_nonneg_right (entry_norm_bound_of_unitary C.property i i) (Real.sqrt_nonneg _)) - _ = A.traceNorm := by - simpa [hH] using (traceNorm_eq_sum_sqrt_eigenvalues A).symm + _ = A.traceNorm := by simpa [hH] using (traceNorm_eq_sum_sqrt_eigenvalues A).symm end complexTraceNorm diff --git a/QuantumInfo/ForMathlib/Misc.lean b/QuantumInfo/ForMathlib/Misc.lean index 0e6dd5b76..4faae5a2c 100644 --- a/QuantumInfo/ForMathlib/Misc.lean +++ b/QuantumInfo/ForMathlib/Misc.lean @@ -169,8 +169,7 @@ lemma exists_equiv_of_multiset_map_eq {α β γ : Type*} [Fintype α] [Fintype ∃ e : α ≃ β, f = g ∘ e := by -- Since the multisets of values are equal, the cardinalities of the domains must be equal (as the multiset size is the cardinality of the domain). Thus there exists a bijection `σ : α ≃ β`. obtain ⟨σ, hσ⟩ : ∃ σ : α ≃ β, Multiset.map f Finset.univ.val = Multiset.map (g ∘ σ) Finset.univ.val := by - have h_card : Fintype.card α = Fintype.card β := by - simpa using congr_arg Multiset.card h; + have h_card : Fintype.card α = Fintype.card β := by simpa using congr_arg Multiset.card h obtain σ := Fintype.equivOfCardEq h_card use σ have h_multiset_eq : Multiset.map g Finset.univ.val = Multiset.map (g ∘ σ) Finset.univ.val := by @@ -178,6 +177,5 @@ lemma exists_equiv_of_multiset_map_eq {α β γ : Type*} [Fintype α] [Fintype rw [ Multiset.map_map ] exact h.trans h_multiset_eq; -- By `Multiset.map_univ_eq_iff`, there exists `e' : α ≃ α` such that `f = (g ∘ σ) ∘ e'`. - obtain ⟨e', he'⟩ : ∃ e' : α ≃ α, f = (g ∘ σ) ∘ e' := by - exact (Multiset.map_univ_eq_iff f (g ∘ ⇑σ)).mp hσ; + obtain ⟨e', he'⟩ : ∃ e' : α ≃ α, f = (g ∘ σ) ∘ e' := (Multiset.map_univ_eq_iff f (g ∘ ⇑σ)).mp hσ exact ⟨ e'.trans σ, by simp_all [ Function.comp ]; grind⟩ diff --git a/QuantumInfo/ForMathlib/SionMinimax.lean b/QuantumInfo/ForMathlib/SionMinimax.lean index c6e379814..f1c801510 100644 --- a/QuantumInfo/ForMathlib/SionMinimax.lean +++ b/QuantumInfo/ForMathlib/SionMinimax.lean @@ -121,8 +121,7 @@ theorem LowerSemicontinuousOn.bddBelow {α : Type*} [TopologicalSpace α] {S : S intros x hx specialize hg x hx (g x - 1) (sub_one_lt (g x)) rw [eventually_nhdsWithin_iff] at hg - simp only [Set.mem_inter_iff, gt_iff_lt, and_imp] - exact ⟨_, hg, fun y hy hyS ↦ hy hyS⟩ + simpa only [Set.mem_inter_iff, gt_iff_lt, and_imp] using ⟨_, hg, fun y hy hyS ↦ hy hyS⟩ choose! U hU using h_neighborhood -- By the finite subcover property, there exists a finite subset t ⊆ S$ such that S ⊆ ⋃_{x ∈ t} U_x$. obtain ⟨t, ht⟩ : ∃ t, (∀ x ∈ t, x ∈ S) ∧ S ⊆ ⋃ x ∈ t, U x := @@ -164,16 +163,14 @@ theorem lowerSemicontinuousOn_iff_isClosed_preimage {f : α → γ} [IsClosed s] exact ⟨ o, ho, h.1, Set.eq_empty_iff_forall_notMem.2 fun z hz => h.2 ⟨ hz.1, hz.2.1 ⟩ |> not_le_of_gt <| Set.mem_Iic.1 hz.2.2 ⟩; · exact ⟨ sᶜ, IsClosed.isOpen_compl, hx', by aesop ⟩; · intro a x hx y hy - have hx_not_in : x ∉ s ∩ f ⁻¹' Set.Iic y := by - simp [hy] + have hx_not_in : x ∉ s ∩ f ⁻¹' Set.Iic y := by simp [hy] rw [ eventually_nhdsWithin_iff ] filter_upwards [ IsOpen.mem_nhds ( isOpen_compl_iff.2 ( a y ) ) hx_not_in ] with z hz hzs exact lt_of_not_ge fun h => hz ⟨hzs, h⟩ theorem segment.isConnected {E : Type u_1} [AddCommGroup E] [Module ℝ E] [TopologicalSpace E] [ContinuousAdd E] [ContinuousSMul ℝ E] (a b : E) : IsConnected (segment ℝ a b) := by - rw [← Path.range_segment a b] - exact isConnected_range (Path.segment a b).continuous + simpa [Path.range_segment a b] using isConnected_range (Path.segment a b).continuous theorem BddAbove.range_inf_of_image2 {M N α : Type*} {f : M → N → α} [ConditionallyCompleteLinearOrder α] {S : Set M} {T : Set N} (h_bddA : BddAbove (Set.image2 f S T)) (h_bddB : BddBelow (Set.image2 f S T)) : @@ -269,8 +266,7 @@ theorem LeftOrdContinuous.comp_lowerSemicontinuousOn_strong_assumptions {α γ by_contra h_contra simp only [not_exists, not_and, not_lt] at h_contra have h_exists_z : ∃ z, z < f x ∧ g z > y := by - have h_lub : IsLUB (Set.Iio (f x)) (f x) := by - exact isLUB_Iio + have h_lub : IsLUB (Set.Iio (f x)) (f x) := isLUB_Iio have := hg h_lub; have := this.exists_between hy simp_all only [Set.mem_image, Set.mem_Iio, exists_exists_and_eq_and, gt_iff_lt] @@ -471,9 +467,7 @@ private lemma sion_exists_min_2 (y₁ y₂ : N) (hy₁ : y₁ ∈ T) (hy₂ : y simp only [Set.mem_setOf_eq, I, C] at hzI replace ⟨hzI, hzI2⟩ := And.intro (hzI · |>.left) (hzI · |>.right) have hz_mem : z ∈ segment ℝ y₁ y₂ := - have cloL : IsClosed (segment ℝ y₁ y₂) := by - rw [← closure_openSegment] - exact isClosed_closure + have cloL : IsClosed (segment ℝ y₁ y₂) := by simp [← closure_openSegment] cloL.isSeqClosed hzI hzs let x := (hC_nonempty z hz_mem).some have hx : x ∈ C z := (hC_nonempty z hz_mem).some_mem @@ -509,9 +503,7 @@ private lemma sion_exists_min_2 (y₁ y₂ : N) (hy₁ : y₁ ∈ T) (hy₂ : y simp only [Set.mem_setOf_eq, J, C] at hzI replace ⟨hzI, hzI2⟩ := And.intro (hzI · |>.left) (hzI · |>.right) have hz_mem : z ∈ segment ℝ y₁ y₂ := - have cloL : IsClosed (segment ℝ y₁ y₂) := by - rw [← closure_openSegment] - exact isClosed_closure + have cloL : IsClosed (segment ℝ y₁ y₂) := by simp [← closure_openSegment] cloL.isSeqClosed hzI hzs let x := (hC_nonempty z hz_mem).some have hx : x ∈ C z := (hC_nonempty z hz_mem).some_mem diff --git a/QuantumInfo/ForMathlib/ULift.lean b/QuantumInfo/ForMathlib/ULift.lean index 82195f7de..355989d42 100644 --- a/QuantumInfo/ForMathlib/ULift.lean +++ b/QuantumInfo/ForMathlib/ULift.lean @@ -28,8 +28,7 @@ instance ULift.instStar {𝕜 : Type u} [Star 𝕜] : Star (ULift.{v,u} 𝕜) wh star x := .up (star x.down) @[simp] -theorem ULift.star_eq {𝕜 : Type u} [Star 𝕜] (x : ULift.{v,u} 𝕜) : star x = .up (star x.down) := by - rfl +theorem ULift.star_eq {𝕜 : Type u} [Star 𝕜] (x : ULift.{v,u} 𝕜) : star x = .up (star x.down) := rfl instance ULift.instInvolutiveStar {𝕜 : Type u} [InvolutiveStar 𝕜] : InvolutiveStar (ULift.{v,u} 𝕜) where @@ -43,8 +42,7 @@ instance {𝕜 : Type u} [NonUnitalNonAssocSemiring 𝕜] [StarRing 𝕜] : Star @[simp] theorem ULift.starRingEnd_down {𝕜 : Type u} (x : ULift.{v,u} 𝕜) [CommSemiring 𝕜] [StarRing 𝕜] : - ((starRingEnd (ULift.{v, u} 𝕜)) x).down = star x.down := by - rfl + ((starRingEnd (ULift.{v, u} 𝕜)) x).down = star x.down := rfl instance {𝕜 : Type u} [NormedField 𝕜] : NormedField (ULift.{v,u} 𝕜) where dist_eq x y := NormedField.dist_eq x.down y.down @@ -55,8 +53,7 @@ instance {𝕜 : Type u} [DenselyNormedField 𝕜] : DenselyNormedField (ULift.{ @[simp] theorem AddEquiv.ulift_apply {α : Type u} [Add α] (x : ULift.{v, u} α) : - AddEquiv.ulift.{u, v} x = x.down := by - rfl + AddEquiv.ulift.{u, v} x = x.down := rfl noncomputable instance {𝕜 : Type u} [RCLike 𝕜] : RCLike (ULift.{v,u} 𝕜) where re := RCLike.re.comp AddEquiv.ulift.toAddMonoidHom (N := 𝕜) diff --git a/QuantumInfo/ForMathlib/Unitary.lean b/QuantumInfo/ForMathlib/Unitary.lean index 5b09a3d5b..58e3f84bd 100644 --- a/QuantumInfo/ForMathlib/Unitary.lean +++ b/QuantumInfo/ForMathlib/Unitary.lean @@ -25,13 +25,11 @@ open Module.End @[simp] theorem unitary_star_apply_eq (U : unitary (E →ₗ[𝕜] E)) (v : E) : - (star U.val) (U.val v) = v := by - rw [← mul_apply, (Unitary.mem_iff.mp U.prop).left, one_apply] + (star U.val) (U.val v) = v := by rw [← mul_apply, (Unitary.mem_iff.mp U.prop).left, one_apply] @[simp] theorem unitary_apply_star_eq (U : unitary (E →ₗ[𝕜] E)) (v : E) : - U.val ((star U.val) v) = v := by - rw [← mul_apply, (Unitary.mem_iff.mp U.prop).right, one_apply] + U.val ((star U.val) v) = v := by rw [← mul_apply, (Unitary.mem_iff.mp U.prop).right, one_apply] /-- Conjugating a linear map by a unitary operator gives a map whose μ-eigenspace is isomorphic (same dimension) as those of the original linear map. -/ diff --git a/QuantumInfo/Measurements/POVM.lean b/QuantumInfo/Measurements/POVM.lean index 781d0e9ab..c2c7c32e0 100644 --- a/QuantumInfo/Measurements/POVM.lean +++ b/QuantumInfo/Measurements/POVM.lean @@ -161,8 +161,7 @@ noncomputable def measureDiscard (Λ : POVM X d) : CPTPMap d X := CPTPMap.traceLeft ∘ₘ Λ.measurementMap theorem measureDiscard_apply (Λ : POVM X d) (ρ : MState d) : - Λ.measureDiscard ρ = MState.ofClassical (Λ.measure ρ) := by - simp [measureDiscard, traceLeft_measurementMap_eq_measure] + Λ.measureDiscard ρ = MState.ofClassical (Λ.measure ρ) := by simp [measureDiscard, traceLeft_measurementMap_eq_measure] /-- The action of measuring a state with the POVM `Λ`, forgetting the measurement outcome, and keeping the disturbed state. -/ diff --git a/QuantumInfo/Operators/Unitary.lean b/QuantumInfo/Operators/Unitary.lean index 9a8fa46a0..10bc5eaf5 100644 --- a/QuantumInfo/Operators/Unitary.lean +++ b/QuantumInfo/Operators/Unitary.lean @@ -47,8 +47,7 @@ of a matrix are always canonically sorted, this is actually an equality. -/ @[simp] theorem U_conj_spectrum_eq (ρ : MState d) (U : 𝐔[d]) : - (ρ.U_conj U).spectrum = ρ.spectrum := by - simp [spectrum, U_conj] + (ρ.U_conj U).spectrum = ρ.spectrum := by simp [spectrum, U_conj] @[simp] theorem inner_U_conj (ρ σ : MState d) (U : 𝐔[d]) : ⟪U ◃ ρ, U ◃ σ⟫_Prob = ⟪ρ, σ⟫_Prob := by diff --git a/QuantumInfo/ResourceTheory/FreeState.lean b/QuantumInfo/ResourceTheory/FreeState.lean index 1140fb184..d93598b96 100644 --- a/QuantumInfo/ResourceTheory/FreeState.lean +++ b/QuantumInfo/ResourceTheory/FreeState.lean @@ -117,8 +117,7 @@ open ComplexOrder in theorem PosDef.prod {ρ : MState (H i)} {σ : MState (H j)} (hρ : ρ.m.PosDef) (hσ : σ.m.PosDef) : (ρ ⊗ᵣ σ).m.PosDef := by have : (ρ ⊗ᴹ σ).m.PosDef := MState.PosDef.kron hρ hσ - rw [prodRelabel] - exact MState.PosDef.relabel this (prodEquiv i j) + simpa [prodRelabel] using MState.PosDef.relabel this (prodEquiv i j) --BAD old attempt at PNat powers -- /-- Powers of spaces. Defined for `PNat` so that we don't have zeroth powers. -/ @@ -153,13 +152,11 @@ theorem PosDef.prod {ρ : MState (H i)} {σ : MState (H j)} (hρ : ρ.m.PosDef) @[simp] theorem qRelEntropy_prodRelabel (ρ₁ ρ₂ : MState (H i)) (σ₁ σ₂ : MState (H j)): - 𝐃(ρ₁ ⊗ᵣ σ₁‖ρ₂ ⊗ᵣ σ₂) = 𝐃(ρ₁‖ρ₂) + 𝐃(σ₁‖σ₂) := by - simp [prodRelabel] + 𝐃(ρ₁ ⊗ᵣ σ₁‖ρ₂ ⊗ᵣ σ₂) = 𝐃(ρ₁‖ρ₂) + 𝐃(σ₁‖σ₂) := by simp [prodRelabel] @[simp] theorem sandwichedRelRentropy_prodRelabel {α : ℝ} (ρ₁ ρ₂ : MState (H i)) (σ₁ σ₂ : MState (H j)): - D̃_ α(ρ₁ ⊗ᵣ σ₁‖ρ₂ ⊗ᵣ σ₂) = D̃_ α(ρ₁‖ρ₂) + D̃_ α(σ₁‖σ₂) := by - simp [prodRelabel] + D̃_ α(ρ₁ ⊗ᵣ σ₁‖ρ₂ ⊗ᵣ σ₂) = D̃_ α(ρ₁‖ρ₂) + D̃_ α(σ₁‖σ₂) := by simp [prodRelabel] end ResourcePretheory @@ -193,15 +190,12 @@ noncomputable def spacePow (i : ι) (n : ℕ) : ι := scoped notation i "⊗^H[" n "]" => spacePow i n @[simp] -theorem spacePow_zero (i : ι) : i ^ 0 = 1 := by - rfl +theorem spacePow_zero (i : ι) : i ^ 0 = 1 := rfl @[simp] -theorem spacePow_one (i : ι) : i ^ 1 = i := by - simp +theorem spacePow_one (i : ι) : i ^ 1 = i := by simp -theorem spacePow_succ (i : ι) (n : ℕ) : i ^ (n + 1) = (i ^ n) * i := by - rfl +theorem spacePow_succ (i : ι) (n : ℕ) : i ^ (n + 1) = (i ^ n) * i := rfl theorem spacePow_add (m n : ℕ) : i ^ (m + n) = (i ^ m) * (i ^ n) := by @@ -223,8 +217,7 @@ noncomputable def statePow (ρ : MState (H i)) (n : ℕ) : MState (H (i ^ n)) := scoped notation ρ " ⊗ᵣ^[" n "]" => statePow ρ n @[simp] -theorem statePow_zero (ρ : MState (H i)) : ρ ⊗ᵣ^[0] = default := - rfl +theorem statePow_zero (ρ : MState (H i)) : ρ ⊗ᵣ^[0] = default := rfl @[simp] theorem statePow_one (ρ : MState (H i)) : ρ ⊗ᵣ^[1] ≍ ρ := by @@ -233,8 +226,7 @@ theorem statePow_one (ρ : MState (H i)) : ρ ⊗ᵣ^[1] ≍ ρ := by · rw [eq_cast_iff_heq, statePow] exact default_prod ρ -theorem statePow_succ (ρ : MState (H i)) (n : ℕ) : ρ ⊗ᵣ^[n + 1] = ρ ⊗ᵣ^[n] ⊗ᵣ ρ := by - rfl +theorem statePow_succ (ρ : MState (H i)) (n : ℕ) : ρ ⊗ᵣ^[n + 1] = ρ ⊗ᵣ^[n] ⊗ᵣ ρ := rfl theorem statePow_add (ρ : MState (H i)) (m n : ℕ) : ρ ⊗ᵣ^[m + n] ≍ ρ ⊗ᵣ^[m] ⊗ᵣ ρ ⊗ᵣ^[n] := by rw [← eq_cast_iff_heq]; swap diff --git a/QuantumInfo/ResourceTheory/HypothesisTesting.lean b/QuantumInfo/ResourceTheory/HypothesisTesting.lean index 9a9dbec0f..e6bec24a8 100644 --- a/QuantumInfo/ResourceTheory/HypothesisTesting.lean +++ b/QuantumInfo/ResourceTheory/HypothesisTesting.lean @@ -117,8 +117,7 @@ theorem le_of_subset (ρ : MState d) (ε : Prob) {S1 S2 : Set (MState d)} (h : S theorem of_singleton {ρ σ : MState d} {ε : Prob} : β_ ε(ρ‖{σ}) = ⨅ T : { m : HermitianMat d ℂ // ρ.exp_val (1 - m) ≤ ε ∧ 0 ≤ m ∧ m ≤ 1}, - ⟨_, σ.exp_val_prob T.2.right⟩ := by - simp only [OptimalHypothesisRate, iSup_singleton] + ⟨_, σ.exp_val_prob T.2.right⟩ := by simp only [OptimalHypothesisRate, iSup_singleton] open scoped Prob in theorem negLog_le_singleton (ρ : MState d) (ε : Prob) (S : Set (MState d)) @@ -209,8 +208,7 @@ theorem exists_min (ρ : MState d) (ε : Prob) (S : Set (MState d)): gcongr · exact T.2.2.1 · simp; positivity - have hρT' : ρ.exp_val (1 - T') = ε := by - simp [T', MState.exp_val_sub, δ, field] + have hρT' : ρ.exp_val (1 - T') = ε := by simp [T', MState.exp_val_sub, δ, field] have hT' : ρ.exp_val (1 - T') ≤ ε ∧ 0 ≤ T' ∧ T' ≤ 1 := by use hρT'.le diff --git a/QuantumInfo/ResourceTheory/SteinsLemma.lean b/QuantumInfo/ResourceTheory/SteinsLemma.lean index 6db4c8b62..b5d4edadd 100644 --- a/QuantumInfo/ResourceTheory/SteinsLemma.lean +++ b/QuantumInfo/ResourceTheory/SteinsLemma.lean @@ -620,9 +620,8 @@ private lemma f_image_bound (mineig : ℝ) (n : ℕ) (h : 0 < mineig) (hn : 0 < exact Real.log_nonpos ( by linarith [ pow_pos h n ] ) right_1; · have := h_f_le n 1 simp_all only [Real.log_one, zero_div, Int.ceil_zero, Int.cast_zero, zero_mul, zero_add, lt_neg_add_iff_add_lt, add_zero] - have h_card_image : Set.ncard (Set.image (fun k : ℤ => Real.exp (k * (Real.log (1 / mineig) + Real.log 3 / (max n 1)))) (Set.Icc (⌈(n * Real.log mineig - Real.log 3) / (Real.log (1 / mineig) + Real.log 3 / (max n 1))⌉) 0)) ≤ Set.ncard (Set.Icc (⌈(n * Real.log mineig - Real.log 3) / (Real.log (1 / mineig) + Real.log 3 / (max n 1))⌉) 0) := by - apply Set.ncard_image_le; - exact Set.finite_Icc _ _; + have h_card_image : Set.ncard (Set.image (fun k : ℤ => Real.exp (k * (Real.log (1 / mineig) + Real.log 3 / (max n 1)))) (Set.Icc (⌈(n * Real.log mineig - Real.log 3) / (Real.log (1 / mineig) + Real.log 3 / (max n 1))⌉) 0)) ≤ Set.ncard (Set.Icc (⌈(n * Real.log mineig - Real.log 3) / (Real.log (1 / mineig) + Real.log 3 / (max n 1))⌉) 0) := + Set.ncard_image_le (Set.finite_Icc _ _) simp_all +decide [ Set.ncard_eq_toFinset_card' ]; refine le_trans h_card <| le_trans h_card_image ?_; rcases n with _ | n @@ -781,14 +780,12 @@ private theorem log_le_f (n : ℕ) (lam : ℝ) : Real.log lam ≤ f_map i n lam _ ≤ (⌈Real.log lam / (σ₁_c i n)⌉) * σ₁_c i n := by rw [← mul_inv_le_iff₀ (σ₁_c_pos i n)] apply Int.le_ceil _ - _ = _ := by - rfl + _ = _ := rfl /-- (S46), part 2 -/ private theorem f_le_log (n : ℕ) (lam : ℝ) : f_map i n lam < Real.log lam + σ₁_c i n := calc - _ = ⌈Real.log lam / σ₁_c i n⌉ * σ₁_c i n := by - rfl + _ = ⌈Real.log lam / σ₁_c i n⌉ * σ₁_c i n := rfl _ < (Real.log lam / σ₁_c i n + 1) * σ₁_c i n := by gcongr · exact σ₁_c_pos i n diff --git a/QuantumInfo/States/Ensemble.lean b/QuantumInfo/States/Ensemble.lean index 621e1fe4a..ec2a0ae1d 100644 --- a/QuantumInfo/States/Ensemble.lean +++ b/QuantumInfo/States/Ensemble.lean @@ -42,8 +42,7 @@ namespace Ensemble instance : Coe (PEnsemble d α) (MEnsemble d α) := ⟨toMEnsemble⟩ @[simp] -theorem toMEnsemble_mk : (toMEnsemble ⟨ps, distr⟩ : MEnsemble d α) = ⟨pure ∘ ps, distr⟩ := - rfl +theorem toMEnsemble_mk : (toMEnsemble ⟨ps, distr⟩ : MEnsemble d α) = ⟨pure ∘ ps, distr⟩ := rfl /-- A mixed-state ensemble comes from a pure-state ensemble if and only if all states are pure. -/ theorem coe_PEnsemble_iff_pure_states (me : MEnsemble d α): (∃ pe : PEnsemble d α, ↑pe = me) ↔ (∃ ψ : α → Ket d, me.states = MState.pure ∘ ψ) := by @@ -112,14 +111,12 @@ def pure_average_NNReal {d : Type _} [Fintype d] (f : Ket d → NNReal) (e : PEn is equal to averaging the restricted function over Kets `f ∘ pure : Ket d → T` on `e`. -/ theorem average_of_pure_ensemble {T : Type _} {U : Type*} [AddCommGroup U] [Module ℝ U] [inst : Mixable U T] (f : MState d → T) (e : PEnsemble d α) : - average f (toMEnsemble e) = pure_average (f ∘ pure) e := by - simp only [average, pure_average, toMEnsemble, comp_map] + average f (toMEnsemble e) = pure_average (f ∘ pure) e := by simp only [average, pure_average, toMEnsemble, comp_map] variable {ψ : Ket d} @[simp] -theorem distr_toMEnsemble (e : PEnsemble d α) : (toMEnsemble e).distr = e.distr := by - rfl +theorem distr_toMEnsemble (e : PEnsemble d α) : (toMEnsemble e).distr = e.distr := rfl /- A pure-state ensemble mixes into a pure state if and only if diff --git a/QuantumInfo/States/Entanglement.lean b/QuantumInfo/States/Entanglement.lean index 7ada04aba..76667a7b0 100644 --- a/QuantumInfo/States/Entanglement.lean +++ b/QuantumInfo/States/Entanglement.lean @@ -84,8 +84,7 @@ theorem convex_roof_ne_top : ∀ ρ, convex_roof_ENNReal g ρ ≠ ∞ := fun ρ simp only [convex_roof_ENNReal, ne_eq, iInf_eq_top, coe_ne_top, imp_false, not_forall] use ⟨Fintype.card d, Fintype.card_pos⟩ have ed : d ≃ Fin ↑(⟨Fintype.card d, Fintype.card_pos⟩ : ℕ+) := by - simp only - exact Fintype.equivFin d + simpa only using Fintype.equivFin d use (congrPEnsemble ed) <| spectral_ensemble ρ rw [mix_congrPEnsemble_eq_mix ed] push Not @@ -126,8 +125,7 @@ theorem le_mixed_convex_roof (ρ : MState d) : unfold mixed_convex_roof rw [WithTop.le_untop_iff] apply le_iInf; intro ⟨n, hnpos⟩; apply le_iInf; intro e; apply le_iInf; intro hmix - rw [some_eq_coe', ENNReal.coe_le_coe] - exact h n hnpos e hmix + exact ENNReal.coe_le_coe.mpr (h n hnpos e hmix) set_option backward.isDefEq.respectTransparency false in theorem le_convex_roof (ρ : MState d) : @@ -135,8 +133,7 @@ theorem le_convex_roof (ρ : MState d) : unfold convex_roof rw [WithTop.le_untop_iff] apply le_iInf; intro ⟨n, hnpos⟩; apply le_iInf; intro e; apply le_iInf; intro hmix - rw [some_eq_coe', ENNReal.coe_le_coe] - exact h n hnpos e hmix + exact ENNReal.coe_le_coe.mpr (h n hnpos e hmix) set_option backward.isDefEq.respectTransparency false in theorem convex_roof_le (ρ : MState d): @@ -145,8 +142,7 @@ theorem convex_roof_le (ρ : MState d): unfold convex_roof rw [WithTop.untop_le_iff] apply iInf_le_of_le ⟨n, hnpos⟩; apply iInf_le_of_le e; apply iInf_le_of_le hmix - rw [some_eq_coe', ENNReal.coe_le_coe] - exact h + exact ENNReal.coe_le_coe.mpr h set_option backward.isDefEq.respectTransparency false in omit [Nonempty d] in @@ -156,8 +152,7 @@ theorem mixed_convex_roof_le (ρ : MState d): unfold mixed_convex_roof rw [WithTop.untop_le_iff] apply iInf_le_of_le ⟨n, hnpos⟩; apply iInf_le_of_le e; apply iInf_le_of_le hmix - rw [some_eq_coe', ENNReal.coe_le_coe] - exact h + exact ENNReal.coe_le_coe.mpr h /-- The mixed convex roof extension of `f` is smaller than or equal to its convex roof extension, since the former minimizes over a larger set of ensembles. -/ @@ -267,15 +262,13 @@ The von Neumann entropy of a state is equal to the trace of `ρ log ρ` (technic theorem Sᵥₙ_eq_trace_cfc {d : Type*} [Fintype d] [DecidableEq d] (ρ : MState d) : Sᵥₙ ρ = (HermitianMat.cfc ρ.M Real.negMulLog).trace := by -- By definition of von Neumann entropy, we have Sᵥₙ ρ = Finset.sum Finset.univ (fun x ↦ Real.negMulLog (ρ.M.H.eigenvalues x)). - have h_def : Sᵥₙ ρ = Finset.sum Finset.univ (fun x ↦ Real.negMulLog (ρ.M.H.eigenvalues x)) := by - rfl + have h_def : Sᵥₙ ρ = Finset.sum Finset.univ (fun x ↦ Real.negMulLog (ρ.M.H.eigenvalues x)) := rfl -- By definition of trace, the trace of `cfc ρ.M Real.negMulLog` is the sum of its eigenvalues. have h_trace : (ρ.M.cfc Real.negMulLog).trace = ∑ x, (ρ.M.cfc Real.negMulLog).H.eigenvalues x := by exact (HermitianMat.sum_eigenvalues_eq_trace _).symm obtain ⟨e, he⟩ : ∃ e : d ≃ d, (ρ.M.cfc Real.negMulLog).H.eigenvalues = - Real.negMulLog ∘ ρ.M.H.eigenvalues ∘ e := by - exact Matrix.IsHermitian.cfc_eigenvalues _ _ + Real.negMulLog ∘ ρ.M.H.eigenvalues ∘ e := Matrix.IsHermitian.cfc_eigenvalues _ _ rw [h_def, h_trace, he] simp only [Function.comp_apply] conv_lhs => rw [ ← Equiv.sum_comp e ] diff --git a/QuantumInfo/States/Mixed/MState.lean b/QuantumInfo/States/Mixed/MState.lean index 12446857d..ff29ab560 100644 --- a/QuantumInfo/States/Mixed/MState.lean +++ b/QuantumInfo/States/Mixed/MState.lean @@ -130,9 +130,8 @@ theorem ext_m {ρ₁ ρ₂ : MState d} (h : ρ₁.m = ρ₂.m) : ρ₁ = ρ₂ : theorem m_inj : (MState.m (d := d)).Injective := fun _ _ h ↦ by ext1; ext1; exact h -theorem M_Injective : Function.Injective (MState.M (d := d)) := by - intro _ _ - exact MState.ext +theorem M_Injective : Function.Injective (MState.M (d := d)) := + fun _ _ => MState.ext variable (d) in /-- The matrices corresponding to MStates are `Convex ℝ` -/ @@ -160,8 +159,7 @@ def nonempty : Nonempty d := by -- Could have used properties of ρ.spectrum theorem eigenvalue_nonneg : ∀ i, 0 ≤ ρ.Hermitian.eigenvalues i := by - rw [← Matrix.PosSemidef.nonneg_iff_eigenvalue_nonneg ρ.Hermitian] - exact ρ.nonneg + exact (zero_le_iff.mp ρ.nonneg).eigenvalues_nonneg set_option backward.isDefEq.respectTransparency false in -- Could have used properties of ρ.spectrum @@ -188,11 +186,9 @@ scoped instance : Inner Prob (MState d) where theorem inner_def : ⟪ρ, σ⟫_Prob = ⟨⟪ρ.M, σ.M⟫, inner_ge_zero ρ.nonneg σ.nonneg, - (inner_le_mul_trace ρ.nonneg σ.nonneg).trans (by simp)⟩ := by - rfl + (inner_le_mul_trace ρ.nonneg σ.nonneg).trans (by simp)⟩ := rfl -theorem val_inner : (⟪ρ, σ⟫_Prob : ℝ) = ⟪ρ.M, σ.M⟫ := by - rfl +theorem val_inner : (⟪ρ, σ⟫_Prob : ℝ) = ⟪ρ.M, σ.M⟫ := rfl section exp_val @@ -211,12 +207,10 @@ theorem exp_val_nonneg {T : HermitianMat d ℂ} (h : 0 ≤ T) : 0 ≤ ρ.exp_val -- to write first.) @[simp] -theorem exp_val_zero : ρ.exp_val 0 = 0 := by - simp [MState.exp_val] +theorem exp_val_zero : ρ.exp_val 0 = 0 := by simp [MState.exp_val] @[simp] -theorem exp_val_one : ρ.exp_val 1 = 1 := by - simp [MState.exp_val] +theorem exp_val_one : ρ.exp_val 1 = 1 := by simp [MState.exp_val] theorem exp_val_le_one {T : HermitianMat d ℂ} (h : T ≤ 1) : ρ.exp_val T ≤ 1 := by have hmono := inner_mono ρ.nonneg h @@ -227,14 +221,12 @@ theorem exp_val_prob {T : HermitianMat d ℂ} (h : 0 ≤ T ∧ T ≤ 1) : ⟨ρ.exp_val_nonneg h.1, ρ.exp_val_le_one h.2⟩ theorem exp_val_sub (A B : HermitianMat d ℂ) : - ρ.exp_val (A - B) = ρ.exp_val A - ρ.exp_val B := by - simp [exp_val, inner_sub_right] + ρ.exp_val (A - B) = ρ.exp_val A - ρ.exp_val B := by simp [exp_val, inner_sub_right] /-- If a PSD observable `A` has expectation value of 0 on a state `ρ`, it must entirely contain the support of `ρ` in its kernel. -/ theorem exp_val_eq_zero_iff {A : HermitianMat d ℂ} (hA₁ : 0 ≤ A) : - ρ.exp_val A = 0 ↔ ρ.M.support ≤ A.ker := by - exact inner_zero_iff ρ.nonneg hA₁ + ρ.exp_val A = 0 ↔ ρ.M.support ≤ A.ker := inner_zero_iff ρ.nonneg hA₁ /-- If an observable `A` has expectation value of 1 on a state `ρ`, it must entirely contain the support of `ρ` in its 1-eigenspace. -/ @@ -245,13 +237,11 @@ theorem exp_val_eq_one_iff {A : HermitianMat d ℂ} (hA₂ : A ≤ 1) : rw [sub_eq_zero, eq_comm] theorem exp_val_add (A B : HermitianMat d ℂ) : - ρ.exp_val (A + B) = ρ.exp_val A + ρ.exp_val B := by - simp [exp_val, inner_add_right] + ρ.exp_val (A + B) = ρ.exp_val A + ρ.exp_val B := by simp [exp_val, inner_add_right] @[simp] theorem exp_val_smul (r : ℝ) (A : HermitianMat d ℂ) : - ρ.exp_val (r • A) = r * ρ.exp_val A := by - simp [MState.exp_val] + ρ.exp_val (r • A) = r * ρ.exp_val A := by simp [MState.exp_val] @[gcongr] theorem exp_val_le_exp_val (ρ : MState d) {A B : HermitianMat d ℂ} (h : A ≤ B) : @@ -290,8 +280,7 @@ theorem pure_inner : ⟪pure ψ, pure φ⟫_Prob = ‖Braket.dot ψ φ‖^2 := b Complex.normSq_eq_norm_sq (((ψ : Bra d) : d → ℂ) ⬝ᵥ (φ : d → ℂ)) @[simp] -theorem pure_apply {i j : d} : (pure ψ).m i j = (ψ i) * conj (ψ j) := by - rfl +theorem pure_apply {i j : d} : (pure ψ).m i j = (ψ i) * conj (ψ j) := rfl theorem pure_mul_self : (pure ψ).m * (pure ψ).m = (pure ψ : Matrix d d ℂ) := by dsimp [pure, MState.m] @@ -529,8 +518,7 @@ def ofClassical (dist : ProbDistribution d) : MState d where @[simp] theorem coe_ofClassical (dist : ProbDistribution d) : - (ofClassical dist).M = diagonal ℂ (dist ·) := by - rfl + (ofClassical dist).M = diagonal ℂ (dist ·) := rfl theorem ofClassical_pow (dist : ProbDistribution d) (p : ℝ) : (ofClassical dist).M ^ p = diagonal ℂ (fun i ↦ (dist i) ^ p) := by @@ -721,9 +709,7 @@ theorem eq_of_sum_eq_pure {d : Type*} [Fintype d] [DecidableEq d] exact ⟨ by assumption, h_eq _ ( ρs i |>.2 ) ( ρs i |>.3 ) ⟩; linarith [ h_trace i hi hpi, (ρ.M - (ρs i).M).inner_self_nonneg ]; -- Since the inner product of a matrix with itself is zero if and only if the matrix is zero, we have ρ.M - (ρs i).M = 0. - have h_zero : ρ.M - (ρs i).M = 0 := by - apply inner_self_eq_zero.mp h_eq; - exact eq_of_sub_eq_zero h_zero; + exact eq_of_sub_eq_zero (inner_self_eq_zero.mp h_eq); exact MState.ext h_eq.symm theorem purity_prod {d₁ d₂ : Type*} [Fintype d₁] [Fintype d₂] [DecidableEq d₁] [DecidableEq d₂] @@ -738,8 +724,7 @@ theorem pure_eq_pure_iff {d : Type*} [Fintype d] [DecidableEq d] (ψ φ : Ket d) intro i j; replace h := congr_arg ( fun ρ => ρ.M.mat i j ) h ; aesop; -- Let $k$ be such that $\varphi_k \neq 0$. - obtain ⟨k, hk⟩ : ∃ k, φ.vec k ≠ 0 := by - exact φ.exists_ne_zero; + obtain ⟨k, hk⟩ : ∃ k, φ.vec k ≠ 0 := φ.exists_ne_zero -- Let $z = \frac{\psi_k}{\varphi_k}$. Then $|z| = 1$. obtain ⟨z, hz⟩ : ∃ z : ℂ, ψ.vec k = z * φ.vec k ∧ ‖z‖ = 1 := by specialize h_eq k k @@ -765,8 +750,7 @@ theorem pure_eq_pure_iff {d : Type*} [Fintype d] [DecidableEq d] (ψ φ : Ket d) /-- Two kets are phase-equivalent if and only if their pure states are equal. -/ theorem PhaseEquiv_iff_pure_eq {d : Type*} [Fintype d] [DecidableEq d] (ψ φ : Ket d) : - Ket.PhaseEquiv.r ψ φ ↔ MState.pure ψ = MState.pure φ := by - exact (pure_eq_pure_iff ψ φ).symm + Ket.PhaseEquiv.r ψ φ ↔ MState.pure ψ = MState.pure φ := (pure_eq_pure_iff ψ φ).symm /-- `MState.pure` descends to the quotient `KetUpToPhase`. -/ def pureQ {d : Type*} [Fintype d] [DecidableEq d] : KetUpToPhase d → MState d := @@ -788,8 +772,7 @@ theorem pure_separable_imp_IsProd {d₁ d₂ : Type*} [Fintype d₁] [Fintype d obtain ⟨ ρLRs, ps, hps ⟩ := h; -- Since `pure ψ` is pure (`purity = 1`), by `MState.eq_of_sum_eq_pure`, for any `k` with `p_k > 0`, we have `pure ψ = ρL_k ⊗ᴹ ρR_k`. obtain ⟨k, hk⟩ : ∃ k : { x : MState d₁ × MState d₂ // x ∈ ρLRs }, 0 < (ps k : ℝ) ∧ (MState.pure ψ).M = (k.val.1).M ⊗ₖ (k.val.2).M := by - have h_pure : (MState.pure ψ).purity = 1 := by - exact ( pure_iff_purity_one _ ).mp ⟨ ψ, rfl ⟩; + have h_pure : (MState.pure ψ).purity = 1 := ( pure_iff_purity_one _ ).mp ⟨ ψ, rfl ⟩; obtain ⟨k, hk⟩ : ∃ k : { x : MState d₁ × MState d₂ // x ∈ ρLRs }, 0 < (ps k : ℝ) := by exact ⟨ Classical.choose ( show ∃ k : ρLRs, 0 < ( ps k : ℝ ) from by exact not_forall_not.mp fun h => by have := ps.2; simp_all ), Classical.choose_spec ( show ∃ k : ρLRs, 0 < ( ps k : ℝ ) from by exact not_forall_not.mp fun h => by have := ps.2; simp_all) ⟩; refine' ⟨ k, hk, _ ⟩; @@ -884,8 +867,7 @@ theorem pure_iff_rank_eq_one {d : Type*} [Fintype d] [DecidableEq d] (ρ : MStat -- Since ρ is Hermitian and has rank 1, it must be of the form |ψ⟩⟨ψ| for some ket ψ. Use this fact. have h_pure : ∃ ψ : d → ℂ, ρ.m = Matrix.of (fun i j => ψ i * star (ψ j)) := by have h_rank : ρ.m.rank = 1 := h - have h_herm : ρ.m.IsHermitian := by - exact ρ.M.property + have h_herm : ρ.m.IsHermitian := ρ.M.property have := h_herm.spectral_theorem; -- Since the rank of ρ.m is 1, the diagonal matrix in the spectral theorem must have exactly one non-zero entry. obtain ⟨i, hi⟩ : ∃ i : d, h_herm.eigenvalues i ≠ 0 ∧ ∀ j : d, j ≠ i → h_herm.eigenvalues j = 0 := by @@ -1055,8 +1037,7 @@ def relabel (ρ : MState d₁) (e : d₂ ≃ d₁) : MState d₂ where @[simp] theorem relabel_m (ρ : MState d₁) (e : d₂ ≃ d₁) : - (ρ.relabel e).m = ρ.m.submatrix e e := by - rfl + (ρ.relabel e).m = ρ.m.submatrix e e := rfl @[simp] theorem relabel_refl {d : Type*} [Fintype d] [DecidableEq d] (ρ : MState d) : @@ -1074,8 +1055,7 @@ theorem relabel_pure_exists (ψ : Ket d₁) (e : d₂ ≃ d₁) : @[simp] theorem relabel_relabel {d d₂ d₃ : Type*} [Fintype d] [DecidableEq d] [Fintype d₂] [DecidableEq d₂] [Fintype d₃] [DecidableEq d₃] - (ρ : MState d) (e : d₂ ≃ d) (e₂ : d₃ ≃ d₂) : (ρ.relabel e).relabel e₂ = ρ.relabel (e₂.trans e) := by - rfl + (ρ : MState d) (e : d₂ ≃ d) (e₂ : d₃ ≃ d₂) : (ρ.relabel e).relabel e₂ = ρ.relabel (e₂.trans e) := rfl theorem eq_relabel_iff {d₁ d₂ : Type u} [Fintype d₁] [DecidableEq d₁] [Fintype d₂] [DecidableEq d₂] (ρ : MState d₁) (σ : MState d₂) (h : d₁ ≃ d₂) : @@ -1167,16 +1147,13 @@ def spectrum_SWAP (ρ : MState (d₁ × d₂)) : ∃ e, ρ.SWAP.spectrum.relabel rfl @[simp] -theorem SWAP_SWAP (ρ : MState (d₁ × d₂)) : ρ.SWAP.SWAP = ρ := - rfl +theorem SWAP_SWAP (ρ : MState (d₁ × d₂)) : ρ.SWAP.SWAP = ρ := rfl @[simp] -theorem traceLeft_SWAP (ρ : MState (d₁ × d₂)) : ρ.SWAP.traceLeft = ρ.traceRight := - rfl +theorem traceLeft_SWAP (ρ : MState (d₁ × d₂)) : ρ.SWAP.traceLeft = ρ.traceRight := rfl @[simp] -theorem traceRight_SWAP (ρ : MState (d₁ × d₂)) : ρ.SWAP.traceRight = ρ.traceLeft := - rfl +theorem traceRight_SWAP (ρ : MState (d₁ × d₂)) : ρ.SWAP.traceRight = ρ.traceLeft := rfl /-- The associator that re-clusters the parts of a quantum system. -/ def assoc (ρ : MState ((d₁ × d₂) × d₃)) : MState (d₁ × d₂ × d₃) := @@ -1187,12 +1164,10 @@ def assoc' (ρ : MState (d₁ × d₂ × d₃)) : MState ((d₁ × d₂) × d₃ ρ.SWAP.assoc.SWAP.assoc.SWAP @[simp] -theorem assoc_assoc' (ρ : MState (d₁ × d₂ × d₃)) : ρ.assoc'.assoc = ρ := by - rfl +theorem assoc_assoc' (ρ : MState (d₁ × d₂ × d₃)) : ρ.assoc'.assoc = ρ := rfl @[simp] -theorem assoc'_assoc (ρ : MState ((d₁ × d₂) × d₃)) : ρ.assoc.assoc' = ρ := by - rfl +theorem assoc'_assoc (ρ : MState ((d₁ × d₂) × d₃)) : ρ.assoc.assoc' = ρ := rfl @[simp] theorem traceLeft_right_assoc (ρ : MState ((d₁ × d₂) × d₃)) : @@ -1219,13 +1194,11 @@ theorem traceLeft_assoc' (ρ : MState (d₁ × d₂ × d₃)) : @[simp] theorem traceLeft_left_assoc (ρ : MState ((d₁ × d₂) × d₃)) : - ρ.assoc.traceLeft.traceLeft = ρ.traceLeft := by - simp [← traceLeft_assoc'] + ρ.assoc.traceLeft.traceLeft = ρ.traceLeft := by simp [← traceLeft_assoc'] @[simp] theorem traceRight_right_assoc' (ρ : MState (d₁ × d₂ × d₃)) : - ρ.assoc'.traceRight.traceRight = ρ.traceRight := by - simp [assoc'] + ρ.assoc'.traceRight.traceRight = ρ.traceRight := by simp [assoc'] @[simp] theorem traceNorm_eq_one (ρ : MState d) : ρ.m.traceNorm = 1 := @@ -1237,12 +1210,10 @@ theorem traceNorm_eq_one (ρ : MState d) : ρ.m.traceNorm = 1 := --TODO: This naming is very inconsistent. Should be better about "prod" vs "kron" theorem relabel_kron (ρ : MState d₁) (σ : MState d₂) (e : d₃ ≃ d₁) : - ((ρ.relabel e) ⊗ᴹ σ) = (ρ ⊗ᴹ σ).relabel (e.prodCongr (Equiv.refl d₂)) := by - rfl --is this defeq abuse? I don't know + ((ρ.relabel e) ⊗ᴹ σ) = (ρ ⊗ᴹ σ).relabel (e.prodCongr (Equiv.refl d₂)) := rfl theorem kron_relabel (ρ : MState d₁) (σ : MState d₂) (e : d₃ ≃ d₂) : - (ρ ⊗ᴹ σ.relabel e) = (ρ ⊗ᴹ σ).relabel ((Equiv.refl d₁).prodCongr e) := by - rfl + (ρ ⊗ᴹ σ.relabel e) = (ρ ⊗ᴹ σ).relabel ((Equiv.refl d₁).prodCongr e) := rfl theorem prod_assoc (ρ : MState d₁) (σ : MState d₂) (τ : MState d₃) : (ρ ⊗ᴹ (σ ⊗ᴹ τ)) = (ρ ⊗ᴹ σ ⊗ᴹ τ).relabel (Equiv.prodAssoc d₁ d₂ d₃).symm := by @@ -1282,8 +1253,7 @@ instance : CompactSpace (MState d) := by noncomputable instance : MetricSpace (MState d) := MetricSpace.induced MState.M MState.M_Injective inferInstance -theorem dist_eq (x y : MState d) : dist x y = dist x.M y.M := by - rfl +theorem dist_eq (x y : MState d) : dist x y = dist x.M y.M := rfl set_option backward.isDefEq.respectTransparency false in instance : BoundedSpace (MState d) where @@ -1315,9 +1285,7 @@ def piProd (ρi : (i:ι) → MState (dI i)) : MState ((i:ι) → dI i) where val := Matrix.piProd (fun i ↦ (ρi i).m) property := Matrix.IsHermitian.piProd (fun i ↦ (ρi i).Hermitian) } - nonneg := by - rw [zero_le_iff] - exact Matrix.PosSemidef.piProd (fun i => psd (ρi i)) + nonneg := by simpa [zero_le_iff] using Matrix.PosSemidef.piProd (fun i => psd (ρi i)) tr := by simp [trace, Matrix.trace_piProd] /-- The n-copy "power" of a mixed state, with the standard basis indexed by pi types. -/ @@ -1371,8 +1339,7 @@ theorem uniform_posDef {d : Type*} [Nonempty d] [Fintype d] [DecidableEq d] : exact Fintype.card_pos theorem posDef_of_unique {d : Type*} [Fintype d] [DecidableEq d] (ρ : MState d) [Unique d] : ρ.m.PosDef := by - rw [Subsingleton.allEq ρ uniform] - exact uniform_posDef + simpa [Subsingleton.allEq ρ uniform] using uniform_posDef end posdef diff --git a/QuantumInfo/States/Pure/Braket.lean b/QuantumInfo/States/Pure/Braket.lean index e23c1e2a3..b74b0ff18 100644 --- a/QuantumInfo/States/Pure/Braket.lean +++ b/QuantumInfo/States/Pure/Braket.lean @@ -85,8 +85,7 @@ def dot (ξ : Bra d) (ψ : Ket d) : ℂ := ∑ x, (ξ x) * (ψ x) scoped notation "〈" ξ:90 "‖" ψ:90 "〉" => dot (ξ : Bra _) (ψ : Ket _) -theorem dot_eq_dotProduct (ψ : Bra d) (φ : Ket d) :〈ψ‖φ〉= dotProduct (m := d) ψ φ := by - rfl +theorem dot_eq_dotProduct (ψ : Bra d) (φ : Ket d) :〈ψ‖φ〉= dotProduct (m := d) ψ φ := rfl end Braket @@ -95,11 +94,9 @@ open Braket variable {d : Type*} [Fintype d] -theorem Ket.apply (ψ : Ket d) (i : d) : ψ i = ψ.vec i := - rfl +theorem Ket.apply (ψ : Ket d) (i : d) : ψ i = ψ.vec i := rfl -theorem Bra.apply (ψ : Bra d) (i : d) : ψ i = ψ.vec i := - rfl +theorem Bra.apply (ψ : Bra d) (i : d) : ψ i = ψ.vec i := rfl @[ext] theorem Ket.ext {ξ ψ : Ket d} (h : ∀ x, ξ x = ψ x) : ξ = ψ := @@ -134,11 +131,9 @@ instance instBraOfKet : Coe (Ket d) (Bra d) := ⟨Ket.to_bra⟩ instance instKetOfBra : Coe (Bra d) (Ket d) := ⟨Bra.to_ket⟩ @[simp] -theorem Bra.eq_conj (ψ : Ket d) (x : d) :〈ψ∣ x = conj (∣ψ〉 x) := - rfl +theorem Bra.eq_conj (ψ : Ket d) (x : d) :〈ψ∣ x = conj (∣ψ〉 x) := rfl -theorem Bra.apply' (ψ : Ket d) (i : d) : 〈ψ∣ i = conj (ψ.vec i) := - rfl +theorem Bra.apply' (ψ : Ket d) (i : d) : 〈ψ∣ i = conj (ψ.vec i) := rfl theorem Ket.exists_ne_zero (ψ : Ket d) : ∃ x, ψ x ≠ 0 := by have hzerolt : ∑ x : d, Complex.normSq (ψ x) > ∑ x : d, 0 := by rw [ψ.normalized, Finset.sum_const_zero]; exact zero_lt_one @@ -343,8 +338,7 @@ is specifically the MES with an all-positive phase. For instance on `d := Fin 2` Bell state. -/ def Ket.MES (d) [Fintype d] [Nonempty d] : Ket (d × d) where vec := fun (i,j) ↦ if i = j then 1 / Real.sqrt (Fintype.card (α := d)) else 0 - normalized' := by - simp [apply_ite, Fintype.sum_prod_type] + normalized' := by simp [apply_ite, Fintype.sum_prod_type] /-- On any space of dimension at least two, the maximally entangled state `MES` is entangled. -/ theorem Ket.MES_isEntangled [Nontrivial d] : (Ket.MES d).IsEntangled := by diff --git a/QuantumInfo/States/Pure/Qubit.lean b/QuantumInfo/States/Pure/Qubit.lean index 52d00715b..0fb9765c6 100644 --- a/QuantumInfo/States/Pure/Qubit.lean +++ b/QuantumInfo/States/Pure/Qubit.lean @@ -132,16 +132,13 @@ theorem H_mul_Z_eq_X_mul_H : H * Z = X * H := by matrix_expand [H, X, Z] @[simp] -theorem S_Z_comm : Z * S = S * Z := by - simp [← S_sq, mul_assoc] +theorem S_Z_comm : Z * S = S * Z := by simp [← S_sq, mul_assoc] @[simp] -theorem T_Z_comm : Z * T = T * Z := by - simp [← S_sq, ← T_sq, mul_assoc] +theorem T_Z_comm : Z * T = T * Z := by simp [← S_sq, ← T_sq, mul_assoc] @[simp] -theorem S_T_comm : S * T = T * S := by - simp [← T_sq, mul_assoc] +theorem S_T_comm : S * T = T * S := by simp [← T_sq, mul_assoc] /-- Given a unitary `U` on some Hilbert space `k`, we have the controllized version that acts on `Fin 2 ⊗ k` where `U` is conditionally applied if the first qubit is `1`. -/ @@ -180,20 +177,16 @@ lemma CNOT_matrix : variable (g : 𝐔[k]) (j₁ j₂ : k) @[simp] -theorem controllize_apply_zero_zero : C[g] (0, j₁) (0, j₂) = (1 : 𝐔[k]) j₁ j₂ := by - rfl +theorem controllize_apply_zero_zero : C[g] (0, j₁) (0, j₂) = (1 : 𝐔[k]) j₁ j₂ := rfl @[simp] -theorem controllize_apply_zero_one : C[g] (0, j₁) (1, j₂) = 0 := by - rfl +theorem controllize_apply_zero_one : C[g] (0, j₁) (1, j₂) = 0 := rfl @[simp] -theorem controllize_apply_one_zero : C[g] (1, j₁) (0, j₂) = 0 := by - rfl +theorem controllize_apply_one_zero : C[g] (1, j₁) (0, j₂) = 0 := rfl @[simp] -theorem controllize_apply_one_one : C[g] (1, j₁) (1, j₂) = g j₁ j₂ := by - rfl +theorem controllize_apply_one_one : C[g] (1, j₁) (1, j₂) = g j₁ j₂ := rfl @[simp] theorem controllize_mul (g₁ g₂ : 𝐔[k]) : C[g₁] * C[g₂] = C[g₁ * g₂] := by @@ -204,8 +197,7 @@ theorem controllize_one : C[(1 : 𝐔[k])] = 1 := by matrix_expand @[simp] -theorem controllize_mul_inv : C[g] * C[g⁻¹] = 1 := by - simp +theorem controllize_mul_inv : C[g] * C[g⁻¹] = 1 := by simp open scoped Matrix in @[simp]