Theorem: NumberField.mixedEmbedding.convexBodySum_volume
File: Mathlib/NumberTheory/NumberField/CanonicalEmbedding/ConvexBody.lean

tactic: obtain hB | hB := le_or_lt B 0
state_before: K : Type u_1
inst✝¹ : Field K
inst✝ : NumberField K
B : ℝ
⊢ volume (convexBodySum K B) = ↑(convexBodySumFactor K) * ENNReal.ofReal B ^ finrank ℚ K
state_after: case inl
K : Type u_1
inst✝¹ : Field K
inst✝ : NumberField K
B : ℝ
hB : B ≤ 0
⊢ volume (convexBodySum K B) = ↑(convexBodySumFactor K) * ENNReal.ofReal B ^ finrank ℚ K

case inr
K : Type u_1
inst✝¹ : Field K
inst✝ : NumberField K
B : ℝ
hB : 0 < B
⊢ volume (convexBodySum K B) = ↑(convexBodySumFactor K) * ENNReal.ofReal B ^ finrank ℚ K

tactic: rw [convexBodySum_volume_eq_zero_of_le_zero K hB, ofReal_eq_zero.mpr hB, zero_pow, mul_zero]
state_before: case inl
K : Type u_1
inst✝¹ : Field K
inst✝ : NumberField K
B : ℝ
hB : B ≤ 0
⊢ volume (convexBodySum K B) = ↑(convexBodySumFactor K) * ENNReal.ofReal B ^ finrank ℚ K
state_after: case inl
K : Type u_1
inst✝¹ : Field K
inst✝ : NumberField K
B : ℝ
hB : B ≤ 0
⊢ finrank ℚ K ≠ 0

tactic: exact finrank_pos.ne'
state_before: case inl
K : Type u_1
inst✝¹ : Field K
inst✝ : NumberField K
B : ℝ
hB : B ≤ 0
⊢ finrank ℚ K ≠ 0
state_after: no goals

tactic: rw [MeasureTheory.measure_le_eq_lt _ ((convexBodySumFun_eq_zero_iff 0).mpr rfl)
  convexBodySumFun_neg convexBodySumFun_add_le
  (fun hx => (convexBodySumFun_eq_zero_iff _).mp hx)
  (fun r x => le_of_eq (convexBodySumFun_smul r x))]
state_before: case inr
K : Type u_1
inst✝¹ : Field K
inst✝ : NumberField K
B : ℝ
hB : 0 < B
⊢ volume (convexBodySum K 1) = ↑(convexBodySumFactor K)
state_after: case inr
K : Type u_1
inst✝¹ : Field K
inst✝ : NumberField K
B : ℝ
hB : 0 < B
⊢ volume {x | convexBodySumFun x < 1} = ↑(convexBodySumFactor K)

tactic: rw [measure_lt_one_eq_integral_div_gamma (g := fun x : (E K) => convexBodySumFun x)
  volume ((convexBodySumFun_eq_zero_iff 0).mpr rfl) convexBodySumFun_neg convexBodySumFun_add_le
  (fun hx => (convexBodySumFun_eq_zero_iff _).mp hx)
  (fun r x => le_of_eq (convexBodySumFun_smul r x)) zero_lt_one]
