File size: 4,245 Bytes
92416a2 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | import Mathlib
import OAI.Computability.VertexCover.Reduction.SeparatorContinuousSumOdd
import OAI.Computability.VertexCover.Analysis.CanonicalGradientInvariant
import OAI.Computability.VertexCover.Analysis.BlockLawAc
namespace OAI
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
namespace VertexCover.Cube
open MeasureTheory ProbabilityTheory
open scoped ENNReal
theorem integrable_continuous {ι : Type*} [Fintype ι] {f : (ι → ℝ) → ℝ}
(hf : Continuous f) : Integrable f (law ι) := by
rw [law_eq_restrict_volume]
exact (hf.continuousOn.integrableOn_compact
(isCompact_univ_pi (fun _ => isCompact_Icc))).smul_measure (by finiteness)
theorem integrable_continuous_block {ι κ : Type*} [Fintype ι] [Fintype κ]
{f : (ι → κ → ℝ) → ℝ} (hf : Continuous f) : Integrable f (blockLaw ι κ) := by
rw [blockLaw_eq_restrict_volume]
exact (hf.continuousOn.integrableOn_compact
(isCompact_univ_pi (fun _ => isCompact_univ_pi (fun _ => isCompact_Icc)))).smul_measure
(by finiteness)
end VertexCover.Cube
namespace VertexCover.LabelCover
open MeasureTheory ProbabilityTheory
noncomputable def batchLaw (Φ : LabelCover) {d : ℕ} (J : Finset (Fin d)) :
Measure (Φ.BatchWeights J) := VertexCover.Cube.blockLaw J (Fin (Φ.WeightDimension d))
instance batchLaw_probability (Φ : LabelCover) {d : ℕ} (J : Finset (Fin d)) :
IsProbabilityMeasure (Φ.batchLaw J) := by
unfold batchLaw
infer_instance
theorem canonicalGradient_ae_cube (Φ : LabelCover) {d : ℕ} (seed : Φ.Seeds d)
(J : Finset (Fin d)) (c0 : Φ.Coordinate d → ℝ)
(A : Finset (Φ.Coordinate d → ℝ)) (hA : A.Nonempty) :
∀ᵐ s ∂Φ.batchLaw J, DifferentiableAt ℝ (Φ.batchFunction seed J c0 A hA) s ∧
Φ.canonicalGradient seed J c0 A hA s =
Φ.batchGradient J (fderiv ℝ (Φ.batchFunction seed J c0 A hA) s) := by
let : (volume : Measure (Φ.BatchWeights J)).IsAddHaarMeasure := by
change (Measure.pi (fun _ : J => (volume : Measure (Fin (Φ.WeightDimension d) → ℝ)))).IsAddHaarMeasure
apply Measure.pi.isAddHaarMeasure
exact (VertexCover.Cube.blockLaw_ac J (Fin (Φ.WeightDimension d))).ae_le
(Φ.canonicalGradient_ae_derivative seed J c0 A hA volume)
theorem batchFunction_integrable (Φ : LabelCover) {d : ℕ} (seed : Φ.Seeds d)
(J : Finset (Fin d)) (c0 : Φ.Coordinate d → ℝ)
(A : Finset (Φ.Coordinate d → ℝ)) (hA : A.Nonempty) :
Integrable (Φ.batchFunction seed J c0 A hA) (Φ.batchLaw J) :=
VertexCover.Cube.integrable_continuous_block (Φ.batchFunction_continuous seed J c0 A hA)
theorem batchSum_update_sub (Φ : LabelCover) {d : ℕ} (seed : Φ.Seeds d)
(J : Finset (Fin d)) (s : Φ.BatchWeights J) (j : J)
(u v : Fin (Φ.WeightDimension d) → ℝ) :
Φ.batchSum seed J (Function.update s j u) -
Φ.batchSum seed J (Function.update s j v) = Φ.increment (Φ.query seed j) (u-v) := by
classical
simp only [batchSum, ← Finset.sum_sub_distrib]
rw [Finset.sum_eq_single j]
· simp only [Function.update_self, ← Φ.increment_sub]
· intro k _ hkj
rw [Function.update_of_ne hkj, Function.update_of_ne hkj, sub_self]
· simp
theorem batchFunction_own_lipschitz (Φ : LabelCover) {d : ℕ} (seed : Φ.Seeds d)
(J : Finset (Fin d)) (c0 : Φ.Coordinate d → ℝ)
(A : Finset (Φ.Coordinate d → ℝ)) (hA : A.Nonempty)
(s : Φ.BatchWeights J) (j : J) :
LipschitzWith 1 (fun u => Φ.batchFunction seed J c0 A hA (Function.update s j u)) := by
classical
apply LipschitzWith.of_dist_le_mul
intro u v
simp only [NNReal.coe_one, one_mul, dist_eq_norm]
apply (Φ.separator_lipschitz A hA _ _).trans
rw [add_sub_add_left_eq_sub, Φ.batchSum_update_sub]
apply Φ.increment_norm_le _ _ (_root_.norm_nonneg _)
intro k
simpa only [Pi.sub_apply, Real.norm_eq_abs] using norm_le_pi_norm (u-v) k
end VertexCover.LabelCover
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end OAI
|