roseking's picture
Add lean source and binary files (part 66)
8e4d533 verified
Raw History Blame Contribute Delete
3.68 kB
25
lemma det_updateRow_identity (j : ι) (v : ι → ℝ) :
    (Matrix.updateRow (1 : Matrix ι ι ℝ) j v).det = v j := by
proof · 5 lines
  have he : (∑ i : ι, v i • (1 : Matrix ι ι ℝ) i) = v := by
    ext l
    simp [Matrix.one_apply]
  rw [←he,Matrix.det_updateRow_sum]
  simp [Matrix.one_apply]
33
theorem hasDerivAt_det_at_identity {A : ℝ → Matrix ι ι ℝ}
    {B : Matrix ι ι ℝ} {t : ℝ} (hA : A t = 1) (hd : HasDerivAt A B t) :
    HasDerivAt (fun s => (A s).det) B.trace t := by
proof · 10 lines
  let D : ContinuousMultilinearMap ℝ (fun _ : ι => ι → ℝ) ℝ :=
    ⟨Matrix.detRowAlternating.toMultilinearMap,continuous_id.matrix_det⟩
  have hD := (D.hasFDerivAt (A t)).comp_hasDerivAt t hd
  change HasDerivAt (fun s => (A s).det) (D.linearDeriv (A t) B) t at hD
  have hv : D.linearDeriv (fun i j => A t i j) (fun i j => B i j) = B.trace := by
    rw [ContinuousMultilinearMap.linearDeriv_apply]
    change (∑ i, (Matrix.updateRow (A t) i (B i)).det) = B.trace
    rw [hA]
    simp only [det_updateRow_identity,Matrix.trace,Matrix.diag]
  exact hD.congr_deriv hv
47
def spatialRadialForm (g r t : ℝ) (α γ : ι → ℝ) : Matrix ι ι ℝ :=
body · 2 lines
  Matrix.of fun i j => (1-t*g)^2 * (if i=j then 1 else 0) -
    (1-t*g)*t*r*(α i*γ j+γ i*α j) + t^2*r^2*γ i*γ j
52
lemma spatialRadialForm_zero (g r : ℝ) (α γ : ι → ℝ) :
    spatialRadialForm g r 0 α γ = 1 := by
proof · 2 lines
  ext i j
  simp [spatialRadialForm,Matrix.one_apply]
57
lemma spatialRadialForm_hasDerivAt_zero (g r : ℝ) (α γ : ι → ℝ) :
    HasDerivAt (fun t => spatialRadialForm g r t α γ)
      (Matrix.of fun i j => -2*g*(if i=j then 1 else 0)-r*(α i*γ j+γ i*α j)) 0 := by
proof · 13 lines
  apply hasDerivAt_pi.2
  intro i
  apply hasDerivAt_pi.2
  intro j
  have hl := (hasDerivAt_const (0:ℝ) 1).sub ((hasDerivAt_id (0:ℝ)).mul_const g)
  have he := (((hl.fun_pow 2).mul_const (if i=j then 1 else 0)).sub
    (((hl.mul (hasDerivAt_id (0:ℝ))).mul_const r).mul_const (α i*γ j+γ i*α j))).add
      ((((hasDerivAt_id (0:ℝ)).fun_pow 2).mul_const (r^2)).mul_const (γ i*γ j))
  convert he using 1
  · ext t
    simp only [spatialRadialForm,Matrix.of_apply,Pi.sub_apply,Pi.add_apply,Pi.mul_apply,id_eq]
    ring
  · simp
74
theorem spatialRadialForm_sqrt_det_hasDerivAt_zero (g r : ℝ) (α γ : ι → ℝ) :
    HasDerivAt (fun t => Real.sqrt (spatialRadialForm g r t α γ).det)
      (-((Fintype.card ι : ℝ)*g+r*∑ i, α i*γ i)) 0 := by
proof · 14 lines
  have hd := hasDerivAt_det_at_identity (spatialRadialForm_zero g r α γ)
    (spatialRadialForm_hasDerivAt_zero g r α γ)
  have hs := hd.sqrt (by simp [spatialRadialForm_zero])
  convert hs using 1
  simp only [spatialRadialForm_zero,Matrix.det_one,Real.sqrt_one,Matrix.trace,
    Matrix.diag,Matrix.of_apply,ite_true, mul_one, Finset.sum_sub_distrib,
    Finset.sum_const, nsmul_eq_mul, Finset.card_univ]
  rw [←Finset.mul_sum]
  have hh : (∑ i, (α i*γ i+γ i*α i)) = 2*(∑ i, α i*γ i) := by
    rw [Finset.sum_add_distrib]
    simp only [mul_comm (γ _) (α _)]
    ring
  rw [hh]
  ring