state_before: case inr
K : Type u_1
inst✝¹ : Field K
inst✝ : NumberField K
B : ℝ
hB : 0 < B
⊢ volume {x | convexBodySumFun x < 1} = ↑(convexBodySumFactor K)
state_after: case inr
K : Type u_1
inst✝¹ : Field K
inst✝ : NumberField K
B : ℝ
hB : 0 < B
⊢ ENNReal.ofReal
      ((∫ (x : ({ w // w.IsReal } → ℝ) × ({ w // w.IsComplex } → ℂ)), rexp (-convexBodySumFun x ^ 1)) /
        Gamma (↑(finrank ℝ (({ w // w.IsReal } → ℝ) × ({ w // w.IsComplex } → ℂ))) / 1 + 1)) =
    ↑(convexBodySumFactor K)

tactic: simp_rw [mixedEmbedding.finrank, div_one, Gamma_nat_eq_factorial, ofReal_div_of_pos
  (Nat.cast_pos.mpr (Nat.factorial_pos _)), Real.rpow_one, ofReal_natCast]
state_before: case inr
K : Type u_1
inst✝¹ : Field K
inst✝ : NumberField K
B : ℝ
hB : 0 < B
⊢ ENNReal.ofReal
      ((∫ (x : ({ w // w.IsReal } → ℝ) × ({ w // w.IsComplex } → ℂ)), rexp (-convexBodySumFun x ^ 1)) /
        Gamma (↑(finrank ℝ (({ w // w.IsReal } → ℝ) × ({ w // w.IsComplex } → ℂ))) / 1 + 1)) =
    ↑(convexBodySumFactor K)
state_after: case inr
K : Type u_1
inst✝¹ : Field K
inst✝ : NumberField K
B : ℝ
hB : 0 < B
⊢ ENNReal.ofReal (∫ (x : ({ w // w.IsReal } → ℝ) × ({ w // w.IsComplex } → ℂ)), rexp (-convexBodySumFun x)) /
      ↑(finrank ℚ K).factorial =
    ↑(convexBodySumFactor K)

tactic: suffices ∫ x : E K, exp (-convexBodySumFun x) =
    (2:ℝ) ^ NrRealPlaces K * (π / 2) ^ NrComplexPlaces K by
  rw [this, convexBodySumFactor, ofReal_mul (by positivity), ofReal_pow zero_le_two,
    ofReal_pow (by positivity), ofReal_div_of_pos zero_lt_two, ofReal_ofNat,
    ← NNReal.coe_real_pi, ofReal_coe_nnreal, coe_div (Nat.cast_ne_zero.mpr
    (Nat.factorial_ne_zero _)), coe_mul, coe_pow, coe_pow, coe_ofNat, coe_div two_ne_zero,
    coe_ofNat, coe_natCast]
state_before: case inr
K : Type u_1
inst✝¹ : Field K
inst✝ : NumberField K
B : ℝ
hB : 0 < B
⊢ ENNReal.ofReal (∫ (x : ({ w // w.IsReal } → ℝ) × ({ w // w.IsComplex } → ℂ)), rexp (-convexBodySumFun x)) /
      ↑(finrank ℚ K).factorial =
    ↑(convexBodySumFactor K)
state_after: case inr
K : Type u_1
inst✝¹ : Field K
inst✝ : NumberField K
B : ℝ
hB : 0 < B
⊢ ∫ (x : ({ w // w.IsReal } → ℝ) × ({ w // w.IsComplex } → ℂ)), rexp (-convexBodySumFun x) =
    2 ^ NrRealPlaces K * (π / 2) ^ NrComplexPlaces K

tactic: calc
  _ = (∫ x : {w : InfinitePlace K // IsReal w} → ℝ, ∏ w, exp (- ‖x w‖)) *
          (∫ x : {w : InfinitePlace K // IsComplex w} → ℂ, ∏ w, exp (- 2 * ‖x w‖)) := by
    simp_rw [convexBodySumFun_apply', neg_add, ← neg_mul, Finset.mul_sum,
      ← Finset.sum_neg_distrib, exp_add, exp_sum, ← integral_prod_mul, volume_eq_prod]
  _ = (∫ x : ℝ, exp (-|x|)) ^ NrRealPlaces K *
          (∫ x : ℂ, Real.exp (-2 * ‖x‖)) ^ NrComplexPlaces K := by
    rw [integral_fintype_prod_eq_pow _ (fun x => exp (- ‖x‖)), integral_fintype_prod_eq_pow _
      (fun x => exp (- 2 * ‖x‖))]
    simp_rw [norm_eq_abs]
  _ =  (2 * Gamma (1 / 1 + 1)) ^ NrRealPlaces K *
          (π * (2:ℝ) ^ (-(2:ℝ) / 1) * Gamma (2 / 1 + 1)) ^ NrComplexPlaces K := by
    rw [integral_comp_abs (f := fun x => exp (- x)), ← integral_exp_neg_rpow zero_lt_one,
      ← Complex.integral_exp_neg_mul_rpow le_rfl zero_lt_two]
    simp_rw [Real.rpow_one]
  _ = (2:ℝ) ^ NrRealPlaces K * (π / 2) ^ NrComplexPlaces K := by
    simp_rw [div_one, one_add_one_eq_two, Gamma_add_one two_ne_zero, Gamma_two, mul_one,
      mul_assoc, ← Real.rpow_add_one two_ne_zero, show (-2:ℝ) + 1 = -1 by norm_num,
      Real.rpow_neg_one]
    rfl
state_before: case inr
K : Type u_1
inst✝¹ : Field K
inst✝ : NumberField K
B : ℝ
hB : 0 < B
⊢ ∫ (x : ({ w // w.IsReal } → ℝ) × ({ w // w.IsComplex } → ℂ)), rexp (-convexBodySumFun x) =
    2 ^ NrRealPlaces K * (π / 2) ^ NrComplexPlaces K
state_after: no goals

tactic: rw [mul_comm]
state_before: K : Type u_1
inst✝¹ : Field K
inst✝ : NumberField K
B : ℝ
hB : 0 < B
this : volume (convexBodySum K 1) = ↑(convexBodySumFactor K)
⊢ volume (convexBodySum K B) = ↑(convexBodySumFactor K) * ENNReal.ofReal B ^ finrank ℚ K
state_after: K : Type u_1
inst✝¹ : Field K
inst✝ : NumberField K
B : ℝ
hB : 0 < B
this : volume (convexBodySum K 1) = ↑(convexBodySumFactor K)
⊢ volume (convexBodySum K B) = ENNReal.ofReal B ^ finrank ℚ K * ↑(convexBodySumFactor K)

tactic: convert addHaar_smul volume B (convexBodySum K 1)
state_before: K : Type u_1
inst✝¹ : Field K
inst✝ : NumberField K
B : ℝ
hB : 0 < B
this : volume (convexBodySum K 1) = ↑(convexBodySumFactor K)
⊢ volume (convexBodySum K B) = ENNReal.ofReal B ^ finrank ℚ K * ↑(convexBodySumFactor K)
state_after: case h.e'_2.h.e'_6
K : Type u_1
inst✝¹ : Field K
inst✝ : NumberField K
B : ℝ
hB : 0 < B
this : volume (convexBodySum K 1) = ↑(convexBodySumFactor K)
⊢ convexBodySum K B = B • convexBodySum K 1

case h.e'_3.h.e'_5
K : Type u_1
inst✝¹ : Field K
inst✝ : NumberField K
B : ℝ
hB : 0 < B
this : volume (convexBodySum K 1) = ↑(convexBodySumFactor K)
⊢ ENNReal.ofReal B ^ finrank ℚ K = ENNReal.ofReal |B ^ finrank ℝ (({ w // w.IsReal } → ℝ) × ({ w // w.IsComplex } → ℂ))|

case h.e'_3.h.e'_6
K : Type u_1
inst✝¹ : Field K
inst✝ : NumberField K
B : ℝ
hB : 0 < B
this : volume (convexBodySum K 1) = ↑(convexBodySumFactor K)
⊢ ↑(convexBodySumFactor K) = volume (convexBodySum K 1)

tactic: simp_rw [← Set.preimage_smul_inv₀ (ne_of_gt hB), Set.preimage_setOf_eq, convexBodySumFun,
normAtPlace_smul, abs_inv, abs_eq_self.mpr (le_of_lt hB), ← mul_assoc, mul_comm, mul_assoc,
← Finset.mul_sum, inv_mul_le_iff hB, mul_one]
state_before: case h.e'_2.h.e'_6
K : Type u_1
inst✝¹ : Field K
inst✝ : NumberField K
B : ℝ
hB : 0 < B
this : volume (convexBodySum K 1) = ↑(convexBodySumFactor K)
⊢ convexBodySum K B = B • convexBodySum K 1
state_after: no goals

tactic: rw [abs_pow, ofReal_pow (abs_nonneg _), abs_eq_self.mpr (le_of_lt hB),
  mixedEmbedding.finrank]
state_before: case h.e'_3.h.e'_5
K : Type u_1
inst✝¹ : Field K
inst✝ : NumberField K
B : ℝ
hB : 0 < B
this : volume (convexBodySum K 1) = ↑(convexBodySumFactor K)
⊢ ENNReal.ofReal B ^ finrank ℚ K = ENNReal.ofReal |B ^ finrank ℝ (({ w // w.IsReal } → ℝ) × ({ w // w.IsComplex } → ℂ))|
state_after: no goals

tactic: exact this.symm
state_before: case h.e'_3.h.e'_6
K : Type u_1
inst✝¹ : Field K
inst✝ : NumberField K
B : ℝ
hB : 0 < B
this : volume (convexBodySum K 1) = ↑(convexBodySumFactor K)
⊢ ↑(convexBodySumFactor K) = volume (convexBodySum K 1)
state_after: no goals

tactic: rw [this, convexBodySumFactor, ofReal_mul (by positivity), ofReal_pow zero_le_two,
  ofReal_pow (by positivity), ofReal_div_of_pos zero_lt_two, ofReal_ofNat,
  ← NNReal.coe_real_pi, ofReal_coe_nnreal, coe_div (Nat.cast_ne_zero.mpr
  (Nat.factorial_ne_zero _)), coe_mul, coe_pow, coe_pow, coe_ofNat, coe_div two_ne_zero,
  coe_ofNat, coe_natCast]
state_before: K : Type u_1
inst✝¹ : Field K
inst✝ : NumberField K
B : ℝ
hB : 0 < B
this :
  ∫ (x : ({ w // w.IsReal } → ℝ) × ({ w // w.IsComplex } → ℂ)), rexp (-convexBodySumFun x) =
    2 ^ NrRealPlaces K * (π / 2) ^ NrComplexPlaces K
⊢ ENNReal.ofReal (∫ (x : ({ w // w.IsReal } → ℝ) × ({ w // w.IsComplex } → ℂ)), rexp (-convexBodySumFun x)) /
      ↑(finrank ℚ K).factorial =
    ↑(convexBodySumFactor K)
state_after: no goals

tactic: positivity
state_before: K : Type u_1
inst✝¹ : Field K
inst✝ : NumberField K
B : ℝ
hB : 0 < B
this :
  ∫ (x : ({ w // w.IsReal } → ℝ) × ({ w // w.IsComplex } → ℂ)), rexp (-convexBodySumFun x) =
    2 ^ NrRealPlaces K * (π / 2) ^ NrComplexPlaces K
⊢ 0 ≤ 2 ^ NrRealPlaces K
state_after: no goals

tactic: positivity
state_before: K : Type u_1
inst✝¹ : Field K
inst✝ : NumberField K
B : ℝ
hB : 0 < B
this :
  ∫ (x : ({ w // w.IsReal } → ℝ) × ({ w // w.IsComplex } → ℂ)), rexp (-convexBodySumFun x) =
    2 ^ NrRealPlaces K * (π / 2) ^ NrComplexPlaces K
⊢ 0 ≤ π / 2
state_after: no goals

tactic: simp_rw [convexBodySumFun_apply', neg_add, ← neg_mul, Finset.mul_sum,
  ← Finset.sum_neg_distrib, exp_add, exp_sum, ← integral_prod_mul, volume_eq_prod]
state_before: K : Type u_1
inst✝¹ : Field K
inst✝ : NumberField K
B : ℝ
hB : 0 < B
⊢ ∫ (x : ({ w // w.IsReal } → ℝ) × ({ w // w.IsComplex } → ℂ)), rexp (-convexBodySumFun x) =
    (∫ (x : { w // w.IsReal } → ℝ), ∏ w : { w // w.IsReal }, rexp (-‖x w‖)) *
      ∫ (x : { w // w.IsComplex } → ℂ), ∏ w : { w // w.IsComplex }, rexp (-2 * ‖x w‖)
state_after: no goals

tactic: rw [integral_fintype_prod_eq_pow _ (fun x => exp (- ‖x‖)), integral_fintype_prod_eq_pow _
  (fun x => exp (- 2 * ‖x‖))]
state_before: K : Type u_1
inst✝¹ : Field K
inst✝ : NumberField K
B : ℝ
hB : 0 < B
⊢ (∫ (x : { w // w.IsReal } → ℝ), ∏ w : { w // w.IsReal }, rexp (-‖x w‖)) *
      ∫ (x : { w // w.IsComplex } → ℂ), ∏ w : { w // w.IsComplex }, rexp (-2 * ‖x w‖) =
    (∫ (x : ℝ), rexp (-|x|)) ^ NrRealPlaces K * (∫ (x : ℂ), rexp (-2 * ‖x‖)) ^ NrComplexPlaces K
state_after: K : Type u_1
inst✝¹ : Field K
inst✝ : NumberField K
B : ℝ
hB : 0 < B
⊢ (∫ (x : ℝ), rexp (-‖x‖)) ^ card { w // w.IsReal } * (∫ (x : ℂ), rexp (-2 * ‖x‖)) ^ card { w // w.IsComplex } =
    (∫ (x : ℝ), rexp (-|x|)) ^ NrRealPlaces K * (∫ (x : ℂ), rexp (-2 * ‖x‖)) ^ NrComplexPlaces K

tactic: simp_rw [norm_eq_abs]
state_before: K : Type u_1
inst✝¹ : Field K
inst✝ : NumberField K
B : ℝ
hB : 0 < B
⊢ (∫ (x : ℝ), rexp (-‖x‖)) ^ card { w // w.IsReal } * (∫ (x : ℂ), rexp (-2 * ‖x‖)) ^ card { w // w.IsComplex } =
    (∫ (x : ℝ), rexp (-|x|)) ^ NrRealPlaces K * (∫ (x : ℂ), rexp (-2 * ‖x‖)) ^ NrComplexPlaces K
state_after: no goals

tactic: rw [integral_comp_abs (f := fun x => exp (- x)), ← integral_exp_neg_rpow zero_lt_one,
  ← Complex.integral_exp_neg_mul_rpow le_rfl zero_lt_two]
state_before: K : Type u_1
inst✝¹ : Field K
inst✝ : NumberField K
B : ℝ
hB : 0 < B
⊢ (∫ (x : ℝ), rexp (-|x|)) ^ NrRealPlaces K * (∫ (x : ℂ), rexp (-2 * ‖x‖)) ^ NrComplexPlaces K =
    (2 * Gamma (1 / 1 + 1)) ^ NrRealPlaces K * (π * 2 ^ (-2 / 1) * Gamma (2 / 1 + 1)) ^ NrComplexPlaces K
state_after: K : Type u_1
inst✝¹ : Field K
inst✝ : NumberField K
B : ℝ
hB : 0 < B
⊢ (2 * ∫ (x : ℝ) in Set.Ioi 0, rexp (-x)) ^ NrRealPlaces K * (∫ (x : ℂ), rexp (-2 * ‖x‖)) ^ NrComplexPlaces K =
    (2 * ∫ (x : ℝ) in Set.Ioi 0, rexp (-x ^ 1)) ^ NrRealPlaces K * (∫ (x : ℂ), rexp (-2 * ‖x‖ ^ 1)) ^ NrComplexPlaces K

tactic: simp_rw [Real.rpow_one]
state_before: K : Type u_1
inst✝¹ : Field K
inst✝ : NumberField K
B : ℝ
hB : 0 < B
⊢ (2 * ∫ (x : ℝ) in Set.Ioi 0, rexp (-x)) ^ NrRealPlaces K * (∫ (x : ℂ), rexp (-2 * ‖x‖)) ^ NrComplexPlaces K =
    (2 * ∫ (x : ℝ) in Set.Ioi 0, rexp (-x ^ 1)) ^ NrRealPlaces K * (∫ (x : ℂ), rexp (-2 * ‖x‖ ^ 1)) ^ NrComplexPlaces K
state_after: no goals

tactic: simp_rw [div_one, one_add_one_eq_two, Gamma_add_one two_ne_zero, Gamma_two, mul_one,
  mul_assoc, ← Real.rpow_add_one two_ne_zero, show (-2:ℝ) + 1 = -1 by norm_num,
  Real.rpow_neg_one]
state_before: K : Type u_1
inst✝¹ : Field K
inst✝ : NumberField K
B : ℝ
hB : 0 < B
⊢ (2 * Gamma (1 / 1 + 1)) ^ NrRealPlaces K * (π * 2 ^ (-2 / 1) * Gamma (2 / 1 + 1)) ^ NrComplexPlaces K =
    2 ^ NrRealPlaces K * (π / 2) ^ NrComplexPlaces K
state_after: K : Type u_1
inst✝¹ : Field K
inst✝ : NumberField K
B : ℝ
hB : 0 < B
⊢ 2 ^ NrRealPlaces K * (π * 2⁻¹) ^ NrComplexPlaces K = 2 ^ NrRealPlaces K * (π / 2) ^ NrComplexPlaces K

tactic: rfl
state_before: K : Type u_1
inst✝¹ : Field K
inst✝ : NumberField K
B : ℝ
hB : 0 < B
⊢ 2 ^ NrRealPlaces K * (π * 2⁻¹) ^ NrComplexPlaces K = 2 ^ NrRealPlaces K * (π / 2) ^ NrComplexPlaces K
state_after: no goals

tactic: norm_num
state_before: K : Type u_1
inst✝¹ : Field K
inst✝ : NumberField K
B : ℝ
hB : 0 < B
⊢ -2 + 1 = -1
state_after: no goals